This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Multiple modules of the main function in Keil uVision

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-

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?

Parents
  • I am not aware, that one can prevent the STM32CubeMX from generating the main.c module. If you need to know it more precise, you need to contact the authors of the STM32CubeMX. In the STM32CubeMX -> Project Manager -> Project it is only possible to not generate the main() function. But then you need your own main() function and call all the init function, that STM32CubeMX generates, manually.

    And the note about renamed object files is NOT a compiler warning. It is just an information of the IDE to inform you, that to make the project build possible while having modules with the same name in the project, one of the modules object files needed to be renamed. It is not possible to link multiple object files with the same name. So, if you have no duplicate symbols in the modules, the project should still build. Normally you do not need to modify the linker scatter file for this.

Reply
  • I am not aware, that one can prevent the STM32CubeMX from generating the main.c module. If you need to know it more precise, you need to contact the authors of the STM32CubeMX. In the STM32CubeMX -> Project Manager -> Project it is only possible to not generate the main() function. But then you need your own main() function and call all the init function, that STM32CubeMX generates, manually.

    And the note about renamed object files is NOT a compiler warning. It is just an information of the IDE to inform you, that to make the project build possible while having modules with the same name in the project, one of the modules object files needed to be renamed. It is not possible to link multiple object files with the same name. So, if you have no duplicate symbols in the modules, the project should still build. Normally you do not need to modify the linker scatter file for this.

Children
No data