2022-09-22 05:40 AM
Hello,
I have a strange issue!, so my project is using cmake to build and it is in c++. Everything is working if i set the startup script (startup_stm32f072xb.s) before stm32f0xx_it.c
But if i set it after stm32f0xx_it.c, than nothing happens it is like the mcu freezes or not even start.
As I know the order is irrelevant? Or am I wrong?
Solved! Go to Solution.
2022-09-28 12:46 AM
Hi I fixed this issue it was a problem with the -flto flag, link time optimization. The size of the output file changes if you change the orders of the source files.
By disabling the -lto flag It was working no mater the order of the source files. Enabling it will not work with different orders of the source files.
I updated the arm compiler from 9.3 to 10.3 and this fixed my issue I can enable the -lfo flag and it works in any order.
2022-09-28 12:46 AM
Hi I fixed this issue it was a problem with the -flto flag, link time optimization. The size of the output file changes if you change the orders of the source files.
By disabling the -lto flag It was working no mater the order of the source files. Enabling it will not work with different orders of the source files.
I updated the arm compiler from 9.3 to 10.3 and this fixed my issue I can enable the -lfo flag and it works in any order.
2022-10-07 09:00 AM
You should be able to use the Linker Script (.LD) to ensure the order of sections and objects, might need a KEEP() to make sure it doesn't jettison the vector table if no secondary references are made to it.
I might use the symbol to set SCB->VTOR in MCU supporting that, in SystemInit()
2022-10-19 01:01 PM
GCC versions 7-9 have a bug with linking weak symbols when LTO is enabled. The following topic has more information about that bug: