Framework for Stm32 MCU on C++ templates. Project based on "mcucpp" by Konstantin Chizhov. Support: I created public group in telegram, where I'll try help everyone with using the framework. Sorry, but I can answer only on russian:)
I'm using VSCode IDE + Platformio + GNU Arm Embedded Toolchain Version 10.3-2021.10 (it supports features from c++20). Basically c++17 is required, c++20 needed only for USB. But I'm planning to use more new features from modern C++ (such as concepts and maybe coroutines), so it's recommended to use latest toolchain.
- Download Visual Studio Code from official site and install it.
- Run VS code, Press Ctrl+Shift+X (or press Extension in left sidebar), input PlatformIO in search and push install. You can get some errors about python virtual environments. There is many solutions in Internet.
- Open PIO Home, push Platforms, check Emedded and print stm32 and press ST STM32 header.
- Press "Install" and wait.
- Open PIO Home Home, press New Project, input project name, board (examples for stm32f103) and CMSIS in Framework.
- Download new Arm Embedded Toolchain from official site. Choose gcc-arm-none-eabi-10.3-2021.10-win32.zip
- Unpack archive and copy witj replace folders bin, share, arm-none-eabi and lib to C:\Users\%Username%\.platformio\packages\toolchain-gccarmnoneeabi\ (With last Platofrmio update this directory has new name: toolchain-gccarmnoneeabi@VERSION). Warning! Do not delete files .piopm and package.json.
- Open PIO Home Home, press New Project, input project name, board (examples for stm32f103) and CMSIS in Framework. Press Finish.
- Copy Zhele/Zhele to lib folder.
- Copy some example in src folder or create new *.cpp file
- Edit platformio.ini for target device. In my case (stm32f103c8t6) platformio.ini like this:
platform = ststm32
board = bluepill_f103c8
framework = cmsis
debug_tool = stlink
upload_port = stlink
build_flags =
-D STM32F1
-std=c++20
build_unflags =
-std=c++11