hardfault in bootloader s32k344.

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

hardfault in bootloader s32k344.

1,461 次查看
paulffffff
Contributor III

trying to run bootloader example I got hardfault during jump to application.

I crated simple application to load to 0x00600000 address. this application count from 1 to 65535 and then to 0 and then jump to _start of itself (or Reset_Handler). but this application caused same hardfaut. may you take a look to project to advice solution.

I use S32 Design Studio v 3.5

Thanks.

Pavel  

0 项奖励
回复
2 回复数

1,394 次查看
paulffffff
Contributor III

using this code:

Boot_JumpToApp(resetHandlerAddr);
Reset_Handler();

caused "HardFault_Handler".

debugger message at this point:

"UsageFault: An instruction executed with an invalid EPSR.T or EPSR.IT field.
HardFault: A fault has been escalated to a hard fault."

that is the reason, why I check "thumb" mode and force switch to it.

removing :

"

// force_thumb_mode();
    __asm volatile
(
        "BX PC \n"       // Branch to the next instruction, ensuring Thumb mode
        "NOP \n"         // No operation (acts as a placeholder)
    );
 

"

does not change hard fault.

 

0 项奖励
回复

1,437 次查看
Senlent
NXP TechSupport
NXP TechSupport

Hi@paulffffff

I don't understand why you use the "BX" instruction here when you have already ported the "Boot_JumpToApp" function to your project.

The reason for the hardfault comes from here.

Senlent_0-1721980809263.png

For the specific reason, please refer to this answer.

https://stackoverflow.com/questions/75965946/gcc-arm-inline-assembly-bx-produce-unexpected-results-t...

 

0 项奖励
回复