Doe Keil IDE support initializing stack space with a constant? For
example with a #define. If not, please does someone have ARM Cortex
M3/M4 assembler code to do that and where should it be located? For
example in startup*.s prior to the branch to main?
Thanks very much for your generous help. It appears to work now as
you described with the stack left full of 0xcccccccc.
Does this help:
Possibly. Thanks for the pointer Andrew. The problem of stack
initialisation now seems to be solved. Keil / ARM advise me I can't
use a symbolic name directly but,
"If you open a Watch window, you can type 'sp' to 'watch' the
stack pointer (r13). Then you can
right-click on 'sp' and navigate to 'Add 'sp' to...' -> Memory 1.
The stack pointer, is
also available in the 'Registers' window."
Why modify the scatter file?
It's not easy to put the code in the stack initalisation?
The ram is initialized before.
LDR R0, =Stack_Mem ; Test stack
LDR R1, =Stack_Size ;
LDR R2, =0xCCCCCCCC ;
Fill STR R2, [R0], #4 ;
SUBS R1,#4 ;
BNE Fill ;
LDR R0, = Heap_Mem
LDR R1, =(Stack_Mem + Stack_Size)
LDR R2, = (Heap_Mem + Heap_Size)
LDR R3, = Stack_Mem
thank you for your thread, it helped me a lot.