This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-M23: Dumping values on the stack

I am trying to debug a Hard fault caused by some inline assembly code in my program. I have tried the two approaches here: https://www.freertos.org/Debugging-Hard-Faults-On-Cortex-M-Microcontrollers.html and https://blog.feabhas.com/2013/02/developing-a-generic-hard-fault-handler-for-arm-cortex-m3cortex-m4/ but seem to be running into errors when building. Is there an equivalent code for Cortex-M23 processor?

Below is my Hardfault handler

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
void prvGetRegistersFromStack( uint32_t *pulFaultStackAddress )
{
/* These are volatile to try and prevent the compiler/linker optimising them
away as the variables never actually get used. If the debugger won't show the
values of the variables, make them global my moving their declaration outside
of this function. */
volatile uint32_t r0;
volatile uint32_t r1;
volatile uint32_t r2;
volatile uint32_t r3;
volatile uint32_t r12;
volatile uint32_t lr; /* Link register. */
volatile uint32_t pc; /* Program counter. */
volatile uint32_t psr;/* Program status register. */
r0 = pulFaultStackAddress[ 0 ];
r1 = pulFaultStackAddress[ 1 ];
r2 = pulFaultStackAddress[ 2 ];
r3 = pulFaultStackAddress[ 3 ];
r12 = pulFaultStackAddress[ 4 ];
lr = pulFaultStackAddress[ 5 ];
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

The following errors come up when I try to build my code:

Fullscreen
1
2
3
4
5
6
7
/tmp/ccHDURtz.s: Assembler messages:
/tmp/ccHDURtz.s:173: Error: unshifted register required -- `tst lr,#4'
/tmp/ccHDURtz.s:174: Error: selected processor does not support `ite eq' in Thumb mode
/tmp/ccHDURtz.s:175: Error: Thumb does not support conditional execution
/tmp/ccHDURtz.s:176: Error: Thumb does not support conditional execution
/tmp/ccHDURtz.s:178: Error: invalid offset, target not word aligned (0x00000062)
/tmp/ccHDURtz.s:178: Error: invalid offset, value too big (0x00000002)
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

0