cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMX different configurations for the same project

etamarin
Associate II

Imagine that two .ioc files exist for the same device, with identical peripherals defined but different settings/pin assignments.

If the user code written for device is not affected by the settings change (for example, the pin assignemnt is different for an SPI interface), is it somehow possible to indicate which codebase is to be used when building the application? For example, a CMake option for pointing to the generated code base on a setting, or something similar?

I am looking into maintaining a codebase across different generation of hardware so using such an option would be extremely useful.

1 ACCEPTED SOLUTION

Accepted Solutions
Pavel A.
Evangelist III

Generally this is done by conditional compilation (a.k.a. #define's) or conditionals in the build - using different libraries (for example, one with UART, another SPI). Eclipse (CubeIDE) supports this by having multiple project configurations. Good luck.

In Eclipse, the project configurations even can depend on different other projects - such as libraries (C/C++ General → Paths and Symbols → References)

 

View solution in original post

2 REPLIES 2
Pavel A.
Evangelist III

Generally this is done by conditional compilation (a.k.a. #define's) or conditionals in the build - using different libraries (for example, one with UART, another SPI). Eclipse (CubeIDE) supports this by having multiple project configurations. Good luck.

In Eclipse, the project configurations even can depend on different other projects - such as libraries (C/C++ General → Paths and Symbols → References)

 

Thanks Pavel, I think going about it manually through using #defines is the way to go.