WWDG_IRQHandler called after a blx instruction
Hi all,
I'm trying to use a version of the elua interpreter on a stm32f446re nucleo board.
I've encountered a problem, the program is jumping on an infinite loop after entering a couple of functions of the interpreter. The system is blocking in an WWDG_IRQHandler set to the default irq handler that is a infinite loop, here's the code where it's blocked:
/**
* @brief This is the code that gets called when the processor receives an
* unexpected interrupt. This simply enters an infinite loop, preserving
* the system state for examination by a debugger.
* @param None
* @retval None
*/
.section .text.Default_Handler,"ax",%progbits
Default_Handler:
Infinite_Loop:
b Infinite_Loop
.size Default_Handler, .-Default_HandlerThe debugger can't find the source of the interrupt in the stack trace.
Debugging the C code I discovered that the program blocks inside an obscure call to a function pointer, so I tried to debug directly the asm code to find out exactly where the code is blocking and I discovered that the program is blocking exactly after a blx instruction that is branching to a mov instruction:
- `blx r3` where r3 is 0x800f710
- `mov r7 r0` where r7 contains 0x10 and r0 0x20000a40
The compilation flags that I'm using are the following:
-std=gnu11 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -Os -mcpu=cortex-m4 -ffunction-sections -fdata-sections -Wall -nostdlib --param max-inline-insns-single=500I tried to take away the -mthumb option but nothing is changing.
Do you know what could be the cause of this behavior?
Do you think that the blx instruction is the problem or that it is just a coincidence?
Do you know what I could do to find out what's the problem? I 'm kinda stuck with the debugging process because I don't know if I should focus on the compilation or maybe the code.
