2023-11-26 01:01 PM
Hi, I'm trying to develop a FW for one of my custom boards that has an ethernet interface.
I'm using STM32CubeIDE, I generated the code with the configurator, and without even writing a line of code, if I go into debug, during the initialization of the HAL the code immediately jumps to:
void Error_Handler(void){
I wanted to ask, Is there a way to know at which point the code jumped to Error_Handler(void), so as to try to understand where the problem is.
In other words, is it possible to run the code backwards or see from which line a certain function was called?
Solved! Go to Solution.
2023-11-27 06:45 AM
Sometimes the IDE parses things wrong. Look for the LWIP_ARP or LWIP_ETHERNET defines and ensure they're defined somewhere prior to the posted code.
2023-11-26 01:07 PM
The more effective version would be to use the one that passes file and line, ie Error_Handler(__FILE__, __LINE__)
Otherwise you'll need to fish out the LR register to understand where it was called from, or step out via a return. Via LR you can perhaps use the .MAP or .LST file, or disassembly
2023-11-26 05:41 PM
If you set a breakpoint in there, you can examine the call stack in the debugger to see where it came from. Unwinding the stack at runtime can be done but is compiler-dependent and isn't very well supported on microcontrollers.
2023-11-27 01:33 AM
Through your heIp I managed to get to the point where Error_Handler() is called. Here:
But I can't explain one thing, the point in question is this, but that whole block of code is grayed out, as if none of the LWIP_ARP or LWIP_ETHERNET macros were defined
How should I interpret this situation, should that code not be executed?
Did I do something wrong in the configurator?
2023-11-27 06:45 AM
Sometimes the IDE parses things wrong. Look for the LWIP_ARP or LWIP_ETHERNET defines and ensure they're defined somewhere prior to the posted code.