From f6e20fc6ca5a45316f94743d8b60dce4d9766bc8 Mon Sep 17 00:00:00 2001 From: wdenk Date: Sun, 8 Feb 2004 19:38:38 +0000 Subject: [PATCH] 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. --- CHANGELOG | 10 ++++++++ board/at91rm9200dk/u-boot.lds | 12 ++++----- board/cradle/u-boot.lds | 15 ++++------- board/csb226/u-boot.lds | 14 ++++------ board/dnp1110/u-boot.lds | 14 ++++------ board/ep7312/u-boot.lds | 12 ++++----- board/impa7/u-boot.lds | 13 ++++------ board/innokom/u-boot.lds | 14 ++++------ board/ixdp425/config.mk | 2 +- board/ixdp425/flash.c | 4 +-- board/ixdp425/u-boot.lds | 8 ++---- board/lart/u-boot.lds | 12 ++++----- board/logodl/flash.c | 2 +- board/logodl/u-boot.lds | 10 ++++---- board/lubbock/config.mk | 2 +- board/lubbock/u-boot.lds | 14 ++++------ board/mpl/vcma9/config.mk | 4 +-- board/mpl/vcma9/u-boot.lds | 12 ++++----- board/omap1510inn/config.mk | 4 +-- board/omap1510inn/u-boot.lds | 12 ++++----- board/omap1610inn/config.mk | 4 +-- board/omap1610inn/u-boot.lds | 4 +-- board/shannon/u-boot.lds | 13 ++++------ board/smdk2400/config.mk | 4 +-- board/smdk2400/u-boot.lds | 13 ++++------ board/smdk2410/u-boot.lds | 14 ++++------ board/trab/u-boot.lds | 15 +++++------ board/wepep250/u-boot.lds | 8 ++---- common/console.c | 2 +- cpu/arm720t/cpu.c | 2 +- cpu/arm720t/start.S | 46 ++++++++++++++++++++------------- cpu/arm920t/cpu.c | 2 +- cpu/arm920t/start.S | 42 ++++++++++++++++++------------ cpu/arm925t/cpu.c | 2 +- cpu/arm925t/start.S | 42 ++++++++++++++++++------------ cpu/arm926ejs/cpu.c | 2 +- cpu/arm926ejs/start.S | 45 +++++++++++++++++++------------- cpu/at91rm9200/cpu.c | 2 +- cpu/at91rm9200/start.S | 43 ++++++++++++++++++------------- cpu/ixp/cpu.c | 22 ++++++---------- cpu/ixp/start.S | 60 ++++++++++++------------------------------- cpu/pxa/cpu.c | 2 +- cpu/pxa/start.S | 34 ++++++++---------------- cpu/sa1100/cpu.c | 2 +- cpu/sa1100/start.S | 42 ++++++++++++++++++------------ doc/README.ARM-memory-map | 10 -------- include/asm-arm/u-boot-arm.h | 4 +-- include/bmp_logo.h | 2 +- include/configs/innokom.h | 4 +-- include/configs/ixdp425.h | 1 + include/configs/trab.h | 2 +- include/flash.h | 2 +- lib_arm/board.c | 8 +++--- 53 files changed, 321 insertions(+), 369 deletions(-) diff --git a/CHANGELOG b/CHANGELOG index 8e4fee6..202dd47 100644 --- 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 diff --git a/board/at91rm9200dk/u-boot.lds b/board/at91rm9200dk/u-boot.lds index 17a85b8..0282898 100644 --- a/board/at91rm9200dk/u-boot.lds +++ b/board/at91rm9200dk/u-boot.lds @@ -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 = .; } diff --git a/board/cradle/u-boot.lds b/board/cradle/u-boot.lds index d321b62..58c371d 100644 --- a/board/cradle/u-boot.lds +++ b/board/cradle/u-boot.lds @@ -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 = .; } diff --git a/board/csb226/u-boot.lds b/board/csb226/u-boot.lds index 4c4cabf..58c371d 100644 --- a/board/csb226/u-boot.lds +++ b/board/csb226/u-boot.lds @@ -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 = .; } diff --git a/board/dnp1110/u-boot.lds b/board/dnp1110/u-boot.lds index 7ac165e..bfb7c38 100644 --- a/board/dnp1110/u-boot.lds +++ b/board/dnp1110/u-boot.lds @@ -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 = .; } diff --git a/board/ep7312/u-boot.lds b/board/ep7312/u-boot.lds index 915e7c4..64d946c 100644 --- a/board/ep7312/u-boot.lds +++ b/board/ep7312/u-boot.lds @@ -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 = .; } diff --git a/board/impa7/u-boot.lds b/board/impa7/u-boot.lds index 36521b8..64d946c 100644 --- a/board/impa7/u-boot.lds +++ b/board/impa7/u-boot.lds @@ -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 = .; } diff --git a/board/innokom/u-boot.lds b/board/innokom/u-boot.lds index 1130013..58c371d 100644 --- a/board/innokom/u-boot.lds +++ b/board/innokom/u-boot.lds @@ -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 = .; } diff --git a/board/ixdp425/config.mk b/board/ixdp425/config.mk index 6bbb9a8..9f616f3 100644 --- a/board/ixdp425/config.mk +++ b/board/ixdp425/config.mk @@ -1,2 +1,2 @@ #TEXT_BASE = 0x00100000 -TEXT_BASE = 0x00f00000 +TEXT_BASE = 0x00f80000 diff --git a/board/ixdp425/flash.c b/board/ixdp425/flash.c index bd3a705..1d958c8 100644 --- a/board/ixdp425/flash.c +++ b/board/ixdp425/flash.c @@ -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, diff --git a/board/ixdp425/u-boot.lds b/board/ixdp425/u-boot.lds index cd44eb9..91ef030 100644 --- a/board/ixdp425/u-boot.lds +++ b/board/ixdp425/u-boot.lds @@ -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 = .; } diff --git a/board/lart/u-boot.lds b/board/lart/u-boot.lds index b3f34ca..bfb7c38 100644 --- a/board/lart/u-boot.lds +++ b/board/lart/u-boot.lds @@ -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 = .; } diff --git a/board/logodl/flash.c b/board/logodl/flash.c index 8c304f9..a947731 100644 --- a/board/logodl/flash.c +++ b/board/logodl/flash.c @@ -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, diff --git a/board/logodl/u-boot.lds b/board/logodl/u-boot.lds index 5aef127..58c371d 100644 --- a/board/logodl/u-boot.lds +++ b/board/logodl/u-boot.lds @@ -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 = .; } diff --git a/board/lubbock/config.mk b/board/lubbock/config.mk index d2a2040..55c8b27 100644 --- a/board/lubbock/config.mk +++ b/board/lubbock/config.mk @@ -1,3 +1,3 @@ #TEXT_BASE = 0xa1700000 -TEXT_BASE = 0xa3000000 +TEXT_BASE = 0xa3080000 #TEXT_BASE = 0 diff --git a/board/lubbock/u-boot.lds b/board/lubbock/u-boot.lds index 4c4cabf..58c371d 100644 --- a/board/lubbock/u-boot.lds +++ b/board/lubbock/u-boot.lds @@ -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 = .; } diff --git a/board/mpl/vcma9/config.mk b/board/mpl/vcma9/config.mk index 3698c24..1fa09c9 100644 --- a/board/mpl/vcma9/config.mk +++ b/board/mpl/vcma9/config.mk @@ -14,11 +14,11 @@ # 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 diff --git a/board/mpl/vcma9/u-boot.lds b/board/mpl/vcma9/u-boot.lds index 3a7c4d4..76df6b2 100644 --- a/board/mpl/vcma9/u-boot.lds +++ b/board/mpl/vcma9/u-boot.lds @@ -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 = .; } diff --git a/board/omap1510inn/config.mk b/board/omap1510inn/config.mk index c5fd706..7b24780 100644 --- a/board/omap1510inn/config.mk +++ b/board/omap1510inn/config.mk @@ -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 diff --git a/board/omap1510inn/u-boot.lds b/board/omap1510inn/u-boot.lds index 46cf9dc..cb28b31 100644 --- a/board/omap1510inn/u-boot.lds +++ b/board/omap1510inn/u-boot.lds @@ -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 = .; } diff --git a/board/omap1610inn/config.mk b/board/omap1610inn/config.mk index 241cb97..80976ef 100644 --- a/board/omap1610inn/config.mk +++ b/board/omap1610inn/config.mk @@ -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 diff --git a/board/omap1610inn/u-boot.lds b/board/omap1610inn/u-boot.lds index cab0080..eee4813 100644 --- a/board/omap1610inn/u-boot.lds +++ b/board/omap1610inn/u-boot.lds @@ -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 = .; } diff --git a/board/shannon/u-boot.lds b/board/shannon/u-boot.lds index d1fe8aa..bfb7c38 100644 --- a/board/shannon/u-boot.lds +++ b/board/shannon/u-boot.lds @@ -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 = .; } diff --git a/board/smdk2400/config.mk b/board/smdk2400/config.mk index 18c412a..82400bf 100644 --- a/board/smdk2400/config.mk +++ b/board/smdk2400/config.mk @@ -15,11 +15,11 @@ # 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 diff --git a/board/smdk2400/u-boot.lds b/board/smdk2400/u-boot.lds index af3cd19..76df6b2 100644 --- a/board/smdk2400/u-boot.lds +++ b/board/smdk2400/u-boot.lds @@ -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 = .; } diff --git a/board/smdk2410/u-boot.lds b/board/smdk2410/u-boot.lds index 0cf076a..76df6b2 100644 --- a/board/smdk2410/u-boot.lds +++ b/board/smdk2410/u-boot.lds @@ -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 = .; } diff --git a/board/trab/u-boot.lds b/board/trab/u-boot.lds index ccffb19..5afdb70 100644 --- a/board/trab/u-boot.lds +++ b/board/trab/u-boot.lds @@ -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 = .; } diff --git a/board/wepep250/u-boot.lds b/board/wepep250/u-boot.lds index 38ec25f..58c371d 100644 --- a/board/wepep250/u-boot.lds +++ b/board/wepep250/u-boot.lds @@ -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 = .; } diff --git a/common/console.c b/common/console.c index 1e0ca8d..5fe364e 100644 --- a/common/console.c +++ b/common/console.c @@ -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) { diff --git a/cpu/arm720t/cpu.c b/cpu/arm720t/cpu.c index b6fcef9..5637eb6 100644 --- a/cpu/arm720t/cpu.c +++ b/cpu/arm720t/cpu.c @@ -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; diff --git a/cpu/arm720t/start.S b/cpu/arm720t/start.S index 8ddb0c9..7fe36c6 100644 --- a/cpu/arm720t/start.S +++ b/cpu/arm720t/start.S @@ -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 diff --git a/cpu/arm920t/cpu.c b/cpu/arm920t/cpu.c index e638c1f..2a2b578 100644 --- a/cpu/arm920t/cpu.c +++ b/cpu/arm920t/cpu.c @@ -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; diff --git a/cpu/arm920t/start.S b/cpu/arm920t/start.S index d640942..49264da 100644 --- a/cpu/arm920t/start.S +++ b/cpu/arm920t/start.S @@ -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 diff --git a/cpu/arm925t/cpu.c b/cpu/arm925t/cpu.c index 6bac53d..b760ec9 100644 --- a/cpu/arm925t/cpu.c +++ b/cpu/arm925t/cpu.c @@ -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; diff --git a/cpu/arm925t/start.S b/cpu/arm925t/start.S index 0a3042d..da84de1 100644 --- a/cpu/arm925t/start.S +++ b/cpu/arm925t/start.S @@ -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 diff --git a/cpu/arm926ejs/cpu.c b/cpu/arm926ejs/cpu.c index 748a21a..6c153e5 100644 --- a/cpu/arm926ejs/cpu.c +++ b/cpu/arm926ejs/cpu.c @@ -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; diff --git a/cpu/arm926ejs/start.S b/cpu/arm926ejs/start.S index 39d7409..0c28927 100644 --- a/cpu/arm926ejs/start.S +++ b/cpu/arm926ejs/start.S @@ -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 diff --git a/cpu/at91rm9200/cpu.c b/cpu/at91rm9200/cpu.c index b0cfcef..0250729 100644 --- a/cpu/at91rm9200/cpu.c +++ b/cpu/at91rm9200/cpu.c @@ -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; diff --git a/cpu/at91rm9200/start.S b/cpu/at91rm9200/start.S index a93d045..b9b889a 100644 --- a/cpu/at91rm9200/start.S +++ b/cpu/at91rm9200/start.S @@ -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 diff --git a/cpu/ixp/cpu.c b/cpu/ixp/cpu.c index d12e8bd..d4fd823 100644 --- a/cpu/ixp/cpu.c +++ b/cpu/ixp/cpu.c @@ -37,22 +37,16 @@ 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 (); diff --git a/cpu/ixp/start.S b/cpu/ixp/start.S index d5fc9bf..09ecc73 100644 --- a/cpu/ixp/start.S +++ b/cpu/ixp/start.S @@ -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 diff --git a/cpu/pxa/cpu.c b/cpu/pxa/cpu.c index 32ec4f6..abb064a 100644 --- a/cpu/pxa/cpu.c +++ b/cpu/pxa/cpu.c @@ -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; diff --git a/cpu/pxa/start.S b/cpu/pxa/start.S index d41b414..de2a084 100644 --- a/cpu/pxa/start.S +++ b/cpu/pxa/start.S @@ -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 diff --git a/cpu/sa1100/cpu.c b/cpu/sa1100/cpu.c index b613fe7..34adf91 100644 --- a/cpu/sa1100/cpu.c +++ b/cpu/sa1100/cpu.c @@ -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; diff --git a/cpu/sa1100/start.S b/cpu/sa1100/start.S index 0c8946e..fe1316c 100644 --- a/cpu/sa1100/start.S +++ b/cpu/sa1100/start.S @@ -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 diff --git a/doc/README.ARM-memory-map b/doc/README.ARM-memory-map index 8905a50..e2c4e16 100644 --- a/doc/README.ARM-memory-map +++ b/doc/README.ARM-memory-map @@ -15,13 +15,3 @@ different parts of the (ARM) code. Furthermore, the startup code (cpu//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. diff --git a/include/asm-arm/u-boot-arm.h b/include/asm-arm/u-boot-arm.h index d5dbd6d..41e7a8f 100644 --- a/include/asm-arm/u-boot-arm.h +++ b/include/asm-arm/u-boot-arm.h @@ -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 */ diff --git a/include/bmp_logo.h b/include/bmp_logo.h index 9c924b8..265f744 100644 --- a/include/bmp_logo.h +++ b/include/bmp_logo.h @@ -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[] = { diff --git a/include/configs/innokom.h b/include/configs/innokom.h index 709c0d7..77439e6 100644 --- a/include/configs/innokom.h +++ b/include/configs/innokom.h @@ -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 */ diff --git a/include/configs/ixdp425.h b/include/configs/ixdp425.h index 1862b06..3f2026e 100644 --- a/include/configs/ixdp425.h +++ b/include/configs/ixdp425.h @@ -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 diff --git a/include/configs/trab.h b/include/configs/trab.h index e9ba90f..5e0b14f 100644 --- a/include/configs/trab.h +++ b/include/configs/trab.h @@ -399,7 +399,7 @@ #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 diff --git a/include/flash.h b/include/flash.h index a0c9cad..8f20887 100644 --- a/include/flash.h +++ b/include/flash.h @@ -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 */ diff --git a/lib_arm/board.c b/lib_arm/board.c index 08679d3..314126a 100644 --- a/lib_arm/board.c +++ b/lib_arm/board.c @@ -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 */ -- 2.7.4