LoginSignup
1
0

More than 1 year has passed since last update.

[2022年10月版] FreeRTOS Linux(QEMU)デモ

Last updated at Posted at 2021-09-17

はじめに

「LinuxでシンプルにFreeRTOSを体験する」
これを目的とした記事です(Windows版はこちら

本編

環境

  • Linux環境
    Ubuntu 20.04 LTSで動作確認

  • QEMU
    4.2.1

  • ARMツールチェイン
    10.2.1 20201103 (release)

  • FreeRTOS 202112.00
    GitHub最新版(執筆現在)

その他は適宜。

手順

QEMU(とmake)インストール

$ sudo apt-get install -y make qemu qemu-system-arm

ARMツールチェインのインストール

$ cd ~
$ curl https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu-rm/10-2020q4/gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2 -o gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2
$ tar -xjvf gcc-arm-none-eabi-10-2020-q4-major-x86_64-linux.tar.bz2

curlにかなり時間が掛かります)

パスを通す

~/.profileを編集、最下部に以下を追加。

export PATH="$HOME/gcc-arm-none-eabi-10-2020-q4-major/bin:$PATH"

GitHubクローン

Windowsデモ版と同様です。

$ cd ~
$ git clone https://github.com/FreeRTOS/FreeRTOS.git --recurse-submodules --depth 1

ビルド

ディレクトリ移動してmakeするだけ。

$ cd ./FreeRTOS/FreeRTOS/Demo/CORTEX_M3_MPS2_QEMU_GCC
$ make

実行

以下コマンドで、無事正常動作が確認できます。

$ sudo qemu-system-arm -machine mps2-an385 -monitor null -semihosting --semihosting-config enable=on,target=native -kernel ./build/RTOSDemo.axf -serial stdio -nographic
blinking
blinking
blinking
blinking
blinking
blinking
blinking
blinking

(軽く)解説

2つのタスク生成、その間のキュー送受信でもって、LED点滅を疑似っています。

main_blinky()が大元の関数ですので、後は煮るなり焼くなりで、知見を深めてください!

参考(ネタばらし)

実はここに記載した内容は、Readme.mdにすべて書いてあります。

おわりに

Windowsデモと同様に、要は

GitHubからコード取得してビルドして動かすだけ

です。とてもかんたんなので、何かきっかけ・参考になれば幸いです。

1
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
1
0