Hello,
I am trying to understand (and debug) a hard fault being produced by my code. After investigating and walking though the disassembly, it looks like the system is trying to branch into the location 0x0. However, I'm stuck on where to go next. This section of code is within the fsl_enet.c SDK file and is included/called by a precompiled library. Does anyone have any suggestions?
3240 s_enetRxIsr(base, s_ENETHandle[instance]);
60009ae4: ldr r3, [pc, #88] ; (0x60009b40 <ENET_CommonFrame0IRQHandler+152>)
// R3 is 0x20004080
60009ae6: ldr r3, [r3, #0]
// R3 is now 0x00000000
60009ae8: ldr r1, [pc, #80] ; (0x60009b3c <ENET_CommonFrame0IRQHandler+148>)
60009aea: ldr r2, [r7, #8]
60009aec: ldr.w r2, [r1, r2, lsl #2]
60009af0: mov r1, r2
60009af2: ldr r0, [r7, #4]
60009af4: blx r3
// PC jumped to 0x00000000
Active faults
Hard Fault (HFSR)
FORCED (30) Indicates a forced hard fault, generated by escalation of a fault with configurable priority that cannot be handled, either because of priority or because it is disabled
Usage Fault (UFSR)
INVSTATE (1) Invalid state
Fault Status Registers
IPSR 0x00000003 Exception Status Register (Hard Fault)
CFSR 0x00020000 Configurable fault Status Register
MMSR 0x00000000 Memory Manage fault Status Register
BFSR 0x00000000 Bus fault Status Register
UFSR 0x00000002 User fault Status Register
HFSR 0x40000000 Hard fault Status Register
DFSR 0x00000000 Debug fault Status Register
MMAR 0x00000000 Memory Manage fault Address Register
BFAR 0x00000000 Bus fault Address Register
ABFSR 0x00000000 Auxiliary Bus Fault Status Register
Stacked Registers (MSP LR/EXC_RETURN=0xfffffff1)
R0 0x402D8000
R1 0x00000000
R2 0x00000000
R3 0x00000000
R12 0x00000000
LR 0x60009AF7 ENET_CommonFrame0IRQHandler() @ \REMOVED\drivers\fsl_enet.c line 3244
PC 0x00000000
PSR 0x20000082
MSP 0x2001FF80
解決済! 解決策の投稿を見る。
Hello,
The problem turned out to be an undocumented change manually added to the startup_mimxrt1062.cpp file that changed the path for the Ethernet ISR. When I generated my project, I didn't have this modification and the system crashed.
For those interested, the changes were:
Add:
extern void nx_driver_imx_ethernet_isr(void);
Change:
WEAK void ENET_IRQHandler(void)
{
// ENET_DriverIRQHandler();
nx_driver_imx_ethernet_isr();
}
Solution, add the following code to your application code.
extern "C"
{
extern void nx_driver_imx_ethernet_isr(void);
void ENET_IRQHandler(void)
{
nx_driver_imx_ethernet_isr();
}
}
Hello,
The problem turned out to be an undocumented change manually added to the startup_mimxrt1062.cpp file that changed the path for the Ethernet ISR. When I generated my project, I didn't have this modification and the system crashed.
For those interested, the changes were:
Add:
extern void nx_driver_imx_ethernet_isr(void);
Change:
WEAK void ENET_IRQHandler(void)
{
// ENET_DriverIRQHandler();
nx_driver_imx_ethernet_isr();
}
Solution, add the following code to your application code.
extern "C"
{
extern void nx_driver_imx_ethernet_isr(void);
void ENET_IRQHandler(void)
{
nx_driver_imx_ethernet_isr();
}
}
It look like it dereferencing a function pointer which is initialized with 0 (NULL).
Could that be the reason? If so, an initialization might be missing?
Hello Erich,
First, thanks for helping again.
Second, as far as I can tell, the Ethernet is initialized. This is again using the ThreadX library and I am able to successfully step through the initialization of the Ethernet port and watch it establishing a successful link. Additionally, s_enetRxIsr is listed in the map file as ".bss.s_enetRxIsr 0x20004080 0x4 ./drivers/fsl_enet.o". I believe that all implies a successful initialization?