Browse Source

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.
wdenk 20 years ago
parent
commit
f6e20fc6ca
53 changed files with 321 additions and 369 deletions
  1. 10 0
      CHANGELOG
  2. 5 7
      board/at91rm9200dk/u-boot.lds
  3. 5 10
      board/cradle/u-boot.lds
  4. 5 9
      board/csb226/u-boot.lds
  5. 5 9
      board/dnp1110/u-boot.lds
  6. 5 7
      board/ep7312/u-boot.lds
  7. 5 8
      board/impa7/u-boot.lds
  8. 5 9
      board/innokom/u-boot.lds
  9. 1 1
      board/ixdp425/config.mk
  10. 2 2
      board/ixdp425/flash.c
  11. 2 6
      board/ixdp425/u-boot.lds
  12. 5 7
      board/lart/u-boot.lds
  13. 1 1
      board/logodl/flash.c
  14. 5 5
      board/logodl/u-boot.lds
  15. 1 1
      board/lubbock/config.mk
  16. 5 9
      board/lubbock/u-boot.lds
  17. 2 2
      board/mpl/vcma9/config.mk
  18. 5 7
      board/mpl/vcma9/u-boot.lds
  19. 2 2
      board/omap1510inn/config.mk
  20. 5 7
      board/omap1510inn/u-boot.lds
  21. 2 2
      board/omap1610inn/config.mk
  22. 2 2
      board/omap1610inn/u-boot.lds
  23. 5 8
      board/shannon/u-boot.lds
  24. 2 2
      board/smdk2400/config.mk
  25. 5 8
      board/smdk2400/u-boot.lds
  26. 5 9
      board/smdk2410/u-boot.lds
  27. 6 9
      board/trab/u-boot.lds
  28. 2 6
      board/wepep250/u-boot.lds
  29. 1 1
      common/console.c
  30. 1 1
      cpu/arm720t/cpu.c
  31. 28 18
      cpu/arm720t/start.S
  32. 1 1
      cpu/arm920t/cpu.c
  33. 26 16
      cpu/arm920t/start.S
  34. 1 1
      cpu/arm925t/cpu.c
  35. 26 16
      cpu/arm925t/start.S
  36. 1 1
      cpu/arm926ejs/cpu.c
  37. 27 18
      cpu/arm926ejs/start.S
  38. 1 1
      cpu/at91rm9200/cpu.c
  39. 25 18
      cpu/at91rm9200/start.S
  40. 8 14
      cpu/ixp/cpu.c
  41. 16 44
      cpu/ixp/start.S
  42. 1 1
      cpu/pxa/cpu.c
  43. 10 24
      cpu/pxa/start.S
  44. 1 1
      cpu/sa1100/cpu.c
  45. 26 16
      cpu/sa1100/start.S
  46. 0 10
      doc/README.ARM-memory-map
  47. 2 2
      include/asm-arm/u-boot-arm.h
  48. 1 1
      include/bmp_logo.h
  49. 1 3
      include/configs/innokom.h
  50. 1 0
      include/configs/ixdp425.h
  51. 1 1
      include/configs/trab.h
  52. 1 1
      include/flash.h
  53. 4 4
      lib_arm/board.c

+ 10 - 0
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
 

+ 5 - 7
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 = .;
 }

+ 5 - 10
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 = .;
 }

+ 5 - 9
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 = .;
 }

+ 5 - 9
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 = .;
 }

+ 5 - 7
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 = .;
 }

+ 5 - 8
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 = .;
 }

+ 5 - 9
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 = .;
 }

+ 1 - 1
board/ixdp425/config.mk

@@ -1,2 +1,2 @@
 #TEXT_BASE = 0x00100000
-TEXT_BASE = 0x00f00000
+TEXT_BASE = 0x00f80000

+ 2 - 2
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,

+ 2 - 6
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 = .;
 }

+ 5 - 7
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 = .;
 }

+ 1 - 1
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,

+ 5 - 5
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 = .;
 }

+ 1 - 1
board/lubbock/config.mk

@@ -1,3 +1,3 @@
 #TEXT_BASE = 0xa1700000
-TEXT_BASE = 0xa3000000
+TEXT_BASE = 0xa3080000
 #TEXT_BASE = 0

+ 5 - 9
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 = .;
 }

+ 2 - 2
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

+ 5 - 7
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 = .;
 }

+ 2 - 2
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

+ 5 - 7
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 = .;
 }

+ 2 - 2
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

+ 2 - 2
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 = .;
 }

+ 5 - 8
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 = .;
 }

+ 2 - 2
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

+ 5 - 8
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 = .;
 }

+ 5 - 9
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 = .;
 }

+ 6 - 9
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 = .;
 }

+ 2 - 6
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 = .;
 }

+ 1 - 1
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) {

+ 1 - 1
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;

+ 28 - 18
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

+ 1 - 1
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;

+ 26 - 16
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

+ 1 - 1
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;

+ 26 - 16
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

+ 1 - 1
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;

+ 27 - 18
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

+ 1 - 1
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;

+ 25 - 18
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

+ 8 - 14
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 ();

+ 16 - 44
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

+ 1 - 1
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;

+ 10 - 24
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

+ 1 - 1
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;

+ 26 - 16
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

+ 0 - 10
doc/README.ARM-memory-map

@@ -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.

+ 2 - 2
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 */
 

+ 1 - 1
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[] = {

+ 1 - 3
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 */

+ 1 - 0
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

+ 1 - 1
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

+ 1 - 1
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	*/

+ 4 - 4
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 */