Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Environment:78 Xiaozhi esp32 ESP IDF

From Leeroopedia
Knowledge Sources
Domains Embedded, Firmware, IoT
Last Updated 2026-10-17 00:00 GMT

Overview

ESP-IDF v6.0.1+ (v6.1 recommended) development environment for ESP32-series voice-assistant firmware with C/C++ toolchain and 60+ managed components.

Description

This environment provides the full Espressif IoT Development Framework (ESP-IDF) toolchain required to build the XiaoZhi ESP32 firmware. It targets ESP32, ESP32-C3, ESP32-C5, ESP32-C6, ESP32-S3, ESP32-S31, and ESP32-P4 chip platforms. The minimum supported SDK is ESP-IDF v6.0.1, with v6.1 recommended. ESP-IDF 5.x is explicitly not supported — the project uses IDF 6 component splits, PSA Crypto migration, and third-party dependencies that require v6 APIs.

The build system uses CMake with a minimal-build trim, the ESP-IDF Component Manager for dependency resolution (via `idf_component.yml`), and a custom `scripts/build.py` entry point that manages board/variant selection, sdkconfig mutation, and flash/partition settings.

Usage

Use this environment for any firmware build of the XiaoZhi ESP32 project. It is the mandatory prerequisite for every implementation in this repository — all 18 implementation pages require it. Source the ESP-IDF environment before running any build command.

System Requirements

Category Requirement Notes
OS Linux (recommended) "Linux is better than Windows for faster compilation and fewer driver issues" (README.md:117)
Hardware ESP32 / ESP32-C3 / ESP32-C5 / ESP32-C6 / ESP32-S3 / ESP32-S31 / ESP32-P4 Target chip selected per board config.json
Disk ~2GB ESP-IDF + components + build artifacts
IDE Cursor or VSCode with ESP-IDF plugin README.md:116

Dependencies

ESP-IDF Framework

  • ESP-IDF >= 6.0.1 (minimum)
  • ESP-IDF 6.1 (recommended)
  • ESP-IDF 5.x not supported

Key Managed Components (from idf_component.yml)

  • `espressif/esp_audio_codec` ~2.5.0
  • `espressif/esp-sr` ==2.4.7
  • `espressif/esp_audio_effects` ~1.3.0
  • `78/esp-wifi-connect` ~3.3.1
  • `78/esp-ml307` ~3.8.1
  • `78/uart-uhci` ^0.4.1 (not ESP32)
  • `78/uart-eth-modem` ~0.7.1 (not ESP32)
  • `78/xiaozhi-fonts` ~2.0.0
  • `lvgl/lvgl` ~9.5.0
  • `esp_lvgl_port` ~2.9.0
  • `espressif/esp_codec_dev` ~1.6.2
  • `espressif/led_strip` ~3.0.3
  • `espressif/button` ~4.2.1
  • `espressif/knob` ^1.1.0
  • `espressif/esp32-camera` ^2.1.7 (ESP32-S3 only)
  • `espressif/esp_video` ^2.4.1 (ESP32-P4/S3/S31)

Build Tools

  • Python 3 (for `scripts/build.py`)
  • CMake >= 3.16
  • Ninja (via ESP-IDF)
  • `clang-format` (repository `.clang-format` for code style)

Credentials

No build-time credentials are required. Runtime credentials (WiFi SSID/password, MQTT endpoint, WebSocket token, OTA URL) are provisioned on-device via BluFi or hotspot and stored in NVS.

Quick Install

# 1. Clone ESP-IDF v6.1
git clone --recursive https://github.com/espressif/esp-idf.git -b v6.1
cd esp-idf && ./install.sh

# 2. Source the environment
source export.sh

# 3. Verify
idf.py --version

# 4. Build a board variant
cd /path/to/xiaozhi-esp32
python3 scripts/build.py --list-boards
python3 scripts/build.py <board-directory> --name <variant-name>

Code Evidence

Minimum IDF version constraint from `main/idf_component.yml:155-156`:

  ## Required IDF version
  idf:
    version: '>=6.0.1'

SDK version policy from `README.md:17`:

The project now requires ESP-IDF v6.0.1 or later. ESP-IDF v6.1 is the
recommended SDK. ESP-IDF 5.x is no longer supported.

Target-specific audio engine selection from `main/audio/audio_service.cc:20-24`:

#if CONFIG_IDF_TARGET_ESP32S3 || CONFIG_IDF_TARGET_ESP32P4 || CONFIG_IDF_TARGET_ESP32S31
#include "engines/afe_audio_engine.h"
#else
#include "engines/lite_audio_engine.h"
#endif

Target-specific component gating from `main/idf_component.yml:32-39`:

  78/uart-uhci:
    version: ^0.4.1
    rules:
    - if: target not in [esp32]
  78/uart-eth-modem:
    version: ~0.7.1
    rules:
    - if: target not in [esp32]

Build entry point from `CMakeLists.txt:1-13`:

cmake_minimum_required(VERSION 3.16)
add_compile_options(-Wno-missing-field-initializers)
include($ENV{IDF_PATH}/tools/cmake/project.cmake)
idf_build_set_property(MINIMAL_BUILD ON)
set(PROJECT_VER "2.5.3")
project(xiaozhi)

Common Errors

Error Message Cause Solution
ESP-IDF 5.x build failures Using unsupported IDF 5.x Upgrade to ESP-IDF v6.0.1+ (v6.1 recommended)
Component not found Missing managed component Run `idf.py reconfigure` to trigger Component Manager download
`esp-ml307` version mismatch Wrong esp-ml307 version Ensure `78/esp-ml307` ~3.8.1 is installed
ESP32-S31 build fails on older IDF ESP32-S31 requires IDF 6.1+ Use ESP-IDF v6.1 for S31 targets
PSRAM allocation failures Board without PSRAM or wrong config Verify board config.json sets PSRAM flags correctly
`CONFIG_USE_DEVICE_AEC` and `CONFIG_USE_SERVER_AEC` conflict Both AEC modes enabled Only one AEC mode can be active (application.cc:28-33)

Compatibility Notes

  • ESP32 (original): No UART-UHCI or UART-ETH-MODEM components. Uses `LiteAudioEngine` instead of `AfeAudioEngine`. No camera support via `esp32-camera`.
  • ESP32-C3/C5/C6: Uses `LiteAudioEngine`. No AFE-based voice processing. Touch sensor components gated to S3 only.
  • ESP32-S3: Full AFE audio engine, camera support, touch sensors, and ESP-SR wake word detection. Device-side AEC available with reference mic.
  • ESP32-S31: Requires IDF 6.1+. Same capabilities as S3.
  • ESP32-P4: V4L2 camera (`esp_video`), LCD panel drivers, no built-in WiFi (uses `esp_wifi_remote` + `esp_hosted` on H2).
  • Linux vs Windows: Linux recommended for faster compilation and fewer driver issues.

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment