Part Number: LAUNCHXL-F280039C
Hi,
I'm working on the hard fault handler and I need to read and store some registers values.
Please provide the assembly code that let me read the program counter.
Thanks,
Dekel
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Part Number: LAUNCHXL-F280039C
Hi,
I'm working on the hard fault handler and I need to read and store some registers values.
Please provide the assembly code that let me read the program counter.
Thanks,
Dekel
Hi Omer,
Thanks for your response.
I'm running the code below but it doesn't work.
Please advise how to implement it correctly.
Regards,
Dekel
C code:
uint32_t pc = _getPC();
ASM code:
;;*****************************************************************************
;; Get Program Counter
;;*****************************************************************************
_getPC:
MOV XAR5, PC
POP XAR5
LRETR
Hello Dekel,
Why are you popping XAR5? This will overwrite the XAR5 register with the data the stack pointer is currently pointing to (pop from the stack), thus erasing your PC value. If you change this to PUSH, what value do you see?
Best regards,
Omer Amir