Leveraging PlatformIO and STM32CubeIDE for Optimized STM32 Firmware Development

My preferred environment for firmware development is VSCode with PlatformIO. However, for one of my projects, I needed to develop on an STM32, and for this MCU family, STM32CubeIDE is the manufacturer’s recommended tool. Read more :point_right:

5 Likes

Hi,
Tip for STM32CubeIde to rename main .c ( or *.c ) to main.cpp for C++ projects.

  1. Create file ‘before.sh’ in project’s root directory as:
    mv ./Core/Src/main.cpp ./Core/Src/main.c
  2. Create file ‘after.sh’ in project’s root directory as:
    mv ./Core/Src/main.c ./Core/Src/main.cpp
  3. Start IOC configurator
  4. In IOC ‘ProjectManager’ → ‘Code Generation’
  5. Fill ‘User actions’ → ‘Before Code Generation’ and ‘After Code Generation’ browsing scripts generated in 1. and 2.
  6. Now the renaming is automated and user changes in main.cpp are preserved during code generation.
1 Like

Thank you, that’s good to know!