Copyrights 2020-2026 Embedded AMS B.V. Hoorn, www.EmbeddedAMS.nl, info@EmbeddedAMS.nl
Looking for a more elaborate description of this example? Please visit: https://embeddedproto.com/how-to-set-up-a-project-with-embeddedproto-using-stm32cubeide/
This example shows you how you can integrate Embedded Proto into your STM32CubeIDE toolchain. It has a simple code example, whenever you build this code the *.proto files will converted into source code and build aswell.
- Install STM32CubeIDE if you have not already. The project was last built with version 2.1.1.
- Install Python 3.11 or newer, the only dependency of Embedded Proto. See the installation instructions.
- Checkout this example repository including the submodule of Embedded Proto:
git clone --recursive https://github.com/Embedded-AMS/EmbeddedProto_Example_STM32CubeIDE.git. - Next setup the virtual environment for Embedded Proto by entering the folder
embeddedprotoand running thepython install.pyscript. Add--installer uvwhen you have uv installed, it is a lot faster.
The Embedded Proto library is header only and requires C++17. The project has the C++ language standard set to GNU++17 in both build configurations.
After generating and building the code the following sub folders will be present:
- Core - The sourcecode folder
- Generated - This folder is filled during the source code generation step. It includes the code generated by the Embedded Proto plugin for the .proto files.
- Debug - The binary output of the project
- Drivers - This folder contains the board support code provided by ARM and ST Microelectronis.
- embeddedproto - This is the submodule for embedded proto.
- proto - The location where the .proto files are located
Just open the project folder with STM32CubeIDE to import the project. As a pre-build step the IDE will call the script GenerateSrc.sh. This script runs the embeddedproto command from the virtual environment of the submodule and generates source code based upon the *.proto files.
The main.cpp holds a very simple infinte loop which over and over sets a new value in the protobuf message.
