libbase/crt0-picorv32: Ensure BSS is cleared on boot.
authorWilliam D. Jones <thor0505@comcast.net>
Thu, 1 Nov 2018 06:18:03 +0000 (02:18 -0400)
committerWilliam D. Jones <thor0505@comcast.net>
Thu, 1 Nov 2018 06:18:03 +0000 (02:18 -0400)
litex/soc/software/libbase/crt0-picorv32.S

index 1d6faa851f0ef5b4725b85ef6ba853121bc01568..054f84d32416fd4a85c3e90fa2a92933b79008c0 100644 (file)
@@ -180,6 +180,14 @@ _crt0:
   la t1, _irq_mask
   sw t0, 0(t1)
 
+  /* Clear BSS */
+  la t0, _fbss
+  la t1, _ebss
+2:
+  sw zero, 0(t0)
+  addi t0, t0, 4
+  bltu t0, t1, 2b
+
   /* set main stack */
   la sp, _fstack