Hi NXP Application team,
Do we have some sample code where s32k116 hardfault handler is implemeted. So that we can trace from which instruction this hardfault occurred ?
Can i use same process as mentioned in this link :--
https://mcuoneclipse.com/2012/11/24/debugging-hard-faults-on-arm-cortex-m/
Please suggest.
Regards
Dinesh
已解决! 转到解答。
Hi @Dinesh_Guleria,
There is a lot of useful information in the thread, please read it again.
An example on S32K116:
Read an unimplemented memory (0x80000):
volatile uint32_t read = *((uint32_t*)0x00080000);
void HardFault_Handler(void){
while(1){
}
}
Read the stack from the fault handler
In memory view, SP + 0x18
Find the instruction:
Regards,
Daniel
Hi @Dinesh_Guleria,
Unfortunately, we have no such example for S32K1xx (Cortex M0+).
The article you posted is for S32K14x (Cotex M4).
You can follow the steps here:
https://community.arm.com/support-forums/f/embedded-forum/3257/debugging-a-cortex-m0-hard-fault
You can read the stack in the memory view, there is no need to have the stacked PC stored in a variable, if you know how to read the stack.
Regards,
Daniel
Thanks for your reply.
Link you shared do not contain any solution how to do this task.
>>You can read the stack in the memory view, there is no need to have the stacked PC stored in a variable, if you know how to read the stack.
Please can you suggest how to read the stack..?
Regards,
Dinesh
Hi @Dinesh_Guleria,
There is a lot of useful information in the thread, please read it again.
An example on S32K116:
Read an unimplemented memory (0x80000):
volatile uint32_t read = *((uint32_t*)0x00080000);
void HardFault_Handler(void){
while(1){
}
}
Read the stack from the fault handler
In memory view, SP + 0x18
Find the instruction:
Regards,
Daniel
@danielmartynek
Thanks for your reply, it is clear to me.
Where exactly this figure comes from :--
In memory view, SP + 0x18.
Please suggest.
Regards,
Dinesh
Hello @Dinesh_Guleria,
This is a speudo code from ARM®v6-M Architecture Reference Manual
Regards,
Daniel