|
Sound Byte Libs 1ee2ca6
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
|
This document describes the JSON schemas used to define hardware in the SBL ecosystem.
SBL uses two primary schemas to model hardware:
| Schema | Purpose |
|---|---|
mainboard.schema.json | Primary boards running an SBL application |
module.schema.json | Attachable modules (expansion boards, ICs) |
The key concept is the expose/claim model: mainboards expose resources (pins, buses) and modules claim them. This creates a traceable chain from logical pin names down to physical MCU registers.
| Schema | Diagram |
|---|---|
| MCU Definition | |
| Project Config | |
| Lock File | |
To regenerate these diagrams:
File: schema/mainboard.schema.json
A mainboard is the primary board in an SBL application. It references an MCU and defines what resources are available to modules.
| Property | Required | Description |
|---|---|---|
schemaVersion | Yes | Schema version (currently "0.1") |
mainboard | Yes | Core board metadata |
exposes | No | Resources exposed to modules |
claims | No | Resources claimed internally |
contains | No | ICs/components on this board |
config | No | Board configuration (clocks, etc.) |
| Field | Required | Description |
|---|---|---|
name | Yes | Identifier matching directory name (^[a-z0-9-]+$) |
manifestVersion | Yes | Manifest definition version (semver) |
revision | Yes | Hardware revision (physical PCB) (^\d+\.\d+(\.\d+)?$) |
mcu | Yes | MCU reference path (^mcu/[a-z0-9_/-]+$) |
Defines what resources this mainboard makes available to modules.
| Field | Required | Description |
|---|---|---|
mcu_pin | Yes | Physical MCU pin name |
functions | No | Available alternate functions |
| Field | Required | Description |
|---|---|---|
mcu_pin | Yes | Physical MCU pin name |
mcu_channel | Yes | ADC channel identifier |
| Field | Required | Description |
|---|---|---|
type | Yes | Bus type: spi, i2c, uart |
mcu_peripheral | Yes | MCU peripheral name |
pins | No | Pin assignments for this bus |
Resources claimed internally by the mainboard (not available to modules).
| Field | Required | Description |
|---|---|---|
mcu_pin | Yes | Physical MCU pin |
function | Yes | Pin function (gpio, adc, pwm, etc.) |
id | Yes | Code identifier (^[a-z][a-z0-9_]*$) |
direction | No | in or out (for GPIO) |
pull | No | up, down, none |
active_low | No | Inverted logic (default: false) |
| Field | Required | Description |
|---|---|---|
mcu_peripheral | Yes | MCU peripheral name |
id | Yes | Code identifier |
ICs and components soldered onto this mainboard.
Board-level configuration.
File: schema/module.schema.json
A module is anything that attaches to a mainboard or another module: expansion boards, ICs, peripherals.
| Property | Required | Description |
|---|---|---|
schemaVersion | Yes | Schema version (currently "0.1") |
module | Yes | Core module metadata |
interface | No | Bus interface (for ICs) |
secondary_mcu | No | Secondary MCU on this module |
exposes | No | Resources exposed to child modules |
claims | No | Resources claimed from parent |
requires | No | Additional required pins (for ICs) |
provides | No | Capabilities documentation |
contains | No | Sub-components |
protocol | No | Communication protocol |
| Field | Required | Description |
|---|---|---|
name | Yes | Module identifier |
manifestVersion | Yes | Manifest definition version (semver) |
revision | Yes | Hardware revision (physical version) |
category | Yes | boards or ic |
attaches_to | No | Parent reference |
manufacturer | No | IC manufacturer |
datasheet | No | Datasheet URL |
For ICs that connect via a bus:
| Field | Required | Description |
|---|---|---|
type | No | spi, i2c, uart |
role | No | peripheral or controller |
address | No | I2C address (hex string) |
mode | No | SPI mode (0-3) |
max_speed_hz | No | Maximum bus speed |
Resources this module claims from its parent:
Key difference from mainboard claims: modules reference logical names from their parent's exposes, not physical MCU pins.
For ICs that need additional pins beyond the bus:
For complex ICs or modules with secondary MCUs:
The power of this schema design is traceable pin resolution:
This separation means:
Validate your definitions against these schemas: