- π Summary
- π Folder structure
- π¦οΈ Packages
- π¨ Building
- π Running
- π§ͺ Testing
- π Debugging
- π Code style
- π Docker
- π Documentation
- π οΈ Windows Development Environment
- π₯ Contributing
- β¨ Contributors
- .docker/ - Docker build and format scripts for CI/CD.
- .github/ - GitHub Actions workflow files.
- .vscode/ - Visual Studio Code configuration files.
- cmake/ - Functions to include in the main CMake.
- config/ - Target and constants configuration values.
- cube/ - STM32CubeMX configuration and build files.
- include/ - Header files for class definitions.
- src/ - Source file for class implementations and executables.
- tests/ - Executable test files.
- micras_hal - Wrapper to the STM32 HAL, implementing the needed functionalities in C++ classes.
- micras_proxy - Intermediate abstraction layer for the hardware components.
- micras_nav - Mapping, planning and control algorithms to navigate inside a maze.
To build the project, it is first necessary to install some dependencies:
sudo apt install cmake make gcc-arm-none-eabiThen, initialize the library submodules:
git submodule update --init --recursiveThe STM32CubeMX program is also required. After the installation is completed, it is necessary to set the CUBE_CMD environment variable to the path of the STM32CubeMX executable or add it to the PATH.
Start the build process by creating a build folder inside the project root:
mkdir build && cd buildAnd then generating the build commands:
cmake ..The project can then be compiled by running:
make -jYou can list all available make commands by running:
make helpmeThe binaries can be flashed into the microcontroller using the STM32CubeProgrammer, which needs to be installed and added to the PATH variable. For flashing the main program, run the following command:
make flash -jIf the project has not been compiled yet, this command will also automatically compile the target.
Any test can be compiled and run using the same commands as the ones used for the main executable, but adding the test name without the file extension at the end:
make [test_name] -jmake flash_[test_name] -jIt is also possible to build all tests at once, using the command:
make test_all -jIt is possible to debug the project using GDB. To do that, first install gdb-multiarch, on Ubuntu, just run:
sudo apt install gdb-multiarchTo debug the project, you need to run the cmake command with BUILD_TYPE set to Debug or RelWithDebInfo, for example:
cmake .. -DBUILD_TYPE=DebugIf you are using Visual Studio Code, install the Cortex Debug extension. Then, generate the launch files for debugging with the command:
make debugIt is also possible to debug test executables, by first running the command:
make debug_[test_name]There are three configurations for debugging present at the .vscode/launch.json file that uses different programs:
For each debug type, you need to install the respective GDB server.
If using J-Link, flash the firmware by running the following command:
make jflash -jor if you want to flash a test:
make jflash_[test_name] -jThe project uses clang-format to format files, there is a .clang-format with the formatting rules for the project. To install it, on Ubuntu, run the following command on the terminal:
sudo apt install clang-formatIn order to format the project, run the following command in the build folder:
make formatThe project uses a linter in order to follow the best code practices. The linter used is clang-tidy, there is a .clang-tidy with the linting rules for the project. To install it on Ubuntu, run the following command on the terminal:
sudo apt install clang-tidyThe linting process is done by running the following command in the build folder:
make lintIt is also possible to lint the project and let the linter fix it using its suggestions:
make lint_fixDocker can be used to build the project inside a container, which makes it possible to implement CI/CD pipelines and develop in any environment, for this, it is necessary to have Docker installed on your system.
The project can be built without entering a container by running the following command:
docker compose run buildThis also works for formatting (docker compose run format) and linting (docker compose run lint).
To enter a container and mount the project folder, run the following command:
docker compose run devFrom inside the container, most of the previous sections can be executed, such as building and code style.
If Visual Studio Code is being used, it is possible to use the Dev Containers extension to develop inside the container with the other recommended extensions.
The project is documented using Doxygen. In Ubuntu, it is possible to install it with the following command:
sudo apt install doxygen graphviz texlive-latex-extra texlive-fonts-extraFor other operating systems, you can see download options on the official Doxygen page.
To generate the pdf documentation at the docs/ folder, run the following command inside the build folder:
make docsThe configuration is in the file Doxyfile.
If you are developing on a Windows machine using Windows Subsystem for Linux (WSL), we recommend installing the following tools on Windows and add them to the WSL PATH:
Our recommended workflow for Windows users is to use WSL for building the project while running STM32CubeMX, flashing tools, and GDB servers directly in the Windows environment. This setup provides a smoother development experience and avoids the need to passthrough the USB connections to WSL, allowing you to use the native Windows tools for flashing and debugging the project inside WSL.
However, if you prefer to keep everything inside WSL, you can manually define the environment variables JLINK_CMD and PROGRAMMER_CMD to point to the respective executables. If you need to passthrough USB devices to WSL, refer to the official WSL USB documentation for setup instructions.
Note
To debug while using WSL, it is recommended to enable Mirrored mode networking, so that you can directly access the ports created by the GDB server from inside the WSL.
To learn how to contribute to the project, see the following contribution guidelines.
-
Use the present tense ("Add feature" not "Added feature").
-
Use the imperative mood ("Move cursor to..." not "Moves cursor to...").
-
It is strongly recommended to start a commit message with a related emoji:
- π
:memo:for documentation. - π
:bug:for bug issues. - π
:ambulance:for critical fixes. - π¨
:art:for formatting code. - β¨
:sparkles:for new features.
For more examples, see this reference.
- π
The project workflow is based on GitHub Flow.
Thanks goes to these wonderful people (emoji key):
Gabriel Cosme Barbosa π» π π¬ π |
Pedro de Santi π» π π¬ π |
Matheus Rezende Pereira π» π π¬ π |
Eduardo Barreto π» π π¬ π |
Claudio Dardengo π» π π¬ π |
This project follows the all-contributors specification. Contributions of any kind welcome!