I am reaching out to seek assistance with a usage fault issue that I am facing while attempting to jump from a custom bootloader to an application on an NXP platform.
Error message:
UsageFault: The processor has attempted to execute an undefined instruction.
HardFault: A fault has been escalated to a hard fault.
Here are some key details regarding my setup:
Bootloader located at address: 0x00400000
Application located at address: 0x00500000
Function pointer address used for jumping to the application: ((0x00500800)+1) (VTABLE address) but faced usage fault which is leading to hardfault.
I have also tried jumping directly to the reset handler address [Reset handler address attempted: 0x00500c20], but the issue persists.
I would greatly appreciate any guidance or insights from the community on potential pitfalls or areas where I might be overlooking crucial details. If anyone has experience with a similar scenario or can provide troubleshooting advice, it would be immensely helpful.
解決済! 解決策の投稿を見る。
Hi @aadyaa,
Can you try with this code?
ADDR_APP = 0x00500000
func = *(UINT32 volatile *)(ADDR_APP + 0xC);
func = *(UINT32 volatile *)(((UINT32)func) + 0x4);
func = (((UINT32)func) & 0xFFFFFFFEU);
(* (void (*) (void)) func)();
Please read the memory first.
At ADDR_APP there should be 0x5AA55AA5
At ADDR_APP + offset 0xC, there is the Cortex-M7_0 core start address.
(RM rev7, Table 189. Image vector table).
Regards,
Daniel
Hi @aadyaa,
Can you try with this code?
ADDR_APP = 0x00500000
func = *(UINT32 volatile *)(ADDR_APP + 0xC);
func = *(UINT32 volatile *)(((UINT32)func) + 0x4);
func = (((UINT32)func) & 0xFFFFFFFEU);
(* (void (*) (void)) func)();
Please read the memory first.
At ADDR_APP there should be 0x5AA55AA5
At ADDR_APP + offset 0xC, there is the Cortex-M7_0 core start address.
(RM rev7, Table 189. Image vector table).
Regards,
Daniel
Hello @danielmartynek
Thank you for your reply, I made small change to your code snippet and it started working.
Here is the updated code:
ADDR_APP = 0x00500000
func = *(UINT32 volatile *)(ADDR_APP + 0xC);
func = *(UINT32 volatile *)(((UINT32)func) + 0x4);
func = ((((uint32_t)func) & 0xFFFFFFFEU) | 1u);
(* (void (*) (void)) func)();