2021-12-08 02:47 AM
** Questions asked by @KSag **
I am trying to migrate the keil project into stm32cube ide. startup file is generating errors. if I add the object files of main.o, stm32f1xx_hal_msp.c and stm32f1xx_it.c along with the startup file(startup_stmf105rbtx.s generated from STM32cubemx ide). it gives main undefined errors and LoopFillZerobss errors. Is it possible to fix these issues? Is it possible to migrate project from keil to stm32cubemx ide?
I also try to add the statup file of keil project startup_stm32f105xc.s. upon compiling a lot of bad instruction error occur.
2021-12-08 05:55 AM
The ARM/Keil vs GNU Assembler format is different. Use the GNU startup.s file templates from the CubeF1 trees
STM32Cube_FW_F1_V1.8.0\Drivers\CMSIS\Device\ST\STM32F1xx\Source\Templates\gcc\startup_stm32f105xc.s
The ST implementation for GNU/GCC startup static initialization is very poor, look at how Arduino on ARM platforms implemented this by building tables in a method similar to that used by Keil which used the scatter loader via __main call, and a table created by the linker.
2021-12-08 07:25 AM
@KSag
2021-12-09 12:59 AM
You are right it is a linker problem. I did what you suggested but still getting the same error.
Description Resource Path Location Type
undefined reference to `main' startup_stm32f105xc.s /MainMcu-HSAE-20211207/Core/Startup line 99 C/C++ Problem
make: *** [makefile:65: MainMcu-HSAE-20211207.elf] Error 1 MainMcu-HSAE-20211207 C/C++ Problem
./Core/Startup/startup_stm32f105xc.o: in function `LoopFillZerobss': MainMcu-HSAE-20211207 C/C++ Problem
when I use main.o (provided by supplier), the error of undefined reference to main occur. When I use main.c generated by stm32cube ide then it works.
2021-12-10 08:58 PM
> when I use main.o (provided by supplier), the error of undefined reference to main occur. When I use main.c generated by stm32cube ide then it works.
Which supplier? If their .o file fails, ask them to provide a fixed one.