Skip to content
tsellaPublic

About

Bare-metal 60 FPS ESP32-S3 AMOLED SDK, PIE-SIMD 2D/3D engine, zero-PSRAM shader pipeline & drop-in LVGL shim — 100 KB Flash, 3 KB DRAM, 0 slow frames across 17 live demos.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

200 Commits

Folders and files

Repository files navigation

⚡ optimi_embedded (oe_*)

Multi-Board Bare-Metal 60 FPS Graphics, UI Engine, Shaders, Audio & Visual Studio for ESP32

Design once in OE-Studio, target any board via boards/<id>/board.yaml, and ship sub-8 ms, zero-tear, 100 KB Flash, 3 KB DRAM embedded UIs — with zero LVGL, zero Arduino_GFX, and zero vendor BSPs.

Version ESP-IDF Architecture OE-Studio 60 FPS Verified Host Tests License: MIT


Why optimi_embedded?

Most embedded UI stacks force an ugly trade-off: either accept 40 MHz vendor BSPs, ~500 KB Flash / 50+ KB internal DRAM bloat, and 25–40 ms frame drops, or spend months hand-coding pixel loops tied to a single PCB.

optimi_embedded (oe_*) gives you both worlds — silicon-level speed AND a multi-board, visual authoring workflow:

  • 🔌 Multi-Board by Design (oe_board + oe_hal + oe_gfx_geom.h) — Every board is declared in a validated boards/<id>/board.yaml (display geometry, shape, pixel format, pinout, power rails, IMU mount, RF limits, quirks, and its own baseline.json). Build-time tools/gen_board.py generates oe_board_config.h and propagates it across the entire firmware with 0 B runtime overhead. Switch targets with idf.py -DOE_BOARD=<id> build or add an out-of-tree board via OE_BOARD_DIR without forking the SDK.
  • 🎨 OE-Studio — Visual Embedded UI IDE & Native C Compiler — Design, prototype, localize, reflow across screen shapes, and flash directly to hardware from a zero-dependency browser studio. Exports native oe_ui C by default (-77% Flash, -100% PSRAM vs. LVGL shim) or clean LVGL 9 C in one click. 👉 Explore OE-Studio in depth →
  • 🚀 2×–12× Faster Than Stock BSP + LVGL — Measured on our reference board (Waveshare ESP32-S3-Touch-AMOLED-1.75C, 466×466 round CO5300 @ 80 MHz QSPI): 10.43 ms full-circle push/swipe, 4.47 ms 3D engine, 6.13 ms Bayer globe, 0.67 ms label update, and 0.00 ms / 0 SPI bytes when idle.
  • 🧩 Drop-In LVGL v8/v9 Compatibility Shim — Already have LVGL screens? Keep your existing lv_btn_create / lv_subject_* / lv_anim_timeline_* / lv_translation_* code untouched while shrinking the UI stack ~8× (0 B internal DRAM).
  • 🔋 Wearable-Grade Power & Formal Reliability — Automatic 240 ↔ 80 MHz DFS, -92% idle wakeups via hardware touch IRQ (< 15 µs wake), CO5300 0x39 IDMON 8-color AOD, on-demand IMU standby, and 18 formally specified state machines (SM-1–SM-18) backed by 140 C++ host tests (ASan + UBSan) and 121 OE-Studio tests.

🎨 Meet OE-Studio — From Visual Design to 60 FPS Silicon in Minutes

Stop hand-tuning pixel coordinates in C structs and waiting 45 seconds per rebuild.

OE-Studio is a built-in, zero-npm-dependency visual UI studio, XML-to-C compiler, interactive simulator, and MCP agent server that runs locally in your browser (node oe_studio/bin/oe-studio.js serve examples/oe_xml):

  • Pixel-Exact Live Preview — Renders your UI through the real oe_ui C++ renderer (not an approximate HTML/CSS mockup), complete with round-bezel safe-area guides, snap-to-grid, 8-point resize handles, and live widget pool telemetry.
  • Interactive Play Mode — Click buttons, drag sliders and arcs, pick dropdowns/rollers, step spinboxes, trigger page transitions, and test state bindings right in the browser before touching hardware.
  • One-Click Multi-Form-Factor Reflow — Switch between round watch panels and rectangular displays; OE-Studio offers an automatic, single-step undoable reflow that rescales geometry, border radii, flow rows, <use> part slots, font sizes, and label wrap widths so every string fits its container.
  • Design System, Localization & Motion — Manage Design Tokens (with inline RGB pickers), Looks, reusable Components (<part-def>), Strings (CSV/JSON import, primary language switcher, live RTL Split View for Hebrew/Arabic), and Motion timeline scrubbers.
  • Native oe_ui C or LVGL 9 C Export + Direct USB Flash — Export deterministic, zero-runtime-overhead C99/C11 code (defaulting to ultra-lean native oe_ui C, or toggle to LVGL 9 C) and Flash directly to a connected ESP32-S3 over USB from the toolbar.
  • Team-Ready History & AI Agent Co-Design — Interactive Action Stack undo/redo, versioned .oe-history/ diffs, Developer Identity & XML Revision Tracking (⚙ Settings), studio-version compatibility checks, automated Golden UI Checks, and a native MCP Server so coding agents can inspect, edit, preview, and test screens live beside you.

👉 Read the full OE-Studio Guide (for Developers, Designers & Product Teams) →


🔌 Multi-Board Architecture (oe_board + oe_hal)

Every board lives in boards/<id>/ with a single declarative source of truth:

boards/
├── board.schema.json                      # JSON Schema (draft 2020-12)
├── waveshare_esp32s3_touch_amoled_175/    # Reference board: 466×466 round AMOLED (1.75 & 1.75C)
│   ├── board.yaml                         # Pins, variants, display, rails, IMU mount, RF limits, quirks
│   ├── board.cpp                          # SM-17 bring-up (bus → rails → variant latch → drivers)
│   ├── baseline.json                      # This board's measured silicon benchmark baseline
│   ├── sdkconfig.board                    # Board-specific flash/PSRAM/target Kconfig
│   └── partitions.csv                     # Board-specific partition table
├── ci_probe_rect/                         # 410×502 rectangular AMOLED compile/geometry probe
└── host_sim/                              # Host simulator board for C++20 regression tests

Select a board at build time (or point at an out-of-tree board directory without modifying the SDK):

# Build for the default reference board (Waveshare ESP32-S3-Touch-AMOLED-1.75 / 1.75C)
idf.py -DOE_BOARD=waveshare_esp32s3_touch_amoled_175 build flash monitor

# Build for another board or an out-of-tree custom board
idf.py -DOE_BOARD=ci_probe_rect build
# Or via menuconfig: CONFIG_OE_BOARD_CUSTOM=y + CONFIG_OE_BOARD_DIR=/path/to/my_board

In firmware, one call brings up the board cleanly in SM-17 order (INV-BD1–INV-BD5):

#include "oe_board.h"
#include "oe_gfx_geom.h"   // Compile-time dg::CX, dg::CY, dg::SAFE_*, dg::px()

extern "C" void app_main(void) {
    oe_board_t board = {};
    ESP_ERROR_CHECK(oe_board_init(&board, OE_BOARD_INIT_ALL));
    // board.disp->width / height / shape / frame_budget_us live in flash .rodata (0 B DRAM)
}

📊 Verified Silicon Benchmarks

Board Identification Policy: Every board in boards/<id>/ has its own frame_budget_us and baseline.json — boards are never silently compared against each other. All silicon benchmarks quoted below were measured on the Reference Board:

  • Board: Waveshare ESP32-S3-Touch-AMOLED-1.75C (boards/waveshare_esp32s3_touch_amoled_175)
  • Silicon: ESP32-S3R8 Dual-Core Xtensa LX7 @ 240 MHz active / 80 MHz idle DFS, 8 MB Octal PSRAM @ 80 MHz, 32 MB QIO Flash @ 80 MHz
  • Display: 466×466 round AMOLED, Chipone CO5300 QSPI @ 80 MHz, RGB565-BE
  • Baseline Record: boards/waveshare_esp32s3_touch_amoled_175/baseline.json

Head-to-Head: Same UI Screens on Four Stacks (Waveshare ESP32-S3-Touch-AMOLED-1.75C)

The same 7 benchmark scenes built four ways — stock, lvgl_oe, and oe compat sharing bench/common/bench_scenes.cpp, plus pure native oe_ui (bench/oe_native/main/main.cpp) — timed on the same Waveshare ESP32-S3-Touch-AMOLED-1.75C board (render + push until the last pixel leaves DMA):

Frame time per scene on Waveshare ESP32-S3-Touch-AMOLED-1.75C: stock BSP + LVGL vs LVGL on oe drivers vs optimi_embedded compat vs optimi_embedded native

Scene (ms/frame avg · Waveshare AMOLED 1.75C, v0.7.0) Stock BSP + LVGL 8.4 LVGL 8.4 on oe drivers oe (LVGL compat) oe_native (pure oe_ui)
Idle (nothing changes) 0 frames 0 frames 0 frames 0 frames
Label (one text update) 2.01 1.72 0.64 0.64
Widgets (slider + arc + bar) 7.75 6.41 2.17 2.17
Full-screen redraw 39.60 (107 slow) 30.18 (161 slow) 9.34 † (0 slow) 9.34 † (0 slow)
Scroll (20-row list) 34.77 (119 slow) 25.82 (185 slow) 8.34 † (0 slow) 8.30 † (0 slow)
Slide screen load 38.25 (74 slow) 28.27 (123 slow) 9.98 (0 slow) 9.98 (0 slow)
Fade screen load 99.61 (38 slow) 89.95 (42 slow) 14.41 (0 slow) 14.41 (0 slow)

† Spread over 3 frames to stay under 16 ms (~21/s full screens vs 32/s for LVGL on oe_co5300). oe_lvgl_compat adds 0.00–0.04 ms/frame and 6.3 KB flash over pure native oe_ui (399,664 B vs 393,184 B). Full method & build projects: bench/README.md.

Real Silicon Highlights (Waveshare ESP32-S3-Touch-AMOLED-1.75C)

Measured via esp_timer_get_time() (1 µs) across 2,078 / 2,078 consecutive rendered frames (0 slow > 16.00 ms, 7.79 ms active gallery mean):

Metric (Waveshare ESP32-S3-Touch-AMOLED-1.75C) Stock Waveshare BSP + LVGL v8.4 optimi_embedded (oe_*) Real Silicon Gain
Static / Idle Screen 5–10 ms wake/poll @ 240 MHz 0.00 ms (0 SPI, 10 Hz IRQ @ 80 MHz DFS) -92% wakeups, 3× lower idle clock
Rolling Odometer Digit 6.80 ms 0.57 ms 11.9× faster
3D IMU Bayer Engine (280×280) ~28+ ms 4.47 ms (5.38 ms max) ~6.3× faster (224 FPS eq.)
Dithered Bayer Globe (320×320) ~32+ ms 6.13 ms (7.04 ms max) ~5.2× faster (163 FPS eq.)
Verlet Spider Web (330×322) ~26+ ms 6.27 ms (6.76 ms max) ~4.1× faster (159 FPS eq.)
Full-Screen 466×466 Shaders ~45+ ms 11.09–12.16 ms (zero-PSRAM stream) ~4× faster (60 FPS locked)
Full-Screen 2-Screen Swipe 36–38 ms (26 FPS) 10.43 ms (10.69 ms max) 3.6× faster (60 FPS locked)
Active Touch I²C Latency 2.2–5.0 ms (vTaskDelay) 0.35 ms (0.00 ms idle, < 15 µs IRQ) ~10× faster
Total Core SDK Flash / Static DRAM ~495 KB / ~48–75 KB 100.14 KB / 3.08 KB (0 B UI) 4.9× smaller Flash, >15× less DRAM

Live Demos 60 FPS Hardware Benchmark on Waveshare ESP32-S3-Touch-AMOLED-1.75C


Modular Component Architecture (components/oe_*)

Pick only what your firmware needs — every component is standalone with zero BSP/LVGL dependencies:

Layer Components Highlights
Board & HAL oe_board, oe_hal boards/<id>/board.yaml → build-time oe_board_config.h, SM-17 oe_board_init(), .rodata oe_disp_info_t, IMU mount & touch rotation transforms, RF limits.
Display & 2D Graphics oe_co5300, oe_gfx 80 MHz QSPI ping-pong DMA, shape-aware oe_disp_push_frame_*, PIE 128-bit SIMD (oe_gfx_simd.h), oe_gfx_geom.h, 8 SIL OFL 1.1 AA fonts (40.5 KB), BiDi/RTL text, transitive dirty-rect merger.
UI & XML Runtime oe_ui, oe_lvgl_compat, oe_xml_rt 26+ retained-mode widgets, flex & grid layouts, 5-language RTL keyboard, animated screen loads, Bayer gradients, drop-in #include "lvgl.h" shim (7 Kconfig extensions), optional zero-DOM streaming SAX XML runtime (CONFIG_OE_XML_RUNTIME).
Shaders & Audio oe_shader, oe_es8311, oe_es7210 Zero-PSRAM IRAM fragment shader engine (~11 ms on Waveshare 1.75C), pop-free Core 0 I²S DAC + PA FSM (ES8311), dual-mic capture + Q15 VAD (ES7210).
Sensors, Power & Connectivity oe_cst9217, oe_qmi8658, oe_power, oe_i2c_bus, oe_wifi, oe_ble, oe_sd, oe_ext_io IRQ-gated touch with ESD recovery, board-mounted 6-axis IMU + WoM, DFS + AOD + Light Sleep power manager, hardened Wi-Fi STA + NimBLE BLE 5.0 coex, 1-bit SDMMC, safe expansion IO.

Port Your Existing LVGL Project in 2 Minutes

Remove lvgl from idf_component.yml, add oe_lvgl_compat to REQUIRES, bind your context once, and compile your existing LVGL v8/v9 screens untouched:

#include "lvgl.h" // Drops straight onto oe_ui (0 B internal DRAM!)

oe_ui_ctx_t *ui = (oe_ui_ctx_t *)heap_caps_calloc(1, sizeof(oe_ui_ctx_t), MALLOC_CAP_SPIRAM);
oe_ui_ctx_init(ui, OE_DISP_W, OE_DISP_H);
oe_lvgl_bind_ctx(ui);

lv_obj_t *scr = lv_obj_create(NULL);
lv_obj_t *btn = lv_btn_create(scr);
lv_obj_set_size(btn, 160, 48);
lv_obj_align(btn, LV_ALIGN_CENTER, 0, 0);
lv_obj_t *lbl = lv_label_create(btn);
lv_label_set_text(lbl, "LAUNCH");
lv_obj_center(lbl);
lv_obj_add_event_cb(btn, on_launch_cb, LV_EVENT_CLICKED, NULL);
lv_scr_load(scr);

See exact per-extension ELF byte costs in docs/LVGL_PORTING.md.


60-Second Quick Start

New here? Follow GETTING_STARTED.md for the complete zero-to-flashing walkthrough (hardware links, OS setup, running OE-Studio with or without AI MCP, and one-click USB flashing) — or jump straight into docs/OE_STUDIO_MCP.md to connect Claude Code, Cursor, VS Code, Antigravity, Windsurf, or Codex CLI.

# 1. Launch OE-Studio in your browser (zero npm install!)
node oe_studio/bin/oe-studio.js serve examples/oe_xml

# 2. Run all 261 automated host & studio tests (< 5 s)
./tests/run_tests.sh                      # 140 C++ host tests (use OE_SANITIZE=1 for ASan/UBSan)
(cd oe_studio && npm test)                # 121 OE-Studio compiler/API/MCP/golden tests

# 3. Build & flash the 21-demo showcase to the reference board (Waveshare AMOLED 1.75 / 1.75C)
source ~/esp/esp-idf/export.sh
idf.py -DOE_BOARD=waveshare_esp32s3_touch_amoled_175 -p /dev/cu.usbmodem* build flash monitor

Live USB-Serial Commands (while monitor is open):

  • b — Run the automated 60 FPS hardware benchmark sweep right on your board
  • n / p / 0–9 / a / c–h / j / \ — Navigate all 21 demos (incl. Spaceballs State of the Art, Dot-Cube 3D, Neon Fluid, RGB Cube, Native XML Fitness, and HW Diagnostics)
  • s — Cycle Battery Saver profile | m — Power telemetry | i — Live IMU axes

Deep-Dive Documentation


Contributing & License

Contributions are welcome — see CONTRIBUTING.md.

Released under the MIT License (Copyright (c) 2026 Tom Sella (@tsella)). Pre-rasterized bitmap fonts in components/oe_gfx/src/oe_fonts.c are generated from SIL OFL 1.1 open-source typefaces, and club dancer rotoscope frames in oe_demos/demos/dance_roto_data.h are derived from Pexels License footage — see THIRD_PARTY_LICENSES.md.

About

Bare-metal 60 FPS ESP32-S3 AMOLED SDK, PIE-SIMD 2D/3D engine, zero-PSRAM shader pipeline & drop-in LVGL shim — 100 KB Flash, 3 KB DRAM, 0 slow frames across 17 live demos.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages