armv7-m: set stack pointer to _estack

this change sets the stack pointer to the value specified in
memlayout.ld before jumping to the bootblock.

BUG=none
BRANCH=ToT
TEST=Built cosmos and all other current boards.

Change-Id: I4bb8cea7435d2a0e2c1ced050c3366d2e636cb8a
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/225420
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
Daisuke Nojiri 2014-10-24 09:38:31 -07:00 committed by chrome-internal-fetch
commit d50fd02db8

View file

@ -31,5 +31,20 @@
#include <arch/asm.h>
ENTRY(_start)
/*
* Initialize the stack to a known value. This is used to check for
* stack overflow later in the boot process.
*/
ldr r0, =_stack
ldr r1, =_estack
ldr r2, =0xdeadbeef
init_stack_loop:
str r2, [r0]
add r0, #4
cmp r0, r1
bne init_stack_loop
call_bootblock:
ldr sp, =_estack /* Set up stack pointer */
bl main
ENDPROC(_start)