2021-10-28 01:23 AM
Hi! I have a project in which I tried to enable LTO for release builds. Issue is that the code hangs before entering the main loop. Upon investigation, I found that an interrupt is triggered: the code gets stuck in the default implementation for the WWDT_IRQHandler function:
Default_Handler:
Infinite_Loop:
b Infinite_Loop
I do not enable WWDT in CubeMX, and it is indeed disabled in my hal conf header file. Now I'm suspecting that I might be enabling LTO incorrectly. I pass -flto to both the C compiler and the linker as arguments. Am I missing something?
Solved! Go to Solution.
2021-10-28 06:50 AM
> WWDT_IRQHandler
You mean WWDG_IRQHandler?
Default_Handler is the default handler for all IRQs you haven't defined. How do you know it's in WWDG_IRQHandler? Examine the VECTACTIVE bits to determine which interrupt it's in.
It's unlikely that the problem is -flto. It's more likely that optimizations are exposing a bug in your program that previously went undetected.
Edit: maybe it is a linker bug, in which case there's nothing we can do about it here. You can remove the weak ISR function definitions.
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966
2021-10-28 01:43 AM
Forgot to add link I found which might be relevant: https://github.com/ObKo/stm32-cmake/issues/78
2021-10-28 06:50 AM
> WWDT_IRQHandler
You mean WWDG_IRQHandler?
Default_Handler is the default handler for all IRQs you haven't defined. How do you know it's in WWDG_IRQHandler? Examine the VECTACTIVE bits to determine which interrupt it's in.
It's unlikely that the problem is -flto. It's more likely that optimizations are exposing a bug in your program that previously went undetected.
Edit: maybe it is a linker bug, in which case there's nothing we can do about it here. You can remove the weak ISR function definitions.
https://bugs.launchpad.net/gcc-arm-embedded/+bug/1747966