zeptoforth is a portable subroutine-threaded / native code inlining Forth for Cortex-M0+/M4/M7/M33 microcontrollers which includes a preemptively multitasking RTOS using deadline scheduling designed to be able to compile to and run from both flash and RAM (the kernel of course exists in flash).
The library of code coming with zeptoforth includes support for the following:
- Lambda expressions
- VALUEs, 2VALUEs, and lexically-scoped local variables compatible with DO LOOPs
- Implicit compilation, where conditional/looping constructs are temporarily compiled during intepretation mode, executed, and then forgotten
- Closures
- Dynamically-scoped, task-local variables
- Double-cell and S31.32 fixed-point arithmetic, including the usual mathematical functions
- Hardware single-precision floating point (except on the RP2040 and STM32F411)
- SysTick
- Interrupt-driven serial IO drivers
- A simple GPIO abstraction layer that is maximally uniform across supported platforms
- GPIO and, where applicable, EXTI drivers
- Arbitrary UART support, beyond the console alone
- ADC support
- SPI support
- SDHC/SDXC card support
- FAT32 filesystem and MBR partition table on SDHC/SDXC cards support
- Support for loading code from files in FAT32 filesystems
- Rebooting via Control-C at the console, or Reboot in zeptocom.js
- Attention key commands via Control-T at the console, or Attention in zeptocom.js; currently the only attention key commands are 'z', which sends an exception to the main task, and 't', which, when the task monitor is active, displays information on all running task
- An optional task monitor (note that starting creates a task dedicated to it)
- Preemptive multitasking
- Action scheduling including synchronous messaging between actions on single tasks
- A disassembler
- Moving the exception vector table into RAM so it can be arbitrarily set
- Task notifications
- Semaphores
- Locks
- Signalling exceptions on other tasks
- Message-oriented channels
- Message-oriented rendezvous channels (aka "fchannels")
- Message-oriented synchronous bidirectional reply channels (aka "rchannels")
- Message-oriented ISR-friendly channels (aka "schannels")
- Byte-oriented streams
- Software alarms
- Console redirection
- Object-orientation
- Maps, including counted string and integer-keyed maps
- Temporary buffers
- An allocator
- Memory pools
- Task pools
- Action pools (for the single-task event scheduler)
- A line editor
- LED drivers
- Random number generator drivers (except on STM32F411 "Black Pill" boards)
- Pseudorandom number generation support (using the TinyMT32 PRNG)
- Best-effort fault recovery
- swdcom support for non-UART-based terminal support
On the Raspberry Pi Pico (and other compatible RP2040-based boards) and Raspberry Pi Pico 2 and Pimoroni Pico Plus 2 (and other compatible RP2350-based boards) it also supports the following:
- An optional USB CDC console
- Programmable input/output (PIO)
- Hardware watchdog
- I2C, in both master and slave modes
- PWM, including both input and output
- Hardware timers
- Realtime clocks (note that on RP2350-based boards this is emulated using the Always-On Timer)
- Multicore execution; note that this can be combined with multitasking on each core and multitasking constructs can be shared by both cores
On the Raspberry Pi Pico W it also supports the following:
- An optional IPv4 stack for the Raspberry Pi Pico W, aka 'zeptoIP'.
- An optional SNTP (Simple Network Time Protocol) implementation for use with zeptoIP
On The Raspberry Pi Pico 2 and Pimoroni Pico Plus 2 (and other compatible RP2350-based boards) it also supports the following:
- The Always-On Timer, which counts time and may wake up the MCU as long as a small amount of power is applied
On the Pimoroni Pico Plus 2 (and other compatible RP2350-based boards with PSRAM) it also supports:
- Up to 8 MiB of PSRAM
- FAT32 filesystems in PSRAM
On the STM32F746 DISCOVERY board, the Raspberry Pi Pico and Raspberry Pi Pico W (and other compatible RP2040-based boards), and the Raspberry Pi Pico 2 and Pimoroni Pico Plus 2 (and other compatible RP2350-based boards) it also supports the following:
- Quad SPI flash memory
- A block interface
- A block editor
- FAT32 filesystems in block storage in Quad SPI flash
There is also optional support for
- Single-cell S15.16 fixed-point numerics support
- A profiler
- An optional text editor for editing files in FAT32 filesystems, aka 'zeptoed'.
- Transferring files to and from your host computer, useful in particular when using FAT32 filesystems in block storage in Quad SPI flash
- Bitmaps
- 16-bit pixmaps
- I2C SSD1306-based displays (currently these are only usable on the Raspberry Pi Pico (and compatible boards) as I2C has only been implemented for it as of yet)
- 16-bit SPI ST7735S-based displays
- 4-bit grayscale SPI SH1122-based displays; note that support for these is text-only
- Monospace bitmap fonts; note that a simple ASCII monospace bitmap font is included