Patch by Anders Larsen, 09 Jan 2004:
authorwdenk <wdenk>
Sun, 8 Feb 2004 19:38:38 +0000 (19:38 +0000)
committerwdenk <wdenk>
Sun, 8 Feb 2004 19:38:38 +0000 (19:38 +0000)
ARM memory layout fixes: the abort-stack is now set up in the
correct RAM area, and the BSS is zeroed out as it should be.

Furthermore, the magic variables 'armboot_end' and 'armboot_end_data'
of the linker scripts are replaced by '__bss_start' and '_end',
resp., which is a further step to eliminate unnecessary differences
between the implementation of the CPU architectures.

53 files changed:
CHANGELOG
board/at91rm9200dk/u-boot.lds
board/cradle/u-boot.lds
board/csb226/u-boot.lds
board/dnp1110/u-boot.lds
board/ep7312/u-boot.lds
board/impa7/u-boot.lds
board/innokom/u-boot.lds
board/ixdp425/config.mk
board/ixdp425/flash.c
board/ixdp425/u-boot.lds
board/lart/u-boot.lds
board/logodl/flash.c
board/logodl/u-boot.lds
board/lubbock/config.mk
board/lubbock/u-boot.lds
board/mpl/vcma9/config.mk
board/mpl/vcma9/u-boot.lds
board/omap1510inn/config.mk
board/omap1510inn/u-boot.lds
board/omap1610inn/config.mk
board/omap1610inn/u-boot.lds
board/shannon/u-boot.lds
board/smdk2400/config.mk
board/smdk2400/u-boot.lds
board/smdk2410/u-boot.lds
board/trab/u-boot.lds
board/wepep250/u-boot.lds
common/console.c
cpu/arm720t/cpu.c
cpu/arm720t/start.S
cpu/arm920t/cpu.c
cpu/arm920t/start.S
cpu/arm925t/cpu.c
cpu/arm925t/start.S
cpu/arm926ejs/cpu.c
cpu/arm926ejs/start.S
cpu/at91rm9200/cpu.c
cpu/at91rm9200/start.S
cpu/ixp/cpu.c
cpu/ixp/start.S
cpu/pxa/cpu.c
cpu/pxa/start.S
cpu/sa1100/cpu.c
cpu/sa1100/start.S
doc/README.ARM-memory-map
include/asm-arm/u-boot-arm.h
include/bmp_logo.h
include/configs/innokom.h
include/configs/ixdp425.h
include/configs/trab.h
include/flash.h
lib_arm/board.c

index 8e4fee6..202dd47 100644 (file)
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -2,6 +2,16 @@
 Changes since U-Boot 1.0.1:
 ======================================================================
 
+* Patch by Anders Larsen, 09 Jan 2004:
+
+  ARM memory layout fixes: the abort-stack is now set up in the
+  correct RAM area, and the BSS is zeroed out as it should be.
+
+  Furthermore, the magic variables 'armboot_end' and 'armboot_end_data'
+  of the linker scripts are replaced by '__bss_start' and '_end',
+  resp., which is a further step to eliminate unnecessary differences
+  between the implementation of the CPU architectures.
+
 * Patch by liang a lei, 9 Jan 2004:
   Fix Intel 28F128J3 ID in include/flash.h
 
index 17a85b8..0282898 100644 (file)
@@ -45,14 +45,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index d321b62..58c371d 100644 (file)
@@ -44,17 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-   __u_boot_cmd_start = .;
-   .u_boot_cmd : { *(.u_boot_cmd) }
-   __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
-
+       _end = .;
 }
index 4c4cabf..58c371d 100644 (file)
@@ -44,16 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-   __u_boot_cmd_start = .;
-   .u_boot_cmd : { *(.u_boot_cmd) }
-   __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index 7ac165e..bfb7c38 100644 (file)
@@ -44,16 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index 915e7c4..64d946c 100644 (file)
@@ -44,14 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index 36521b8..64d946c 100644 (file)
@@ -44,15 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
-
+       _end = .;
 }
index 1130013..58c371d 100644 (file)
@@ -44,16 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index 6bbb9a8..9f616f3 100644 (file)
@@ -1,2 +1,2 @@
 #TEXT_BASE = 0x00100000
-TEXT_BASE = 0x00f00000
+TEXT_BASE = 0x00f80000
index bd3a705..1d958c8 100644 (file)
@@ -72,7 +72,7 @@ unsigned long flash_init (void)
                        flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
                        break;
                default:
-                       panic ("configured to many flash banks!\n");
+                       panic ("configured too many flash banks!\n");
                        break;
                }
                size += flash_info[i].size;
@@ -82,7 +82,7 @@ unsigned long flash_init (void)
         */
        flash_protect (FLAG_PROTECT_SET,
                       CFG_FLASH_BASE,
-                      CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
+                      CFG_FLASH_BASE + _bss_start - _armboot_start,
                       &flash_info[0]);
 
        flash_protect (FLAG_PROTECT_SET,
index cd44eb9..91ef030 100644 (file)
@@ -48,12 +48,8 @@ SECTIONS
        .u_boot_cmd : { *(.u_boot_cmd) }
        __u_boot_cmd_end = .;
 
-       armboot_end_data = .;
-
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index b3f34ca..bfb7c38 100644 (file)
@@ -44,14 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index 8c304f9..a947731 100644 (file)
@@ -105,7 +105,7 @@ ulong flash_init(void)
      */
     flash_protect(FLAG_PROTECT_SET,
                  CFG_FLASH_BASE,
-                 CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
+                 CFG_FLASH_BASE + _bss_start - _armboot_start,
                  &flash_info[0]);
 
     flash_protect(FLAG_PROTECT_SET,
index 5aef127..58c371d 100644 (file)
@@ -44,12 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index d2a2040..55c8b27 100644 (file)
@@ -1,3 +1,3 @@
 #TEXT_BASE = 0xa1700000
-TEXT_BASE = 0xa3000000
+TEXT_BASE = 0xa3080000
 #TEXT_BASE = 0
index 4c4cabf..58c371d 100644 (file)
@@ -44,16 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-   __u_boot_cmd_start = .;
-   .u_boot_cmd : { *(.u_boot_cmd) }
-   __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index 3698c24..1fa09c9 100644 (file)
 # Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
 # optionally with a ramdisk at 3040'0000
 #
-# we load ourself to 30F8'0000
+# we load ourself to 33F8'0000
 #
 # download area is 3080'0000
 #
 
 
 #TEXT_BASE = 0x30F80000
-TEXT_BASE = 0x33F00000
+TEXT_BASE = 0x33F80000
index 3a7c4d4..76df6b2 100644 (file)
@@ -45,14 +45,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index c5fd706..7b24780 100644 (file)
@@ -17,9 +17,9 @@
 #
 # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000  (mem base + reserved)
 #
-# we load ourself to 1100'0000
+# we load ourself to 1108'0000
 #
 #
 
 
-TEXT_BASE = 0x11000000
+TEXT_BASE = 0x11080000
index 46cf9dc..cb28b31 100644 (file)
@@ -45,14 +45,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
+       _end = .;
 }
index 241cb97..80976ef 100644 (file)
@@ -18,9 +18,9 @@
 # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
 # (mem base + reserved)
 #
-# we load ourself to 1100'0000
+# we load ourself to 1108'0000
 #
 #
 
 
-TEXT_BASE = 0x11000000
+TEXT_BASE = 0x11080000
index cab0080..eee4813 100644 (file)
@@ -44,8 +44,8 @@ SECTIONS
        .u_boot_cmd : { *(.u_boot_cmd) }
        __u_boot_cmd_end = .;
 
-       armboot_end_data = .;
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-       armboot_end = .;
+       _end = .;
 }
index d1fe8aa..bfb7c38 100644 (file)
@@ -44,15 +44,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
-
+       _end = .;
 }
index 18c412a..82400bf 100644 (file)
 # Linux-Kernel is expected to be at 0cf0'0000, entry 0cf0'0000
 # optionally with a ramdisk at 0c80'0000
 #
-# we load ourself to 0CF00000 (must be high enough not to be
+# we load ourself to 0CF80000 (must be high enough not to be
 # overwritten by the uncompessing Linux kernel)
 #
 # download area is 0C80'0000
 #
 
 
-TEXT_BASE = 0x0CF00000
+TEXT_BASE = 0x0CF80000
index af3cd19..76df6b2 100644 (file)
@@ -45,15 +45,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
-
+       _end = .;
 }
index 0cf076a..76df6b2 100644 (file)
@@ -45,16 +45,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-       armboot_end = .;
-
+       _end = .;
 }
index ccffb19..5afdb70 100644 (file)
@@ -39,7 +39,7 @@ SECTIONS
          lib_generic/string.o  (.text)
 
        . = DEFINED(env_offset) ? env_offset : .;
-       common/environment.o    (.ppcenv)
+         common/environment.o  (.ppcenv)
 
          *(.text)
        }
@@ -53,15 +53,12 @@ SECTIONS
        . = ALIGN(4);
        .got : { *(.got) }
 
-  __u_boot_cmd_start = .;
-  .u_boot_cmd : { *(.u_boot_cmd) }
-  __u_boot_cmd_end = .;
-
-       armboot_end_data = .;
+       __u_boot_cmd_start = .;
+       .u_boot_cmd : { *(.u_boot_cmd) }
+       __u_boot_cmd_end = .;
 
        . = ALIGN(4);
+       __bss_start = .;
        .bss : { *(.bss) }
-
-
-       armboot_end = .;
+       _end = .;
 }
index 38ec25f..58c371d 100644 (file)
@@ -48,12 +48,8 @@ SECTIONS
        .u_boot_cmd : { *(.u_boot_cmd) }
        __u_boot_cmd_end = .;
 
-       armboot_end_data = .;
-
        . = ALIGN(4);
-       bss_start = .;
+       __bss_start = .;
        .bss : { *(.bss) }
-       bss_end = .;
-
-       armboot_end = .;
+       _end = .;
 }
index 1e0ca8d..5fe364e 100644 (file)
@@ -193,7 +193,7 @@ void putc (const char c)
 
 #ifdef CONFIG_SILENT_CONSOLE
        if (gd->flags & GD_FLG_SILENT)
-               return(0);
+               return;
 #endif
 
        if (gd->flags & GD_FLG_DEVINIT) {
index b6fcef9..5637eb6 100644 (file)
@@ -87,7 +87,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index 8ddb0c9..7fe36c6 100644 (file)
@@ -63,7 +63,7 @@ _fiq:                 .word fiq
  *
  * Startup Code (reset vector)
  *
- * do important init only if we don't start from memory!
+ * do important init only if we don't start from RAM!
  * relocate armboot to ram
  * setup stack
  * jump to second stage
@@ -79,16 +79,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -131,7 +130,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -151,6 +150,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
        ldr     pc, _start_armboot
 
 _start_armboot:        .word start_armboot
@@ -225,7 +235,7 @@ cpu_init_crit:
 
        /*
         * before relocating, we have to setup RAM timing
-        * because memory timing is board-dependend, you will
+        * because memory timing is board-dependent, you will
         * find a memsetup.S in your board directory.
         */
        mov     ip, lr
@@ -281,9 +291,9 @@ cpu_init_crit:
        stmia   sp, {r0 - r12}                  @ Calling r0-r12
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r4}                   @ get pc, cpsr, old_r0
        add     r0, sp, #S_FRAME_SIZE           @ restore sp_SVC
 
@@ -314,9 +324,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index e638c1f..2a2b578 100644 (file)
@@ -92,7 +92,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index d640942..49264da 100644 (file)
@@ -80,16 +80,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -170,7 +169,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -190,6 +189,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
 #if 0
        /* try doing this stuff after the relocation */
        ldr     r0, =pWTCON
@@ -303,9 +313,9 @@ cpu_init_crit:
        .macro  bad_save_user_regs
        sub     sp, sp, #S_FRAME_SIZE
        stmia   sp, {r0 - r12}                  @ Calling r0-r12
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r3}                   @ get pc, cpsr
        add     r0, sp, #S_FRAME_SIZE           @ restore sp_SVC
 
@@ -336,9 +346,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index 6bac53d..b760ec9 100644 (file)
@@ -93,7 +93,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index 0a3042d..da84de1 100644 (file)
@@ -89,16 +89,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -176,7 +175,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -196,6 +195,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
        ldr     pc, _start_armboot
 
 _start_armboot:        .word start_armboot
@@ -283,9 +293,9 @@ cpu_init_crit:
        sub     sp, sp, #S_FRAME_SIZE           @ carve out a frame on current user stack
        stmia   sp, {r0 - r12}                  @ Save user registers (now in svc mode) r0-r12
 
-       ldr     r2, _armboot_end                @ find top of stack
-       add     r2, r2, #CONFIG_STACKSIZE       @ find base of normal stack
-       sub     r2, r2, #8                      @ set base 2 words into abort stack
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r3}                   @ get values for "aborted" pc and cpsr (into parm regs)
        add     r0, sp, #S_FRAME_SIZE           @ grab pointer to old stack
 
@@ -316,9 +326,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ get bottom of stack (into sp by by user stack pointer).
-       add     r13, r13, #CONFIG_STACKSIZE     @ head to reserved words at the top of the stack
-       sub     r13, r13, #8                    @ reserved a couple spots in abort stack
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr in position 0 of saved stack
        mrs     lr, spsr                        @ get the spsr
index 748a21a..6c153e5 100644 (file)
@@ -93,7 +93,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index 39d7409..0c28927 100644 (file)
@@ -97,16 +97,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -170,7 +169,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -190,6 +189,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
        ldr     pc, _start_armboot
 
 _start_armboot:
@@ -278,9 +288,10 @@ cpu_init_crit:
        @ carve out a frame on current user stack
        sub     sp, sp, #S_FRAME_SIZE
        stmia   sp, {r0 - r12}  @ Save user registers (now in svc mode) r0-r12
-       ldr     r2, _armboot_end        @ find top of stack
-       add     r2, r2, #CONFIG_STACKSIZE       @ find base of normal stack
-       sub     r2, r2, #8      @ set base 2 words into abort stack
+
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        @ get values for "aborted" pc and cpsr (into parm regs)
        ldmia   r2, {r2 - r3}
        add     r0, sp, #S_FRAME_SIZE           @ grab pointer to old stack
@@ -312,11 +323,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       @ get bottom of stack (into sp by by user stack pointer).
-       ldr     r13, _armboot_end
-       @ head to reserved words at the top of the stack
-       add     r13, r13, #CONFIG_STACKSIZE
-       sub     r13, r13, #8    @ reserved a couple spots in abort stack
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]       @ save caller lr in position 0 of saved stack
        mrs     lr, spsr        @ get the spsr
index b0cfcef..0250729 100644 (file)
@@ -87,7 +87,7 @@ int cpu_init(void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index a93d045..b9b889a 100644 (file)
@@ -79,19 +79,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-/*
- * Note: armboot_end is defined by the (board-dependent) linker script
- */
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -149,6 +145,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
        ldr pc,_start_armboot
 
 _start_armboot: .word start_armboot
@@ -212,9 +219,9 @@ cpu_init_crit:
        stmia   sp, {r0 - r12}                  @ Calling r0-r12
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r4}                   @ get pc, cpsr, old_r0
        add     r0, sp, #S_FRAME_SIZE           @ restore sp_SVC
 
@@ -245,9 +252,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index d12e8bd..d4fd823 100644 (file)
 int cpu_init (void)
 {
        /*
-        * setup up stack if necessary
+        * setup up stacks if necessary
         */
-/*
-
-  FIXME: the stack is _below_ the uboot code!!
-
 #ifdef CONFIG_USE_IRQ
-       IRQ_STACK_START = _armboot_end +
-                       CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
-       FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
-       _armboot_real_end = FIQ_STACK_START + 4;
-#else
-       _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
+       DECLARE_GLOBAL_DATA_PTR;
+
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
+       FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
-*/
-   pci_init();
+
+       pci_init();
        return 0;
 }
 
@@ -84,7 +78,7 @@ int do_reset (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
 {
        extern void reset_cpu (ulong addr);
 
-       printf ("reseting ...\n");
+       printf ("resetting ...\n");
 
        udelay (50000);                         /* wait 50 ms */
        disable_interrupts ();
index d5fc9bf..09ecc73 100644 (file)
@@ -101,42 +101,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
- */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
-
-/*
- * This is defined in the board specific linker script
+ * These are defined in the board-specific linker script.
  */
 .globl _bss_start
 _bss_start:
-       .word bss_start
+       .word __bss_start
 
 .globl _bss_end
 _bss_end:
-       .word bss_end
-
-/*
- * _armboot_real_end is the first usable RAM address behind armboot
- * and the various stacks
- */
-.globl _armboot_real_end
-_armboot_real_end:
-       .word 0x0badc0de
-
-/*
- * We relocate uboot to this address (end of RAM - 128 KiB)
- */
-.globl _uboot_reloc
-_uboot_reloc:
-       .word TEXT_BASE
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -294,7 +267,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -305,16 +278,16 @@ copy_loop:
        ble     copy_loop
 
        /* Set up the stack                                                 */
-
 stack_setup:
-
-       ldr     r0, _uboot_reloc        /* upper 128 KiB: relocated uboot   */
-       sub     r0, r0, #CFG_MALLOC_LEN /* malloc area                      */
-                                       /* FIXME: bdinfo should be here     */
+       ldr     r0, _TEXT_BASE          /* upper 128 KiB: relocated uboot   */
+       sub     r0, r0, #CFG_MALLOC_LEN /* malloc area                      */
+       sub     r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo                        */
+#ifdef CONFIG_USE_IRQ
+       sub     r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
+#endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
 clear_bss:
-
        ldr     r0, _bss_start          /* find start of bss segment        */
        add     r0, r0, #4              /* start at first byte of bss       */
        ldr     r1, _bss_end            /* stop here                        */
@@ -325,7 +298,6 @@ clbss_l:str r2, [r0]                /* clear loop...                    */
        cmp     r0, r1
        bne     clbss_l
 
-
        ldr     pc, _start_armboot
 
 _start_armboot: .word start_armboot
@@ -370,9 +342,9 @@ _start_armboot: .word start_armboot
        stmia   sp, {r0 - r12}                  /* Calling r0-r12           */
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r4}                   /* get pc, cpsr, old_r0     */
        add     r0, sp, #S_FRAME_SIZE           /* restore sp_SVC           */
 
@@ -407,9 +379,9 @@ _start_armboot: .word start_armboot
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index 32ec4f6..abb064a 100644 (file)
@@ -42,7 +42,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index d41b414..de2a084 100644 (file)
@@ -69,27 +69,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
- */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
-
-/*
- * This is defined in the board specific linker script
+ * These are defined in the board-specific linker script.
  */
 .globl _bss_start
 _bss_start:
-       .word bss_start
+       .word __bss_start
 
 .globl _bss_end
 _bss_end:
-       .word bss_end
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -131,7 +119,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -152,7 +140,6 @@ stack_setup:
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
 clear_bss:
-
        ldr     r0, _bss_start          /* find start of bss segment        */
        add     r0, r0, #4              /* start at first byte of bss       */
        ldr     r1, _bss_end            /* stop here                        */
@@ -163,7 +150,6 @@ clbss_l:str r2, [r0]                /* clear loop...                    */
        cmp     r0, r1
        bne     clbss_l
 
-
        ldr     pc, _start_armboot
 
 _start_armboot: .word start_armboot
@@ -303,9 +289,9 @@ setspeed_done:
        stmia   sp, {r0 - r12}                  /* Calling r0-r12           */
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r4}                   /* get pc, cpsr, old_r0     */
        add     r0, sp, #S_FRAME_SIZE           /* restore sp_SVC           */
 
@@ -340,9 +326,9 @@ setspeed_done:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index b613fe7..34adf91 100644 (file)
@@ -41,7 +41,7 @@ int cpu_init (void)
 #ifdef CONFIG_USE_IRQ
        DECLARE_GLOBAL_DATA_PTR;
 
-       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
+       IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
        FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
 #endif
        return 0;
index 0c8946e..fe1316c 100644 (file)
@@ -81,16 +81,15 @@ _armboot_start:
        .word _start
 
 /*
- * Note: _armboot_end_data and _armboot_end are defined
- * by the (board-dependent) linker script.
- * _armboot_end_data is the first usable FLASH address after armboot
+ * These are defined in the board-specific linker script.
  */
-.globl _armboot_end_data
-_armboot_end_data:
-       .word armboot_end_data
-.globl _armboot_end
-_armboot_end:
-       .word armboot_end
+.globl _bss_start
+_bss_start:
+       .word __bss_start
+
+.globl _bss_end
+_bss_end:
+       .word _end
 
 #ifdef CONFIG_USE_IRQ
 /* IRQ stack memory (calculated at run-time) */
@@ -133,7 +132,7 @@ relocate:                           /* relocate U-Boot to RAM           */
        beq     stack_setup
 
        ldr     r2, _armboot_start
-       ldr     r3, _armboot_end
+       ldr     r3, _bss_start
        sub     r2, r3, r2              /* r2 <- size of armboot            */
        add     r2, r0, r2              /* r2 <- source end address         */
 
@@ -153,6 +152,17 @@ stack_setup:
 #endif
        sub     sp, r0, #12             /* leave 3 words for abort-stack    */
 
+clear_bss:
+       ldr     r0, _bss_start          /* find start of bss segment        */
+       add     r0, r0, #4              /* start at first byte of bss       */
+       ldr     r1, _bss_end            /* stop here                        */
+       mov     r2, #0x00000000         /* clear                            */
+
+clbss_l:str    r2, [r0]                /* clear loop...                    */
+       add     r0, r0, #4
+       cmp     r0, r1
+       bne     clbss_l
+
        ldr     pc, _start_armboot
 
 _start_armboot:        .word start_armboot
@@ -276,9 +286,9 @@ cpu_init_crit:
        stmia   sp, {r0 - r12}                  @ Calling r0-r12
        add     r8, sp, #S_PC
 
-       ldr     r2, _armboot_end
-       add     r2, r2, #CONFIG_STACKSIZE
-       sub     r2, r2, #8
+       ldr     r2, _armboot_start
+       sub     r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r2, r2, #(CFG_GBL_DATA_SIZE+8)  @ set base 2 words into abort stack
        ldmia   r2, {r2 - r4}                   @ get pc, cpsr, old_r0
        add     r0, sp, #S_FRAME_SIZE           @ restore sp_SVC
 
@@ -309,9 +319,9 @@ cpu_init_crit:
        .endm
 
        .macro get_bad_stack
-       ldr     r13, _armboot_end               @ setup our mode stack
-       add     r13, r13, #CONFIG_STACKSIZE     @ resides at top of normal stack
-       sub     r13, r13, #8
+       ldr     r13, _armboot_start             @ setup our mode stack
+       sub     r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
+       sub     r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
 
        str     lr, [r13]                       @ save caller lr / spsr
        mrs     lr, spsr
index 8905a50..e2c4e16 100644 (file)
@@ -15,13 +15,3 @@ different parts of the (ARM) code.
 Furthermore, the startup code (cpu/<arm>/start.S) internally uses
 another variable (_TEXT_BASE) with the same content as _armboot_start.
 I agree that this mess should be cleaned up.
-
-_armboot_end_data is the end address of the initialized data section,
-and is only used in one place (board/logodl/flash.c - the reference in
-lib_arm/board.c is purely informational).
-
-_armboot_end is the end address of the BSS and is used to determine
-the address of the VFD buffer.
-
-Eliminating those should be doable, and at least the patch already
-eliminates _armboot_real_end.
index d5dbd6d..41e7a8f 100644 (file)
@@ -31,8 +31,8 @@
 
 /* for the following variables, see start.S */
 extern ulong _armboot_start;   /* code start */
-extern ulong _armboot_end_data;        /* code + data end */
-extern ulong _armboot_end;     /* BSS end */
+extern ulong _bss_start;       /* code + data end == BSS start */
+extern ulong _bss_end;         /* BSS end */
 extern ulong IRQ_STACK_START;  /* top of IRQ stack */
 extern ulong FIQ_STACK_START;  /* top of FIQ stack */
 
index 9c924b8..265f744 100644 (file)
@@ -18,7 +18,7 @@ unsigned short bmp_logo_palette[] = {
        0x0343,  0x0454,  0x0565,  0x0565,  0x0676,  0x0787,  0x0898,  0x0999,
        0x0AAA,  0x0ABA,  0x0BCB,  0x0CCC,  0x0DDD,  0x0EEE,  0x0FFF,  0x0FB3,
        0x0FB4,  0x0FC4,  0x0FC5,  0x0FC6,  0x0FD7,  0x0FD8,  0x0FD9,  0x0FDA,
-       0x0FEA,  0x0FEB,  0x0FEC,  0x0FFD,  0x0FFE,  0x0FFF,  0x0FFF,
+       0x0FEA,  0x0FEB,  0x0FEC,  0x0FFD,  0x0FFE,  0x0FFF,  0x0FFF,  
 };
 
 unsigned char bmp_logo_bitmap[] = {
index 709c0d7..77439e6 100644 (file)
@@ -82,9 +82,7 @@
  */
 
 /*
- * Size of malloc() pool; this lives below the uppermost 128 KiB which are
- * used for the RAM copy of the uboot code
- *
+ * Size of malloc() pool
  */
 #define CFG_MALLOC_LEN         (256*1024)
 #define CFG_GBL_DATA_SIZE      128             /* size in bytes reserved for initial data */
index 1862b06..3f2026e 100644 (file)
@@ -49,6 +49,7 @@
  * Size of malloc() pool
  */
 #define CFG_MALLOC_LEN      (CFG_ENV_SIZE + 128*1024)
+#define CFG_GBL_DATA_SIZE      128     /* size in bytes reserved for initial data */
 
 /* allow to overwrite serial and ethaddr */
 #define CONFIG_ENV_OVERWRITE
index e9ba90f..5e0b14f 100644 (file)
 #define CFG_ENV_SIZE           0x4000
 #define CFG_ENV_SECT_SIZE      0x20000
 #else
-#define CFG_ENV_ADDR           (CFG_FLASH_BASE + 0x4000)
+#define CFG_ENV_ADDR           (CFG_FLASH_BASE + 0x8000)
 #define CFG_ENV_SIZE           0x4000
 #define CFG_ENV_SECT_SIZE      0x4000
 #endif
index a0c9cad..8f20887 100644 (file)
@@ -215,7 +215,7 @@ extern int flash_real_protect(flash_info_t *info, long sector, int prot);
 #define INTEL_ID_28F640C3T  0x88CC88CC /*  64M = 4M x 16 top boot sector       */
 #define INTEL_ID_28F640C3B  0x88CD88CD /*  64M = 4M x 16 bottom boot sector    */
 
-#define INTEL_ID_28F128J3   0x89189818 /*  16M = 8M x 16 x 128 */
+#define INTEL_ID_28F128J3   0x89188918 /*  16M = 8M x 16 x 128 */
 #define INTEL_ID_28F320J5   0x00140014 /*  32M = 128K x  32    */
 #define INTEL_ID_28F640J5   0x00150015 /*  64M = 128K x  64    */
 #define INTEL_ID_28F320J3A  0x00160016 /*  32M = 128K x  32    */
index 08679d3..314126a 100644 (file)
@@ -117,7 +117,7 @@ static int display_banner (void)
 {
        printf ("\n\n%s\n\n", version_string);
        printf ("U-Boot code: %08lX -> %08lX  BSS: -> %08lX\n",
-               _armboot_start, _armboot_end_data, _armboot_end);
+               _armboot_start, _bss_start, _bss_end);
 #ifdef CONFIG_MODEM_SUPPORT
        puts ("Modem Support enabled\n");
 #endif
@@ -173,7 +173,7 @@ static void display_flash_config (ulong size)
  * All attempts to come up with a "common" initialization sequence
  * that works for all boards and architectures failed: some of the
  * requirements are just _too_ different. To get rid of the resulting
- * mess of board dependend #ifdef'ed code we now make the whole
+ * mess of board dependent #ifdef'ed code we now make the whole
  * initialization sequence configurable to the user.
  *
  * The requirements for any new initalization function is simple: it
@@ -217,7 +217,7 @@ void start_armboot (void)
        gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
        memset (gd->bd, 0, sizeof (bd_t));
 
-       monitor_flash_len = _armboot_end_data - _armboot_start;
+       monitor_flash_len = _bss_start - _armboot_start;
 
        for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
                if ((*init_fnc_ptr)() != 0) {
@@ -237,7 +237,7 @@ void start_armboot (void)
         * reserve memory for VFD display (always full pages)
         */
        /* armboot_end is defined in the board-specific linker script */
-       addr = (_armboot_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
+       addr = (_bss_start + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
        size = vfd_setmem (addr);
        gd->fb_base = addr;
 #endif /* CONFIG_VFD */