Skip to content

Conversation

@me-no-dev
Copy link
Member

This pull request introduces support for handling chip variants in the build system, making it possible to distinguish between different configurations of the same target (e.g., esp32p4 vs. esp32p4_es). The changes update scripts and configuration files to consistently use the new CHIP_VARIANT variable, ensuring builds, outputs, and configurations are correctly associated with the intended variant.

Build System Updates:

  • Added logic in build.sh and tools/config.sh to extract and use chip_variant from configs/builds.json, defaulting to target if not specified. All build and config operations now reference CHIP_VARIANT instead of just IDF_TARGET. [1] [2] [3]
  • Updated CMake custom commands in CMakeLists.txt to pass CHIP_VARIANT to scripts, ensuring the correct variant is used during library, bootloader, and memory variant copying. [1] [2] [3]

Configuration File Changes:

  • Added a new entry for esp32p4_es in configs/builds.json, enabling builds for this chip variant with its own features, libraries, bootloaders, and memory variants.
  • Introduced configs/defconfig.esp32p4_es for the new variant with specific configuration options, including ESP-Hosted-MCU, Bluetooth, display, and USB settings.

Script and Variable Renaming:

  • Modified all relevant scripts (tools/copy-libs.sh, tools/copy-bootloader.sh, tools/copy-mem-variant.sh) to accept CHIP_VARIANT as an argument and use it in output paths and logging, replacing previous uses of IDF_TARGET. [1] [2] [3]
  • Updated output and configuration variables in tools/config.sh to use CHIP_VARIANT for SDK paths and platform definitions.

Logging and Output Improvements:

  • Enhanced build and script logs to show both target and CHIP_VARIANT, improving clarity during multi-variant builds. [1] [2] [3] [4]

Default Configuration Handling:

  • Ensured that if CHIP_VARIANT is not set, it defaults to the value of IDF_TARGET, maintaining backward compatibility.

These changes collectively enable robust multi-variant support in the build system, making it easier to manage and build different configurations for the same hardware target.

Connected to espressif/arduino-esp32#12036

Copy link
Member

@lucasssvaz lucasssvaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lucasssvaz lucasssvaz requested a review from Copilot November 17, 2025 19:33
Copilot finished reviewing on behalf of lucasssvaz November 17, 2025 19:35
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request introduces comprehensive support for chip variants in the ESP32 Arduino library builder, enabling differentiation between configurations of the same target (e.g., esp32p4 vs. esp32p4_es). The changes update build scripts, CMake configuration, and CI/CD workflows to use a new CHIP_VARIANT variable alongside IDF_TARGET, with automatic fallback to maintain backward compatibility.

Key changes:

  • Added CHIP_VARIANT parameter handling throughout the build system, extracting it from configs/builds.json and defaulting to IDF_TARGET when not specified
  • Introduced new ESP32-P4 early silicon variant (esp32p4_es) with dedicated configuration and build definitions
  • Updated all shell scripts to accept and use CHIP_VARIANT for output paths and logging

Reviewed Changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
build.sh Extracts chip_variant from JSON config, uses CHIP_VARIANT for builds and path resolution, updated logging
CMakeLists.txt Passes CHIP_VARIANT environment variable to all custom commands (libs, bootloader, mem-variant)
tools/config.sh Adds CHIP_VARIANT fallback logic and updates SDK paths to use variant instead of target
tools/copy-libs.sh Adds CHIP_VARIANT as second parameter, shifts other parameters accordingly
tools/copy-bootloader.sh Adds CHIP_VARIANT as second parameter, shifts flash mode/freq parameters
tools/copy-mem-variant.sh Adds CHIP_VARIANT as second parameter, shifts oct flash/psram parameters
configs/builds.json Adds new esp32p4_es target entry with chip_variant field and specific build configurations
configs/defconfig.esp32p4_es New configuration file for ESP32-P4 early silicon with ESP-Hosted-MCU, Bluetooth, display, and USB settings
configs/defconfig.esp32p4 Adds explicit disable of early silicon revision selection
.github/workflows/push.yml Adds esp32p4_es to build matrix targets
.github/workflows/cron.yml Adds esp32p4_es to scheduled build targets

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@me-no-dev me-no-dev merged commit f049bf0 into master Nov 17, 2025
17 checks passed
@me-no-dev me-no-dev deleted the feature/chip_variant branch November 17, 2025 21:40
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.

3 participants