Hysen Labs
Open-source project
tabemann/zeptoforth avatar
tabemann

zeptoforth

A not-so-small Forth for Cortex-M

354 stars44 forksForthMIT
DEEP OPEN-SOURCE ANALYSIS

zeptoforth: a Forth implementation for Cortex-M microcontrollers

zeptoforth is a Forth system for RP2040, RP2350 and STM32 boards with a multitasker and drivers.

Supported hardware

zeptoforth is a Cortex-M Forth, and the README lists the boards it targets in detail. For the RP2040 family it names the Raspberry Pi Pico, the Pico W, the Arduino Nano RP2040 Connect, the Cytron Maker Nano RP2040, the SeeedStudio XIAO RP2040, and the WIO RP2040, all using a 25Q Quad SPI flash compatible with the Winbond part on the Pico. For the RP2350 it names the Raspberry Pi Pico 2 and the Pimoroni Pico Plus 2. For STM32 it names the STM32L476, STM32F407, and STM32F746 DISCOVERY boards, plus the STM32F411 Black Pill. The README notes that ports to more platforms are on hold because of the current chip shortage, with a possible STM32H7 port mentioned as a board the author already has. There is also a hack for getting zeptoforth working on STM32F411 Nucleo 64 boards using the binaries built for the Black Pill. A practical warning appears prominently: if you want .bin or .uf2 files to install zeptoforth, do not download the source zip or tar.gz that GitHub auto generates, because those are source only and lack the binaries. Instead, download the zeptoforth-x.y.z.tar.gz listed at the top of the latest release, which contains the .bin and .uf2 files. This distinction matters because new users often grab the wrong archive and then cannot find an installable image.

Kernel and language features

The zeptoforth kernel is written in assembly for the target: Thumb-1 for the RP2040 and Thumb-2 for the RP2350, the STM32L476, F407, F746 DISCOVERY, and the F411 Black Pill, with a further body of core code written in Forth that loads after the kernel. The included library, present in full, full_usb, and full_swdcom builds, is extensive. It provides a priority scheduled preemptive multitasker with deadline scheduling, semaphores, locks with priority inversion handling, message oriented queue channels, rendezvous channels called fchannels, and bidirectional synchronous reply channels called rchannels. There are byte oriented streams, software alarms, interrupt service handler safe channels called schannels, and task notifications. The language adds console redirection, implicit compilation from the REPL, action scheduler support, multicore support on RP2040 and RP2350, double cell and S31.32 fixed point numerics, and single precision floating point except on RP2040 and F411. Higher level features include lambda expressions, values and block scoped local variables, closures, dynamically scoped task local variables, object orientation, and a disassembler. This is a substantial surface for a microcontroller Forth, and it lets developers write concurrent, structured programs directly on the device instead of cross compiling large C code. The README's feature list reads like a small operating system kernel rather than a toy interpreter.

Peripheral and storage support

Beyond the scheduler and language, zeptoforth ships drivers and storage support for the hardware it runs on. GPIO is supported with EXTI on STM32, and general UART is available in addition to the serial console. There is one shot ADC support, SPI in both master and slave roles, and I2C master and slave on RP2040 and RP2350. PWM and hardware timers exist on RP2040 and RP2350, with RTC on RP2040 and RTC emulation through the Always On Timer on RP2350, plus Always On Timer support on RP2350 and PSRAM support on RP2350. The system provides maps including counted string and integer keyed maps, several allocator types such as heap, memory pool, task pool, action pool, and temporary storage allocators, a line editor, LED drivers, and SDHC or SDXC card support over SPI with FAT32. Code can be loaded from files on a FAT32 filesystem, and there are user level FAT32 tools. FAT32 also sits on top of block storage in on board Quad SPI flash on RP2040, RP2350, and F746, and on PSRAM on RP2350 boards that have it. A block editor, hardware and pseudorandom number generation using TinyMT32, programmable IO on RP2040 and RP2350, watchdog support, and optional swdcom and task monitor round out the list. Documentation lives on GitHub and a wiki, with an IRC channel on irc.hackint.org. The repository is published under the MIT license and its most recent commit was on 2026-08-26.

Editorial conclusion

zeptoforth is a Cortex-M Forth currently targeted at RP2040 boards such as the Raspberry Pi Pico, RP2350 boards such as the Pico 2, and STM32 boards including the L476, F407, F746 DISCOVERY and the F411 Black Pill. The README warns that binaries must be taken from the release tarball rather than the GitHub source zip. The repository is published under the MIT license and its most recent commit was on 2026-08-26.

DEEP OPEN-SOURCE ANALYSIS

Official sources

Community notes

Community notes