Skip to content

ESP32: Modernize Build System Infrastructure (Step 1)#32245

Draft
Bwooce wants to merge 1 commit intoArduPilot:masterfrom
Bwooce:esp32-hwdef-infrastructure
Draft

ESP32: Modernize Build System Infrastructure (Step 1)#32245
Bwooce wants to merge 1 commit intoArduPilot:masterfrom
Bwooce:esp32-hwdef-infrastructure

Conversation

@Bwooce
Copy link

@Bwooce Bwooce commented Feb 20, 2026

This PR introduces the core infrastructure for a data-driven build system for ESP32, aligning it further with the standard ArduPilot hwdef.dat approach while maintaining strict compatibility with existing board syntax.

Key Changes

  • Generalized Generator: Refactored esp32_hwdef.py to support multiple chip variants (ESP32, S2, S3, C3, C6, P4) through a data-driven capability database.
  • Auto-Detection: The advanced engine is automatically activated by adding the MCU directive to a hwdef.dat.
  • Dynamic Configuration: Supports generating board-specific ESP-IDF settings (FLASH_SIZE_MB, PSRAM_SIZE) into a generated sdkconfig.board file.
  • Zero-Delta Syntax: The existing master directives (ESP32_SERIAL, ESP32_RCOUT, etc.) are fully supported and validated by the new engine.
  • RISC-V Support: Integrated toolchain selection logic for RISC-V variants in boards.py.
  • Feature Flags: Introduced C++ capability defines (e.g., HAL_ESP32_HAS_MCPWM) to replace target-specific ifdefs.
  • Documentation: Added MIGRATION.md detailing the one-step MCU upgrade path.

Staging Strategy

This is Step 1 of a multi-stage refactor:

  1. Infrastructure (This PR): Adds the advanced logic and auto-detection support. Existing boards remain unchanged and fully functional.
  2. Migration: Upgrading existing boards to the "Advanced" hwdef.dat engine by adding the MCU directive and moving board-specific settings from shared templates to board files.
  3. Cleanup: Removing deprecated compatibility logic once all boards are migrated.

Relates to #30709

@Bwooce Bwooce force-pushed the esp32-hwdef-infrastructure branch 9 times, most recently from e295322 to d30dfca Compare February 20, 2026 08:13
This PR introduces the core infrastructure for a data-driven build system for ESP32, aligning it further with the standard ArduPilot hwdef.dat approach while maintaining strict compatibility with existing board syntax.

Key Infrastructure Changes:
- Generalized esp32_hwdef.py: Supports multiple chip variants (ESP32, S2, S3, C3, C6, P4) through a data-driven capability database.
- Auto-detection: The advanced engine is automatically activated by the presence of the 'MCU' directive in hwdef.dat.
- Backward Compatibility: Full support for current master 'ESP32_...' syntax ensures zero breakage for existing boards.
- Dynamic sdkconfig: Added support for generating board-specific settings (FLASH_SIZE_MB, PSRAM_SIZE) into a generated 'sdkconfig.board' file, reducing reliance on shared templates.
- Partition Table Support: Automated copying of custom partition tables from board directories.
- RISC-V Support: Integrated toolchain selection logic for ESP32-C3, C6, and P4 variants in boards.py.
- Feature Flags: Introduced C++ capability defines (e.g., HAL_ESP32_HAS_MCPWM) triggered by the hardware database.
- Documentation: Added MIGRATION.md detailing the 'MCU' upgrade path.

Relates to ArduPilot#30709
@Bwooce Bwooce force-pushed the esp32-hwdef-infrastructure branch from d30dfca to 7854789 Compare February 20, 2026 08:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments