Hi,
I am using: ARM Compiler/Assembler/Linker on Cortex-M0.
Given the following template for startup.s: www.keil.com/.../startup_s_pg.html
Stack_Size EQU 0x00000400 AREA STACK, NOINIT, READWRITE, ALIGN=3 Stack_Mem SPACE Stack_Size __initial_sp
I want to define my memory regions(including stack) in scatter file. However, I want to use the start address of my Stack in my code.
My scatter file is as follows:
LOAD START_ADDRESS LR_SIZE { RAM RAM_START_ADDRESS { *(INTERRUPTS, +First) .ANY (+RO) .ANY (+RW,+ZI) } STACK_SPACE END_STACK_ADDR UNINIT STACK_SIZE { *(STACK) } }
I want __initial_sp to point to the END_STACK_ADDR + STACK_SIZE in the startup file and I want to export __initial_sp so that my application can use it.
I have attempted to use Image$$STACK_SPACE$$ZI$$Limit and Image$$STACK_SPACE$$ZI$$Base in my startup.s file but EQU and SPACE does not take these values (not constant).
Stack_Size EQU |Image$$STACK_SPACE$$ZI$$Limit|
How can I reserve SPACE in my startup file with a value of stack size defined in scatter file so that my __initial_sp points to the right location?
if that's not possible, how can I export a variable in my startup.s file that has a name __initial_sp and value of |Image$$STACK_SPACE$$ZI$$Limit| ?