Template to create FreeRTOS tasks using the team's middleware
- Clone it
git clone git@github.com:RobomasterOwltech/AppCodeTemp.git - Go into the newly generated directory
cd AppCodeTemp - Download the submodules
git submodule init && git submodule update - In case any of the dependencies needs to be updated, simply do:
git submodule update --remote
- Make sure that
postStartCommandvalue is set at the.devcontainer/devcontainer.json. - Make sure to have created and register ssh keys for Github, as done in DeployTools
- At the moment you clone the repo, modify the branch for the
robotConfigrepo. 1. This will Change the defines on theMakefile - Change the OwlDefines variables at
.vscode/c_cpp_properties.json
- Download docker:
- For Linux: https://docs.docker.com/engine/install/
- For Windows: https://docs.docker.com/desktop/setup/install/windows-install/
- For MacOS: https://docs.docker.com/desktop/setup/install/mac-install/ - From the project root folder (AppCodeTemp) go to ".devcontainer":
cd .devcontainer - Build the image:
docker build . - List the images:
docker images- Identify the ID of the image just built - Go to the project root folder (AppCodeTemp):
cd .. - Run the container in detach mode:
docker run -d --mount type=bind,source=$(realpath ./),target=/home/myProjects <YOUR_IMAGE_ID># Source is the absoluthe path to AppCodeTemp
All compilation steps need to be done form inside the container. To enter it:
- List containers:
docker ps- Identify the ID of the container- Enter the container:
docker exec -it <CONTAINER_ID> bash
From the project root folder (AppCodeTemp) call make
make allYou might need to specify the compiler path, in which case use:
make GCC_PATH=/path/2/compilerAlternatively, you can add it to your path, or set it as an environment variable.
If your build failed, then you can clean the
buildfoldermake cleanIf you are encountering problems, and would like to know what is being configured by the makefiles from other projects, try:
make showRobotConfig showRtosConfig
- Save your changes to the file.
- Copy it's relative path.
- If it is a C, add it in the
C_SOURCESvariable from theMakefile - In case your file is referencing any library, make sure it is present in the
C_INCLUDES
arm-none-eabi-gcc -c -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32F407xx -IrobotConfig/inc -Ieigen/Eigen -IDrivers/STM32F4xx_HAL_Driver/Inc -IDrivers/STM32F4xx_HAL_Driver/Inc/Legacy -IDrivers/CMSIS/Device/ST/STM32F4xx/Include -IDrivers/CMSIS/Include -IMiddlewares/Third_Party/FreeRTOS/Source/include -IMiddlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS -IMiddlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F -IMiddlewares/ST/stm32_mw_usb_device/Class/CDC/Inc -IMiddlewares/ST/stm32_mw_usb_device/Core/Inc -IowltechMiddleware/inc -Og -Wall -fdata-sections -ffunction-sections -g -gdwarf-2 -MMD -MP -MF"build/main.d" -Wa,-a,-ad,-alms=build/main.lst robotConfig/src/main.cpp -o build/main.o
If you were to change the C/C++ standard used, remember to change it in the IntelliSense, makefile, and c_cpp_properties.json
For more formatting options see the link.
If you would like to learn more about the used tools and information, then check:
- Quick intro to Makefiles (Video)
- GNU Make manual
- The GNU Make Book. John Graham-Cumming. No Starch Press
- Example on using Eigen