LoginSignup
0
0

TeensyでFreeRTOSを使ってみよう

Last updated at Posted at 2023-12-28

みなさんRTOSは好きですか?

私はそこそこ好きです。大好きではない
Teensy4.1でFreeRTOSを使う場面があったので記録を残しておきます。

環境

freertos-teensyではTeensy4.1以外にもTeensy 3.5, 3.6, 4.0でも使えるそうです。
基本的にはvscodeにPlatformIOの拡張機能を導入して使います。ArduinoIDE(Teensyduino)でも一応使用可能なようです。

導入方法

freertos-teensyより引用

  1. Install PlatformIO core as described [here][PIOInstall]
  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][PIOToolbar] for your Teensy board, e.g. teensy41
  5. Build project: use Build button on the [PlatformIO toolbar][PIOToolbar] or shortcut (ctrl/cmd+alt+b)
  6. Upload firmware image
    * Connect USB cable to teensy board
    * Use Upload button on the [PlatformIO toolbar][PIOToolbar] 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)

簡単に言えば、リポジトリのexampleの中身をもとに使ってね、って感じです。

ただ、platformio.iniの中を下の様に書き換えることでも最低限使えるようになります。

platformio.ini
[env:teensy41]
platform = https://github.com/tsandmann/platform-teensy.git
board = teensy41
framework = arduino
lib_deps = 
	https://github.com/tsandmann/freertos-teensy.git
build_flags = -Wformat=1 -DUSB_SERIAL -DTEENSY_OPT_FASTER_LTO
upload_flags = -v
upload_protocol = teensy-cli

APIなどは一般的なFreeRTOSと全く同じように使えました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0