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.
This commit is contained in:
wdenk 2004-02-08 19:38:38 +00:00
parent f4863a7aec
commit f6e20fc6ca
53 changed files with 321 additions and 369 deletions

View File

@ -2,6 +2,16 @@
Changes since U-Boot 1.0.1: 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: * Patch by liang a lei, 9 Jan 2004:
Fix Intel 28F128J3 ID in include/flash.h Fix Intel 28F128J3 ID in include/flash.h

View File

@ -45,14 +45,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -44,17 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

@ -44,16 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

@ -44,16 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .;
__u_boot_cmd_start = .; .u_boot_cmd : { *(.u_boot_cmd) }
.u_boot_cmd : { *(.u_boot_cmd) } __u_boot_cmd_end = .;
__u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -44,14 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -44,15 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -44,16 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

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

View File

@ -72,7 +72,7 @@ unsigned long flash_init (void)
flash_get_offsets (PHYS_FLASH_1, &flash_info[i]); flash_get_offsets (PHYS_FLASH_1, &flash_info[i]);
break; break;
default: default:
panic ("configured to many flash banks!\n"); panic ("configured too many flash banks!\n");
break; break;
} }
size += flash_info[i].size; size += flash_info[i].size;
@ -82,7 +82,7 @@ unsigned long flash_init (void)
*/ */
flash_protect (FLAG_PROTECT_SET, flash_protect (FLAG_PROTECT_SET,
CFG_FLASH_BASE, CFG_FLASH_BASE,
CFG_FLASH_BASE + _armboot_end_data - _armboot_start, CFG_FLASH_BASE + _bss_start - _armboot_start,
&flash_info[0]); &flash_info[0]);
flash_protect (FLAG_PROTECT_SET, flash_protect (FLAG_PROTECT_SET,

View File

@ -48,12 +48,8 @@ SECTIONS
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

@ -44,14 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -105,7 +105,7 @@ ulong flash_init(void)
*/ */
flash_protect(FLAG_PROTECT_SET, flash_protect(FLAG_PROTECT_SET,
CFG_FLASH_BASE, CFG_FLASH_BASE,
CFG_FLASH_BASE + _armboot_end_data - _armboot_start, CFG_FLASH_BASE + _bss_start - _armboot_start,
&flash_info[0]); &flash_info[0]);
flash_protect(FLAG_PROTECT_SET, flash_protect(FLAG_PROTECT_SET,

View File

@ -44,12 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
armboot_end_data = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

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

View File

@ -44,16 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

@ -14,11 +14,11 @@
# Linux-Kernel is expected to be at 3000'8000, entry 3000'8000 # Linux-Kernel is expected to be at 3000'8000, entry 3000'8000
# optionally with a ramdisk at 3040'0000 # optionally with a ramdisk at 3040'0000
# #
# we load ourself to 30F8'0000 # we load ourself to 33F8'0000
# #
# download area is 3080'0000 # download area is 3080'0000
# #
#TEXT_BASE = 0x30F80000 #TEXT_BASE = 0x30F80000
TEXT_BASE = 0x33F00000 TEXT_BASE = 0x33F80000

View File

@ -45,14 +45,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -17,9 +17,9 @@
# #
# Linux-Kernel is expected to be at 1000'8000, entry 1000'8000 (mem base + reserved) # 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

View File

@ -45,14 +45,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -18,9 +18,9 @@
# Linux-Kernel is expected to be at 1000'8000, entry 1000'8000 # Linux-Kernel is expected to be at 1000'8000, entry 1000'8000
# (mem base + reserved) # (mem base + reserved)
# #
# we load ourself to 1100'0000 # we load ourself to 1108'0000
# #
# #
TEXT_BASE = 0x11000000 TEXT_BASE = 0x11080000

View File

@ -44,8 +44,8 @@ SECTIONS
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
armboot_end = .; _end = .;
} }

View File

@ -44,15 +44,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -15,11 +15,11 @@
# Linux-Kernel is expected to be at 0cf0'0000, entry 0cf0'0000 # Linux-Kernel is expected to be at 0cf0'0000, entry 0cf0'0000
# optionally with a ramdisk at 0c80'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) # overwritten by the uncompessing Linux kernel)
# #
# download area is 0C80'0000 # download area is 0C80'0000
# #
TEXT_BASE = 0x0CF00000 TEXT_BASE = 0x0CF80000

View File

@ -45,15 +45,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -45,16 +45,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -39,7 +39,7 @@ SECTIONS
lib_generic/string.o (.text) lib_generic/string.o (.text)
. = DEFINED(env_offset) ? env_offset : .; . = DEFINED(env_offset) ? env_offset : .;
common/environment.o (.ppcenv) common/environment.o (.ppcenv)
*(.text) *(.text)
} }
@ -53,15 +53,12 @@ SECTIONS
. = ALIGN(4); . = ALIGN(4);
.got : { *(.got) } .got : { *(.got) }
__u_boot_cmd_start = .; __u_boot_cmd_start = .;
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
__bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
_end = .;
armboot_end = .;
} }

View File

@ -48,12 +48,8 @@ SECTIONS
.u_boot_cmd : { *(.u_boot_cmd) } .u_boot_cmd : { *(.u_boot_cmd) }
__u_boot_cmd_end = .; __u_boot_cmd_end = .;
armboot_end_data = .;
. = ALIGN(4); . = ALIGN(4);
bss_start = .; __bss_start = .;
.bss : { *(.bss) } .bss : { *(.bss) }
bss_end = .; _end = .;
armboot_end = .;
} }

View File

@ -193,7 +193,7 @@ void putc (const char c)
#ifdef CONFIG_SILENT_CONSOLE #ifdef CONFIG_SILENT_CONSOLE
if (gd->flags & GD_FLG_SILENT) if (gd->flags & GD_FLG_SILENT)
return(0); return;
#endif #endif
if (gd->flags & GD_FLG_DEVINIT) { if (gd->flags & GD_FLG_DEVINIT) {

View File

@ -87,7 +87,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -63,7 +63,7 @@ _fiq: .word fiq
* *
* Startup Code (reset vector) * 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 * relocate armboot to ram
* setup stack * setup stack
* jump to second stage * jump to second stage
@ -79,16 +79,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
.globl _armboot_end
_armboot_end: .globl _bss_end
.word armboot_end _bss_end:
.word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -131,7 +130,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -151,6 +150,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 ldr pc, _start_armboot
_start_armboot: .word start_armboot _start_armboot: .word start_armboot
@ -225,7 +235,7 @@ cpu_init_crit:
/* /*
* before relocating, we have to setup RAM timing * 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. * find a memsetup.S in your board directory.
*/ */
mov ip, lr mov ip, lr
@ -281,9 +291,9 @@ cpu_init_crit:
stmia sp, {r0 - r12} @ Calling r0-r12 stmia sp, {r0 - r12} @ Calling r0-r12
add r8, sp, #S_PC add r8, sp, #S_PC
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
add r0, sp, #S_FRAME_SIZE @ restore sp_SVC add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
@ -314,9 +324,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -92,7 +92,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -80,16 +80,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
.globl _armboot_end
_armboot_end: .globl _bss_end
.word armboot_end _bss_end:
.word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -170,7 +169,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -190,6 +189,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 #if 0
/* try doing this stuff after the relocation */ /* try doing this stuff after the relocation */
ldr r0, =pWTCON ldr r0, =pWTCON
@ -303,9 +313,9 @@ cpu_init_crit:
.macro bad_save_user_regs .macro bad_save_user_regs
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #S_FRAME_SIZE
stmia sp, {r0 - r12} @ Calling r0-r12 stmia sp, {r0 - r12} @ Calling r0-r12
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r3} @ get pc, cpsr ldmia r2, {r2 - r3} @ get pc, cpsr
add r0, sp, #S_FRAME_SIZE @ restore sp_SVC add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
@ -336,9 +346,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -93,7 +93,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -89,16 +89,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
.globl _armboot_end
_armboot_end: .globl _bss_end
.word armboot_end _bss_end:
.word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -176,7 +175,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -196,6 +195,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 ldr pc, _start_armboot
_start_armboot: .word 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 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 stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12
ldr r2, _armboot_end @ find top of stack ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE @ find base of normal stack sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 @ set base 2 words into abort stack 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) 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 add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
@ -316,9 +326,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ get bottom of stack (into sp by by user stack pointer). ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ head to reserved words at the top of the stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 @ reserved a couple spots in abort stack 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 str lr, [r13] @ save caller lr in position 0 of saved stack
mrs lr, spsr @ get the spsr mrs lr, spsr @ get the spsr

View File

@ -93,7 +93,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -97,16 +97,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
.globl _armboot_end
_armboot_end: .globl _bss_end
.word armboot_end _bss_end:
.word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -170,7 +169,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -190,6 +189,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 ldr pc, _start_armboot
_start_armboot: _start_armboot:
@ -278,9 +288,10 @@ cpu_init_crit:
@ carve out a frame on current user stack @ carve out a frame on current user stack
sub sp, sp, #S_FRAME_SIZE sub sp, sp, #S_FRAME_SIZE
stmia sp, {r0 - r12} @ Save user registers (now in svc mode) r0-r12 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 ldr r2, _armboot_start
sub r2, r2, #8 @ set base 2 words into abort stack 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) @ get values for "aborted" pc and cpsr (into parm regs)
ldmia r2, {r2 - r3} ldmia r2, {r2 - r3}
add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack add r0, sp, #S_FRAME_SIZE @ grab pointer to old stack
@ -312,11 +323,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
@ get bottom of stack (into sp by by user stack pointer). ldr r13, _armboot_start @ setup our mode stack
ldr r13, _armboot_end sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
@ head to reserved words at the top of the stack sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
add r13, r13, #CONFIG_STACKSIZE
sub r13, r13, #8 @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr in position 0 of saved stack str lr, [r13] @ save caller lr in position 0 of saved stack
mrs lr, spsr @ get the spsr mrs lr, spsr @ get the spsr

View File

@ -87,7 +87,7 @@ int cpu_init(void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -79,19 +79,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
/*
* Note: armboot_end is defined by the (board-dependent) linker script .globl _bss_end
*/ _bss_end:
.globl _armboot_end .word _end
_armboot_end:
.word armboot_end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -149,6 +145,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 ldr pc,_start_armboot
_start_armboot: .word start_armboot _start_armboot: .word start_armboot
@ -212,9 +219,9 @@ cpu_init_crit:
stmia sp, {r0 - r12} @ Calling r0-r12 stmia sp, {r0 - r12} @ Calling r0-r12
add r8, sp, #S_PC add r8, sp, #S_PC
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
add r0, sp, #S_FRAME_SIZE @ restore sp_SVC add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
@ -245,9 +252,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -37,22 +37,16 @@
int cpu_init (void) 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 #ifdef CONFIG_USE_IRQ
IRQ_STACK_START = _armboot_end + DECLARE_GLOBAL_DATA_PTR;
CONFIG_STACKSIZE + CONFIG_STACKSIZE_IRQ - 4;
FIQ_STACK_START = IRQ_STACK_START + CONFIG_STACKSIZE_FIQ; IRQ_STACK_START = _armboot_start - CFG_MALLOC_LEN - CFG_GBL_DATA_SIZE - 4;
_armboot_real_end = FIQ_STACK_START + 4; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#else
_armboot_real_end = _armboot_end + CONFIG_STACKSIZE;
#endif #endif
*/
pci_init(); pci_init();
return 0; 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); extern void reset_cpu (ulong addr);
printf ("reseting ...\n"); printf ("resetting ...\n");
udelay (50000); /* wait 50 ms */ udelay (50000); /* wait 50 ms */
disable_interrupts (); disable_interrupts ();

View File

@ -101,42 +101,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* 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
*/ */
.globl _bss_start .globl _bss_start
_bss_start: _bss_start:
.word bss_start .word __bss_start
.globl _bss_end .globl _bss_end
_bss_end: _bss_end:
.word bss_end .word _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
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -294,7 +267,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -305,16 +278,16 @@ copy_loop:
ble copy_loop ble copy_loop
/* Set up the stack */ /* Set up the stack */
stack_setup: stack_setup:
ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
ldr r0, _uboot_reloc /* upper 128 KiB: relocated uboot */ sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
sub r0, r0, #CFG_MALLOC_LEN /* malloc area */ sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
/* FIXME: bdinfo should be here */ #ifdef CONFIG_USE_IRQ
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ sub sp, r0, #12 /* leave 3 words for abort-stack */
clear_bss: clear_bss:
ldr r0, _bss_start /* find start of bss segment */ ldr r0, _bss_start /* find start of bss segment */
add r0, r0, #4 /* start at first byte of bss */ add r0, r0, #4 /* start at first byte of bss */
ldr r1, _bss_end /* stop here */ ldr r1, _bss_end /* stop here */
@ -325,7 +298,6 @@ clbss_l:str r2, [r0] /* clear loop... */
cmp r0, r1 cmp r0, r1
bne clbss_l bne clbss_l
ldr pc, _start_armboot ldr pc, _start_armboot
_start_armboot: .word start_armboot _start_armboot: .word start_armboot
@ -370,9 +342,9 @@ _start_armboot: .word start_armboot
stmia sp, {r0 - r12} /* Calling r0-r12 */ stmia sp, {r0 - r12} /* Calling r0-r12 */
add r8, sp, #S_PC add r8, sp, #S_PC
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */ ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */ add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
@ -407,9 +379,9 @@ _start_armboot: .word start_armboot
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -42,7 +42,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -69,27 +69,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* 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
*/ */
.globl _bss_start .globl _bss_start
_bss_start: _bss_start:
.word bss_start .word __bss_start
.globl _bss_end .globl _bss_end
_bss_end: _bss_end:
.word bss_end .word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -131,7 +119,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -152,7 +140,6 @@ stack_setup:
sub sp, r0, #12 /* leave 3 words for abort-stack */ sub sp, r0, #12 /* leave 3 words for abort-stack */
clear_bss: clear_bss:
ldr r0, _bss_start /* find start of bss segment */ ldr r0, _bss_start /* find start of bss segment */
add r0, r0, #4 /* start at first byte of bss */ add r0, r0, #4 /* start at first byte of bss */
ldr r1, _bss_end /* stop here */ ldr r1, _bss_end /* stop here */
@ -163,7 +150,6 @@ clbss_l:str r2, [r0] /* clear loop... */
cmp r0, r1 cmp r0, r1
bne clbss_l bne clbss_l
ldr pc, _start_armboot ldr pc, _start_armboot
_start_armboot: .word start_armboot _start_armboot: .word start_armboot
@ -303,9 +289,9 @@ setspeed_done:
stmia sp, {r0 - r12} /* Calling r0-r12 */ stmia sp, {r0 - r12} /* Calling r0-r12 */
add r8, sp, #S_PC add r8, sp, #S_PC
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */ ldmia r2, {r2 - r4} /* get pc, cpsr, old_r0 */
add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */ add r0, sp, #S_FRAME_SIZE /* restore sp_SVC */
@ -340,9 +326,9 @@ setspeed_done:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -41,7 +41,7 @@ int cpu_init (void)
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
DECLARE_GLOBAL_DATA_PTR; 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; FIQ_STACK_START = IRQ_STACK_START - CONFIG_STACKSIZE_IRQ;
#endif #endif
return 0; return 0;

View File

@ -81,16 +81,15 @@ _armboot_start:
.word _start .word _start
/* /*
* Note: _armboot_end_data and _armboot_end are defined * These are defined in the board-specific linker script.
* by the (board-dependent) linker script.
* _armboot_end_data is the first usable FLASH address after armboot
*/ */
.globl _armboot_end_data .globl _bss_start
_armboot_end_data: _bss_start:
.word armboot_end_data .word __bss_start
.globl _armboot_end
_armboot_end: .globl _bss_end
.word armboot_end _bss_end:
.word _end
#ifdef CONFIG_USE_IRQ #ifdef CONFIG_USE_IRQ
/* IRQ stack memory (calculated at run-time) */ /* IRQ stack memory (calculated at run-time) */
@ -133,7 +132,7 @@ relocate: /* relocate U-Boot to RAM */
beq stack_setup beq stack_setup
ldr r2, _armboot_start ldr r2, _armboot_start
ldr r3, _armboot_end ldr r3, _bss_start
sub r2, r3, r2 /* r2 <- size of armboot */ sub r2, r3, r2 /* r2 <- size of armboot */
add r2, r0, r2 /* r2 <- source end address */ add r2, r0, r2 /* r2 <- source end address */
@ -153,6 +152,17 @@ stack_setup:
#endif #endif
sub sp, r0, #12 /* leave 3 words for abort-stack */ 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 ldr pc, _start_armboot
_start_armboot: .word start_armboot _start_armboot: .word start_armboot
@ -276,9 +286,9 @@ cpu_init_crit:
stmia sp, {r0 - r12} @ Calling r0-r12 stmia sp, {r0 - r12} @ Calling r0-r12
add r8, sp, #S_PC add r8, sp, #S_PC
ldr r2, _armboot_end ldr r2, _armboot_start
add r2, r2, #CONFIG_STACKSIZE sub r2, r2, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r2, r2, #8 sub r2, r2, #(CFG_GBL_DATA_SIZE+8) @ set base 2 words into abort stack
ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0 ldmia r2, {r2 - r4} @ get pc, cpsr, old_r0
add r0, sp, #S_FRAME_SIZE @ restore sp_SVC add r0, sp, #S_FRAME_SIZE @ restore sp_SVC
@ -309,9 +319,9 @@ cpu_init_crit:
.endm .endm
.macro get_bad_stack .macro get_bad_stack
ldr r13, _armboot_end @ setup our mode stack ldr r13, _armboot_start @ setup our mode stack
add r13, r13, #CONFIG_STACKSIZE @ resides at top of normal stack sub r13, r13, #(CONFIG_STACKSIZE+CFG_MALLOC_LEN)
sub r13, r13, #8 sub r13, r13, #(CFG_GBL_DATA_SIZE+8) @ reserved a couple spots in abort stack
str lr, [r13] @ save caller lr / spsr str lr, [r13] @ save caller lr / spsr
mrs lr, spsr mrs lr, spsr

View File

@ -15,13 +15,3 @@ different parts of the (ARM) code.
Furthermore, the startup code (cpu/<arm>/start.S) internally uses Furthermore, the startup code (cpu/<arm>/start.S) internally uses
another variable (_TEXT_BASE) with the same content as _armboot_start. another variable (_TEXT_BASE) with the same content as _armboot_start.
I agree that this mess should be cleaned up. 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.

View File

@ -31,8 +31,8 @@
/* for the following variables, see start.S */ /* for the following variables, see start.S */
extern ulong _armboot_start; /* code start */ extern ulong _armboot_start; /* code start */
extern ulong _armboot_end_data; /* code + data end */ extern ulong _bss_start; /* code + data end == BSS start */
extern ulong _armboot_end; /* BSS end */ extern ulong _bss_end; /* BSS end */
extern ulong IRQ_STACK_START; /* top of IRQ stack */ extern ulong IRQ_STACK_START; /* top of IRQ stack */
extern ulong FIQ_STACK_START; /* top of FIQ stack */ extern ulong FIQ_STACK_START; /* top of FIQ stack */

View File

@ -18,7 +18,7 @@ unsigned short bmp_logo_palette[] = {
0x0343, 0x0454, 0x0565, 0x0565, 0x0676, 0x0787, 0x0898, 0x0999, 0x0343, 0x0454, 0x0565, 0x0565, 0x0676, 0x0787, 0x0898, 0x0999,
0x0AAA, 0x0ABA, 0x0BCB, 0x0CCC, 0x0DDD, 0x0EEE, 0x0FFF, 0x0FB3, 0x0AAA, 0x0ABA, 0x0BCB, 0x0CCC, 0x0DDD, 0x0EEE, 0x0FFF, 0x0FB3,
0x0FB4, 0x0FC4, 0x0FC5, 0x0FC6, 0x0FD7, 0x0FD8, 0x0FD9, 0x0FDA, 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[] = { unsigned char bmp_logo_bitmap[] = {

View File

@ -82,9 +82,7 @@
*/ */
/* /*
* Size of malloc() pool; this lives below the uppermost 128 KiB which are * Size of malloc() pool
* used for the RAM copy of the uboot code
*
*/ */
#define CFG_MALLOC_LEN (256*1024) #define CFG_MALLOC_LEN (256*1024)
#define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */ #define CFG_GBL_DATA_SIZE 128 /* size in bytes reserved for initial data */

View File

@ -49,6 +49,7 @@
* Size of malloc() pool * Size of malloc() pool
*/ */
#define CFG_MALLOC_LEN (CFG_ENV_SIZE + 128*1024) #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 */ /* allow to overwrite serial and ethaddr */
#define CONFIG_ENV_OVERWRITE #define CONFIG_ENV_OVERWRITE

View File

@ -399,7 +399,7 @@
#define CFG_ENV_SIZE 0x4000 #define CFG_ENV_SIZE 0x4000
#define CFG_ENV_SECT_SIZE 0x20000 #define CFG_ENV_SECT_SIZE 0x20000
#else #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_SIZE 0x4000
#define CFG_ENV_SECT_SIZE 0x4000 #define CFG_ENV_SECT_SIZE 0x4000
#endif #endif

View File

@ -215,7 +215,7 @@ extern int flash_real_protect(flash_info_t *info, long sector, int prot);
#define INTEL_ID_28F640C3T 0x88CC88CC /* 64M = 4M x 16 top boot sector */ #define INTEL_ID_28F640C3T 0x88CC88CC /* 64M = 4M x 16 top boot sector */
#define INTEL_ID_28F640C3B 0x88CD88CD /* 64M = 4M x 16 bottom 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_28F320J5 0x00140014 /* 32M = 128K x 32 */
#define INTEL_ID_28F640J5 0x00150015 /* 64M = 128K x 64 */ #define INTEL_ID_28F640J5 0x00150015 /* 64M = 128K x 64 */
#define INTEL_ID_28F320J3A 0x00160016 /* 32M = 128K x 32 */ #define INTEL_ID_28F320J3A 0x00160016 /* 32M = 128K x 32 */

View File

@ -117,7 +117,7 @@ static int display_banner (void)
{ {
printf ("\n\n%s\n\n", version_string); printf ("\n\n%s\n\n", version_string);
printf ("U-Boot code: %08lX -> %08lX BSS: -> %08lX\n", 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 #ifdef CONFIG_MODEM_SUPPORT
puts ("Modem Support enabled\n"); puts ("Modem Support enabled\n");
#endif #endif
@ -173,7 +173,7 @@ static void display_flash_config (ulong size)
* All attempts to come up with a "common" initialization sequence * All attempts to come up with a "common" initialization sequence
* that works for all boards and architectures failed: some of the * that works for all boards and architectures failed: some of the
* requirements are just _too_ different. To get rid of the resulting * 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. * initialization sequence configurable to the user.
* *
* The requirements for any new initalization function is simple: it * 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)); gd->bd = (bd_t*)((char*)gd - sizeof(bd_t));
memset (gd->bd, 0, 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) { for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {
if ((*init_fnc_ptr)() != 0) { if ((*init_fnc_ptr)() != 0) {
@ -237,7 +237,7 @@ void start_armboot (void)
* reserve memory for VFD display (always full pages) * reserve memory for VFD display (always full pages)
*/ */
/* armboot_end is defined in the board-specific linker script */ /* 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); size = vfd_setmem (addr);
gd->fb_base = addr; gd->fb_base = addr;
#endif /* CONFIG_VFD */ #endif /* CONFIG_VFD */