Show HN: MicroLua – Lua for the RP2040 Microcontroller
github.com
MicroLua is licensed under the MIT license.
I wanted to learn about Lua and about the RP2040 microcontroller. This is the result :)
github.com
MicroLua is licensed under the MIT license.
I wanted to learn about Lua and about the RP2040 microcontroller. This is the result :)
When I was 12-13 and had an R4 for my DS, I managed to install MicroLua and program some simple apps that showed shapes when the screen was touched in specific areas.
Looking at the page, I see it even has full Wi-Fi and Local Wireless support !
https://github.com/MicroLua/MicroLua/commit/b9dfa2407afe932b...
Apache Arrow's C GLib implementation works with Lua. From https://news.ycombinator.com/item?id=38103326 :
> Apache Arrow already supports C, C++, Python, Rust, Go and has C GLib support Lua: https://github.com/apache/arrow/tree/main/c_glib/example/lua
LearnXinYminutes Lua: https://learnxinyminutes.com/docs/lua/
OpenWRT is a Make-based Linux distro for embedded devices with limited RAM and flash ROM, x86, and docker. OpenWRT is built on `uci` (and procd and ubusd instead of systemd and dbus). UCI is an /etc/config/* dotted.key=value configuration system which procd sys-v /etc/init.d/* scripts read values in from when regenerating their configuration when $1 is e.g. 'start', 'restart', or 'reload' per sys-v. LuCI is the OpenWRT web UI which is written in Lua; which is now implemented mostly as a JSON-RPC API instead of with server-side HTML templates for usability and performance on embedded devices.
Notes on how to write a LuCI app in Lua: https://github.com/x-wrt/luci/commit/73cda4f4a0115bb05bbd3d1...
applications/luci-app-example: https://github.com/openwrt/luci/tree/master/applications/luc...
openwrt/luci//docs: https://github.com/openwrt/luci/tree/master/docs
https://openwrt.org/supported_devices
It's probably impossible to build OpenWRT (and opkg packages) for an RP2040W.
https://github.com/raspberrypi/pico-sdk/ links to a PDF about connecting to the interwebs with a pi pico: "Connecting to the Internet with Raspberry Pi Pico W" https://rptl.io/picow-connect
micropython/micropython//ports/rp2/boards/RPI_PICO_W: https://github.com/micropython/micropython/tree/master/ports...
micropython/micropython//lib: https://github.com/micropython/micropython/blob/master/lib
micropython/micropython//examples/network/http_server_simplistic.py: https://github.com/micropython/micropython/blob/master/examp...
micropython/micropython//examples/network/http_server_ssl.py: https://github.com/micropython/micropython/blob/master/examp...
raspberrypi/pico-sdk//lib: btstack, cyw43-driver, lwip, mbedtls, tinyusb https://github.com/raspberrypi/pico-sdk/tree/master/lib
raspberrypi/pico-examples//pico_w/wifi/access_point/picow_access_point.c: https://github.com/raspberrypi/pico-examples/blob/master/pic...
There's an iperf opkg pkg, or is it just netperf (which works with the flent CLI and GUI)?
raspberrypi/pico-examples//pico_w/wifi/iperf/picow_iperf.c: https://github.com/raspberrypi/pico-examples/blob/master/pic...
raspberrypi/pico-examples//pico_w/wifi/freertos/iperf/picow_iperf.c: https://github.com/raspberrypi/pico-examples/blob/master/pic...
FreeRTOS > Process management: https://en.wikipedia.org/wiki/FreeRTOS#Process_managememt
elf2uf2: https://github.com/raspberrypi/pico-sdk/tree/master/tools/el...
adafruit/circuitpython//tests/micropython: https://github.com/adafruit/circuitpython/tree/main/tests/mi...
adafruit/circuitpython//tools: https://github.com/adafruit/circuitpython/tree/main/tools
adafruit/circuitpython//tools/cortex-m-fault-gdb.py: https://github.com/adafruit/circuitpython/blob/main/tools/co...
RP2040 > Features: 2x ARM Cortex-M0 https://en.wikipedia.org/wiki/RP2040#Features
Other than that, nodeMCU is much more advanced :)
I have wanted to do something similar for either an existing language or a subset of such or for a minimal language I create. Do you have any suggestions on how to get started on that in terms of high-level steps?
For that, it helps if the existing implementation is already cross-platform and has few dependencies. Lua is great in this respect, as it only depends on a libc. The first step is to get it to compile for the target platform and have it execute a hard-coded "hello world" script. After that, it's only a matter of adding more libraries, one at a time.
I think it's inactive now, though.
The few convenient things that expect tables to be indexed using integers starting at 1 are the # operator to get the number of elements, and the ipairs function, used in the common idiom “for index, value in ipairs(t) do . . . end”.
Probably the number one reason not to start arrays at 0 in an educational language is that having the last element of an array of size 10 have an index of 9 causes quite a bit of confusion.
Roughly how long did it take you to get to this point?
I've been working on this in my spare time since March, so roughly 8 months.