SkillAgentSearch skills...

Picoruby

PicoRuby is the smallest Ruby implementation for one-chip microcontrollers

Install / Use

/learn @picoruby/Picoruby
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

C/C++ CI

PicoRuby

PicoRuby is an alternative mruby implementation which is:

  • Small foot print (depending on build config)
    • RAM: 512 KB or less (PicoRuby with networking)
    • RAM: 128 KB or less (FemtoRuby)
  • Portable
    • Depends on only standard C library such as glibc, Newlib or Newlib-nano, and emcc
  • Reference microcontroller boards
    • Raspberry Pi Pico 2 W - Arm Cortex-M33, 520 KB RAM, 4 MB Flash with CYW43 network module
    • Raspberry Pi Pico - Arm Cortex-M0+, 264 KB RAM, 2 MB Flash

FemtoRuby?

From version 4.x, we call the artifacts below:

  • PicoRuby (used to be MicroRuby) ... mruby VM version
  • FemtoRuby (used to be PicoRuby) ... mruby/c VM version

mruby VM version is mainly being developed.

API documentation with some demo videos

https://picoruby.org/

<img src="docs/logos/fukuokarubyaward.png" width="212">

Depends on

Used by

Testing

For detailed information on testing PicoRuby, refer to the Testing Guide.

Build

  • 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

Cross compilation

See an example: build_config/r2p2-picoruby-pico.rb

Binaries

rake command will make three kinds of executable binary

  • bin/picorbc
    • bin/picorbc path/to/source.rb makes path/to/source.mrb that is VM code runs on an mruby-compatible virtual machine
  • bin/picoruby
    • bin/picoruby source.rb executes Ruby just like normal ruby command
    • bin/picoruby -e "puts 'Hello1'" also works
  • bin/r2p2

Acknowledgement

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.

Stargazers over time

Stargazers over time

License

Copyright © 2020- HASUMI Hitoshi. See MIT-LICENSE for further details.

Copyright © 2020-2021 Monstarlab. See MIT-LICENSE for further details.

View on GitHub
GitHub Stars980
CategoryDevelopment
Updated3h ago
Forks59

Languages

C

Security Score

100/100

Audited on Apr 7, 2026

No findings