SolarOS

Native extensions

SolarOS Modules

Native modules extend SolarOS with applications, background jobs, hardware drivers, and reusable libraries. Browse the catalog below, or connect your device to Wi-Fi and open the package manager:

pkg

Native modules require an ESP32-S3 device with PSRAM and native-module support enabled in its firmware. Each module can have additional requirements, shown in its catalog entry.

Install and manage modules

Use these shell commands to check your system, list packages, and manage installed modules. Replace MODULE-ID with the ID shown in the module details:

pkg system
pkg available
pkg installed
pkg install MODULE-ID
pkg remove MODULE-ID

pkg checks the signed catalog against the device's exact SolarOS version, ESP target, and native ABI. It verifies each package's size and SHA-256 before installation. A module listed here may not yet have a published package for your firmware; use pkg available to see what you can install on your device.

Run a module

Installed applications run by module ID from the shell. Background jobs use the job commands, and driver modules register expansion drivers. Libraries load when a consumer acquires their API. Open a module's details for its controls, required assets, and usage.

See the native module guide, native media interfaces, and foreground app guide for the supported interfaces.

Official module catalog

Explore the modules.

16 modules in 2 categories. Select a module to read its requirements and usage.

Applications

Libraries

Application · Version 0.1.0 · ESP32-S3 · Requires PSRAM, graphics

amiga foreground app

Amiga 500 emulator for SolarOS on ESP32-S3, based on Makerstown/amiga500-esp32. It provides 1 MiB RAM, keyboard, mouse, joystick, audio and one read-only AmigaDOS floppy drive.

See the amiga manual for launch commands, controls, supported images and limitations.

Build and install

Build from this directory with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
cmake --build build --target typed_elf

Copy build/solaros_native_amiga.app.elf to modules/apps/amiga.elf on the preferred storage volume. The launch command is amiga.

The firmware must support lifecycle ABI 2, the pointer-events manifest flag and the foreground service through calendar_read. Boards with 8 MiB PSRAM are recommended. Launch requires at least 3 MiB free PSRAM and 8 KiB free internal RAM after ELF loading, plus a 16 KiB worker stack.

Supply your own raw 256 KiB Kickstart 1.3 ROM and an optional 880 KiB AmigaDOS ADF image. These files are not included or modified.

cd /sdcard/amiga
amiga kick13.rom workbench.adf

Checks

Run the host tests from the SolarOS repository root:

python3 tests/test_amiga_module.py

Run the device checks on an idle display:

python3 tests/hil/amiga_module.py --host DEVICE_ADDRESS \
  --elf modules/amiga/build/solaros_native_amiga.app.elf \
  --size WIDTH HEIGHT --output /tmp/amiga-hil

The device check installs the module and uses its built-in diagnostic; no ROM or disk image is required. To run the diagnostic directly:

amiga --self-test
amiga --self-test /sdcard/amiga/diagnostic.ppm

Source and licenses

Upstream revision: ba0f6f10efde64abcd07c217ba46b5506dcc7a4b. The chipset sources come from esp32, with matching Musashi sources from pc/musashi and the ESP32 68000 configuration.

The upstream MIT license is retained in main/vendor/LICENSE. Musashi and SoftFloat license notices remain in their source files.

Package commands

Module ID: amiga.

pkg available
pkg install amiga

Library · Version 1.0.0 · ESP32-S3 · Requires PSRAM

AOgmaNeo resident library

aogmaneo.library.elf provides online learning through sparse predictive hierarchies, reinforcement-learning actors, and image encoding/reconstruction. It runs on ESP32-S3 with executable PSRAM and the native-module service. The engine remains in the optional ELF. The service.aogmaneo firmware frontend provides Python/Lua bindings and is selected by the Python and Lua groups on supported boards. It registers no shell command.

The versioned C API is solar_os_aogmaneo_abi.h. Native apps and jobs acquire library ID aogmaneo, provider ABI 1, and retain their lease until every model has been destroyed. The table supports up to eight hierarchy/image models in total. Shutdown refuses while any model is live. All calls run synchronously on the caller's task, using a single execution thread. Overlapping or reentrant calls return INVALID_STATE.

Hierarchies accept categorical columns with input-only, prediction or action roles, recurrent layers, online learning, reward and imitation input, predicted categories, activations and actor value estimates. The image encoder accepts byte channels, returns categorical columns and reconstructs visible layers. Each model has independent seeded random state. Learning parameters use the pinned upstream defaults. ABI 1 does not expose model persistence. Python and Lua expose solaros.aogmaneo with matching hierarchy, actor and image operations. Each interpreter owns its model handles and closes them on exit, including after script errors. Explicitly destroy models when finished.

Buffers and descriptors are copied into provider-owned storage. Outputs are copied into caller buffers. No C++ object, borrowed output pointer, exception, file, display or worker is exposed. An allocation or engine failure during a step invalidates that model; destroy and recreate it. See the manual for dimensions, buffer order and usage.

Build

python3 modules/aogmaneo/build.py

The builder configures an isolated PlatformIO SDK under .pio/aogmaneo-sdk for esp32_s3_devkitc1_n16r8, without building or flashing firmware. --environment selects another ESP32-S3 SDK. Reuse an existing configured SDK with --sdk-build-dir .pio/build/esp32_s3_devkitc1_n16r8. --output selects the artifact directory. CMake exposes typed_elf for module catalog tooling.

Outputs under .pio/modules/aogmaneo/ are aogmaneo.library.elf, aogmaneo.debug.elf, and build.json containing the upstream revision, SDK directory, artifact size, SHA-256 and verified imports. The public C header is embedded in the library ELF for the installed cc SDK. The private C++ runtime, linker layout and exception-frame tools come from modules/espdl; the ESP-DL library is not a runtime dependency. GCC 14.2.0 is required for this runtime. The builder rejects unsupported imports and relocations.

Once the module is in a compatible signed catalog, install it with pkg install aogmaneo. It is stored as modules/libraries/aogmaneo.elf in the preferred volume. Acquisition loads the installed file without network access. Unused libraries can be unloaded with pkg unload aogmaneo.

Script examples

Run Python or Lua after installing the library. Both examples train a hierarchy and encode/reconstruct an image. Model/layer indexes are zero-based in both languages; Lua list tables use their normal one-based array positions. See the manual for signatures, descriptor fields and defaults.

Native C example

Copy examples/predict.c and examples/cc.toml into the same device directory. With cc and the library installed, run:

cc build
load predict.elf

Upstream source, revision, local changes and licensing are recorded in vendor/README.solaros.md. AOgmaNeo uses CC BY-NC-SA 4.0; commercial use requires an appropriate upstream license.

Package commands

Module ID: aogmaneo.

pkg available
pkg install aogmaneo

Application · Version 0.2.0 · ESP32-S3 · Requires PSRAM, graphics

Apple II Plus foreground app

External SolarOS foreground app based on Reinette II Plus. Upstream snapshot: b272efd (2023-09-10). MIT notices and the license are retained under main/vendor. Apple II Plus and Disk II firmware ROMs are embedded in the module; see ROM provenance. Disk images are supplied separately.

The module emulates an Apple II Plus with 64 KiB RAM including the language card, 40-column text, lores/hires and mixed graphics, two Disk II drives, paddles and the speaker. It supports NIB disk images. Undocumented CPU opcodes act as NOPs. The font is derived from upstream assets/font-normal.bmp.

Build with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
idf.py build
cmake --build build --target typed_elf

The manifest declares a resumable GUI app, a 16 KiB worker stack and priority 1. Launch admission checks its internal-memory and PSRAM requirements.

Artifact: build/solaros_native_apple2.app.elf. Copy it to storage and run:

load /sdcard/solaros_native_apple2.app.elf /sdcard/apple2/dos33.nib

Use pkg install apple2 to install from the module catalog, or copy the artifact to /sdcard/modules/apps/apple2.elf. Start BASIC or boot one or two disks:

apple2
apple2 dos33.nib
apple2 dos33.nib data.nib
session create apple2 display0 /sdcard/apple2/dos33.nib

No separate ROM files are needed. NIB images must be exactly 232960 bytes. Disk paths are relative to the launching shell's current directory, or absolute. The existing apple2 <disk-directory> [drive1.nib] [drive2.nib] form also works; relative disk names then use that directory. Files opens .nib images with the installed module. The firmware must provide resolve_path.

F1 saves drive 1; Alt+F1 saves drive 2. F2 shows status, F3 toggles disk acceleration, F4 mutes, F10 pauses, F11 resets the guest, and F12 shows help. Ctrl+Alt+Del or Ctrl+] exits to the SolarOS shell. Exit discards unsaved disk changes. The module requires firmware providing the foreground stop_requested callback. See the Apple II Plus user guide and native app reference.

Alt+Tab or Alt+Right switches to the next SolarOS session; Alt+Left switches to the previous session. Resume with these shortcuts or session fg ID. Switching pauses the guest and releases display, keyboard and audio resources; CPU, RAM and disk state, including unsaved changes, remain allocated. F10 pause is retained across session switches. The firmware must provide enable_suspend, suspend_requested and suspend.

The module uses the SolarOS foreground app service for display, keyboard, storage, timing and optional audio. Text and overlays follow terminal colors on color displays and use black on white on monochrome displays. Graphics retain their Apple II palettes. Native color displays use black aspect-ratio bars. The firmware must provide text_colors and video_open_ex. Changed frames are submitted asynchronously at up to 25 Hz. F2 includes guest speed, interpreter throughput and frame-rendering time.

Package commands

Module ID: apple2.

pkg available
pkg install apple2

Application · Version 0.1.0 · ESP32-S3 · Requires PSRAM, graphics

Commodore 64 foreground app

PAL C64 emulator for SolarOS on ESP32-S3, using the CPU6502, VIC-II, CIA and SID cores from retroelec/T-HMI-C64. The module includes the standard BASIC, KERNAL and character ROMs, so c64 boots directly to BASIC without external ROM files. --roms DIRECTORY selects an alternate set instead.

See the c64 manual for installation, ROMs, program loading, controls and compatibility.

Build

Build with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
cmake --build build --target typed_elf

The artifact is build/solaros_native_c64.app.elf. Copy it to modules/apps/c64.elf on the preferred storage volume. The module manifest is discovered by the standard module catalog builder; no firmware package or board driver is added.

Requires lifecycle ABI 2, the foreground service through video_dimensions, and the base memory service through free. Frame exchange and joystick axes are optional appended services. The app declares a 16 KiB worker stack, 8 KiB free internal memory and 2 MiB free PSRAM after ELF loading. Host allocation admission can still refuse a display buffer.

CPU and chipset work stays on the foreground worker. SolarOS owns display presentation, keyboard/button/axis routing, paths, file access, timing and audio output. A bounded single-producer/single-consumer PCM queue separates SID generation from the host audio callback. Close joins the callback before guest allocations are released. Suspend retains guest RAM, chip state and loaded media, clears held input and rebases pacing on resume. The adapter queries the selected output's sample rate before opening the synth, and converts the core's 16 kHz PCM to that rate in the callback. An overlap/add clock follower matches uneven guest production while preserving waveform pitch, with 128 ms of prebuffering and fades on underrun. The CPU uses direct C64 bus calls, and hot state and RAM use internal SRAM when the host can preserve its memory reserve. On 320-pixel-wide displays that fit the active picture, VIC renders into exchanged host buffers directly; other sizes use the fitted picture path.

Validation

From the firmware repository root:

python3 tests/test_c64_module.py

The host suite uses ASan/UBSan and original diagnostic ROM code. It checks CPU execution, banking, CIA keyboard scanning in both directions, multiple held keys, joystick axes, VIC modes and sprites, SID PCM, media bounds, display geometry, frame exchange, suspend/resume and allocation/error cleanup. It also checks that the bundled ROMs boot to READY. without file access. No external ROM downloads or files are needed.

On a device, c64 --self-test runs the original diagnostic guest without ROM or program files. This exercises CPU, video and optional audio through the normal session lifecycle. It is not a substitute for testing licensed software or measuring emulation speed on a particular board.

For automated device checks, c64 --self-test /sdcard/c64/diagnostic.ppm enables F2 snapshots in diagnostic mode only. It writes a 320×200 PPM and an 80-byte little-endian .state sidecar: C64S, version at offset 4, guest frames at 8, PC at 12, counter at 16, pause/audio/joystick mode at 20/24/28, keyboard rows at 32, joystick ports and guest CIA samples at 40, elapsed milliseconds at 44, presenter frames/replacements at 48/52, presenter microseconds at 56, PCM write/read indices at 64/68, underrun events at 72 and output frames at 76. Normal C64 software retains F2 as a guest function key. For ROM-based validation, --snapshot /sdcard/c64/guest.ppm explicitly reserves F2 for the same capture without replacing the guest ROMs.

Run the device acceptance suite on an idle display with stopped displayd and ftpd jobs:

python3 tests/hil/c64_module.py --host DEVICE_ADDRESS \
  --elf modules/c64/build/solaros_native_c64.app.elf \
  --output /tmp/c64-hil --require-audio

This installs and reads back the ELF, checks guest frames and CIA input, pause and retained suspension, audio ownership, cleanup and repeated relaunch. It leaves the installed ELF and diagnostic snapshots on the SD card.

Source and license

Upstream revision: fce5a1d8bf1deba34f8050175bbfcb6969db1b32. Upstream core files carry GPL-3.0-or-later notices. The license text is in main/vendor/COPYING; the SolarOS adapter is also GPL-3.0-or-later.

Vendored from upstream src/:

  • CPU6502.{cpp,h}: CPU core.
  • CIA.{cpp,h}: timers and time-of-day clock.
  • VIC.{cpp,h}: raster renderer, modes, sprites and collision detection.
  • SID.{cpp,h}: voices and sample generation.
  • C64Sys.{cpp,h}: memory bus and raster execution, reduced to a bounded core.

Local changes remove hardware factories, permanent tasks, upstream ROM embedding, overlays, BLE/web input, network/OTA, filesystem drivers and the floppy/UI layer. VIC buffers are caller owned and expanded sprites clip each output pixel. SID fills exactly 320 samples per PAL frame at 16 kHz, avoiding the upstream per-raster buffer overrun, retains oscillator phase on wrapping and uses the sustain register's high nibble. The memory bus uses a full keyboard matrix, honors the CPU port direction register, masks color RAM and converts the SID envelope after scaling. No game images are included. D64/1541, cartridges, tape and in-guest file I/O are not implemented.

The bundled Commodore ROMs are separate from the GPL emulator code and retain their original Commodore copyright. ROM provenance records the Zimmers source files and pinned SHA-256 digests. Build generation checks each file's size and hash and embeds it as read-only module data; the build does not download assets. The default guest reads these arrays directly, without allocating a second ROM copy.

Package commands

Module ID: c64.

pkg available
pkg install c64

Application · Version 0.7.0 · ESP32-S3 · Requires PSRAM

C compiler

cc compiles C source files on ESP32-S3 devices with PSRAM into native SolarOS applications. On firmware without the built-in compiler, install it with pkg install cc; its matching tinycc library is installed automatically.

The full flavor includes the cc group by default on ESP32-S3 boards with PSRAM. Other flavors can enable it in a custom build. It links this command and the TinyCC provider into the image using the same sources and ABI. This form requires no installed compiler packages. An installed cc command can also acquire the built-in tinycc provider through normal library leases.

cc main.c helpers.c -o program.elf
load program.elf

Run cc or cc --help to print usage and return success without compiling.

For a repeatable project build, put cc.toml beside the source directory:

sources = ["src/main.c", "src/helpers.c"]
include_dirs = ["include"]
output = "build/demo.elf"
dependencies = [{ id = "hello-library", version = "1.1.0" }]
cc build
load build/demo.elf

cc build reads cc.toml in the current directory. cc build /dev/demo/cc.toml selects another project. Relative source, include and output paths are based on the project file's directory, independent of the calling shell's directory; absolute paths are also accepted. sources is required; include_dirs and dependencies default to empty arrays, and output defaults to a.elf beside the project file. The project example contains two source files and a local header.

Each dependency requires an installed library with SDK metadata matching its exact version. Checks read the library ELF without executing the provider. Missing libraries report a pkg install ID command; a version mismatch reports both versions. The repository must provide the required version. Build settings do not acquire runtime library leases; the application still uses the SolarOS library API. The compiler does not download packages during a build.

The project format is a bounded TOML subset: the four root keys above, single or double quoted strings, multiline arrays, comments and trailing array commas. Double quoted strings support escaped quotes and backslashes. Inline dependency tables contain id and version on one line. Other tables, multiline strings, Unicode escapes, unknown keys and duplicate keys are rejected with a line number. Project files are limited to 8 KiB, with at most eight source files, eight include directories and eight dependencies. Paths fit in 160 bytes including the terminator. Source lists contain explicit paths, with no wildcard expansion or shell recipes.

Every build recompiles all listed sources. After successful compilation and ELF validation, it creates missing output directories and replaces the executable through the existing recoverable writer. Failed compilation, dependency checks and cooperative cancellation preserve an existing executable. The output must differ from the project and source files, including case variants on FAT.

Use -I directory for local headers. SolarOS ABI headers and a bounded standard C library are included. Installed libraries can supply namespaced headers in their ELF packages: Jet provides <jet/solar_os_jet_abi.h>.

Browse the available SDK directly on the device:

cc sdk list
cc sdk show jet/solar_os_jet_abi.h
cc sdk export /dev/sdk
edit /dev/sdk/jet/solar_os_jet_abi.h

list shows header names, provider package versions and sizes. show prints the selected header. export requires a new destination directory, creates its parents and preserves the include namespaces. Use another destination for a fresh export after updating packages. Existing directories and edited headers are preserved. Library SDK metadata is read directly from installed files.

The Jet cube example builds a native foreground app with input, suspend/resume and clean exit. The compiler accepts up to eight source files totaling 64 KiB, eight include directories, a 2 MiB private compilation heap and a 20-second cooperative deadline. It validates the generated ELF before replacing the output file. This is a bounded C SDK; it does not provide full libc, POSIX, optimization or a general object/archive linker. See the compiler reference for the supported language and runtime operations.

Package commands

Module ID: cc.

pkg available
pkg install cc

Application · Version 0.1.0 · ESP32-S3 · Requires PSRAM, graphics

DOOM foreground app

External SolarOS ESP32-S3 app based on Espressif's esp32-doom revision 085f21b630f11adb69a3894db5a1efa39a7aa31a (PrBoom 2.5.0). The engine, tables, authors and GPL license are retained in main/vendor. The SolarOS adapter is GPL-2.0-or-later. No game WAD is bundled.

Build and launch

Build with ESP-IDF 5.5 for ESP32-S3, from this directory:

idf.py set-target esp32s3
cmake --build build --target typed_elf

Copy build/solaros_native_doom.app.elf to /sdcard/modules/apps/doom.elf, and supply a DOOM or DOOM II IWAD:

doom /sdcard/doom/doom1.wad
load /sdcard/solaros_native_doom.app.elf /sdcard/doom/doom1.wad
session create doom display0 /sdcard/doom/doom1.wad

Only one IWAD argument is accepted. PWAD overlays, DeHackEd patches, networking, music, savegames and persistent configuration are unsupported. The WAD remains on storage; keep it mounted and unchanged while the app is running or suspended. The game uses a 320x240 indexed frame, fitted by the host presenter. Palette flashes are converted to a fixed RGB332 palette. Monochrome output uses the host's display conversion. Missing PrBoom color tables use identity mappings; missing alternate HUD artwork uses the IWAD's original font. Vanilla IWADs use the standard engine switch and animation definitions when the Boom SWITCHES and ANIMATED tables are absent.

Sampled sound effects use the selected SolarOS audio output and global speaker level. The module mixes the engine's sound channels into stereo PCM, with resampling, distance attenuation and stereo positioning. The game's sound volume controls its mixer gain. An unavailable or busy audio output leaves the game usable silently. The IWAD must contain DS* digital sound lumps; Espressif's doom1-cut.wad omits them. Use an uncut shareware or owned full-game IWAD for sound effects. Music remains disabled.

Controls: arrow keys move/turn, Ctrl fires, Space uses doors/switches, Shift runs, Alt strafes, comma/period strafe left/right, 1–7 select weapons, Tab opens the map, Escape opens the menu, and Enter selects. Use a keyboard that supplies key releases for held actions. Text-only key sources provide taps.

SolarOS session shortcuts suspend the game. Resume retains game state, clears held keys, excludes suspension time from the game clock, and redraws the frame. Ctrl+] or session close ID closes it and releases all module allocations.

If a replacement ELF changes the app's resource declaration, reboot SolarOS before launching it. App discovery retains that declaration until restart.

The manifest declares a resumable GUI app, a 24 KiB worker stack, priority 1, 8 KiB free internal memory and 4 MiB free PSRAM minimum. These are launch admission checks, not reserved memory or a guarantee that every IWAD fits. The adapter uses only versioned SolarOS services and initializes no peripherals. Its PCM callback runs on the host audio worker and is joined before suspension or unload. Resume reopens the selected output and continues retained samples.

Source and validation

main/vendor/prboom and main/vendor/tables come from the revision above. i_main.c retains upstream platform startup; i_sound.c supplies the SolarOS sampled-effects backend. Local engine changes replace raw zone allocation, preserve integer booleans with SolarOS headers, remove hardware/IRAM headers, and supply fallbacks for optional PrBoom artwork and colormap markers, standard switch and animation tables, and cooperative checks during translucency-map generation. The table defaults reproduce the engine definitions in upstream's cut WAD. The adapter supplies tracked PSRAM, bounded read-only WAD access with an unlocked-lump cache, fixed-palette video, keyboard events, time, cooperative lifecycle checks and trapped engine exits. The DeHackEd translation unit supplies engine string defaults; patch processing is rejected by the adapter. Process-wide stdio and configuration access are disabled. Pure string helpers and libm are linked into the module.

Run the host tests from the SolarOS repository root:

python3 -m unittest discover -s tests -p test_doom_module.py
SOLAR_OS_DOOM_TEST_WAD=/path/to/doom1.wad python3 -m unittest discover -s tests -p test_doom_module.py

The optional IWAD fixture must contain Episode 1 and standard DOOM menus; digital sound lumps enable the audio integration cases. The host checks exercise gameplay, keyboard input, suspend/resume, close, sample mixing, resampling, malformed samples and directories, short reads, allocation failures and cleanup. Hardware frame rate, display behavior and memory availability depend on the selected device.

Package commands

Module ID: doom.

pkg available
pkg install doom

Library · Version 1.0.0 · ESP32-S3 · Requires PSRAM

Emotion library

Optional ESP32-S3 native library for procedural facial expressions and short synthesized reaction sounds. It requires the SolarOS native-module service and executable PSRAM. It contains authored eye geometry, without image or audio assets.

The versioned C contract is include/solar_os_emotion_abi.h. Acquire library emotion, ABI 1, through the native library service. Allocate state_bytes with normal heap alignment, call init, and serialize calls on each state. Keep the library lease until all state users have stopped. The library starts no workers and acquires no hardware; different states are independent.

The installed package publishes emotion/solar_os_emotion_abi.h for native C clients. Use cc sdk show emotion/solar_os_emotion_abi.h to inspect it, or cc sdk export NEW_DIRECTORY to export it with the other available SDK headers.

set changes the persistent pose. react temporarily replaces it, then returns to it after the transition and hold. A new reaction replaces the previous one; set cancels the reaction. look accepts -1000..1000 on each axis. Negative y looks up. blink closes and opens the eyes over 180 ms. Pass monotonic milliseconds to state operations. Timelines advance correctly when frames are skipped. Hosts may pause their clock during suspension.

render writes INDEX2 pixels, least-significant pixel first, with background index 0 and eye index 3. It preserves aspect ratio and clears row padding. The SolarOS host defaults to terminal foreground/background colors, with optional per-face overrides. Native consumers can build the presentation palette with solar_os_emotion_palette_rgb565(foreground, background, palette). Set animate=0 to suppress idle movement and automatic blinks. sound produces chunk-independent mono S16 samples for chirp, giggle, sigh, and alert cues. Playback, volume, and output ownership belong to the host.

Build with the ESP-IDF environment used for other external modules:

idf.py -B ../../.pio/emotion-module set-target esp32s3
idf.py -B ../../.pio/emotion-module build
cmake --build ../../.pio/emotion-module --target typed_elf

The artifact is solaros_emotion.library.elf. The top-level module.toml is consumed by the normal signed module catalog build. Installing a library does not start an expression or claim a display.

Python and Lua consumers use the firmware adapter described in the emotion manual. The runnable pose tours are Python and Lua.

Package commands

Module ID: emotion.

pkg available
pkg install emotion

Library · Version 3.3.13 · ESP32-S3 · Requires PSRAM

ESP-DL inference library

The espdl resident library supplies the ESP32-S3 inference engine for firmware that enables service.inference without backend.inference-espdl. It uses ESP-DL 3.3.13 with the configured SDK operator registry, including single, auto, and dual-core execution. It accepts validated, unencrypted, single-model EDL1/EDL2 buffers. File access, bundle validation, input adapters, model admission, and scripting APIs belong to the firmware frontend.

Usage

Mount storage and install from the signed catalog for your firmware version:

pkg install espdl
model backend
model load /sdcard/model.espdl

The library loads when the frontend first loads a model. Each model holds a lease until it closes and its workers finish. After closing all models, pkg unload espdl releases library code and runtime allocations without removing the installed file. pkg remove espdl also removes the file. Built-in firmware always uses its built-in engine. See Model inference for Python, Lua, native clients, bundles, and execution modes.

Native provider clients can include <espdl/solar_os_inference_backend_abi.h>. The package also carries its inference and image type headers. Browse the contract with cc sdk show espdl/solar_os_inference_backend_abi.h, or export it with cc sdk export NEW_DIRECTORY.

Build and catalog

Use the project's ESP-IDF 5.5 toolchain with GCC 14.2.0 and PlatformIO installed:

python3 modules/espdl/build.py

Outputs are .pio/modules/espdl/espdl.library.elf, arithmetic and vision probes, a debug ELF, and build.json with artifact hashes. The builder configures a separate SDK under .pio/espdl-sdk/build/<environment> using a generated copy of full with inference_backend enabled, then builds the ESP-DL and schema archives. It creates the compile commands automatically and refreshes the SDK on later runs. It does not compile or flash a firmware image or edit the checked-in flavor files.

--environment selects an ESP32-S3 PlatformIO environment; --output selects a folder. SOLAROS_PIO can select the PlatformIO executable. To reuse an already prepared SDK instead, pass --sdk-build-dir /path/to/build/<environment>; it must contain both archives and ESP-DL compile commands from a build with the backend enabled. The standard full flavor uses downloadable inference and does not supply these prerequisites by itself. CMake's typed_elf target wraps the same builder. CID's module deployment pipeline accepts this module's module.toml, validates imports and ELF structure, and signs the catalog. SOLAROS_ESPDL_ENVIRONMENT selects the SDK environment during deployment.

The builder makes private archive copies, replaces only the worker dispatcher, binds C++ symbols within the library, and verifies the final stripped ELF's imports and mapped relocations. Its only imports are the library host and memcpy, memmove, memset, memcmp, and strlen. The firmware ownership patch must be present in the SDK archives; the builder rejects unpatched sources.

The private runtime manages constructors, finalizers, exception frames, tracked allocations, and exception TLS. Dual workers use versioned host synchronization and joined internal stacks. Exceptions stay inside the provider; copied output buffers belong to the host and may outlive the model and library. Unavailable file/partition/crypto paths cannot be used by this buffer-only interface. Toolchain upgrades require review of exception-frame relocation and runtime layout.

The frontend transfers its aligned model-file allocation to providers that support load_owned_buffer, avoiding a second file-sized allocation during load.

Model weights and tensor descriptors remain loaded between calls. Activation workspace is acquired for each inference and released after its outputs are copied, including cancellation and error paths. Image decoding and other idle work can use that space between calls. Loaded-model memory estimates exclude the released workspace; execution still needs a contiguous workspace block. The original borrowed-buffer operation still copies its input. Both paths free the owned model source when the model closes, including failed construction.

Hardware checks

The arithmetic probe checks scalar int8, float32, SIMD int8, all execution modes, cancellation, oversized workspace rejection, leases, copied-output lifetime, and 15 complete library/model cycles:

python3 tests/hil/espdl_library.py --telnet DEVICE_ADDRESS \
  --artifacts .pio/modules/espdl --output .pio/espdl-arithmetic-check

Upload mode requires FTP, refuses an existing espdl install, uses unsigned maintainer ELFs, and removes only its own uploads. --installed --probe PATH uses staged files and leaves them in place.

For real-model parity, supply compatible vision models explicitly:

python3 tests/hil/inference_backends.py --telnet DEVICE_ADDRESS \
  --probe .pio/modules/espdl/espdl-vision-check.app.elf \
  --model /path/to/face-model.espdl --model /path/to/classifier.espdl \
  --output .pio/espdl-baseline --keep-fixtures

After changing to firmware without a built-in engine and installing the signed library, repeat with --installed .pio/espdl-baseline/fixtures.json and --expected .pio/espdl-baseline/results.json. The probe exercises typed inputs, all execution modes, cancellation/recovery, output parity, and worker teardown. Use --cleanup --installed PATH to remove retained fixtures. Firmware flashing and catalog hosting are separate maintainer actions.

Measured inference timing includes cooperative layer delays. Compare equivalent frontend workloads; these probes do not establish camera throughput or detector accuracy on images. Model files, workspace, copied outputs and loaded code all consume PSRAM; externalization saves firmware flash, not active inference RAM.

Package commands

Module ID: espdl.

pkg available
pkg install espdl

Application · Version 0.1.0 · ESP32-S3 · Requires PSRAM, graphics

Game Boy foreground app

External SolarOS app using the vendored Peanut-GB CPU core, ROM validator, packed video conversion and MiniGB APU. The original licenses are in main/vendor/peanut_gb. No ROM images are bundled.

Build with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
idf.py build
cmake --build build --target typed_elf

Artifact: build/solaros_native_gameboy.app.elf. Install from a compatible catalog with pkg install gameboy, or copy the artifact to /sdcard/modules/apps/gameboy.elf. Launch from a display shell:

gameboy /sdcard/roms/game.gb

You can also use session create gameboy display0 /sdcard/roms/game.gb or load /sdcard/gameboy.app.elf /sdcard/roms/game.gb.

Files opens .gb ROMs through the installed app's file association.

Arrow keys control the directional pad. The physical US-Z key position and X are A and B; the US-Z key is labeled Y on German QWERTZ keyboards. Enter is Start, and Backspace/Delete is Select. Character-only input pulses buttons for 140 ms. P pauses, R resets, and Q, Escape or Ctrl+] exits. On boards with a buttons input source, Enter is A, Space is B, the app-exit button is Start and Escape is Select; pressing Start and Select together exits.

The first ready joystick is used automatically, including when connected after launch. X/Y control directions with a dead zone (engage at 10000, release at 7000 on the normalized -32767..32767 range). Hats/D-pads also control directions. Buttons 1/3 are A, 2/4 are B, 9 is Select, and 10 is Start; pressing joystick Start and Select together exits. Unplugging releases its controls. Keyboard and board controls remain available. This module requires host firmware with native axis-event support.

Session switching retains guest CPU, RAM, cartridge RAM, pause state and APU state. Display and audio are released for the other foreground app. Resume clears held inputs and rebases frame timing. Closing writes modified cartridge RAM to a .sav file alongside the ROM using atomic replacement. Existing saves are loaded on launch; a size mismatch is reported. Reset preserves cartridge RAM.

The module accepts original Game Boy ROMs up to 4 MiB. Color-only ROMs and unsupported cartridge controllers are rejected. Video uses packed INDEX2 frames at up to 25 presented frames/s. The guest frame period is 16743 microseconds, with at most three catch-up frames. Audio uses MiniGB at 16 kHz stereo with gain 4 through the host synth service; unavailable audio leaves emulation running.

The foreground manifest declares an 8 KiB worker, priority 2, 16 KiB of internal memory and 256 KiB of PSRAM for admission. ROM and cartridge allocations are checked at launch. Hot core/APU state prefers internal RAM and can fall back to PSRAM. Two optional 16 KiB internal ROM caches preserve the OS reserve. See the foreground app contract. The Game Boy user guide covers installation, controls, and save files.

Package commands

Module ID: gameboy.

pkg available
pkg install gameboy

Library · Version 1.2.1 · ESP32-S3 · Requires PSRAM

Himax HX6538 processor

processor-himax is an optional native library for SSCMA model discovery and camera-bound inference, model programming and slot selection. The expansion driver owns SPI and camera sampling; this module owns programming policy, inference commands and result interpretation. It uses the versioned camera.sscma host service and shares exclusive camera ownership with Photo, camera captures and stream publishers.

The Watcher board profile selects backend.processor-himax, compiling this same provider into its firmware. Firmware builders can omit that package from the board's required packages and install the external library instead. Other ESP32-S3 boards with a himax-hx6538 expansion camera can use either form. Built-in providers do not load or depend on an installed ELF. Installed providers load on demand and retain a library lease until the pipeline closes.

Use

pipeline info himax
pipeline info himax camera0 models
pipeline start himax camera0 1
pipeline result 1
pipeline destroy 1

On firmware without the built-in provider, install processor-himax from a signed module repository that supplies it before using these commands. Building an ELF alone does not publish it to that repository.

The source must be the attached HX6538 camera's stream ID. Files, other camera drivers and RTSP sources are unsupported by this provider. They can still use the existing QR or ESP-DL processors.

Inference uses the Himax's currently configured model when model=0 in the pipeline configuration. A nonzero value selects that device slot, retaining the selection after the pipeline closes. It sends AT+INVOKE=1,0,0, retains the event's JPEG alongside its results, and performs no ESP32 pixel decoding. The module preserves SSCMA's boxes, classes, points, count and perf fields. coordinate_space is sscma; no unverified coordinate conversion or class labels are applied. perf contains preprocessing, inference and postprocessing milliseconds.

Queries are info, version, models, model, algorithms, identity, metadata, and slots. Slot metadata is reported as received: some factory firmware reports zero type/size values even while inference works. No readiness decision is based on these fields.

Model management uses the provider's optional management callbacks. The generic host owns dispatch and the model-upload background job, while this module validates schema-two bundles and implements the SSCMA/WE2 SPI programmer:

model upload himax camera0 /path/to/bundle.json 4 --replace
job status model-upload
model select himax camera0 4
model slots himax camera0

Upload accepts slots 1 through 4, protects the active slot, requires the reported four-slot layout, and checks hashes, labels, model interfaces and firmware requirements before writing. It checks page/CRC status, tests inference, restores the old selection and atomically updates /flash/.himax/<chip-id>.json. model slots himax camera0 joins live selection with recorded slot identities. Missing records remain unknown; removing a Zoo bundle does not remove this inventory. Uploads require mounted, writable internal flash. No atomic rollback of flash contents or full-image flash readback is claimed. See the user manual for cancellation, recovery, programming limits and the separate download step. Threshold changes, firmware updates and ESP-DL resident handles are unsupported.

Build

Build/configure an ESP32-S3 firmware SDK, then build the standalone library:

pio run -e seeed_sensecap_watcher
python3 modules/himax/build.py --sdk-build-dir .pio/build/seeed_sensecap_watcher

The output is .pio/modules/himax/processor-himax.library.elf with an import, size and SHA-256 report in build.json. The builder checks the loader's section and relocation subset. Its only firmware imports are the native library host and standard memory/string-length helpers.

himax-check.app.elf is a development probe. With the library installed under modules/libraries/processor-himax.elf, run it using load /path/himax-check.app.elf. It verifies three load/query/capture/close/unload cycles and prints HIMAX_LIBRARY_OK cycles=3 captures=3. It exports no camera images. This also checks the external provider on firmware containing the built-in provider.

The provider ABI is include/solar_os_processor_provider_abi.h. Consumers must hold a native-library lease through every call and client close. Copy borrowed frames before release_frame; JSON uses host memory and can outlive the module. The module has no global clients, background tasks or persistent allocations. Management also uses the host's storage.files and strict json tables. Close file leases and JSON roots before releasing the provider lease. Older providers retain the capture ABI prefix; callers check size and capability bits before accessing appended management methods.

The installed package publishes this contract as processor-himax/solar_os_processor_provider_abi.h. Native C clients can include that path directly. Use cc sdk show processor-himax/solar_os_processor_provider_abi.h or cc sdk export NEW_DIRECTORY to inspect or export it.

Package commands

Module ID: processor-himax.

pkg available
pkg install processor-himax

Library · Version 1.12.0 · ESP32-S3 · Requires PSRAM

Jet resident library

jet.library.elf supplies the Jet renderer behind the firmware's service.jet frontend and the Python/Lua solaros.jet bindings. It is loaded on demand from modules/libraries/jet.elf, with a lease for the entire scene lifetime. The renderer is not compiled into the firmware and registers no shell command.

The C provider ABI is solar_os_jet_abi.h. It provides a camera, directional and ambient lighting, cubes, indexed triangle meshes, transforms, removal and synchronous cancellable rendering. The host owns display claims, color/depth buffers and the shared presenter. RGB565 output is already in LCD wire byte order; MONO1 dithering belongs to the host presenter. Only one scene may be live, and calls must be serialized, because upstream still has shared material/trigonometric state. Exceptions stay inside the provider.

The optional size-checked extension adds reusable materials, textures and palette animation, mesh attributes, primitives, scene/camera controls, point lights, sprites, picking, in-memory asset loading, shared mesh instances, particle pools, lens flares, post-processing, tiled indexed textures, procedural shaders and renderer controls. Python and Lua expose the same operations. Script shader errors are contained during rendering and re-raised after the provider returns. Older providers retain the base scene API; scripts can query capabilities() before using extensions. Resources reject removal while in use.

See the Jet manual for script APIs and limitations. Examples are Python and Lua. Install the library from a compatible signed catalog with pkg install jet. The firmware does not download it while opening a scene. Close all scenes before pkg unload jet or pkg remove jet.

Build

Use the SolarOS ESP32-S3 toolchain and PlatformIO:

python3 modules/jet/build.py

Outputs are .pio/modules/jet/jet.library.elf, jet.debug.elf, and build.json with the artifact hash, imports and SDK environment. The builder configures a private SDK under .pio/jet-sdk, without building or flashing firmware. --environment chooses an ESP32-S3 PlatformIO environment; --sdk-build-dir can reuse a configured SDK containing compile_commands.json. --output selects the artifact folder. CMake's typed_elf target wraps this builder for the module deployment pipeline. module.toml declares a library module.

The build reuses the private C++ runtime, exception relocation checker and linker layout from modules/espdl; the installed ESP-DL library is not required. All runtime symbols are localized in Jet's ELF. Toolchain GCC 14.2.0 is pinned for the exception-frame layout. Allocation, synchronization, time and libc operations use versioned host services. The runtime clears exception TLS after each provider call and releases constructors, exception frames and tracked allocations on unload. The final ELF imports only the library host and five standard memory/string helpers; the builder rejects unsupported imports or relocations. Jet's DRAM-attributed constant tables are included in a mapped data section.

Upstream provenance and local renderer changes are recorded in main/vendor/README.solaros.md.

Package commands

Module ID: jet.

pkg available
pkg install jet

Application · Version 1.0.0 · ESP32-S3 · Requires PSRAM

Lua runtime

Install with pkg install lua on SolarOS ESP32-S3 firmware with PSRAM and native modules. Run lua for the REPL or lua SCRIPT.lua [ARG...] for a script. Playground uses the installed interpreter for Lua applications. Install Jet separately to run Boing.

The package contains the Lua VM, console, and Playground bindings for graphics, keyboard input, timing, tones, synthesis, and Jet scenes. The firmware-selected Lua runtime provides the full scripting API.

Build the package with the ESP32-S3 compiler on PATH:

cmake -S modules/lua -B /tmp/solaros-lua
cmake --build /tmp/solaros-lua --target elf

The build validates lua.app.elf with SolarOS's ELF validator. Lua sources are shared with the built-in interpreter. The application uses only SolarOS public service tables and does not use a board's firmware build products.

Package commands

Module ID: lua.

pkg available
pkg install lua

Application · Version 0.1.0 · ESP32-S3 · Requires PSRAM, graphics

Macintosh Plus foreground app

External ESP32-S3 SolarOS app based on epatel/esp32_mac, revision eaffb010eee2267672f1f766fcc4c5eb80cb5baa. The Musashi 68000 core, VIA, SCC, RTC, mouse and SCSI controller run in the SolarOS foreground worker. No Arduino, BLE server, board driver, SD mount, flash partition or separate emulator task is initialized by this module.

The guest has 4 MiB RAM, a monochrome screen matching the selected display, keyboard, mouse, and one optional SCSI disk or floppy. Audio and LocalTalk are not implemented. The IWM remains a stub; floppy access uses the replacement Sony driver described below. Pointer devices use the SolarOS foreground input service; keyboard mouse controls remain available.

Build and install

Build with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
cmake --build build --target typed_elf

Copy build/solaros_native_mac.app.elf to modules/apps/mac.elf on the preferred storage volume. The firmware must provide the foreground service through disk_close and recognize the pointer-events manifest flag. Device pointer input also requires read_pointer. This module uses lifecycle ABI 2, a 16 KiB worker stack and priority 1. Launch admission requires 8 KiB free internal RAM and 5 MiB free PSRAM after loading the ELF. Guest RAM needs a contiguous 4 MiB block; 8 MiB PSRAM boards can fail admission or allocation if other apps retain large buffers or memory is fragmented. Allocation failure returns to the shell.

mac /sdcard/mac/macplus.rom
mac /sdcard/mac/macplus.rom /sdcard/mac/hd.img
mac /sdcard/mac/macplus.rom --floppy /sdcard/mac/system.img
mac /sdcard/mac/macplus.rom --pointer-speed 2
session create mac display0 /sdcard/mac/macplus.rom --floppy /sdcard/mac/system.img
mac --self-test

ROM and guest disks are user-supplied and are not included. ROM loading checks the complete 128 KiB prefix against the Mac Plus v1, v2 or v3 checksum and reset vector. Extra trailing dump data is ignored. SCSI disks need 512-byte sectors and a guest bootable Apple partition map and driver. A raw HFS floppy is not a SCSI hard disk. The controller rejects transfers larger than its 32 KiB buffer and accesses past the image end.

Verified Plus v3 ROMs skip the long power-on RAM test in the in-memory copy. The host allocates and clears guest RAM before startup. Native display sizes other than 512×342 require Plus v3. Plus v1/v2 retain their original screen and require a 512×342 host surface.

--floppy accepts one raw 400 or 800 KiB image and requires a verified Plus v3 ROM (4d1f8172). It patches only the in-memory ROM copy with the open source Sony driver. The original ROM file is unchanged. Disk Copy containers and GCR/nibble images are not accepted. Floppy and SCSI attachments are mutually exclusive in this version.

Images are exclusively claimed through the SolarOS disk service. Guest writes update and sync the image immediately; use copies to preserve original disks. The image remains claimed while the app is suspended. Close the guest before mounting its image elsewhere or removing storage. PRAM is stored in a 32-byte .pram sidecar beside the ROM, on suspend and close. Serial-port settings start in offline asynchronous mode; LocalTalk is disabled when loading saved PRAM.

Display, controls and sessions

The app queries the selected display dimensions and patches the in-memory Plus v3 ROM so the guest uses that resolution. Each guest pixel maps to one display pixel: there is no scaling, cropping or letterboxing. Both dimensions must be 64..1024 pixels; larger surfaces may exceed the available PSRAM. Rows are word-aligned even when the visible width is not a multiple of 16 pixels. The app checks for screen changes at up to 25 Hz and submits only changed frames, with a complete redraw after resume. Hosts with video_open_mono1 keep video frames packed at one bit per pixel, including acquired/exchanged buffers. At 624x468 each frame uses 36504 bytes instead of 292032; the three host-owned video buffers save 766584 bytes together. Older hosts and targets without packed monochrome video use the indexed path. Guest RAM remains 4 MiB. Precomputed source rows, byte offsets and bit masks expand the packed guest pixels to display palette indices. Software that assumes the original Mac screen size may have windows or dialogs that do not fit smaller displays.

  • Letters, punctuation and modifiers use Macintosh keyboard scan codes.
  • Mouse and trackball devices move the guest mouse; the primary button clicks and drags. Touch acts as a touchpad: drag to move and hold the mouse button.
  • Keypad 4/6/8/2 move the mouse; hold keypad 5 to hold its button.
  • F8 toggles mouse mode: arrows move and Space holds the mouse button.
  • F2 saves the guest framebuffer as a .pbm sidecar beside the ROM.
  • F10 toggles pause.
  • Ctrl+] closes the app. SolarOS session shortcuts retain their normal use.

On character-only input sources, each arrow event moves six pixels and Space toggles the button because those sources do not supply key-release events.

Relative mouse and trackball deltas default to 5× speed. --pointer-speed N accepts an integer from 1 to 10, with 1 restoring the original speed. It can appear before or after the ROM or disk arguments. Touch movement and keyboard mouse controls are unaffected. The speed setting survives suspend and resume.

Suspend retains CPU, RAM, peripheral state, pause state and image claims. It releases display and input ownership. Resume clears held inputs and submits a complete frame. The guest has no callbacks or workers that survive module unload. CPU batches are bounded and yield to the host scheduler.

--self-test runs an original diagnostic ROM that fills the guest framebuffer with stripes and increments a RAM counter. It needs no Apple files and does not boot Macintosh software.

Source and licenses

The original Beer-Ware notices and Musashi MIT permission text are retained under main/vendor. SolarOS changes provide checked memory accesses, bounded execution, deferred device interrupts, recoverable failures, controller bounds, input translation and foreground lifecycle handling.

The replacement Sony driver comes from umac, revision b62d3c6e725ca2ac2224e710b3cee765dbc35e45, and its Basilisk II driver code by Christian Bauer. Its GPL notices, Matt Evans's notices, corresponding assembly source and generated bytes are retained under main/vendor/sony; see COPYING. SolarOS changes bound guest-memory spans, disk offsets, drive-queue traversal and transfer chunks, and update actual transfer counts. Plus v3 installs this driver even without a floppy image. Native-resolution patches in main/video.c derive from umac's MIT-licensed rom.c and Mini vMac's GPL-2.0 SCRNHACK.h by Paul C. Pratt; their notices are retained in that file.

To regenerate the bundled Sony stub with GNU m68k binutils:

cpp main/vendor/sony/sonydrv.S | m68k-linux-gnu-as -o /tmp/sonydrv.o
m68k-linux-gnu-ld /tmp/sonydrv.o -o /tmp/sonydrv.elf -Ttext=0
m68k-linux-gnu-objcopy /tmp/sonydrv.elf -O binary --only-section=.text /tmp/sonydrv.bin
xxd -i < /tmp/sonydrv.bin > main/vendor/sony/sonydrv.h

No Apple firmware, operating system, or disk image is part of these sources.

Package commands

Module ID: mac.

pkg available
pkg install mac

Library · Version 1.0.0 · ESP32-S3 · Requires PSRAM

Robot library

Optional ESP32-S3 native library implementing URDF models, transforms, calibrated rotary joints and differential drive. The versioned C API is solar_os_robot_abi.h. Motor/encoder velocity joints configure and tick bound OS controllers through native controllers ABI 1. Encoder scaling, velocity estimation and relative position belong to the encoder service. PID, ramping, deadband, friction feedforward and command freshness belong to the controller service. Motor polarity, output limits and stop behavior belong to the motor service. Standalone controllers bind those same enc.<name> sources and mot.<name> sinks without this library. Joint configuration is applied under endpoint/configuration claims and restored before release. No motor feedback loop or PID implementation is linked into the ELF. Servo-position joints own joint-to-servo conversion and calibrated limits. Joint control works without a URDF model or display.

controller tune accepts standalone PID instances only; robot-owned instances reject it. Stop the robot, tune an equivalent standalone controller, then copy reviewed candidate gains into the URDF and reload it. Tuning does not modify joint configuration or model files. See Feedback controllers.

The model API loads expanded URDF, validates a fixed/continuous/revolute/prismatic joint tree, accepts explicit position updates and computes frame transforms. Transform math supports RPY construction, composition, inverse, points and directions. Movable joints start unknown. Model-created continuous joints feed their measured relative encoder positions into model queries automatically; missing, stale, faulted or stopped feedback invalidates the position. Bounded joints require a referenced position. Manual state updates cannot override runtime-bound joints. The optional version-1 solar_os block declares motor/encoder velocity controllers; loading validates their configuration without creating controllers or claiming hardware. robot start creates and enables them, waiting with outputs stopped for fresh commands. robot stop releases model-owned controllers and retains the model. Stop before reloading or unloading; failed cleanup retains ownership for retry. The optional diff_drive component converts body velocity to owned wheel commands and integrates measured encoder odometry. Its OS frontend publishes command, odometry and parameter endpoints. Use stream write to publish one command or periodically update several command streams; stream echo reads feedback. The shell exposes robot model load, set, transform, point, vector, inspection and unload. Python/Lua provide matching model operations. See Robot models and transforms.

The shell exposes joint operations under robot joint. Continuous friction feedforward is configured with friction_bias_forward and friction_bias_reverse; an observed breakaway drive is a separate calibration quantity. There is no startup boost.

Native API

The library package includes its three public C headers. With cc and robot installed, use #include <robot/solar_os_robot_abi.h>; its model and differential drive headers resolve in the same namespace. Browse them with cc sdk list, cc sdk show robot/solar_os_robot_abi.h, or cc sdk export NEW_DIRECTORY.

The firmware's motion ABI supplies generic claims and device access. Its thread/time/memory services supply joinable workers, clocks and allocation. Creation does not claim hardware; enable is explicit. Motor enable waits with output stopped until the first fresh command arms the command watchdog. Feedback and fault monitoring continue while waiting. Every client must retain its library lease through disable, worker join and successful close. Failed cleanup retains resources and the object for retry. Unload refuses live joints. Command expiry stops output and returns to waiting; a fresh command resumes without disable/enable. Hardware and feedback faults remain latched. Counts per joint revolution are derived from PPR, the actual decoding factor and encoder placement/gear ratio, and are exposed as read-only status. The provider API is robot ABI 3 with appended model, transform and drive functions. Joint-only clients may request SOLAR_OS_ROBOT_JOINT_API_SIZE; model and drive clients must acquire a table large enough for the functions they use. The host motion and controllers ABIs are version 1.

Native callers can keep up to four model handles, independently of the shared shell/Python/Lua model. Model-created joints pin their model until closed. Close every joint, drive and model before releasing its library lease. Model state and parser scratch use the native PSRAM allocator. Input XML is consumed synchronously; callers can release it after load. Transform functions support aliased input/output, normalize nonzero quaternions and reject invalid transforms without changing the output. Transform math and scalar streams use float32; odometry pose storage uses double precision.

Drive I/O callbacks exchange command and status snapshots with a joint worker. Callbacks must not block or call back into robot/controller services, and their context must remain valid until diff_drive_close succeeds. See solar_os_robot_diff_drive.h.

Build and install

Build against a configured ESP32-S3 firmware SDK:

python3 modules/robot/build.py --sdk-build-dir .pio/build/goouuu_esp32_s3cam

Without --sdk-build-dir, the builder configures an isolated SDK under .pio/robot-sdk for --environment (default esp32_s3_devkitc1_n16r8).

Outputs are .pio/modules/robot/robot.library.elf, robot.debug.elf, and build.json with artifact size/hash and verified imports. Controller math remains in firmware. module.toml integrates the provider with the signed module catalog; CMake exposes typed_elf. The firmware provides native motion ABI 1 and controllers ABI 1 for motor velocity control. Update firmware and the ELF together. The standard install path is modules/libraries/robot.elf on the preferred storage volume.

See Robot joints for calibration, lifecycle, commands, Python/Lua APIs, units and limitations.

Package commands

Module ID: robot.

pkg available
pkg install robot

Application · Version 0.2.0 · ESP32-S3 · Requires PSRAM, graphics

Tiny386 foreground app

External ESP32-S3 SolarOS app using tiny386 at 9ed786b4dd9698306dccdb7595858dee10949994. BSD-3-Clause and upstream MIT notices are retained in main/vendor. The port uses SolarOS memory, timing, display, input and file services; it initializes no board peripherals.

The app emulates a 386 PC with 2 MiB RAM, 256 KiB VGA RAM, PS/2 keyboard, timer, RTC, floppy drive and IDE hard drive. The app queries the foreground display dimensions and submits a matching indexed frame. Text cells use the guest's VGA font and palette, with coverage sampling to retain thin strokes at smaller cell sizes. Graphics use a 640x400 VGA buffer and an aspect-preserving fit. This version has no guest networking, mouse or audio. Guest RTC starts at 2000-01-01. It supports 720 KiB, 1.2 MiB, 1.44 MiB and 2.88 MiB raw floppy images and one raw IDE image with 512-byte sectors, smaller than 2 GiB. Images are read and written directly through the host's disk-image service; writes sync before returning. Keep a copy of images whose original contents must be preserved. Unmount an image from SolarOS before starting the guest, and close the guest before mounting it to edit its files.

Build and launch

Build with ESP-IDF 5.5 for ESP32-S3:

idf.py set-target esp32s3
idf.py build
cmake --build build --target typed_elf

The BIOS and VGA BIOS are embedded in the ELF; no separate ROM files are required. The firmware must provide the appended foreground video_dimensions method and the appended disk-image methods through disk_close. Copy build/solaros_native_tiny386.app.elf to storage and run:

load /sdcard/solaros_native_tiny386.app.elf /sdcard/tiny386/dos.img

For installed app discovery, copy the artifact to /sdcard/modules/apps/tiny386.elf, then run:

tiny386 /sdcard/tiny386/dos.img
tiny386 /sdcard/tiny386/dos.img --hdd /sdcard/tiny386/harddisk.img
tiny386 --hdd /sdcard/tiny386/bootable-harddisk.img

The manifest declares a resumable GUI app, a 16 KiB worker stack, priority 1, 8 KiB free internal-memory minimum and 5 MiB free PSRAM minimum. These are admission checks; allocation failures return an error and release guest state.

Keyboard events go to the guest PS/2 keyboard. SolarOS session shortcuts switch away normally. Suspend retains the CPU, RAM and unsaved floppy changes, pauses guest timers, and releases foreground resources. Resume clears held keys and redraws the guest screen. Ctrl+] or session close ID closes the app and saves floppy changes before releasing allocations.

See the Tiny386 application manual.

BIOS source and licenses

The bundled ROMs use SeaBIOS revision 81ec9ec0bcf45df11fb7f98339ec9036b546fca0, tiny386's BIOS patches and the configuration under bios/. bios/seabios-source.tar.xz contains the corresponding unmodified source; bios/tiny386.patch contains the changes. SeaBIOS license texts are included as bios/COPYING and bios/COPYING.LESSER. Distribute these sources, patches, configuration and notices with the ROMs.

SolarOS changes to the vendored core provide bounded stepping, service-backed allocation, files and timing, trapped failures, and a VGA text-frame snapshot for rendering at the selected display's resolution. VGA retrace advances with CPU/device stepping independently of the host's 15 fps rendering limit. Text rendering caches guest glyphs and unchanged cells; a resumed session still submits a complete frame. CPU execution yields after bounded 8 ms batches. Register decrement/branch pairs retain the instruction budget and code-page checks. REP moves use bulk copies for separate RAM ranges; overlaps and device memory retain element-by-element access. Guest fonts remain in VGA RAM; no replacement font or guest disk image is bundled.

Rebuild the ROMs with a native x86 GCC/binutils toolchain, Python 3 and make:

python3 -B scripts/build_bios.py

The build uses a fixed version string. The resulting ROM bytes depend on the compiler and binutils versions. scripts/embed_bios.py converts the bundled ROMs into C data during the module build. No DOS, Windows or other guest disk image is bundled.

Package commands

Module ID: tiny386.

pkg available
pkg install tiny386

Library · Version 0.6.0 · ESP32-S3 · Requires PSRAM

TinyCC compiler library

TinyCC supplies the versioned compiler API used by cc on ESP32-S3 devices with PSRAM. On firmware without the built-in compiler, install the cc package for the command and its matching library. The package declares the firmware memory, worker, time and C helper tables it requires, so incompatible firmware is rejected during installation.

The optional cc firmware group links the same compiler and command into an ESP32-S3 image. Library acquisition selects this built-in provider without an installed ELF. The usual leases and busy checks protect its worker; unloading releases its runtime snapshot while the code and static state remain in the image. Private compiler, allocator and frontend symbols are isolated from the firmware and from each other. The full flavor enables this group by default on supported boards; other flavors can select it explicitly.

The provider compiles bounded C translation units into loadable SolarOS ELF modules. It uses a private heap, cooperative cancellation, a stack guard and explicit limits on sources, headers, output and compile time. It loads when a consumer acquires its API and can be unloaded after all leases are released.

Its built-in SDK includes the native service and compiler APIs, their shared image, vision and inference type headers, and the supported standard C headers. Use cc sdk list to browse these alongside the installed libraries' headers.

The compiler reference describes the C subset, limits, API, pinned upstream sources and build tools.

Package commands

Module ID: tinycc.

pkg available
pkg install tinycc