cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to have CubeIDE project with multiple main functions?

ADovn.1
Associate II

I have a project which uses multiple identical boards and needs them to have slightly different firmware. So I thought that having a folder for each firmware with its own main function in one project will be efficient because all boards will use the same libraries and I won't need to maintain multiple projects at one time. 

So is it possible to set up a project with multiple main functions in Cube IDE? If yes, how I can do it?

1 ACCEPTED SOLUTION

Accepted Solutions
berendi
Principal

You can create multiple configurations under Project / Build Configurations / Manage. Each configuration has its own set of project settings, so you can e.g. define preprocessor symbols to activate some #ifdef in the code, or exclude entire files or directories from build.

Another way is to create sub-projects within a project. Create the main project without a target, new projects for each configuration inside the main project folder, and additional directories for common code. CubeMX uses this approach to manage dual core MCUs, you might want to create a dummy project for a STM32H745 to see how does it look like.

View solution in original post

2 REPLIES 2
berendi
Principal

You can create multiple configurations under Project / Build Configurations / Manage. Each configuration has its own set of project settings, so you can e.g. define preprocessor symbols to activate some #ifdef in the code, or exclude entire files or directories from build.

Another way is to create sub-projects within a project. Create the main project without a target, new projects for each configuration inside the main project folder, and additional directories for common code. CubeMX uses this approach to manage dual core MCUs, you might want to create a dummy project for a STM32H745 to see how does it look like.

ADovn.1
Associate II

Thanks a lot, I tried the first method, it is working as I desired.