Open2

「基礎から学ぶ 組込みRust」メモ@Apple Silicon

unokununokun

2章 環境構築の準備

ハードウエア(Wio Terminal)

p.24の「必要なハードウエアと購入先」を見て購入

最小限だけ購入するという手もあります。

  • Wio Terminal
  • USBケーブル(Type-C/Type-C)

Rust

インストール

以下のサイトを参考にインストールしました。
Rustの環境構築(Apple Silicon) 2020年12月版

クロスビルドツールチェインのインストール

これを実行しないとビルドエラーになります。

$ rustup target add thumbv7em-none-eabihf

参考) エラーメッセージ

error[E0463]: can't find crate for `core`
  |
  = note: the `thumbv7em-none-eabihf` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: could not compile `nb`

To learn more, run the command again with --verbose.
warning: build failed, waiting for other jobs to finish...
error[E0463]: can't find crate for `core`
  |
  = note: the `thumbv7em-none-eabihf` target may not be installed

error: aborting due to previous error

For more information about this error, try `rustc --explain E0463`.
error: build failed

参考) targetの調べ方
rustインストール直後のtarget一覧

$ rustup show
Default host: aarch64-apple-darwin
rustup home:  ユーザーディレクトリ/.rustup

stable-aarch64-apple-darwin (default)
rustc 1.51.0 (2fd73fabe 2021-03-23)

追加後のtarget一覧

unokun@air wio-terminal-blink-rs % rustup show
Default host: aarch64-apple-darwin
rustup home:  ユーザーディレクトリ/.rustup

installed targets for active toolchain
--------------------------------------

aarch64-apple-darwin
thumbv7em-none-eabihf

active toolchain
----------------

stable-aarch64-apple-darwin (default)
rustc 1.51.0 (2fd73fabe 2021-03-23)

開発補助ツール

macosの場合にはHomebrewなどのパッケージマネージャーを使って必要なモジュールをインストールするのが簡単です。

$ brew install git mincom sdl2 openssl

Cargoサブコマンドのインストール

$ cargo install cargo-generate
$ cargo install hf2-cli
$ cargo install cargo-hf2