This repo contains my base project for a FreeRTOS application to be ran on the Raspberry Pi RP2040 microcontroller. This was developed using a Adafruit Feather RP2040.
The application connects using the default I2C interface to a BNO055 sensor and extracts pitch, yaw, and roll from it and prints it to stdio. Stdio is configured to be over UART using interface UART0 or USB.
Based on the work done by smittytone, details in this blog post.
/RP2040-FreeRTOS
|
|___/app // Application source code
| |___CMakeLists.txt // Application-level CMake config file
|
|___/config
| |___FreeRTOSConfig.h // FreeRTOS project config file
|
|___/FreeRTOS-Kernel // FreeRTOS kernel files, included as a submodule
|___/pico-sdk // Raspberry Pi Pico SDK, included as a submodule
|
|___CMakeLists.txt // Top-level project CMake config file
|___pico_sdk_import.cmake // Raspberry Pi Pico SDK CMake import script
|___deploy.sh // Build-and-deploy shell script
|
|___rp2040.code-workspace // Visual Studio Code workspace
|___rp2040.xcworkspace // Xcode workspace
|
|___README.md
|___LICENSE.md
To use the code in this repo, your system must be set up for RP2040 C/C++ development. See this blog post of smittyone for setup details.
- Clone the repo.
- Enter the repo.
- Install the submodules:
git submodule update --init --recursive
. - Create the build directory:
mkdir build
. - Manually build the app:
cmake --build build
. - Connect your device so it’s ready for file transfer.
- Press the BOOTSEL button followed by the RESET button to put the board in bootloading mode. The board should appear as a USB drive.
- Copy the file
${PROJECT ROOT}/build/app/rpi-pico-imu.uf2
to the USB device mounted by the bootloading process. - The board should restart and run the application.
If your board is a variant of the Raspberry Pi Pico, you need to specify this using the PICO_BOARD
cmake flag in step 5 of usage.
For example, the Adafruit Feather RP2040:
cmake --build build -DPICO_BOARD=adafruit_feather_rp2040
You can switch between build types when you make the cmake
call in step 5 of usage. A debug build is made explicit with:
cmake -S . -B build -D CMAKE_BUILD_TYPE=Debug
For a release build, which among various optimisations omits UART debugging code, call:
cmake -S . -B build -D CMAKE_BUILD_TYPE=Release
Follow both of these commands with the usual
cmake --build build
Workspace files are included for the Visual Studio Code and Xcode IDEs.
This work was inspired by work done on Twilio Microvisor FreeRTOS Demo code, but the version of the FreeRTOSConfig.h
file included here was derived from work by @yunka2.
Application template gerated from source code © 2023, by Tony Smith and licensed under the terms of the MIT Licence.
FreeRTOS © 2021, Amazon Web Services, Inc. It is also licensed under the terms of the MIT Licence.
The Raspberry Pi Pico SDK is © 2020, Raspberry Pi (Trading) Ltd. It is licensed under the terms of the BSD 3-Clause "New" or "Revised" Licence.