{"id":18103051,"url":"https://github.com/smittytone/rp2040-freertos","last_synced_at":"2025-04-05T02:11:15.788Z","repository":{"id":79034941,"uuid":"460869252","full_name":"smittytone/RP2040-FreeRTOS","owner":"smittytone","description":"Raspberry Pi RP2040 FreeRTOS baseline development project","archived":false,"fork":false,"pushed_at":"2025-02-21T08:09:21.000Z","size":2709,"stargazers_count":133,"open_issues_count":1,"forks_count":41,"subscribers_count":4,"default_branch":"main","last_synced_at":"2025-03-29T01:13:52.412Z","etag":null,"topics":["freertos","pico","raspberry-pi"],"latest_commit_sha":null,"homepage":"https://blog.smittytone.net/2022/02/24/how-to-use-freertos-with-the-raspberry-pi-pico/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smittytone.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-02-18T13:44:33.000Z","updated_at":"2025-03-24T14:37:51.000Z","dependencies_parsed_at":null,"dependency_job_id":"e793dd92-e71d-41de-9e3c-bf5044d07941","html_url":"https://github.com/smittytone/RP2040-FreeRTOS","commit_stats":null,"previous_names":[],"tags_count":10,"template":true,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smittytone%2FRP2040-FreeRTOS","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smittytone%2FRP2040-FreeRTOS/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smittytone%2FRP2040-FreeRTOS/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smittytone%2FRP2040-FreeRTOS/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smittytone","download_url":"https://codeload.github.com/smittytone/RP2040-FreeRTOS/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276189,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["freertos","pico","raspberry-pi"],"created_at":"2024-10-31T22:10:03.915Z","updated_at":"2025-04-05T02:11:15.773Z","avatar_url":"https://github.com/smittytone.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RP2040-FreeRTOS Template 1.5.0\n\nThis repo contains my base project for [FreeRTOS](https://freertos.org/) on the [Raspberry Pi RP2040 microcontroller](https://www.raspberrypi.com/products/rp2040/). It can be run as a demo and then used as the basis of a new project.\n\nMore details [in this blog post](https://blog.smittytone.net/2022/02/24/how-to-use-freertos-with-the-raspberry-pi-pico/).\n\n## Project Structure\n\n```\n/RP2040-FreeRTOS\n|\n|___/App-Template           // Application 1 (FreeRTOS template) source code (C)\n|   |___CMakeLists.txt      // Application-level CMake config file\n|\n|___/App-Scheduling         // Application 2 (scheduling demo) source code (C++)\n|   |___CMakeLists.txt      // Application-level CMake config file\n|\n|___/App-IRQs               // Application 3 (IRQs demo) source code (C++)\n|   |___CMakeLists.txt      // Application-level CMake config file\n|\n|___/App-Timers             // Application 4 (timers demo) source code (C++)\n|   |___CMakeLists.txt      // Application-level CMake config file\n|\n|___/Common                 // Source code common to applications 2-4 (C++)\n|\n|___/Config\n|   |___FreeRTOSConfig.h    // FreeRTOS project config file\n|\n|___/FreeRTOS-Kernel        // FreeRTOS kernel files, included as a submodule\n|___/pico-sdk               // Raspberry Pi Pico SDK, included as a submodule\n|\n|___CMakeLists.txt          // Top-level project CMake config file\n|___pico_sdk_import.cmake   // Raspberry Pi Pico SDK CMake import script\n|___deploy.sh               // Build-and-deploy shell script\n|\n|___rp2040.code-workspace   // Visual Studio Code workspace\n|___rp2040.xcworkspace      // Xcode workspace\n|\n|___README.md\n|___LICENSE.md\n```\n\n## Prerequisites\n\nTo use the code in this repo, your system must be set up for RP2040 C/C++ development. See [this blog post of mine](https://blog.smittytone.net/2021/02/02/program-raspberry-pi-pico-c-mac/) for setup details.\n\n## Usage\n\n1. Clone the repo: `git clone https://github.com/smittytone/RP2040-FreeRTOS`.\n1. Enter the repo: `cd RP2040-FreeRTOS`.\n1. Prepare the submodules: `git submodule update --init`.\n1. Install Pico SDK submodules: `cd pico-sdk \u0026\u0026 git submodule update --init`.\n1. Optionally, edit `CMakeLists.txt` and `/\u003cApplication\u003e/CMakeLists.txt` to rename the project.\n1. Optionally, manually configure the build process: `cmake -S . -B build/`.\n1. Optionally, manually build the app: `cmake --build build`.\n1. Connect your device so it’s ready for file transfer.\n1. Install the app: `./deploy.sh`.\n    * Pass the app you wish to deplopy:\n        * `./deploy.sh build/App-Template/TEMPLATE.uf2`.\n        * `./deploy.sh build/App-Scheduling/SCHEDULING_DEMO.uf2`.\n    * To trigger a build, include the `--build` or `-b` flag: `./deploy.sh -b`.\n\n## Debug vs Release\n\nYou can switch between build types when you make the `cmake` call in step 5, above. A debug build is made explicit with:\n\n```shell\ncmake -S . -B build -D CMAKE_BUILD_TYPE=Debug\n```\n\nFor a release build, which among various optimisations omits UART debugging code, call:\n\n```shell\ncmake -S . -B build -D CMAKE_BUILD_TYPE=Release\n```\n\nFollow both of these commands with the usual\n\n```shell\ncmake --build build\n```\n\n## The Apps\n\nThis repo includes a number of deployable apps. The project builds them all, sequentially. Exclude apps from the build process by commenting out their `add_subdirectory()` lines in the top-level `CMakeLists.txt`.\n\n### App One: Template\n\nThis C app provides a simple flip-flop using an on-board LED and an LED wired between GPIO 20 and GND. The board LED flashes every 500ms under one task. When its state changes, a message containing its state is added to a FreeRTOS inter-task xQueue. A second task checks for an enqueued message: if one is present, it reads the message and sets the LED it controls — the GPIO LED — accordingly to the inverse of the board LED’s state.\n\n![Circuit layout](./images/plus.png)\n\nThe code demonstrates a basic FreeRTOS setup, but you can replace it entirely with your own code if you’re using this repo’s contents as a template for your own projects.\n\n### App Two: Scheduling\n\nThis C++ app builds on the first by adding an MCP9808 temperature sensor and an HT16K33-based LED display. It is used in [this blog post](https://blog.smittytone.net/2022/03/04/further-fun-with-freertos-scheduling/).\n\n![Circuit layout](./images/scheduler.png)\n\n### App Three: IRQs\n\nThis C++ app builds on the second by using the MCP9808 temperature sensor to trigger an interrupt. It is used in [this blog post](https://blog.smittytone.net/2022/03/20/fun-with-freertos-and-pi-pico-interrupts-semaphores-notifications/).\n\n![Circuit layout](./images/irqs.png)\n\n### App Four: Timers\n\nThis C++ app provides an introduction to FreeRTOS’ software timers. No extra hardware is required. It is used in [this blog post](https://blog.smittytone.net/2022/06/14/fun-with-freertos-and-the-pi-pico-timers/).\n\n## IDEs\n\nWorkspace files are included for the Visual Studio Code and Xcode IDEs.\n\n## Credits\n\nThis work was inspired by work done on [KORE Wireless Microvisor FreeRTOS Demo code](https://github.com/korewireless/Microvisor-Demo-CMSIS-Freertos), but the version of the `FreeRTOSConfig.h` file included here was derived from [work by @yunka2](https://github.com/yunkya2/pico-freertos-sample).\n\n## Copyright and Licences\n\nApplication source © 2024, Tony Smith and licensed under the terms of the [MIT Licence](./LICENSE.md).\n\n[FreeRTOS](https://freertos.org/) © 2021, Amazon Web Services, Inc. It is also licensed under the terms of the [MIT Licence](./LICENSE.md).\n\nThe [Raspberry Pi Pico SDK](https://github.com/raspberrypi/pico-sdk) is © 2020, Raspberry Pi (Trading) Ltd. It is licensed under the terms of the [BSD 3-Clause \"New\" or \"Revised\" Licence](https://github.com/raspberrypi/pico-sdk/blob/master/LICENSE.TXT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmittytone%2Frp2040-freertos","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmittytone%2Frp2040-freertos","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmittytone%2Frp2040-freertos/lists"}