PicoRuby is an alternative mruby implementation which is:
- Small foot print
- ROM: 256 KB (depending on build config)
- RAM: 128 KB or less (depending on app code)
- (Figures in 32 bit architecture)
- Portable
- Depends on only standard C library such as glibc, Newlib or Newlib-nano
- Reference microcontroller boards
- Raspberry Pi Pico - Arm Cortex-M0+, 264 KB RAM, 2 MB Flash
- mruby (mruby/mruby)
- mruby/c (mrubyc/mrubyc): Another implementation of mruby virtual machine
- picoruby.wasm: PicoRuby WASI runtime for WebAssembly
- PRK Firmware: Keyboard firmware for Raspberry Pi Pico
For detailed information on testing PicoRuby, refer to the Testing Guide.
- Prerequisites
- C toolchain
- git
- ruby (should be CRuby 3.4+)
git clone --recurse-submodules https://github.com/picoruby/picoruby
cd picoruby/
git submodule update --init --recursive # If you forgot --recurse-submodules when git clone
rake # same for `rake picoruby:prod`
rake picoruby:debug # for debug build
bin/picoruby -e 'puts "Hello World!"'- Building on a mac
- openssl is not linked in homebrew to avoid mixing with system ssl
- extend the C/LD flags to point to the right locations:
rake LDFLAGS=-L$(brew --prefix openssl@3)/lib CFLAGS=-I$(brew --prefix openssl@3)/include
See an example: build_config/r2p2-picoruby-pico.rb
rake command will make three kinds of executable binary
- bin/picorbc
bin/picorbc path/to/source.rbmakespath/to/source.mrbthat is VM code runs on an mruby-compatible virtual machine
- bin/picoruby
bin/picoruby source.rbexecutes Ruby just like normalrubycommand- You can do like
bin/picoruby path/to/your_script.rbto run your script
- bin/r2p2
- POSIX version of R2P2 (See mrbgems/picoruby-r2p2 for the Raspi Pico edition)
Part of this project was coded by Monstarlab with the support of the Ruby Association Grant Program 2020 and 2021.
See also picoruby/picoruby/wiki.
Copyright © 2020- HASUMI Hitoshi. See MIT-LICENSE for further details.
Copyright © 2020-2021 Monstarlab. See MIT-LICENSE for further details.