Hello! I'm developing s32k312 bootloader, but when jump to app, it always stuck in "HardFault_Handler".
Bootloader range: 0x400000 - 0x4fffff,App range: 0x500000 - end, RTD version: 3.0.0
This is my jump code in bootloader:
Boot & app already downloaded by Jlink, so I put jump code before bsp_init
This is app's map
I tried a lot solutions in forum, but not work. Should I do some remapping stuff or something else?
Best Regards!
解決済! 解決策の投稿を見る。
Hi @danielmartynek ,
Thanks for your support! I tried your code but still stuck in hardfault_handler.
So I search same topic again, finally found the solution, now my code jump normally:
已解决: UsageFault: The processor has attempted to execute... - NXP Community
Maybe your code should update to this:
uint32 func = *(uint32 volatile *)(APP_STARTADDR+ 0xC);
func = *(uint32 volatile *)(((uint32)func) + 0x4);
func = ((((uint32)func) & 0xFFFFFFFEU) | 1u); // with "|1u" code worked
(* (void (*) (void)) func)();
Hi @Vandarkholme,
Can you use this code?
func = *(UINT32 volatile *)(0x500000 + 0xC);
func = *(UINT32 volatile *)(((UINT32)func) + 0x4);
func = (((UINT32)func) & 0xFFFFFFFEU);
(* (void (*) (void)) func)();
Please check the code in the memory view.
At 0x500000 there should be 0x5AA55AA5
At 0x500000 + 0xC, there is the Cortex-M7_0 core start address.
(RM rev7, Table 189. Image vector table).
BR, Daniel
Hi @danielmartynek ,
Thanks for your support! I tried your code but still stuck in hardfault_handler.
So I search same topic again, finally found the solution, now my code jump normally:
已解决: UsageFault: The processor has attempted to execute... - NXP Community
Maybe your code should update to this:
uint32 func = *(uint32 volatile *)(APP_STARTADDR+ 0xC);
func = *(uint32 volatile *)(((uint32)func) + 0x4);
func = ((((uint32)func) & 0xFFFFFFFEU) | 1u); // with "|1u" code worked
(* (void (*) (void)) func)();