[U-Boot] [PATCH 06/29] blackfin: Clear the BSS in C code

Simon Glass sjg at chromium.org
Thu Dec 15 04:27:37 CET 2016


We don't need to clear BSS in assembler. Move it to C to reduce the amount
of assembly code needed.

Signed-off-by: Simon Glass <sjg at chromium.org>
---

 arch/blackfin/cpu/cpu.c   |  3 +++
 arch/blackfin/cpu/start.S | 13 -------------
 2 files changed, 3 insertions(+), 13 deletions(-)

diff --git a/arch/blackfin/cpu/cpu.c b/arch/blackfin/cpu/cpu.c
index 529322a..ef362d4 100644
--- a/arch/blackfin/cpu/cpu.c
+++ b/arch/blackfin/cpu/cpu.c
@@ -18,6 +18,7 @@
 #include <asm/blackfin.h>
 #include <asm/cplb.h>
 #include <asm/clock.h>
+#include <asm/sections.h>
 #include <asm/mach-common/bits/core.h>
 #include <asm/mach-common/bits/ebiu.h>
 #include <asm/mach-common/bits/trace.h>
@@ -323,6 +324,8 @@ void cpu_init_f(ulong bootflag, ulong loaded_from_ldr)
 		memcpy(&_sdata_l1, &_data_l1_lma, (unsigned long)_data_l1_len);
 	}
 
+	memset(__bss_start, '\0', __bss_stop - __bss_start);
+
 	/*
 	 * Make sure our async settings are committed.  Some bootroms
 	 * (like the BF537) will reset some registers on us after it
diff --git a/arch/blackfin/cpu/start.S b/arch/blackfin/cpu/start.S
index 6265a51..01985ea 100644
--- a/arch/blackfin/cpu/start.S
+++ b/arch/blackfin/cpu/start.S
@@ -191,19 +191,6 @@ ENTRY(_start)
 #endif
 
 .Lnorelocate:
-	/* Initialize BSS section ... we know that memset() does not
-	 * use the BSS, so it is safe to call here.  The bootrom LDR
-	 * takes care of clearing things for us.
-	 */
-	serial_early_puts("Zero BSS");
-	r0.l = ___bss_start;
-	r0.h = ___bss_start;
-	r1 = 0 (x);
-	r2.l = __bss_len;
-	r2.h = __bss_len;
-	call _memset;
-
-
 	/* Setup the actual stack in external memory */
 	sp.h = HI(CONFIG_STACKBASE);
 	sp.l = LO(CONFIG_STACKBASE);
-- 
2.8.0.rc3.226.g39d4020



More information about the U-Boot mailing list