/Zhele

Framework for Stm32 MCU on C++ templates. Project based on great "mcucpp" by Konstantin Chizhov.

Primary LanguageC++BSD 2-Clause "Simplified" LicenseBSD-2-Clause

Zhele

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:)

Getting started

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.

  1. Download Visual Studio Code from official site and install it.
  2. 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. VSCode Extensions
  3. Open PIO Home, push Platforms, check Emedded and print stm32 and press ST STM32 header. PlatformIO platforms
  4. Press "Install" and wait. Install plaform
  5. Open PIO Home Home, press New Project, input project name, board (examples for stm32f103) and CMSIS in Framework. New project
  6. Download new Arm Embedded Toolchain from official site. Choose gcc-arm-none-eabi-10.3-2021.10-win32.zip Arm Embedded Toolchain download
  7. 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. Copy new toolchain
  8. Open PIO Home Home, press New Project, input project name, board (examples for stm32f103) and CMSIS in Framework. Press Finish. New project
  9. Copy Zhele/Zhele to lib folder. Copy Zhele
  10. Copy some example in src folder or create new *.cpp file Add source file
  11. 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
  1. Build project, upload it on your device. Building If VSCode doesnt build and shows editbox in top, restart VSCode and try again.