tsandmann / freertos-teensy

FreeRTOS port with C++ std::thread support for ARM boards Teensy 3.5, 3.6, 4.0 and 4.1 (cortex-m4f and cortex-m7f)
92 stars 15 forks source link
cortex-m4 cortex-m7 freertos freertos-kernel teensy

FreeRTOS Port for Teensy 3.5, 3.6, 4.0, 4.1

This is a basic port of FreeRTOS for the Teensy 3.5, Teensy 3.6, Teensy 4.0 and Teensy 4.1 boards.

Introduction

To make FreeRTOS work on the teensy boards I had to adjust the EventResponder class of the Teensy Arduino core library and optimized some minor parts. Therefore a custom platform setting is used (platform = https://github.com/tsandmann/platform-teensy). It uses a more recent compiler toolchain (e.g. to support C++20) and a slightly modified Arduino core library. The latter is needed because FreeRTOS needs some interrupt vectors that are also used by the Arduino core (SysTick and PendSV for EventResponder) to be set up for the RTOS. The modified core library supports these services by running them ontop of the RTOS.

Notice

Consider this as experimental code and work in progress. If it breaks, you get to keep both pieces.

Current Limitations

PlatformIO Usage

  1. Install PlatformIO core as described here
  2. Clone this git repository: git clone https://github.com/tsandmann/freertos-teensy
  3. Open an example of the cloned repo, e.g. freertos-teensy/example/blink
  4. Select the correct project environment PlatformIO toolbar for your Teensy board, e.g. teensy41
  5. Build project: use Build button on the PlatformIO toolbar or shortcut (ctrl/cmd+alt+b)
  6. Upload firmware image
    • Connect USB cable to teensy board
    • Use Upload button on the PlatformIO toolbar or shortcut (ctrl/cmd+alt+t) and select "PlatformIO: Upload"
  7. Use a terminal program (e.g. minicom) to connect to the USB serial device
    • If you use minicom: goto Serial port setup settings and set Serial Device to your serial device (typically sth. like /dev/cu.usbmodemXXXXXXX or /dev/tty.usbmodemXXXXXXX)

Teensyduino Usage

There is a test version available which can be used with Teensyduino. If you want to try it out:

  1. Download the library here as a zip archive.
  2. In Teensyduino select "Sketch -> Include Library -> Add .ZIP Library" and specify the downloaded zip archive.
  3. Create a new sketch in Teensyduino, e.g. blink.ino.
  4. Copy the contents of main.cpp to it.
  5. Compile and upload the sketch as usual.

Currently there are the following limitations for Teensyduino projects:

Continuous Integration Tests

TBD