Commit f6e20fc6ca5a45316f94743d8b60dce4d9766bc8

Authored by wdenk
1 parent f4863a7aec

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.

Showing 53 changed files with 321 additions and 369 deletions Side-by-side Diff

... ... @@ -2,6 +2,16 @@
2 2 Changes since U-Boot 1.0.1:
3 3 ======================================================================
4 4  
  5 +* Patch by Anders Larsen, 09 Jan 2004:
  6 +
  7 + ARM memory layout fixes: the abort-stack is now set up in the
  8 + correct RAM area, and the BSS is zeroed out as it should be.
  9 +
  10 + Furthermore, the magic variables 'armboot_end' and 'armboot_end_data'
  11 + of the linker scripts are replaced by '__bss_start' and '_end',
  12 + resp., which is a further step to eliminate unnecessary differences
  13 + between the implementation of the CPU architectures.
  14 +
5 15 * Patch by liang a lei, 9 Jan 2004:
6 16 Fix Intel 28F128J3 ID in include/flash.h
7 17  
board/at91rm9200dk/u-boot.lds
... ... @@ -45,15 +45,13 @@
45 45 . = ALIGN(4);
46 46 .got : { *(.got) }
47 47  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
  48 + __u_boot_cmd_start = .;
  49 + .u_boot_cmd : { *(.u_boot_cmd) }
  50 + __u_boot_cmd_end = .;
51 51  
52   - armboot_end_data = .;
53   -
54 52 . = ALIGN(4);
  53 + __bss_start = .;
55 54 .bss : { *(.bss) }
56   -
57   - armboot_end = .;
  55 + _end = .;
58 56 }
board/cradle/u-boot.lds
... ... @@ -44,18 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
59   -
  54 + _end = .;
60 55 }
board/csb226/u-boot.lds
... ... @@ -44,17 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
board/dnp1110/u-boot.lds
... ... @@ -44,17 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
47 50  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
51   -
52   -
53   - armboot_end_data = .;
54   -
55 51 . = ALIGN(4);
  52 + __bss_start = .;
56 53 .bss : { *(.bss) }
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
board/ep7312/u-boot.lds
... ... @@ -44,15 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
  52 + __bss_start = .;
54 53 .bss : { *(.bss) }
55   -
56   - armboot_end = .;
  54 + _end = .;
57 55 }
board/impa7/u-boot.lds
... ... @@ -44,16 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
  52 + __bss_start = .;
54 53 .bss : { *(.bss) }
55   -
56   - armboot_end = .;
57   -
  54 + _end = .;
58 55 }
board/innokom/u-boot.lds
... ... @@ -44,17 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
board/ixdp425/config.mk
1 1 #TEXT_BASE = 0x00100000
2   -TEXT_BASE = 0x00f00000
  2 +TEXT_BASE = 0x00f80000
board/ixdp425/flash.c
... ... @@ -72,7 +72,7 @@
72 72 flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
73 73 break;
74 74 default:
75   - panic ("configured to many flash banks!\n");
  75 + panic ("configured too many flash banks!\n");
76 76 break;
77 77 }
78 78 size += flash_info[i].size;
... ... @@ -82,7 +82,7 @@
82 82 */
83 83 flash_protect (FLAG_PROTECT_SET,
84 84 CFG_FLASH_BASE,
85   - CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
  85 + CFG_FLASH_BASE + _bss_start - _armboot_start,
86 86 &flash_info[0]);
87 87  
88 88 flash_protect (FLAG_PROTECT_SET,
board/ixdp425/u-boot.lds
... ... @@ -48,13 +48,9 @@
48 48 .u_boot_cmd : { *(.u_boot_cmd) }
49 49 __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
board/lart/u-boot.lds
... ... @@ -44,15 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
  52 + __bss_start = .;
54 53 .bss : { *(.bss) }
55   -
56   - armboot_end = .;
  54 + _end = .;
57 55 }
board/logodl/flash.c
... ... @@ -105,7 +105,7 @@
105 105 */
106 106 flash_protect(FLAG_PROTECT_SET,
107 107 CFG_FLASH_BASE,
108   - CFG_FLASH_BASE + _armboot_end_data - _armboot_start,
  108 + CFG_FLASH_BASE + _bss_start - _armboot_start,
109 109 &flash_info[0]);
110 110  
111 111 flash_protect(FLAG_PROTECT_SET,
board/logodl/u-boot.lds
... ... @@ -44,13 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - armboot_end_data = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
48 50  
49 51 . = ALIGN(4);
50   - bss_start = .;
  52 + __bss_start = .;
51 53 .bss : { *(.bss) }
52   - bss_end = .;
53   -
54   - armboot_end = .;
  54 + _end = .;
55 55 }
board/lubbock/config.mk
1 1 #TEXT_BASE = 0xa1700000
2   -TEXT_BASE = 0xa3000000
  2 +TEXT_BASE = 0xa3080000
3 3 #TEXT_BASE = 0
board/lubbock/u-boot.lds
... ... @@ -44,17 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
board/mpl/vcma9/config.mk
... ... @@ -14,12 +14,12 @@
14 14 # Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
15 15 # optionally with a ramdisk at 3040'0000
16 16 #
17   -# we load ourself to 30F8'0000
  17 +# we load ourself to 33F8'0000
18 18 #
19 19 # download area is 3080'0000
20 20 #
21 21  
22 22  
23 23 #TEXT_BASE = 0x30F80000
24   -TEXT_BASE = 0x33F00000
  24 +TEXT_BASE = 0x33F80000
board/mpl/vcma9/u-boot.lds
... ... @@ -45,15 +45,13 @@
45 45 . = ALIGN(4);
46 46 .got : { *(.got) }
47 47  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
  48 + __u_boot_cmd_start = .;
  49 + .u_boot_cmd : { *(.u_boot_cmd) }
  50 + __u_boot_cmd_end = .;
51 51  
52   - armboot_end_data = .;
53   -
54 52 . = ALIGN(4);
  53 + __bss_start = .;
55 54 .bss : { *(.bss) }
56   -
57   - armboot_end = .;
  55 + _end = .;
58 56 }
board/omap1510inn/config.mk
... ... @@ -17,10 +17,10 @@
17 17 #
18 18 # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000 (mem base + reserved)
19 19 #
20   -# we load ourself to 1100'0000
  20 +# we load ourself to 1108'0000
21 21 #
22 22 #
23 23  
24 24  
25   -TEXT_BASE = 0x11000000
  25 +TEXT_BASE = 0x11080000
board/omap1510inn/u-boot.lds
... ... @@ -45,15 +45,13 @@
45 45 . = ALIGN(4);
46 46 .got : { *(.got) }
47 47  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
  48 + __u_boot_cmd_start = .;
  49 + .u_boot_cmd : { *(.u_boot_cmd) }
  50 + __u_boot_cmd_end = .;
51 51  
52   - armboot_end_data = .;
53   -
54 52 . = ALIGN(4);
  53 + __bss_start = .;
55 54 .bss : { *(.bss) }
56   -
57   - armboot_end = .;
  55 + _end = .;
58 56 }
board/omap1610inn/config.mk
... ... @@ -18,10 +18,10 @@
18 18 # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
19 19 # (mem base + reserved)
20 20 #
21   -# we load ourself to 1100'0000
  21 +# we load ourself to 1108'0000
22 22 #
23 23 #
24 24  
25 25  
26   -TEXT_BASE = 0x11000000
  26 +TEXT_BASE = 0x11080000
board/omap1610inn/u-boot.lds
... ... @@ -44,9 +44,9 @@
44 44 .u_boot_cmd : { *(.u_boot_cmd) }
45 45 __u_boot_cmd_end = .;
46 46  
47   - armboot_end_data = .;
48 47 . = ALIGN(4);
  48 + __bss_start = .;
49 49 .bss : { *(.bss) }
50   - armboot_end = .;
  50 + _end = .;
51 51 }
board/shannon/u-boot.lds
... ... @@ -44,16 +44,13 @@
44 44 . = ALIGN(4);
45 45 .got : { *(.got) }
46 46  
47   - __u_boot_cmd_start = .;
48   - .u_boot_cmd : { *(.u_boot_cmd) }
49   - __u_boot_cmd_end = .;
  47 + __u_boot_cmd_start = .;
  48 + .u_boot_cmd : { *(.u_boot_cmd) }
  49 + __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
  52 + __bss_start = .;
54 53 .bss : { *(.bss) }
55   -
56   - armboot_end = .;
57   -
  54 + _end = .;
58 55 }
board/smdk2400/config.mk
... ... @@ -15,12 +15,12 @@
15 15 # Linux-Kernel is expected to be at 0cf0'0000, entry 0cf0'0000
16 16 # optionally with a ramdisk at 0c80'0000
17 17 #
18   -# we load ourself to 0CF00000 (must be high enough not to be
  18 +# we load ourself to 0CF80000 (must be high enough not to be
19 19 # overwritten by the uncompessing Linux kernel)
20 20 #
21 21 # download area is 0C80'0000
22 22 #
23 23  
24 24  
25   -TEXT_BASE = 0x0CF00000
  25 +TEXT_BASE = 0x0CF80000
board/smdk2400/u-boot.lds
... ... @@ -45,16 +45,13 @@
45 45 . = ALIGN(4);
46 46 .got : { *(.got) }
47 47  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
  48 + __u_boot_cmd_start = .;
  49 + .u_boot_cmd : { *(.u_boot_cmd) }
  50 + __u_boot_cmd_end = .;
51 51  
52   - armboot_end_data = .;
53   -
54 52 . = ALIGN(4);
  53 + __bss_start = .;
55 54 .bss : { *(.bss) }
56   -
57   - armboot_end = .;
58   -
  55 + _end = .;
59 56 }
board/smdk2410/u-boot.lds
... ... @@ -45,17 +45,13 @@
45 45 . = ALIGN(4);
46 46 .got : { *(.got) }
47 47  
48   - __u_boot_cmd_start = .;
49   - .u_boot_cmd : { *(.u_boot_cmd) }
50   - __u_boot_cmd_end = .;
  48 + __u_boot_cmd_start = .;
  49 + .u_boot_cmd : { *(.u_boot_cmd) }
  50 + __u_boot_cmd_end = .;
51 51  
52   -
53   - armboot_end_data = .;
54   -
55 52 . = ALIGN(4);
  53 + __bss_start = .;
56 54 .bss : { *(.bss) }
57   -
58   - armboot_end = .;
59   -
  55 + _end = .;
60 56 }
board/trab/u-boot.lds
... ... @@ -39,7 +39,7 @@
39 39 lib_generic/string.o (.text)
40 40  
41 41 . = DEFINED(env_offset) ? env_offset : .;
42   - common/environment.o (.ppcenv)
  42 + common/environment.o (.ppcenv)
43 43  
44 44 *(.text)
45 45 }
46 46  
47 47  
48 48  
... ... @@ -53,16 +53,13 @@
53 53 . = ALIGN(4);
54 54 .got : { *(.got) }
55 55  
56   - __u_boot_cmd_start = .;
57   - .u_boot_cmd : { *(.u_boot_cmd) }
58   - __u_boot_cmd_end = .;
  56 + __u_boot_cmd_start = .;
  57 + .u_boot_cmd : { *(.u_boot_cmd) }
  58 + __u_boot_cmd_end = .;
59 59  
60   - armboot_end_data = .;
61   -
62 60 . = ALIGN(4);
  61 + __bss_start = .;
63 62 .bss : { *(.bss) }
64   -
65   -
66   - armboot_end = .;
  63 + _end = .;
67 64 }
board/wepep250/u-boot.lds
... ... @@ -48,13 +48,9 @@
48 48 .u_boot_cmd : { *(.u_boot_cmd) }
49 49 __u_boot_cmd_end = .;
50 50  
51   - armboot_end_data = .;
52   -
53 51 . = ALIGN(4);
54   - bss_start = .;
  52 + __bss_start = .;
55 53 .bss : { *(.bss) }
56   - bss_end = .;
57   -
58   - armboot_end = .;
  54 + _end = .;
59 55 }
... ... @@ -193,7 +193,7 @@
193 193  
194 194 #ifdef CONFIG_SILENT_CONSOLE
195 195 if (gd->flags & GD_FLG_SILENT)
196   - return(0);
  196 + return;
197 197 #endif
198 198  
199 199 if (gd->flags & GD_FLG_DEVINIT) {
... ... @@ -87,7 +87,7 @@
87 87 #ifdef CONFIG_USE_IRQ
88 88 DECLARE_GLOBAL_DATA_PTR;
89 89  
90   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  90 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
91 91 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
92 92 #endif
93 93 return 0;
... ... @@ -63,7 +63,7 @@
63 63 *
64 64 * Startup Code (reset vector)
65 65 *
66   - * do important init only if we don't start from memory!
  66 + * do important init only if we don't start from RAM!
67 67 * relocate armboot to ram
68 68 * setup stack
69 69 * jump to second stage
70 70  
71 71  
... ... @@ -79,17 +79,16 @@
79 79 .word _start
80 80  
81 81 /*
82   - * Note: _armboot_end_data and _armboot_end are defined
83   - * by the (board-dependent) linker script.
84   - * _armboot_end_data is the first usable FLASH address after armboot
  82 + * These are defined in the board-specific linker script.
85 83 */
86   -.globl _armboot_end_data
87   -_armboot_end_data:
88   - .word armboot_end_data
89   -.globl _armboot_end
90   -_armboot_end:
91   - .word armboot_end
  84 +.globl _bss_start
  85 +_bss_start:
  86 + .word __bss_start
92 87  
  88 +.globl _bss_end
  89 +_bss_end:
  90 + .word _end
  91 +
93 92 #ifdef CONFIG_USE_IRQ
94 93 /* IRQ stack memory (calculated at run-time) */
95 94 .globl IRQ_STACK_START
... ... @@ -131,7 +130,7 @@
131 130 beq stack_setup
132 131  
133 132 ldr r2, _armboot_start
134   - ldr r3, _armboot_end
  133 + ldr r3, _bss_start
135 134 sub r2, r3, r2 /* r2 <- size of armboot */
136 135 add r2, r0, r2 /* r2 <- source end address */
137 136  
... ... @@ -151,6 +150,17 @@
151 150 #endif
152 151 sub sp, r0, #12 /* leave 3 words for abort-stack */
153 152  
  153 +clear_bss:
  154 + ldr r0, _bss_start /* find start of bss segment */
  155 + add r0, r0, #4 /* start at first byte of bss */
  156 + ldr r1, _bss_end /* stop here */
  157 + mov r2, #0x00000000 /* clear */
  158 +
  159 +clbss_l:str r2, [r0] /* clear loop... */
  160 + add r0, r0, #4
  161 + cmp r0, r1
  162 + bne clbss_l
  163 +
154 164 ldr pc, _start_armboot
155 165  
156 166 _start_armboot: .word start_armboot
... ... @@ -225,7 +235,7 @@
225 235  
226 236 /*
227 237 * before relocating, we have to setup RAM timing
228   - * because memory timing is board-dependend, you will
  238 + * because memory timing is board-dependent, you will
229 239 * find a memsetup.S in your board directory.
230 240 */
231 241 mov ip, lr
... ... @@ -281,9 +291,9 @@
281 291 stmia sp, {r0 - r12} @ Calling r0-r12
282 292 add r8, sp, #S_PC
283 293  
284   - ldr r2, _armboot_end
285   - add r2, r2, #CONFIG_STACKSIZE
286   - sub r2, r2, #8
  294 + ldr r2, _armboot_start
  295 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  296 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
287 297 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
288 298 add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
289 299  
... ... @@ -314,9 +324,9 @@
314 324 .endm
315 325  
316 326 .macro get_bad_stack
317   - ldr r13, _armboot_end @ setup our mode stack
318   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
319   - sub r13, r13, #8
  327 + ldr r13, _armboot_start @ setup our mode stack
  328 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  329 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
320 330  
321 331 str lr, [r13] @ save caller lr / spsr
322 332 mrs lr, spsr
... ... @@ -92,7 +92,7 @@
92 92 #ifdef CONFIG_USE_IRQ
93 93 DECLARE_GLOBAL_DATA_PTR;
94 94  
95   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  95 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
96 96 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
97 97 #endif
98 98 return 0;
... ... @@ -80,17 +80,16 @@
80 80 .word _start
81 81  
82 82 /*
83   - * Note: _armboot_end_data and _armboot_end are defined
84   - * by the (board-dependent) linker script.
85   - * _armboot_end_data is the first usable FLASH address after armboot
  83 + * These are defined in the board-specific linker script.
86 84 */
87   -.globl _armboot_end_data
88   -_armboot_end_data:
89   - .word armboot_end_data
90   -.globl _armboot_end
91   -_armboot_end:
92   - .word armboot_end
  85 +.globl _bss_start
  86 +_bss_start:
  87 + .word __bss_start
93 88  
  89 +.globl _bss_end
  90 +_bss_end:
  91 + .word _end
  92 +
94 93 #ifdef CONFIG_USE_IRQ
95 94 /* IRQ stack memory (calculated at run-time) */
96 95 .globl IRQ_STACK_START
... ... @@ -170,7 +169,7 @@
170 169 beq stack_setup
171 170  
172 171 ldr r2, _armboot_start
173   - ldr r3, _armboot_end
  172 + ldr r3, _bss_start
174 173 sub r2, r3, r2 /* r2 <- size of armboot */
175 174 add r2, r0, r2 /* r2 <- source end address */
176 175  
... ... @@ -190,6 +189,17 @@
190 189 #endif
191 190 sub sp, r0, #12 /* leave 3 words for abort-stack */
192 191  
  192 +clear_bss:
  193 + ldr r0, _bss_start /* find start of bss segment */
  194 + add r0, r0, #4 /* start at first byte of bss */
  195 + ldr r1, _bss_end /* stop here */
  196 + mov r2, #0x00000000 /* clear */
  197 +
  198 +clbss_l:str r2, [r0] /* clear loop... */
  199 + add r0, r0, #4
  200 + cmp r0, r1
  201 + bne clbss_l
  202 +
193 203 #if 0
194 204 /* try doing this stuff after the relocation */
195 205 ldr r0, =pWTCON
... ... @@ -303,9 +313,9 @@
303 313 .macro bad_save_user_regs
304 314 sub sp, sp, #S_FRAME_SIZE
305 315 stmia sp, {r0 - r12} @ Calling r0-r12
306   - ldr r2, _armboot_end
307   - add r2, r2, #CONFIG_STACKSIZE
308   - sub r2, r2, #8
  316 + ldr r2, _armboot_start
  317 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  318 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
309 319 ldmia r2, {r2 - r3} @ get pc, cpsr
310 320 add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
311 321  
... ... @@ -336,9 +346,9 @@
336 346 .endm
337 347  
338 348 .macro get_bad_stack
339   - ldr r13, _armboot_end @ setup our mode stack
340   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
341   - sub r13, r13, #8
  349 + ldr r13, _armboot_start @ setup our mode stack
  350 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  351 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
342 352  
343 353 str lr, [r13] @ save caller lr / spsr
344 354 mrs lr, spsr
... ... @@ -93,7 +93,7 @@
93 93 #ifdef CONFIG_USE_IRQ
94 94 DECLARE_GLOBAL_DATA_PTR;
95 95  
96   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  96 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
97 97 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
98 98 #endif
99 99 return 0;
... ... @@ -89,17 +89,16 @@
89 89 .word _start
90 90  
91 91 /*
92   - * Note: _armboot_end_data and _armboot_end are defined
93   - * by the (board-dependent) linker script.
94   - * _armboot_end_data is the first usable FLASH address after armboot
  92 + * These are defined in the board-specific linker script.
95 93 */
96   -.globl _armboot_end_data
97   -_armboot_end_data:
98   - .word armboot_end_data
99   -.globl _armboot_end
100   -_armboot_end:
101   - .word armboot_end
  94 +.globl _bss_start
  95 +_bss_start:
  96 + .word __bss_start
102 97  
  98 +.globl _bss_end
  99 +_bss_end:
  100 + .word _end
  101 +
103 102 #ifdef CONFIG_USE_IRQ
104 103 /* IRQ stack memory (calculated at run-time) */
105 104 .globl IRQ_STACK_START
... ... @@ -176,7 +175,7 @@
176 175 beq stack_setup
177 176  
178 177 ldr r2, _armboot_start
179   - ldr r3, _armboot_end
  178 + ldr r3, _bss_start
180 179 sub r2, r3, r2 /* r2 <- size of armboot */
181 180 add r2, r0, r2 /* r2 <- source end address */
182 181  
... ... @@ -196,6 +195,17 @@
196 195 #endif
197 196 sub sp, r0, #12 /* leave 3 words for abort-stack */
198 197  
  198 +clear_bss:
  199 + ldr r0, _bss_start /* find start of bss segment */
  200 + add r0, r0, #4 /* start at first byte of bss */
  201 + ldr r1, _bss_end /* stop here */
  202 + mov r2, #0x00000000 /* clear */
  203 +
  204 +clbss_l:str r2, [r0] /* clear loop... */
  205 + add r0, r0, #4
  206 + cmp r0, r1
  207 + bne clbss_l
  208 +
199 209 ldr pc, _start_armboot
200 210  
201 211 _start_armboot: .word start_armboot
... ... @@ -283,9 +293,9 @@
283 293 sub sp, sp, #S_FRAME_SIZE @ carve out a frame on current user stack
284 294 stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
285 295  
286   - ldr r2, _armboot_end @ find top of stack
287   - add r2, r2, #CONFIG_STACKSIZE @ find base of normal stack
288   - sub r2, r2, #8 @ set base 2 words into abort stack
  296 + ldr r2, _armboot_start
  297 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  298 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
289 299 ldmia r2, {r2 - r3} @ get values for "aborted" pc and cpsr (into parm regs)
290 300 add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
291 301  
... ... @@ -316,9 +326,9 @@
316 326 .endm
317 327  
318 328 .macro get_bad_stack
319   - ldr r13, _armboot_end @ get bottom of stack (into sp by by user stack pointer).
320   - add r13, r13, #CONFIG_STACKSIZE @ head to reserved words at the top of the stack
321   - sub r13, r13, #8 @ reserved a couple spots in abort stack
  329 + ldr r13, _armboot_start @ setup our mode stack
  330 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  331 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
322 332  
323 333 str lr, [r13] @ save caller lr in position 0 of saved stack
324 334 mrs lr, spsr @ get the spsr
... ... @@ -93,7 +93,7 @@
93 93 #ifdef CONFIG_USE_IRQ
94 94 DECLARE_GLOBAL_DATA_PTR;
95 95  
96   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  96 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
97 97 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
98 98 #endif
99 99 return 0;
cpu/arm926ejs/start.S
... ... @@ -97,17 +97,16 @@
97 97 .word _start
98 98  
99 99 /*
100   - * Note: _armboot_end_data and _armboot_end are defined
101   - * by the (board-dependent) linker script.
102   - * _armboot_end_data is the first usable FLASH address after armboot
  100 + * These are defined in the board-specific linker script.
103 101 */
104   -.globl _armboot_end_data
105   -_armboot_end_data:
106   - .word armboot_end_data
107   -.globl _armboot_end
108   -_armboot_end:
109   - .word armboot_end
  102 +.globl _bss_start
  103 +_bss_start:
  104 + .word __bss_start
110 105  
  106 +.globl _bss_end
  107 +_bss_end:
  108 + .word _end
  109 +
111 110 #ifdef CONFIG_USE_IRQ
112 111 /* IRQ stack memory (calculated at run-time) */
113 112 .globl IRQ_STACK_START
... ... @@ -170,7 +169,7 @@
170 169 beq stack_setup
171 170  
172 171 ldr r2, _armboot_start
173   - ldr r3, _armboot_end
  172 + ldr r3, _bss_start
174 173 sub r2, r3, r2 /* r2 <- size of armboot */
175 174 add r2, r0, r2 /* r2 <- source end address */
176 175  
... ... @@ -190,6 +189,17 @@
190 189 #endif
191 190 sub sp, r0, #12 /* leave 3 words for abort-stack */
192 191  
  192 +clear_bss:
  193 + ldr r0, _bss_start /* find start of bss segment */
  194 + add r0, r0, #4 /* start at first byte of bss */
  195 + ldr r1, _bss_end /* stop here */
  196 + mov r2, #0x00000000 /* clear */
  197 +
  198 +clbss_l:str r2, [r0] /* clear loop... */
  199 + add r0, r0, #4
  200 + cmp r0, r1
  201 + bne clbss_l
  202 +
193 203 ldr pc, _start_armboot
194 204  
195 205 _start_armboot:
... ... @@ -278,9 +288,10 @@
278 288 @ carve out a frame on current user stack
279 289 sub sp, sp, #S_FRAME_SIZE
280 290 stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
281   - ldr r2, _armboot_end @ find top of stack
282   - add r2, r2, #CONFIG_STACKSIZE @ find base of normal stack
283   - sub r2, r2, #8 @ set base 2 words into abort stack
  291 +
  292 + ldr r2, _armboot_start
  293 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  294 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
284 295 @ get values for "aborted" pc and cpsr (into parm regs)
285 296 ldmia r2, {r2 - r3}
286 297 add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
... ... @@ -312,11 +323,9 @@
312 323 .endm
313 324  
314 325 .macro get_bad_stack
315   - @ get bottom of stack (into sp by by user stack pointer).
316   - ldr r13, _armboot_end
317   - @ head to reserved words at the top of the stack
318   - add r13, r13, #CONFIG_STACKSIZE
319   - sub r13, r13, #8 @ reserved a couple spots in abort stack
  326 + ldr r13, _armboot_start @ setup our mode stack
  327 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  328 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
320 329  
321 330 str lr, [r13] @ save caller lr in position 0 of saved stack
322 331 mrs lr, spsr @ get the spsr
cpu/at91rm9200/cpu.c
... ... @@ -87,7 +87,7 @@
87 87 #ifdef CONFIG_USE_IRQ
88 88 DECLARE_GLOBAL_DATA_PTR;
89 89  
90   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  90 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
91 91 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
92 92 #endif
93 93 return 0;
cpu/at91rm9200/start.S
... ... @@ -79,20 +79,16 @@
79 79 .word _start
80 80  
81 81 /*
82   - * Note: _armboot_end_data and _armboot_end are defined
83   - * by the (board-dependent) linker script.
84   - * _armboot_end_data is the first usable FLASH address after armboot
  82 + * These are defined in the board-specific linker script.
85 83 */
86   -.globl _armboot_end_data
87   -_armboot_end_data:
88   - .word armboot_end_data
89   -/*
90   - * Note: armboot_end is defined by the (board-dependent) linker script
91   - */
92   -.globl _armboot_end
93   -_armboot_end:
94   - .word armboot_end
  84 +.globl _bss_start
  85 +_bss_start:
  86 + .word __bss_start
95 87  
  88 +.globl _bss_end
  89 +_bss_end:
  90 + .word _end
  91 +
96 92 #ifdef CONFIG_USE_IRQ
97 93 /* IRQ stack memory (calculated at run-time) */
98 94 .globl IRQ_STACK_START
... ... @@ -149,6 +145,17 @@
149 145 #endif
150 146 sub sp, r0, #12 /* leave 3 words for abort-stack */
151 147  
  148 +clear_bss:
  149 + ldr r0, _bss_start /* find start of bss segment */
  150 + add r0, r0, #4 /* start at first byte of bss */
  151 + ldr r1, _bss_end /* stop here */
  152 + mov r2, #0x00000000 /* clear */
  153 +
  154 +clbss_l:str r2, [r0] /* clear loop... */
  155 + add r0, r0, #4
  156 + cmp r0, r1
  157 + bne clbss_l
  158 +
152 159 ldr pc,_start_armboot
153 160  
154 161 _start_armboot: .word start_armboot
... ... @@ -212,9 +219,9 @@
212 219 stmia sp, {r0 - r12} @ Calling r0-r12
213 220 add r8, sp, #S_PC
214 221  
215   - ldr r2, _armboot_end
216   - add r2, r2, #CONFIG_STACKSIZE
217   - sub r2, r2, #8
  222 + ldr r2, _armboot_start
  223 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  224 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
218 225 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
219 226 add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
220 227  
... ... @@ -245,9 +252,9 @@
245 252 .endm
246 253  
247 254 .macro get_bad_stack
248   - ldr r13, _armboot_end @ setup our mode stack
249   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
250   - sub r13, r13, #8
  255 + ldr r13, _armboot_start @ setup our mode stack
  256 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  257 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
251 258  
252 259 str lr, [r13] @ save caller lr / spsr
253 260 mrs lr, spsr
... ... @@ -37,22 +37,16 @@
37 37 int cpu_init (void)
38 38 {
39 39 /*
40   - * setup up stack if necessary
  40 + * setup up stacks if necessary
41 41 */
42   -/*
43   -
44   - FIXME: the stack is _below_ the uboot code!!
45   -
46 42 #ifdef CONFIG_USE_IRQ
47   - IRQ_STACK_START = _armboot_end +
48   - CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
49   - FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ;
50   - _armboot_real_end = FIQ_STACK_START + 4;
51   -#else
52   - _armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
  43 + DECLARE_GLOBAL_DATA_PTR;
  44 +
  45 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
  46 + FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
53 47 #endif
54   -*/
55   - pci_init();
  48 +
  49 + pci_init();
56 50 return 0;
57 51 }
58 52  
... ... @@ -84,7 +78,7 @@
84 78 {
85 79 extern void reset_cpu (ulong addr);
86 80  
87   - printf ("reseting ...\n");
  81 + printf ("resetting ...\n");
88 82  
89 83 udelay (50000); /* wait 50 ms */
90 84 disable_interrupts ();
... ... @@ -101,43 +101,16 @@
101 101 .word _start
102 102  
103 103 /*
104   - * Note: _armboot_end_data and _armboot_end are defined
105   - * by the (board-dependent) linker script.
106   - * _armboot_end_data is the first usable FLASH address after armboot
  104 + * These are defined in the board-specific linker script.
107 105 */
108   -.globl _armboot_end_data
109   -_armboot_end_data:
110   - .word armboot_end_data
111   -.globl _armboot_end
112   -_armboot_end:
113   - .word armboot_end
114   -
115   -/*
116   - * This is defined in the board specific linker script
117   - */
118 106 .globl _bss_start
119 107 _bss_start:
120   - .word bss_start
  108 + .word __bss_start
121 109  
122 110 .globl _bss_end
123 111 _bss_end:
124   - .word bss_end
  112 + .word _end
125 113  
126   -/*
127   - * _armboot_real_end is the first usable RAM address behind armboot
128   - * and the various stacks
129   - */
130   -.globl _armboot_real_end
131   -_armboot_real_end:
132   - .word 0x0badc0de
133   -
134   -/*
135   - * We relocate uboot to this address (end of RAM - 128 KiB)
136   - */
137   -.globl _uboot_reloc
138   -_uboot_reloc:
139   - .word TEXT_BASE
140   -
141 114 #ifdef CONFIG_USE_IRQ
142 115 /* IRQ stack memory (calculated at run-time) */
143 116 .globl IRQ_STACK_START
... ... @@ -294,7 +267,7 @@
294 267 beq stack_setup
295 268  
296 269 ldr r2, _armboot_start
297   - ldr r3, _armboot_end
  270 + ldr r3, _bss_start
298 271 sub r2, r3, r2 /* r2 <- size of armboot */
299 272 add r2, r0, r2 /* r2 <- source end address */
300 273  
301 274  
302 275  
... ... @@ -305,16 +278,16 @@
305 278 ble copy_loop
306 279  
307 280 /* Set up the stack */
308   -
309 281 stack_setup:
310   -
311   - ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */
312   - sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
313   - /* FIXME: bdinfo should be here */
  282 + ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
  283 + sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
  284 + sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
  285 +#ifdef CONFIG_USE_IRQ
  286 + sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
  287 +#endif
314 288 sub sp, r0, #12 /* leave 3 words for abort-stack */
315 289  
316 290 clear_bss:
317   -
318 291 ldr r0, _bss_start /* find start of bss segment */
319 292 add r0, r0, #4 /* start at first byte of bss */
320 293 ldr r1, _bss_end /* stop here */
... ... @@ -325,7 +298,6 @@
325 298 cmp r0, r1
326 299 bne clbss_l
327 300  
328   -
329 301 ldr pc, _start_armboot
330 302  
331 303 _start_armboot: .word start_armboot
... ... @@ -370,9 +342,9 @@
370 342 stmia sp, {r0 - r12} /* Calling r0-r12 */
371 343 add r8, sp, #S_PC
372 344  
373   - ldr r2, _armboot_end
374   - add r2, r2, #CONFIG_STACKSIZE
375   - sub r2, r2, #8
  345 + ldr r2, _armboot_start
  346 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  347 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
376 348 ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
377 349 add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
378 350  
... ... @@ -407,9 +379,9 @@
407 379 .endm
408 380  
409 381 .macro get_bad_stack
410   - ldr r13, _armboot_end @ setup our mode stack
411   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
412   - sub r13, r13, #8
  382 + ldr r13, _armboot_start @ setup our mode stack
  383 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  384 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
413 385  
414 386 str lr, [r13] @ save caller lr / spsr
415 387 mrs lr, spsr
... ... @@ -42,7 +42,7 @@
42 42 #ifdef CONFIG_USE_IRQ
43 43 DECLARE_GLOBAL_DATA_PTR;
44 44  
45   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  45 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
46 46 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
47 47 #endif
48 48 return 0;
... ... @@ -69,27 +69,15 @@
69 69 .word _start
70 70  
71 71 /*
72   - * Note: _armboot_end_data and _armboot_end are defined
73   - * by the (board-dependent) linker script.
74   - * _armboot_end_data is the first usable FLASH address after armboot
  72 + * These are defined in the board-specific linker script.
75 73 */
76   -.globl _armboot_end_data
77   -_armboot_end_data:
78   - .word armboot_end_data
79   -.globl _armboot_end
80   -_armboot_end:
81   - .word armboot_end
82   -
83   -/*
84   - * This is defined in the board specific linker script
85   - */
86 74 .globl _bss_start
87 75 _bss_start:
88   - .word bss_start
  76 + .word __bss_start
89 77  
90 78 .globl _bss_end
91 79 _bss_end:
92   - .word bss_end
  80 + .word _end
93 81  
94 82 #ifdef CONFIG_USE_IRQ
95 83 /* IRQ stack memory (calculated at run-time) */
... ... @@ -131,7 +119,7 @@
131 119 beq stack_setup
132 120  
133 121 ldr r2, _armboot_start
134   - ldr r3, _armboot_end
  122 + ldr r3, _bss_start
135 123 sub r2, r3, r2 /* r2 <- size of armboot */
136 124 add r2, r0, r2 /* r2 <- source end address */
137 125  
... ... @@ -152,7 +140,6 @@
152 140 sub sp, r0, #12 /* leave 3 words for abort-stack */
153 141  
154 142 clear_bss:
155   -
156 143 ldr r0, _bss_start /* find start of bss segment */
157 144 add r0, r0, #4 /* start at first byte of bss */
158 145 ldr r1, _bss_end /* stop here */
... ... @@ -163,7 +150,6 @@
163 150 cmp r0, r1
164 151 bne clbss_l
165 152  
166   -
167 153 ldr pc, _start_armboot
168 154  
169 155 _start_armboot: .word start_armboot
... ... @@ -303,9 +289,9 @@
303 289 stmia sp, {r0 - r12} /* Calling r0-r12 */
304 290 add r8, sp, #S_PC
305 291  
306   - ldr r2, _armboot_end
307   - add r2, r2, #CONFIG_STACKSIZE
308   - sub r2, r2, #8
  292 + ldr r2, _armboot_start
  293 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  294 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
309 295 ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
310 296 add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
311 297  
... ... @@ -340,9 +326,9 @@
340 326 .endm
341 327  
342 328 .macro get_bad_stack
343   - ldr r13, _armboot_end @ setup our mode stack
344   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
345   - sub r13, r13, #8
  329 + ldr r13, _armboot_start @ setup our mode stack
  330 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  331 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
346 332  
347 333 str lr, [r13] @ save caller lr / spsr
348 334 mrs lr, spsr
... ... @@ -41,7 +41,7 @@
41 41 #ifdef CONFIG_USE_IRQ
42 42 DECLARE_GLOBAL_DATA_PTR;
43 43  
44   - IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_LEN - 4;
  44 + IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
45 45 FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
46 46 #endif
47 47 return 0;
... ... @@ -81,17 +81,16 @@
81 81 .word _start
82 82  
83 83 /*
84   - * Note: _armboot_end_data and _armboot_end are defined
85   - * by the (board-dependent) linker script.
86   - * _armboot_end_data is the first usable FLASH address after armboot
  84 + * These are defined in the board-specific linker script.
87 85 */
88   -.globl _armboot_end_data
89   -_armboot_end_data:
90   - .word armboot_end_data
91   -.globl _armboot_end
92   -_armboot_end:
93   - .word armboot_end
  86 +.globl _bss_start
  87 +_bss_start:
  88 + .word __bss_start
94 89  
  90 +.globl _bss_end
  91 +_bss_end:
  92 + .word _end
  93 +
95 94 #ifdef CONFIG_USE_IRQ
96 95 /* IRQ stack memory (calculated at run-time) */
97 96 .globl IRQ_STACK_START
... ... @@ -133,7 +132,7 @@
133 132 beq stack_setup
134 133  
135 134 ldr r2, _armboot_start
136   - ldr r3, _armboot_end
  135 + ldr r3, _bss_start
137 136 sub r2, r3, r2 /* r2 <- size of armboot */
138 137 add r2, r0, r2 /* r2 <- source end address */
139 138  
... ... @@ -153,6 +152,17 @@
153 152 #endif
154 153 sub sp, r0, #12 /* leave 3 words for abort-stack */
155 154  
  155 +clear_bss:
  156 + ldr r0, _bss_start /* find start of bss segment */
  157 + add r0, r0, #4 /* start at first byte of bss */
  158 + ldr r1, _bss_end /* stop here */
  159 + mov r2, #0x00000000 /* clear */
  160 +
  161 +clbss_l:str r2, [r0] /* clear loop... */
  162 + add r0, r0, #4
  163 + cmp r0, r1
  164 + bne clbss_l
  165 +
156 166 ldr pc, _start_armboot
157 167  
158 168 _start_armboot: .word start_armboot
... ... @@ -276,9 +286,9 @@
276 286 stmia sp, {r0 - r12} @ Calling r0-r12
277 287 add r8, sp, #S_PC
278 288  
279   - ldr r2, _armboot_end
280   - add r2, r2, #CONFIG_STACKSIZE
281   - sub r2, r2, #8
  289 + ldr r2, _armboot_start
  290 + sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  291 + sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
282 292 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
283 293 add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
284 294  
... ... @@ -309,9 +319,9 @@
309 319 .endm
310 320  
311 321 .macro get_bad_stack
312   - ldr r13, _armboot_end @ setup our mode stack
313   - add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack
314   - sub r13, r13, #8
  322 + ldr r13, _armboot_start @ setup our mode stack
  323 + sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
  324 + sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
315 325  
316 326 str lr, [r13] @ save caller lr / spsr
317 327 mrs lr, spsr
doc/README.ARM-memory-map
... ... @@ -15,14 +15,4 @@
15 15 Furthermore, the startup code (cpu/<arm>/start.S) internally uses
16 16 another variable (_TEXT_BASE) with the same content as _armboot_start.
17 17 I agree that this mess should be cleaned up.
18   -
19   -_armboot_end_data is the end address of the initialized data section,
20   -and is only used in one place (board/logodl/flash.c - the reference in
21   -lib_arm/board.c is purely informational).
22   -
23   -_armboot_end is the end address of the BSS and is used to determine
24   -the address of the VFD buffer.
25   -
26   -Eliminating those should be doable, and at least the patch already
27   -eliminates _armboot_real_end.
include/asm-arm/u-boot-arm.h
... ... @@ -31,8 +31,8 @@
31 31  
32 32 /* for the following variables, see start.S */
33 33 extern ulong _armboot_start; /* code start */
34   -extern ulong _armboot_end_data; /* code + data end */
35   -extern ulong _armboot_end; /* BSS end */
  34 +extern ulong _bss_start; /* code + data end == BSS start */
  35 +extern ulong _bss_end; /* BSS end */
36 36 extern ulong IRQ_STACK_START; /* top of IRQ stack */
37 37 extern ulong FIQ_STACK_START; /* top of FIQ stack */
38 38  
... ... @@ -18,7 +18,7 @@
18 18 0x0343, 0x0454, 0x0565, 0x0565, 0x0676, 0x0787, 0x0898, 0x0999,
19 19 0x0AAA, 0x0ABA, 0x0BCB, 0x0CCC, 0x0DDD, 0x0EEE, 0x0FFF, 0x0FB3,
20 20 0x0FB4, 0x0FC4, 0x0FC5, 0x0FC6, 0x0FD7, 0x0FD8, 0x0FD9, 0x0FDA,
21   - 0x0FEA, 0x0FEB, 0x0FEC, 0x0FFD, 0x0FFE, 0x0FFF, 0x0FFF,
  21 + 0x0FEA, 0x0FEB, 0x0FEC, 0x0FFD, 0x0FFE, 0x0FFF, 0x0FFF,
22 22 };
23 23  
24 24 unsigned char bmp_logo_bitmap[] = {
include/configs/innokom.h
... ... @@ -82,9 +82,7 @@
82 82 */
83 83  
84 84 /*
85   - * Size of malloc() pool; this lives below the uppermost 128 KiB which are
86   - * used for the RAM copy of the uboot code
87   - *
  85 + * Size of malloc() pool
88 86 */
89 87 #define CFG_MALLOC_LEN (256*1024)
90 88 #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
include/configs/ixdp425.h
... ... @@ -49,6 +49,7 @@
49 49 * Size of malloc() pool
50 50 */
51 51 #define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024)
  52 +#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */
52 53  
53 54 /* allow to overwrite serial and ethaddr */
54 55 #define CONFIG_ENV_OVERWRITE
include/configs/trab.h
... ... @@ -399,7 +399,7 @@
399 399 #define CFG_ENV_SIZE 0x4000
400 400 #define CFG_ENV_SECT_SIZE 0x20000
401 401 #else
402   -#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x4000)
  402 +#define CFG_ENV_ADDR (CFG_FLASH_BASE + 0x8000)
403 403 #define CFG_ENV_SIZE 0x4000
404 404 #define CFG_ENV_SECT_SIZE 0x4000
405 405 #endif
... ... @@ -215,7 +215,7 @@
215 215 #define INTEL_ID_28F640C3T 0x88CC88CC /* 64M = 4M x 16 top boot sector */
216 216 #define INTEL_ID_28F640C3B 0x88CD88CD /* 64M = 4M x 16 bottom boot sector */
217 217  
218   -#define INTEL_ID_28F128J3 0x89189818 /* 16M = 8M x 16 x 128 */
  218 +#define INTEL_ID_28F128J3 0x89188918 /* 16M = 8M x 16 x 128 */
219 219 #define INTEL_ID_28F320J5 0x00140014 /* 32M = 128K x 32 */
220 220 #define INTEL_ID_28F640J5 0x00150015 /* 64M = 128K x 64 */
221 221 #define INTEL_ID_28F320J3A 0x00160016 /* 32M = 128K x 32 */
... ... @@ -117,7 +117,7 @@
117 117 {
118 118 printf ("\n\n%s\n\n", version_string);
119 119 printf ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n",
120   - _armboot_start, _armboot_end_data, _armboot_end);
  120 + _armboot_start, _bss_start, _bss_end);
121 121 #ifdef CONFIG_MODEM_SUPPORT
122 122 puts ("Modem Support enabled\n");
123 123 #endif
... ... @@ -173,7 +173,7 @@
173 173 * All attempts to come up with a "common" initialization sequence
174 174 * that works for all boards and architectures failed: some of the
175 175 * requirements are just _too_ different. To get rid of the resulting
176   - * mess of board dependend #ifdef'ed code we now make the whole
  176 + * mess of board dependent #ifdef'ed code we now make the whole
177 177 * initialization sequence configurable to the user.
178 178 *
179 179 * The requirements for any new initalization function is simple: it
... ... @@ -217,7 +217,7 @@
217 217 gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
218 218 memset (gd->bd, 0, sizeof (bd_t));
219 219  
220   - monitor_flash_len = _armboot_end_data - _armboot_start;
  220 + monitor_flash_len = _bss_start - _armboot_start;
221 221  
222 222 for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
223 223 if ((*init_fnc_ptr)() != 0) {
... ... @@ -237,7 +237,7 @@
237 237 * reserve memory for VFD display (always full pages)
238 238 */
239 239 /* armboot_end is defined in the board-specific linker script */
240   - addr = (_armboot_end + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
  240 + addr = (_bss_start + (PAGE_SIZE - 1)) & ~(PAGE_SIZE - 1);
241 241 size = vfd_setmem (addr);
242 242 gd->fb_base = addr;
243 243 #endif /* CONFIG_VFD */