What I normally do when I have an exception, I look for registers with addresses in the flash range, 0x8000000
and up ( for STMF32 ).
Then I open the LSS listing of the project and look up these addresses. When an addresses is ‘odd’, strip off the LSB ( the Thumb-mode bit ).
The register values will also change when you use a different optimisation level, -Os
in stead of -O0
.
I also wonder about the stack during an ISR. Richard knows a lot more about this subject. But I remember that in some ports the stack used in main()
, the default application stack, is being recycled and used for ISR stack.
This stack is defined in your linker file xxx.ld
:
_estack = 0x20050000; /* end of RAM */
_Min_Stack_Size = 0x460; /* required amount of stack */
In this example, the last 1120 bytes of RAM are dedicated to the stack.