LoginSignup
5
3

More than 3 years have passed since last update.

MaixduinoでTOPPERSを動かしてみる

Last updated at Posted at 2020-01-31

はじめに

TOPPERSプロジェクトのニュースリリースに、64 ビット RISC-V プロセッサを搭載した Sipeed 社のMaixduino ボード対応、とありました。気になったので試してみました。とはいえ、ITRONという名前は知っているけど、TOPPERSって?という感じです。

前提条件

開発環境に関しては色々なページで解説されていますので省略します。PATHにツールチェーンを追加しておきます。

TOPPERS/ASPのソースとコンフィギュレータのダウンロード

TOPPERSのダウンロードページには何やらたくさんありますが、今回RISC-Vに対応されたのはTOPPERS/ASPカーネル、個別パッケージから入手する必要があるようです。

ダウンロードページ https://www.toppers.jp/asp-d-download.html

から、TOPPERS/ASPカーネル ターゲット非依存部パッケージ、RISC-V HI-FIVE1/K210アーキテクチャ・GCC依存部パッケージ、の2ファイルをダウンロードします。

asp-1.9.3.tar.gz
asp_arch_riscv_gcc-1.9.3.tar.gz

また、

から、コンフィギュレータ Release 1.9.6(Windows用バイナリ) もダウンロードします。

cfg-mingw-static-1_9_6.zip

ソースコードの展開

作業用のディレクトリを作成して、ダウンロードしたファイルを格納します。
Min-GWのコンソールでディレクトリを移動し、ファイルを展開します。

$ tar xvf asp-1.9.3.tar.gz
$ tar xvf asp_arch_riscv_gcc-1.9.3.tar.gz

aspフォルダー下にソースが展開されます。

コンフィギュレータも解凍します。

$ mkdir -p asp/cfg/cfg
$ unzip cfg-mingw-static-1_9_6.zip
$ mv cfg.exe asp/cfg/cfg

ツールチェーンの指定

展開された asp/target/k210_gcc/Makefile.target の39行目にツールチェーンが指定されていますが、Kendryte GNU Toolchainを指定してあげます。

#GCC_TARGET = riscv-none-embed
GCC_TARGET = riscv64-unknown-elf

ビルド

ターゲットとコンフィギュレータを指定して、コンフィギュレーションします。

$ mkdir OBJ
$ cd OBJ
$ perl ../configure -T k210_gcc -g ../cfg/cfg/cfg.exe

ビルドを実行します。

$ make depend
$ make

サンプルの実行

できあがったaspはELF形式なので、binに変換します。

$ riscv64-unknown-elf-objcopy -O binary asp asp.bin

フラッシュメモリに書き込みます。

$ kflash.py asp.bin

または

$ ktool.py asp.bin

Tera Term等でシリアル接続すると、次のようなログが出力されました。

TOPPERS/ASP Kernel Release 1.9.3 for K210 (Jan 31 2020, 10:09:56)
Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
                            Toyohashi Univ. of Technology, JAPAN
Copyright (C) 2004-2014 by Embedded and Real-Time Systems Laboratory
            Graduate School of Information Science, Nagoya Univ., JAPAN
Copyright (C) 2017-2019 by Education Working Group TOPPERS PROJECT

mSystem logging task is started on port 1.
Sample program starts (exinf = 0).
task1 is running (001).   |
task1 is running (002).   |
task1 is running (003).   |
task1 is running (004).   |
task1 is running (005).   |

...

おわり

Maixduino / Maix-Go で動作確認できました。

5
3
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
5
3