2012-06-19 02:21 AM
How do I modify (startup*.s ?) to fill the stack with a constant value? Example assembler code would be appreciated. I want to check stack usage. I posted a similar question to this in the Keil forum
Looking for a quick solution - no lectures please!2012-06-19 05:22 AM
Reset_Handler PROC
EXPORT Reset_Handler [WEAK]
IMPORT __main
LDR R0, =__initial_sp
LDR R1, =0x20010000 ; Top of mem
LDR R2, =0x6B6B6B6B
Clear_Heap
STR R2, [R0, #0]
ADD R0, #4
CMP R0, R1
BNE Clear_Heap
; The __main routine resets the stack pointer, and then initialize the static area
; it then CLEARS all the space between there and the stack.
LDR R0, =__main
BX R0
ENDP
2012-06-19 05:36 AM
Thanks Clive. It looks like for the Keil IDE it's also necessary to create a modified copy of the scatter file (*.sct). Please see the link to the Keil forum for full details.
For anyone else who might help ... I still don't know how to get a view of the stack in the Keil IDE's memory window apart from getting the stack address from the *.map file and typing it in. How to use a symbolic name such as ''STACK''? Don't know.