2025-11-08 4:26 AM - edited 2025-11-08 4:28 AM
Hi,
I create an empty project for Nucleo-L432KC with all default settings using STM32CubeIDE 3.6.4. on Win11.
Default settings are gcc toolchain and Debug preset.
Then, I switch to Release Preset (CMake: Select Configure Preset - as described in Development — STM32CubeIDE for Visual Studio Code Extensions Documentation 0.1.0 documentation).
After building in Build/Release, the compile commands are like
{
"directory": "C:/tmp/test2/build/Release",
"command": "C:\\ST\\cube\\gnu-tools-for-stm32\\13.3.1+st.9\\bin\\arm-none-eabi-gcc.exe -DRTE_DEVICE_STARTUP_STM32L4XX -IC:/tmp/test2/Inc -IC:/tmp/test2 -fdata-sections -ffunction-sections -Wl,--gc-sections -Wno-comment -O3 -DNDEBUG -std=gnu11 -mcpu=cortex-m4 -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mlittle-endian -mthumb -Wall -Wextra -Wpedantic -Wno-unused-parameter -Os -o CMakeFiles\\test2.dir\\Src\\sysmem.c.obj -c C:\\tmp\\test2\\Src\\sysmem.c",
"file": "C:\\tmp\\test2\\Src\\sysmem.c",
"output": "CMakeFiles\\test2.dir\\Src\\sysmem.c.obj"
},having two potentially conflicting optimization settings: -O3 ... -Os.
I would like to see more presets pre-defined like RelWithDebInfo and MinSizeRel and have a more direct way to configure all those flags.
Likewise some advanced docs explaining if/how to do a headless build with cmake (without VS code?), using cmake-gui to re-configrue/finetune a project creating new presets, what's the exact difference between configure and build presets and why do i have to learn all that, etc..
I like the STM32CubeIDE for VS Cube pretty much. But, even though the underlying tools are mostly open-source (toolchain, cmake) I'm still feeling somewhat "locked in" into a predescribed and rather complex workflow.
hth
KnarfB
2025-11-09 10:31 AM
@KnarfB
Sounds weird to me. Empty project is promoting the following to me so I'm facing no issue while switching from Debug to Release:
You're asking to more presets ... myself I like to get only x2 ... more by default will lead to more complex and confusing first guess proposal. If I need more, I'm able to define it/them myself and at least they will fit my need better.
2025-11-09 11:20 AM - edited 2025-11-09 11:26 AM
0.1.0 is obsolete now and too IDE isnt normal step. Latest MX version create cmakes...
Get started with STM32Cube for VS Code: from installation to debugging - YouTube
2025-11-10 12:12 AM - edited 2025-11-10 12:29 AM
Yes, my CMakeLists.txt looks like yours, okay.
But check Release/compile_commands.json.
Where does the additional -O3 come from and how to change? grep doesn't find it in my project folder.
more presets: cmake ships with 4 default configurations are Debug, Release, RelWithDebInfo, and MinRelSize.
KnarfB
2025-11-10 12:16 AM - edited 2025-11-10 12:30 AM
> 0.1.0 is obsolete
yeah, on my other machine the docs say 0.0.5.
But Switching Between Debug and Release Configurations is the same.
No, I don't use MX here, just "Create empty project".
KnarfB