hardfault in bootloader s32k344.

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

hardfault in bootloader s32k344.

1,457 Views
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 Kudos
Reply
2 Replies

1,390 Views
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 Kudos
Reply

1,433 Views
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 Kudos
Reply