8
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

Wio TerminalでRustをやるのをちょっと途中で投げ出してました。
初心に戻ってArduinoからやり直そうと思います。

基本ここ↓をなぞっていけばよさそうですが手順通りに進めてもbuildできません :innocent:

ちょっと調べてみたところ以下のissueにヒットするようで、nightly-2021-01-07のtoolchainを使わないとbuildできないようです。

※LLVM側の問題の様子です
https://github.com/rust-lang/compiler-builtins/issues/400

環境構築

WindowsのWSLにRustを入れた後、nightly-2021-01-07のtoolchainをinstallしました。

rustup toolchain install nightly-2021-01-07
rustup component add rust-src --toolchain nightly-2021-01-07

Lチカ

installしたらこの方のコードをCloneします。

https://elchika.com/article/c74e9dd4-cdbe-4550-a4e9-60730bb374b0
https://github.com/grace2riku/avr-hal/tree/add_leafony

git clone -b add_leafony https://github.com/grace2riku/avr-hal.git
cd avr-hal/boards/arduino-uno/
cargo +nightly-2021-01-07 build --example uno-blink

buildできたらホスト側のTerminalからelfファイルをArduinoに書き込みます。
WindowsではAKBONEを挿したらデバイスマネージャーでポートを確認してCOM3=ttyS3に置き換えるといいようです。

avrdude -patmega328p -carduino -P/dev/ttyS3 -b57600 -D -Uflash:w:../../target/avr-atmega328p/debug/examples/uno-blink.elf:e

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e950f (probably m328p)
avrdude: reading input file "../../target/avr-atmega328p/debug/examples/uno-blink.elf"
avrdude: writing flash (374 bytes):

Writing | ################################################## | 100% 0.11s

avrdude: 374 bytes of flash written
avrdude: verifying flash memory against ../../target/avr-atmega328p/debug/examples/uno-blink.elf:
avrdude: load data flash data from input file ../../target/avr-atmega328p/debug/examples/uno-blink.elf:
avrdude: input file ../../target/avr-atmega328p/debug/examples/uno-blink.elf contains 374 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.08s

avrdude: verifying ...
avrdude: 374 bytes of flash verified

avrdude: safemode: Fuses OK (E:00, H:00, L:00)

avrdude done.  Thank you.

書き込みに成功してLEDが点滅すればOKです。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?