cancel
Showing results for 
Search instead for 
Did you mean: 

cpp project using STM32CubeMX and Keil

AVerm.4
Associate III

Hi,

I have created a project using STM32CubeMX and Keil uVision.

The generated CubeMX comes with its own main.c and main function.

What I want to do is disable that main.c build in the project and create my main.cpp file,

where I can put my main function.

The problem I'm now facing is that the compiler is giving the following warning-

 

Object file renamed main.o to main_1.o

 

While going through this documentation it says to configure the linker and scatter file.

https://developer.arm.com/documentation/ka004041/latest/

But I'm not able to figure it out. is there some other document I can go through?

1 ACCEPTED SOLUTION

Accepted Solutions
Imen.D
ST Employee

Hello @AVerm.4 ,

It seems the build contains two files with the same exact name!

Make sure every "main.c" "stm32xxxx_it.c" and stm32xxxx_hal_map.c" is excluded in the current target build options.

Check that it is building into different directories for each sub-project​, and verify the "include in Target Build" option in the "Option for target".

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

2 REPLIES 2
Imen.D
ST Employee

Hello @AVerm.4 ,

It seems the build contains two files with the same exact name!

Make sure every "main.c" "stm32xxxx_it.c" and stm32xxxx_hal_map.c" is excluded in the current target build options.

Check that it is building into different directories for each sub-project​, and verify the "include in Target Build" option in the "Option for target".

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
AVerm.4
Associate III

Hi @Imen.D ,

I am working only on one project and no sub-project. what I want to do is disable main.c generated by CubeMX and work on main.cpp file.

Should I use Keil RTE to generate the CubeMX files?