Skip to main content

Is it possible to calculate the stack usage for a bare-metal application? - Knowledgebase / TRACE32 PowerView - Lauterbach Support

Is it possible to calculate the stack usage for a bare-metal application?

Here it is an example that can be tested on the TRACE32 Instruction Set Simulator for Arm:

RESet
SYStem.RESet
SYStem.CPU CortexA9
SYStem.Up
DO ~~/demo/arm/compiler/gnu-pic/demo_sieve
; initialize the stack with a specific pattern
; use section .stack here
Data.Set sYmbol.SECRANGE(.stack) %Byte 0xa5
Go main\1
WAIT !STATE.RUN()
; add stacks manually
TASK.STacK.PATtern %Byte 0xa5
TASK.STacK.view
; use any number as "task" identifier, e.g. here 0x100
TASK.STacK.ADD 0x100 sYmbol.SECRANGE(.stack)
; possibly add more stacks: TASK.STacK.ADD
; [optional] set a name:
TASK.NAME.Set 0x100 "main"
Helpful Unhelpful