[U-Boot-Users] [PATCH] Fix alignment error on ARM for modules

Woodruff, Richard r-woodruff2 at ti.com
Sat Mar 1 00:34:35 CET 2008


Fix alignment fault on ARM when running modules.  With out an explicit
linker file gcc4.2.1 will half word align __bss_start's value.  The word
dereference will crash hello_world. 

signed-off-by Richard Woodruff <r-woodruff2 at ti.com>

diff --git a/examples/Makefile b/examples/Makefile
index d63fa70..60a6f5e 100644
--- a/examples/Makefile
+++ b/examples/Makefile
@@ -30,8 +30,12 @@ LOAD_ADDR = 0x40000
 endif
 
 ifeq ($(ARCH),arm)
+ifeq ($(BOARD),omap2420h4)
+LOAD_ADDR = 0x80300000
+else
 LOAD_ADDR = 0xc100000
 endif
+endif
 
 ifeq ($(ARCH),mips)
 LOAD_ADDR = 0x80200000 -T mips.lds
diff --git a/examples/stubs.c b/examples/stubs.c
index 9b3cadd..b9dbcf9 100644
--- a/examples/stubs.c
+++ b/examples/stubs.c
@@ -190,10 +190,10 @@ extern unsigned long __bss_start, _end;
 
 void app_startup(char **argv)
 {
-	unsigned long * cp = &__bss_start;
+	unsigned char * cp = (unsigned char *) &__bss_start;
 
 	/* Zero out BSS */
-	while (cp < &_end) {
+	while (cp < (unsigned char *)&_end) {
 		*cp++ = 0;
 	}





More information about the U-Boot mailing list