Recommended Development Workflow
ESP-GSP works best when scene structure, generated interfaces, application state, and board integration have clear ownership. This workflow applies to manual development and AI-assisted UI iteration.
Start with the product constraints
Section titled “Start with the product constraints”For layout or style changes, use the existing project’s display and bundle settings. When starting a project or changing displays, check the following:
- ESP-IDF project and selected target;
- logical display width and height;
- RGB565 or RGB888 bundle format;
- panel interface, physical rotation, and byte order supplied by the BSP;
- touch controller and coordinate orientation, when used;
- PSRAM availability and the main memory constraints;
- scene files and bundle symbol owned by the application component.
Do not infer resolution or pixel format from the SoC. The same target can be paired with different panels and presentation paths.
Put each change in the right layer
Section titled “Put each change in the right layer”| Requirement | Preferred owner |
|---|---|
| Layout, style, static text, local assets | JSON scene |
| Named value, visibility, color, text, selection, or navigation update | Generated C API |
| Product state, networking, storage, sensors, and blocking work | Application task |
| Runtime images, camera/video frames, dynamic rows | Public media/list/Canvas API |
| Panel timing, framebuffer exposure, rotation, byte swap, TE, touch mapping | BSP/display target |
| Framework-wide behavior missing from the public contract | Report as a framework capability gap |
Keep product-specific policy out of the scene compiler and display layer. Keep panel-specific policy out of application UI code.
Prefer the default integration path
Section titled “Prefer the default integration path”For an ordinary firmware-owned UI, embed the bundle and use its generated header:
gsp_add_bundle(${COMPONENT_LIB})This compiles the sorted scenes/*.json set with RGB565. Use explicit
SCENES, SYMBOL, or PIXEL_FORMAT only when the application differs from
that convention.
Add an option only when the product needs the corresponding behavior:
DYNAMIC_FONTwhen runtime text contains glyphs unknown at build time;IMAGE_CACHE_BYTESafter measuring a product-specific decoded-image budget;SYMBOLwhen one application component owns multiple independent bundles;PROFILEfor a reviewed expert compiler override;DEPLOYABLEto load a complete UI independently of firmware.
To replace only pictures or animations in an existing layout, use
gsp_add_assets() and a media package.
Keep display presentation on ESP_DISPLAY_PRESENT_MODE_AUTO unless
measurement on the real target justifies a reviewed override.
Author the scene for generated APIs
Section titled “Author the scene for generated APIs”Use a stable name for every element the application must update. Use
callback for actions that must be decoded by the application. Leave purely
decorative elements unnamed.
Prefer authored structure over runtime construction:
- properties for values, text, colors, checked state, and visibility;
- templates for repeated component structure;
- List, Grid, Wheel, and Message List for application-backed collections;
- PageFlow, StackView, Drawer, and scenes for navigation;
- Canvas for an external producer that owns continuously changing pixels.
Validate fields against Scene authoring. Do not add a plausible JSON key absent from that version’s Schema.
Build before writing the integration layer
Section titled “Build before writing the integration layer”Compile the scene early. The generated <symbol>_gsp.h is the exact contract
for the current bundle and includes configuration, scene identifiers, event
predicates, template descriptors, and typed operations for named elements.
Use editor completion and the declarations in the generated header when writing application code. Update JSON and rebuild after changing names, callbacks, properties, templates or the scene list.
Generated typed helpers provide object-specific operations; generic public APIs support
data-driven integration. To access raw identifiers, define GSP_BUNDLE_ENABLE_RAW_IDS
before including the generated bundle header.
Connect product state
Section titled “Connect product state”Treat the application as the source of truth. UI events request product actions; completed product changes update the UI through setters.
UI callback -> short message/notification -> application taskapplication state change -> generated setter -> render-task commitSetters are asynchronous on ESP-IDF. A successful return means the update was
accepted. Use esp_gsp_flush() only at a deterministic test, capture, or
orderly synchronization boundary.
Event, timer, list-binding, image-release, and Canvas callbacks run on framework tasks and must not block. Defer storage, networking, decoding owned by the application, and shutdown to an application task.
Choose the right data path
Section titled “Choose the right data path”| Data shape | Use |
|---|---|
| Build-time image or font | Scene-relative asset |
| Occasional encoded image replacement | Named image generated setter or esp_gsp_set_image*() |
| Camera, video, or continuously produced pixels | Canvas frame or direct-draw callback |
| Large application collection | List/Grid/Wheel binder with recycled rows |
| Dynamic chat-style collection | Message List |
| Fixed repeated UI structure | Authored template |
See Media and application data before selecting ownership or cache settings.
Check the application
Section titled “Check the application”- Run
idf.py buildto compile scenes, resources and application code. - Check layout, data updates and interaction in the simulator.
- Run on the target board to check colors, orientation, clipping, animation, touch and memory use.
Compiler-assisted development
Section titled “Compiler-assisted development”Use the same GSPC as the application build. From the project root:
gspc doctor . --build buildgspc cards slidergspc diagnose scenes/main.json --format jsongspc verify scenes/main.json --platform-soc esp32s3 --psram --layout-check --include-apigspc image-audit scenes/main.json --platform-soc esp32s3 --psram --format textgspc bundle-diff old.gspb new.gspb --format textcards returns widget fields and examples; verify compiles in memory with
optional layout checks, Flash budget enforcement and C API output (and also
accepts --context <path> for a configured ESP-IDF build); image-audit
compares Flash vs. decode RAM per image; bundle-diff classifies OTA and
live-reload compatibility. For targeted diagnosis on a configured Bundle, pass
its context from doctor to gspc diagnose --context <path>. The
Agent-assisted UI guide shows how to find a specific
field, a complete example or a generated C setter.
Add --layout-check --round-safe-area for optional checks on static root
boxes and the screen’s inscribed circle. Child or dynamic geometry is reported
as skipped. Image advice compares encoded and uncompressed sizes. Review any
store_scale suggestion at the largest intended display size. Runtime peak
memory also depends on the decoder and cache settings.
Completion checklist
Section titled “Completion checklist”- Scene dimensions and bundle format match the BSP display target.
- Application-controlled elements have stable names.
- Application actions use generated event predicates.
- Generated artifacts were rebuilt and not edited.
- Callback and buffer ownership follows the lifecycle contract.
- Runtime capacities cover simultaneously active objects, not total dataset size.
- Check display, touch and resource use on the target board.
Multi-scene builds and input completion
Section titled “Multi-scene builds and input completion”gsp_add_bundle() links scenes with compile, sharing images and font character sets.
The CLI pack command uses the same linker; use bundle for existing binary members.
To generate application outputs independently:
gspc compile scenes/*.json -o gsp-out/app.gspb \ --api-header gsp-out/app_gsp.h --depfile gsp-out/app.d --symbol appScene IDs follow explicit input order, or sorted filenames with CMake discovery. They are not permanent identifiers across bundle versions. JSON edits trigger regeneration; generated action predicates check both the scene and its local action number.
Arc requires an explicit bind (for example, bind: "volume") to enable pointer
dragging; a name and value setters alone leave it as a gauge. Slider is draggable
by default.
Slider/Arc events can bind value -> call and release -> call for changes and commits.
Cast arg to int32_t to read the committed value in authored min/max units. Unchanged
values do not notify again. A press that changes the value notifies too; release outside
the control still commits, while cancellation does not. A bare Slider/Arc callback
defaults to release. Application setters do not emit these user-input callbacks. Queue
business work to an application task from the callback.
Both events also support declarative value, visibility and navigation actions in JSON
order. Pending writes commit before each timeline, animated toggle or glow action,
and again at the end of the event. A later write to the same property takes over
its tween when the write commits. If a later action fails, earlier commits stand
and pending writes are discarded. Only call replaces
arg with the completed drag value. Other actions retain their authored arguments
(set_value uses the target’s 0..100 rail, where 0 selects its minimum).
For example, a release set_value with arg: 0 followed by call resets the control
while reporting the drag’s final value. A getter inside the callback can still observe
the state before those declarative writes commit. Hiding or disabling a captured
control cancels the drag; after restoring it, lift and press again.
For color selection, use three Sliders for H, S and V (suggested ranges: 0..359, 0..100,
0..100). Update the preview on value and commit lighting/theme settings on release.
The application converts color spaces and retains its full HSV state. Controls still
resolve values in 100 intervals; choose the hue range with that resolution in mind.
Generated Wheel bindings enable row snapping. Advanced Lists can opt in using
esp_gsp_list_snap(). Set Wheel cyclic: true to wrap across the first and last
items. snap_to_item: false disables snapping in both generated-header and deployable-metadata integration.
Handle item selection through row callbacks; snapping controls the scroll position.
Animations and transitions
Section titled “Animations and transitions”Start property animations through the application animation APIs. Keep animation startup and lifetime management together and check return values. Use the tween options for looping and alternating playback.
Use esp_gsp_goto_scene() to navigate and select a transition, and
esp_gsp_set_swipe_transition() to choose the follow-finger visual. Check the
display backend’s supported transitions when configuring navigation.
Source checkouts build from source; precompiled component packages use their bundled libraries. Update the compiler and component package together.
Compiler selection
Section titled “Compiler selection”Activate the ESP-IDF environment before installing esp-gsp-tools. CMake uses
that environment’s Python, so installing into a different Python does not make
the manager available to the build.
An explicit GSPC_EXECUTABLE CMake value takes priority over the environment
variable. On Linux and macOS, source checkouts without a version marker use
the Cargo launcher. In native Windows builds, set GSPC_EXECUTABLE to the
absolute path of a matching gspc.exe before configuring.
Component packages use the project .gspc_version, or
otherwise the package marker: first check GSP_TOOLS_DIR (if set, strictly
requiring an exact version match for offline builds), then reuse an
exact-version gspc on PATH,
then use the manager’s versioned cache/download. A mismatched PATH executable is
reported and skipped; all selected compilers must pass format/ABI checks.
CMake detects creation, edits and removal of either version marker on the next build, including changes between the project override and component default.
For offline builds, put a matching compiler on PATH, set GSPC_EXECUTABLE, or
prepopulate the manager cache while online. On failure, use the reported Python
installation command or compiler path. A manager package version is independent
of the GSPC version; upgrading the manager cannot supply an unpublished compiler.
Dropdown selection and color actions
Section titled “Dropdown selection and color actions”The generated gsp_settings_display_mode_set_selected(ui, index) uses a zero-based
index in the current scene. Scene prefixes distinguish C symbols; they do not route
commands to inactive scenes. Restore the saved index on the matching
ESP_GSP_EVENT_SCENE_CHANGED. The setter updates runtime state and displayed text;
it does not rewrite JSON’s initial selected. Read user selection from the callback’s
event->arg; getters during that callback can still see the pre-commit value.
On ESP-IDF, setter success means the command was accepted, as with other queued setters.
Use set_bg_color to update a color Bind from a scene event. For example,
with bind: "button_color" and bind_target: "color":
"events": [ {"event":"click", "action":"set_bg_color", "target":"button_color", "arg":"#FF3020"}]Use #RRGGBB strings for colors that work across target profiles. Integer arguments
use the target’s native pixel format. This action changes the color; configure
opacity separately. Clickable controls provide automatic pressed feedback.
Numeric actions use integer arg values; value is a compatibility alias.
For example, add_value with arg: -5 decreases a numeric Bind by five steps
on its 0..100 range. call also accepts signed 32-bit arguments; cast the
callback’s event->arg to int32_t to read them. Page and scene indices are
unsigned 16-bit values. Invalid types and out-of-range arguments produce a
diagnostic at the event field. An explicit arg takes precedence over value.
Generated entry points, event IDs and capacity reports
Section titled “Generated entry points, event IDs and capacity reports”gsp_add_bundle() defaults to SYMBOL bundle, producing bundle_gsp.h and
gsp_bundle_config(). With SYMBOL ui (CLI: --symbol ui), the entry point becomes
gsp_ui_config() and the CMake header becomes ui_gsp.h. The generated header names its actual initializer.
Use gsp_<scene>_event_is_<callback>() or event_decode_call() for normal callbacks;
they check both scene and action IDs. action_id is local to a scene. To access
GSP_<SCENE>_ACT_ID_*, define GSP_BUNDLE_ENABLE_RAW_IDS before including the bundle
header and also check scene_id. Raw IDs are not exported by default.
text slots outside lists counts mutable scene text and freestanding template text.
total glyph-run slots also includes list text and internal headroom. Template capacity is derived from
max_instances × text slots per instance; runtime-only objects still require explicit
application capacity. Static text does not consume runtime text slots.
Linked scenes share one set of (font, size) packs. --max-font-packs defaults to 32,
matching the ESP-GSP font capacity; custom runtimes can pass their supported limit.
The compiler reports an over-limit shared set once for the bundle.
Inspect final bundles and release expectations
Section titled “Inspect final bundles and release expectations”Use a GSPC advertising compiler_features.bundle_inspection: 1 in its
compatibility or doctor report for the bundle-info entry point:
gspc bundle-info app.gspb assets.gspb --format jsongspc bundle-info --expect release.json --format jsonThe read-only report inspects final GSPB bytes without compilation sidecars.
Its versioned JSON reports file/member identities, scenes, bindings, resource
references, actual codecs/cache policies and compiled-animation frame counts,
loop counts, per-frame intervals and cycle duration. These intervals describe
the nominal playback timeline, not measured display cadence. Legacy zero-duration
entries use the player’s 100 ms fallback; raw values remain in
stored_frame_intervals_ms. Original source paths and
encoding-selection reasons are not inferred from the bytes. The current inspector
marks EAF timeline metadata as not read; an unmet EAF timing expectation is
reported as unverified, rather than as a missing asset.
resources[].animation describes one resource member. For recognized external
asset packages, external_assets separately reports the complete asset timeline
across its consecutive frame members. Unclear grouping, zero external durations
or inconsistent loop values remain explicit unknown/partial results; they do not
restrict generic bundles or inherit the embedded player’s 100 ms fallback.
For a two-scene release, a minimal release.json is:
{ "schema_version": 1, "bundles": [{"path": "app.gspb", "scenes": [0, 1]}]}Bundle paths are relative to the declaration file. With --expect alone, those
paths select the inputs; explicit bundle arguments must match the declared set.
Scene IDs are Bundle member/load IDs; metadata_scene_id preserves the GSB value.
The declaration supports these optional checks for each bundle:
| Field | Expected final fact |
|---|---|
identity |
Exact supplied crc32, content_id, bytes, target_profile_id, version_major and/or version_minor. |
scenes / members |
Exact scene ID set or member {kind, id} set; members can also pin content_id and name_hash. Use allow_extra_scenes or allow_extra_members to allow additional entries. |
bindings |
Required {scene_id, bind_id} entries, optionally with bind_type such as i32 or resource. |
animations |
Require the animation selected by {member_id, resource_id}; optionally check frame_count, loop_count, cycle_duration_ms and/or frame_intervals_ms for that member. |
Maintain expectations from the application’s release requirements. Copying facts from the inspected package into a declaration checks repeatability, but does not independently establish that it is the intended release. Identity fields pin only the fields supplied; omitting them preserves compatible asset updates. The command does not change the runtime’s external-package replacement policy.
Invalid structure, CRC, verifiable references or declared expectations return a
nonzero exit status. With --format json, declaration and input-preparation
errors after argument parsing also return a versioned failure report and stable
diagnostic codes. Without --expect, success covers the inspected structure
and relationships, not the product’s required page/resource set. The report
identifies unresolved external dependencies and its validation scope. Font
references can resolve against supplied catalogs by asset/content ID; this
checks availability, not runtime attachment. Unresolved fonts or legacy ordinal
identities leave validation.references as partial. It does
not fully decode every codec, validate appearance, measure device FPS, or verify
runtime switching deadlines; keep those checks in the owning application.
Review optional link modules
Section titled “Review optional link modules”After registering bundles with gsp_add_bundle() or gsp_add_assets(), run:
idf.py gsp_feature_reportThe read-only report inspects the final GSPB bytes, including hidden scenes, templates and external assets. It lists optional JPEG, PNG, EAF, reference-renderer, vector, procedural, animation-span and animation-DEFLATE modules with their reasons. It does not change sdkconfig, resources or link roots and does not estimate Flash savings. Disabled capabilities are checked against final resources before the component is built; unchanged inputs reuse the successful check.
Unknown requirements outside registered packages retain enabled modules.
Use the existing gsp_specialize_runtime(DYNAMIC_FEATURES ...) declaration only
when it covers direct APIs, downloads and OTA resources too; NONE declares
that there are no such inputs. Extra packages belong in EXTRA_BUNDLES.
AUTO and ALL respect disabled link capabilities. Dynamic features with a
configuration option must be enabled in the project configuration. The span
decoder has no separate menuconfig option; final resources and the runtime-link
declaration determine whether it is retained.
The report preserves an enabled reference-renderer fallback. Apply candidates
that have configuration options through menuconfig, then compare APP binaries,
functionality, frame times and memory on the intended board.
The same analysis is available without build integration or sidecars:
gspc features app.gspb assets.gspb --sdkconfig build/config/sdkconfig.jsongspc features app.gspb --sdkconfig build/config/sdkconfig.json --runtime png,jpeg --format jsonSupply every application and external asset package. --runtime auto is the
default; use none, all or a complete comma-separated declaration when known.
--check validates requirements without printing suggestions. Rebuild or select
GSPC with compiler_features.link_feature_report: 2 for this entry point.
Compile-time multi-language (i18n)
Section titled “Compile-time multi-language (i18n)”Scene text fields accept "$i18n:<key>" or "$i18n:<key>|<default>" references resolved against a multi-locale JSON catalog or a directory of <locale>.json files (supporting nested key flattening and per-locale _meta overrides for font, font_size_delta, direction, and name).
- Per-locale minimal bundles (each bundle bakes only the glyphs used by that locale and mirrors default alignment to
rightfor RTL locales):
gspc pack scenes/home.json -o bundle_ar.gspb --i18n i18n.json --locale ar --i18n-strictESP-IDF projects can pass I18N, LOCALE, FALLBACK_LOCALE, and I18N_STRICT directly to gsp_add_bundle() with automatic rebuild tracking when translations change.
- Single-firmware language switching and static audits:
gspc i18n extract scenes/*.json -o i18n.json --merge i18n.jsongspc i18n check --i18n i18n.json scenes/*.json --strict-overflowgspc i18n charset --i18n i18n.json --expand-arabic-forms -o charset.txtgspc i18n codegen --i18n i18n.json -o app_i18n.h --prefix app_i18n --pre-shape-rtlgspc i18n check audits missing keys, unused keys, printf/{...} placeholder parity, and rasterized pixel-width box overflows. gspc i18n codegen --pre-shape-rtl emits a Flash-resident, zero-allocation C header with pre-shaped RTL strings for display-only text. For strings with placeholders, generate logical-order strings, format the value, and then apply runtime BiDi.
LVGL project migration scan
Section titled “LVGL project migration scan”Analyze an existing LVGL (v8/v9, SquareLine, EEZ Studio) C/C++ project to classify APIs into Direct, Assisted, and Custom tiers, inventory images/fonts/event callbacks, and optionally emit preliminary ESP-GSP scene skeleton JSON files checked by gspc diagnose:
gspc migrate-scan path/to/lvgl_app --format markdown -o migration_report.md \ --emit-skeleton migrated_scenes/ --font /path/to/your-font.ttfReplace placeholder images, list and grid templates, and chart points with your application data before shipping the migrated UI. Use the report to locate the source APIs and callbacks that require manual migration.