Implementation:78 Xiaozhi esp32 config json
| Knowledge Sources | |
|---|---|
| Domains | Build_Systems, Configuration_Management |
| Last Updated | 2026-10-17 00:00 GMT |
Overview
Concrete tool for board build declaration provided by the XiaoZhi firmware, defining a JSON manifest schema that specifies the chip target, build variants, and sdkconfig overrides consumed by scripts/build.py.
Description
config.json is a Pattern Doc — it documents a file convention. Each board directory contains a config.json that scripts/build.py parses to configure the build. The JSON schema includes:
target: The ESP32 chip target (e.g.,"esp32s3","esp32c3","esp32p4")builds: An array of build variants, each with:name: Variant name (used with--nameflag)sdkconfig_append: List ofKEY=ystrings that select Kconfig options (e.g.,"CONFIG_BOARD_TYPE_BREAD=y")
manufacturer(optional): Manufacturer name for documentationpreview(optional): Boolean indicating a preview/incomplete board
The name field in builds becomes the board identity that the server uses for OTA compatibility. Changing this name after deployment breaks OTA updates for existing devices.
Usage
Reference this implementation when:
- Adding a new board's build configuration
- Understanding how
build.pydiscovers and selects boards - Configuring multiple build variants for one board (e.g., WiFi vs cellular)
- Understanding sdkconfig_append options
Code Reference
Source Location
- Repository: XiaoZhi ESP32
- Files:
main/boards/*/config.json(one per board),scripts/build.py(parser)
Signature
{
"target": "esp32s3",
"builds": [
{
"name": "wifi",
"sdkconfig_append": [
"CONFIG_BOARD_TYPE_BREAD_COMPACT_WIFI=y"
]
}
]
}
Import
# Parsed by scripts/build.py:
import json
with open(config_path) as f:
config = json.load(f)
target = config["target"]
builds = config["builds"]
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| target | string | ESP32 chip target (e.g., "esp32s3") | |
| builds | array | Build variant definitions | |
| builds[].name | string | Variant name (board identity for OTA) | |
| builds[].sdkconfig_append | string[] | Kconfig options to append | |
| manufacturer | string | Manufacturer name | |
| preview | boolean | Marks as preview/incomplete |
Outputs
| Name | Type | Description |
|---|---|---|
| (parsed by build.py) | Python dict with target, builds, and sdkconfig options | |
| idf.py set-config | Each sdkconfig_append entry becomes an idf.py set-config call |
Usage Examples
Single-Variant Board (WiFi only)
{
"target": "esp32s3",
"builds": [
{
"name": "wifi",
"sdkconfig_append": [
"CONFIG_BOARD_TYPE_MY_BOARD=y"
]
}
]
}
Multi-Variant Board (WiFi + Cellular)
{
"target": "esp32s3",
"builds": [
{
"name": "wifi",
"sdkconfig_append": [
"CONFIG_BOARD_TYPE_DUAL_BOARD_WIFI=y"
]
},
{
"name": "ml307",
"sdkconfig_append": [
"CONFIG_BOARD_TYPE_DUAL_BOARD_ML307=y"
]
}
]
}
Building
# Discover available boards
python3 scripts/build.py --list-boards
# Build a specific variant
python3 scripts/build.py main/boards/my-board --name wifi
# Build with zip output
python3 scripts/build.py main/boards/my-board --name wifi --zip