arm: support interrupt stack with CONFIG_INIT_STACKS

Use the main stack during very early boot so that we can call memset on
the interrupt stack. Initialize the interrupt stack before it is used
for the rest of the pre-kernel initialization.

Change-Id: I6fcc9a08678afdb82e83465cda1c7a2a8c849c9b
Signed-off-by: Benjamin Walsh <benjamin.walsh@windriver.com>
This commit is contained in:
Benjamin Walsh 2016-11-21 12:11:18 -05:00 committed by Anas Nashif
commit 0c9268784e
2 changed files with 17 additions and 1 deletions

View file

@ -33,6 +33,7 @@
_ASM_FILE_PROLOGUE
GTEXT(__reset)
GTEXT(memset)
GDATA(_interrupt_stack)
/**
@ -78,6 +79,13 @@ SECTION_SUBSEC_FUNC(TEXT,_reset_section,__start)
msr BASEPRI, r0
#endif
#ifdef CONFIG_INIT_STACKS
ldr r0, =_interrupt_stack
mov r1, #0xaa
ldr r2, =CONFIG_ISR_STACK_SIZE
bl memset
#endif
/*
* Set PSP and use it to boot without using MSP, so that it
* gets set to _interrupt_stack during nanoInit().

View file

@ -36,6 +36,8 @@
_ASM_FILE_PROLOGUE
GDATA(_main_stack)
SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)
/* in XIP kernels. the entry point is also the start of the vector table */
@ -43,7 +45,13 @@ SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,_vector_table)
SECTION_SUBSEC_FUNC(exc_vector_table,_vector_table_section,__start)
#endif
.word 0 /* no need for a stack, the kernel sets one up before running C */
/*
* setting the _very_ early boot on the main stack allows to use memset
* on the interrupt stack when CONFIG_INIT_STACKS is enabled before
* switching to the interrupt stack for the rest of the early boot
*/
.word _main_stack + CONFIG_MAIN_STACK_SIZE
.word __reset
.word __nmi