Skip to content

build(esp32s2/s3): drop unconditional -DUSB_VID/USB_PID injection (149-156 redefinition warnings per build) #405

Description

@zackees

Summary

On esp32s2 and esp32s3 builds, fbuild unconditionally injects -DUSB_VID=... and -DUSB_PID=... (and likely USB_MANUFACTURER/USB_PRODUCT) into the compile-flag set. The Arduino framework variant headers also #define these symbols, producing 149-156 redefinition warnings per build.

warning: "USB_VID" redefined
note: this is the location of the previous definition  <command-line>

Locations:

  • framework-arduinoespressif32/.../variants/esp32s3/pins_arduino.h:7
  • framework-arduinoespressif32/.../variants/lolin_s2_mini/pins_arduino.h:7 (also other S2 variants)

Evidence

  • esp32s3 audit run: 156 hits
  • esp32s2 audit run: 149 hits
  • rgbw (esp32s3 underneath): 39 hits

This is noise that buries real warnings and slows CI log grep / diagnostics workflows.

Proposed fix

Mirror PlatformIO behavior: only inject -DUSB_VID/USB_PID when the user has explicitly set custom values in build_flags or the board JSON, otherwise let the variant pins_arduino.h define them. This requires the ESP32 flag builder (crates/fbuild-build/src/esp32/.../flag_* likely) to detect default-vs-override.

Acceptance: a clean esp32s3 build emits zero "USB_VID" redefined warnings; a user sketch with build_flags = -DUSB_VID=0xDEAD still wins.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    Triage

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions