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

Raspberry Pi PicoでRustによるLチカ

Posted at

Raspberry Pi Picoで、というかRP2040で自前のキーボードファームウェアをつくりたくなったため、ひとまずLチカをした件についての記録です。

本文

適当にぐぐった結果、これを使えばいいらしいとわかった。

> git clone https://github.com/rp-rs/rp2040-project-template.git
Cloning into 'rp2040-project-template'...
remote: Enumerating objects: 498, done.
remote: Counting objects: 100% (264/264), done.
remote: Compressing objects: 100% (121/121), done.
remote: Total 498 (delta 204), reused 147 (delta 142), pack-reused 234 (from 3)
Receiving objects: 100% (498/498), 109.92 KiB | 316.00 KiB/s, done.
Resolving deltas: 100% (252/252), done.

また、書き込み方法をデバッガが必要ない形式にしたいので、以下の通り変更。

.cargo/config.toml
# runner = "probe-rs run --chip RP2040 --protocol swd"
runner = "elf2uf2-rs -d"

そして、BOOTSELボタンを押しながらUSBケーブルを接続。

> cargo run --release
    Finished `release` profile [optimized + debuginfo] target(s) in 0.07s
     Running `elf2uf2-rs -d target\thumbv6m-none-eabi\release\rp2040-project-template`
Found pico uf2 disk H:\
Error: "Unrecognized ABI"
error: process didn't exit successfully: `elf2uf2-rs -d target\thumbv6m-none-eabi\release\rp2040-project-template` (exit code: 1)

はい、エラーになりました。

ここから試行錯誤をした結果、以下に落ち着きました。

ビルド済みのpicotoolを取得。

https://github.com/raspberrypi/pico-sdk-tools/releases/tag/v2.2.0-0
picotool-2.2.0-x64-win.zip

ツールをフォルダ毎仮置きでプロジェクト内に設置し、config.tomlを以下に書き換え。

.cargo/config.toml
# runner = "probe-rs run --chip RP2040 --protocol swd"
# runner = "elf2uf2-rs -d"
runner = "./picotool/picotool.exe load -v -x -t elf"

上記はこちらのIssueから勉強させてもらいました。
https://github.com/rp-rs/rp2040-project-template/issues/102

そして、実行。

> cargo run --release
    Finished `release` profile [optimized + debuginfo] target(s) in 0.07s
     Running `rp2040-project-template\./picotool/picotool.exe load -v -x -t elf target\thumbv6m-none-eabi\release\rp2040-project-template`
Loading into Flash:   [==============================]  100%
Verifying Flash:      [==============================]  100%
  OK

これで書き込みできました。

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

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?