Skip to main content
AVerm.4
Associate III
February 15, 2024
Solved

cpp project using STM32CubeMX and Keil

  • February 15, 2024
  • 2 replies
  • 2107 views

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?

This topic has been closed for replies.
Best answer by Imen.D

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

2 replies

Imen.DBest answer
Technical Moderator
February 15, 2024

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"".ThanksImen"
AVerm.4
AVerm.4Author
Associate III
February 15, 2024

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?