sudo apt update
sudo apt install build-essential gcc-arm-none-eabi git cmake python3 tio
git clone https://github.com/JeremyGrosser/picolua
cd picolua
mkdir build
cd build
cmake ..
make
Hold BOOTSEL button, connect USB.
sudo cp picolua.uf2 /dev/disk/by-label/RPI-RP2
tio -b 115200 /dev/ttyACM0
Ctrl-C Clear buffer
Ctrl-D Execute buffer
Ctrl-L Clear screen
lua> print("hello lua")
<Ctrl-D>
hello lua
lua> a=2
b=2
print(a*b)
<Ctrl-D>
4
A few simple bindings for SDK functions have been added as examples. Here we turn the LED on:
lua> LED=25
set_output(LED, true)
set_pin(LED, true)
<Ctrl-D>
Blinking is an exercise left to the reader.
The bootsel()
function will reset the chip for reflashing as if you'd held down the BOOTSEL button.
The lua-5.4.6 distribution is copied from the release source tarball with the following modifications:
- Added src/CMakeLists.txt, which lists all of the .c files except lua.c and luac.c
- Changed
LUA_32BITS
to1
in luaconf.h