s32k116 hardfault handler

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 
已解决

s32k116 hardfault handler

跳至解决方案
4,113 次查看
Dinesh_Guleria
NXP Employee
NXP Employee

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

标签 (1)
标记 (1)
0 项奖励
回复
1 解答
4,067 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

danielmartynek_0-1642002157699.png

In memory view, SP + 0x18

danielmartynek_1-1642002223526.png

Find the instruction:

danielmartynek_2-1642002287673.png

 

Regards,

Daniel

 

 

在原帖中查看解决方案

0 项奖励
回复
5 回复数
4,105 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

 

0 项奖励
回复
4,095 次查看
Dinesh_Guleria
NXP Employee
NXP Employee

@danielmartynek ,

 

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

0 项奖励
回复
4,068 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

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

danielmartynek_0-1642002157699.png

In memory view, SP + 0x18

danielmartynek_1-1642002223526.png

Find the instruction:

danielmartynek_2-1642002287673.png

 

Regards,

Daniel

 

 

0 项奖励
回复
3,999 次查看
Dinesh_Guleria
NXP Employee
NXP Employee

@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

0 项奖励
回复
3,990 次查看
danielmartynek
NXP TechSupport
NXP TechSupport

Hello @Dinesh_Guleria,

This is a speudo code from ARM®v6-M Architecture Reference Manual

danielmartynek_0-1642515374308.png

 

Regards,

Daniel