Implementation:78 Xiaozhi esp32 Kconfig Board Selection
Appearance
| Knowledge Sources | |
|---|---|
| Domains | Build_Systems, Configuration_Management |
| Last Updated | 2026-10-17 00:00 GMT |
Overview
Concrete tool for Kconfig-based board selection provided by the XiaoZhi firmware, defining a choice BOARD_TYPE block in main/Kconfig.projbuild that maps each board to a Kconfig symbol and its chip target.
Description
main/Kconfig.projbuild contains a Pattern Doc — the Kconfig choice BOARD_TYPE block. It is a critical link in the build configuration chain. Each board has one config BOARD_TYPE_<NAME> entry inside the choice block:
- The entry's
boolprompt is the board's human-readable name select IDF_TARGET_<CHIP>sets the chip target- Only one board can be selected (Kconfig
choiceensures exclusivity) scripts/build.pysets theCONFIG_BOARD_TYPE_<NAME>symbol viaidf.py set-configmain/CMakeLists.txtusesif(CONFIG_BOARD_TYPE_<NAME>)to select source files
Usage
Reference this implementation when:
- Adding a new board to the Kconfig choice
- Understanding how board selection maps to chip target
- Debugging "board type not found" build errors
- Understanding the Kconfig → CMake dependency
Code Reference
Source Location
- Repository: XiaoZhi ESP32
- File:
main/Kconfig.projbuild
Signature
choice BOARD_TYPE
prompt "Board Type"
default BOARD_TYPE_BREAD_COMPACT_WIFI
config BOARD_TYPE_BREAD_COMPACT_WIFI
bool "Bread Compact WiFi"
select IDF_TARGET_ESP32S3
config BOARD_TYPE_M5STACK_CORES3
bool "M5Stack CoreS3"
select IDF_TARGET_ESP32S3
config BOARD_TYPE_SEEED_XIAO_ESP32S3
bool "Seeed XIAO ESP32-S3"
select IDF_TARGET_ESP32S3
# ... one config per board
endchoice
Import
# Kconfig is processed by the ESP-IDF build system automatically.
# No import needed — the build system reads Kconfig.projbuild.
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| choice BOARD_TYPE | Kconfig block | Contains one config per board | |
| config BOARD_TYPE_<NAME> | Kconfig entry | bool prompt + select IDF_TARGET_<CHIP> |
Outputs
| Name | Type | Description |
|---|---|---|
| CONFIG_BOARD_TYPE_<NAME> | Set to "y" for the selected board, used in CMakeLists.txt | |
| IDF_TARGET_<CHIP> | Chip target (e.g., ESP32S3, ESP32C3, ESP32P4) |
Usage Examples
Adding a New Board to Kconfig
# In main/Kconfig.projbuild, inside the choice BOARD_TYPE block:
config BOARD_TYPE_MY_CUSTOM_BOARD
bool "My Custom Board"
select IDF_TARGET_ESP32S3
Corresponding CMakeLists.txt Entry
# In main/CMakeLists.txt:
elseif(CONFIG_BOARD_TYPE_MY_CUSTOM_BOARD)
set(SRCS
boards/my-board/board.cc
)
target_add_binary_assets(boards/my-board/assets)
endif()
Related Pages
Implements Principle
Requires Environment
Page Connections
Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment