LoginSignup
3
2

More than 1 year has passed since last update.

Raspberry Pi Picoでmrubyが使えるようにしました。

Posted at

Raspberry Pi Pico用のmruby

mrubyをRaspberry Pi Pcioで使えるようにしました。

ソースコードの取得

$ git clone https://github.com/k-mana/pico-mruby.git --recursive

または

$ git clone https://github.com/k-mana/pico-mruby.git
$ cd pico-mruby
$ git submodule update --init --recursive

ビルドツールのインストール

$ sudo apt install cmake build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib rake

ビルド

$ cd pico-mruby
$ mkdir build
$ cd build
$ cmake ..
$ cmake --build .

pico-sdkのissue#623が発生すると動作しません。 その場合はsrc/pico-sdk/pico_stdio.patchを適用してください。

アプリケーション

デフォルトはUSBシリアル

hello_world

  • バイナリはbuild/src/hello_world/hello_world.uf2に作られます。
  • スクリプトまたはバイトコードを埋め込んだサンプルです。1秒ごとにHello worldを出力します。

pico_mirb

  • バイナリはbuild/src/pico_mirb/pico_mirb.uf2に作られます。
  • REPL(Read-Eval-Print Loop)のmirbとして動作します。

pico_mruby

  • バイナリはbuild/src/pico_mruby/pico_mruby.uf2に作られます。
  • USBマスストレージにcode.rbまたはcode.mrbが存在する場合、自動的に実行します。
  • 実行する優先順位は以下です。

    1. code.mrb
    2. code.rb
    3. REPLモード
  • USBマスストレージに書き込むと自動的に再起動します。

  • code.rbまたはcode.mrbの実行中にシリアル入力をするとREPLモードになります。

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