cancel
Showing results for 
Search instead for 
Did you mean: 

LoopFillZerobss errors when migrating the keil project into stm32cube ide

LauraCx
ST Employee

** 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.

4 REPLIES 4

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.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
LauraCx
ST Employee

@KSag​ 

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.

Pavel A.
Evangelist III

> 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.