Skip to content
Ooidget

Ooidget Component Format 0.1Editor's Draft

Embedded devices

Ooidget documents MAY target microcontrollers: devices with no general-purpose operating system, from about 256 KiB of RAM and 1 MiB of flash, with a display driven over a parallel or SPI bus and no GPU. Appliances, instrument clusters, medical devices, industrial panels and wearables are typical. This section defines the Embedded profile for runtimes and the constraints a document meets to run under it.

Compiled bundles

An embedded runtime does not read JSON or compile source at run time. A conforming compiler turns a bundle into a compiled bundle ahead of time, on the developer’s machine:

  1. Resolve every component, style and token reference; drop what no shown component reaches.
  2. Check the bundle against the document constraints, reporting every violation.
  3. Compile every expression and behaviour to bytecode for the profile's script engine, or to native code.
  4. Rasterise every font the bundle uses, at the sizes it uses, to glyph atlases in the target's pixel format; decode images to that format.
  5. Lay out what does not depend on state, so the runtime computes only what can change.
  6. Emit a binary image to be placed in flash, and a C header naming its components.

The format of a compiled bundle is specific to a compiler and a runtime and is not specified here; a runtime MUST produce the same frames from it as a Full runtime produces from the source bundle.

Document constraints

A document that targets the Embedded profile declares "profiles": ["embedded"] and MUST meet these constraints:

AreaConstraint
Expressions and behavioursOnly the ECMAScript features of ECMAScript 5.1 [ECMA-262], plus arrow functions, let, const and template literals, which a compiler lowers. No regular expressions; no JSON round trips in a frame.
Computed SVGsvgExpr and pathExpr MUST NOT be used; drawings that change are layers whose when, frames and opacity change.
TextFonts are named in the bundle and rasterised by the compiler; text MUST NOT use a size not listed in extensions.OOIDGET_embedded.textSizes.
StateThe state’s members and the lengths of arrays used with each are bounded; a document declares the bounds in extensions.OOIDGET_embedded.limits.
EffectsBlur and shadows are drawn from pre-rendered images; gradients are limited to linear and radial with up to four stops.

Runtime requirements

An Embedded runtime implements the Interactive profile over compiled bundles, and:

  • MUST render without a full-frame buffer, a line or band at a time, when the device has too little RAM for one;
  • MUST NOT allocate memory after start-up except from pools sized by the bundle’s declared limits;
  • MUST run expressions and behaviours under a time budget, as other profiles do;
  • MUST support RGB565 and SHOULD support RGB888 and 8-bit greyscale output;
  • MAY omit accessibility output on devices with no assistive technology, and says so in its conformance statement.

The reference embedded runtime is planned to use MicroQuickJS for scripts (ECMAScript close to 5.1 in about 10 kB of RAM, with bytecode stored in flash), Taffy without the standard library for layout, and a line-by-line software renderer.