How to set the MCU for a static C library in 'Properties->C/C++ Build->Settings->MCU Settings'
- December 4, 2019
- 1 reply
- 3443 views
So I've developed several 'MCU ARM GCC' static libraries for use in a range of STM32 devices.
They contain standard definitions and utility functions needed by many different projects.
When instantiating a standard, non-STM32 specific, 'MCU ARM GCC' static library, you are not promoted to select an MCU (nothing wrong here) however as you need to know the target for compilation, you need to somehow get this information to the compiler.

When instantiating a STM32 specific project, CubeMX allows you to select a target, which is then locked in to the project and not able to be changed. It is independent of the build settings.
Is there a way to tie the target to a build configuration?

This would allow me to have a single 'STM32Cube project file' with different build configurations for different targets. Ideally, this would not involve re-writing, hacking, or invoking external makefiles, scripts, or something else. Cube should manage all of this for me just as long as I can set the target, and then set all the regular specifics (soft FPs, instruction sets, etc...).