Visitar URL original
esp32/esp32_common: Make a board's pins.csv configurable for variants. by UnexpectedMaker · Pull Request #19728 · micropython/micropython · GitHub
Skip to content

esp32/esp32_common: Make a board's pins.csv configurable for variants. - #19728

Merged
dpgeorge merged 1 commit into
micropython:masterfrom
UnexpectedMaker:variants
Oct 10, 2026
Merged

dpgeorge merged 1 commit into
micropython:masterfrom
UnexpectedMaker:variants

Conversation

@UnexpectedMaker

Copy link
Copy Markdown
Contributor

Summary

I have new revisions of most of my ESP32 boards that can run off the same MP builds – but they have some external header and/or internal IO mapping changes, so I needed a way to allow the variant build system to support different pins.csv files.

The rp2 port lets a board override its pins file via MICROPY_BOARD_PINS (1a060e8), so this change brings the same to the esp32 port, so one board folder can use board variants to support hardware revisions with different pin mappings, instead of duplicating the whole board definition.

A board's mpconfigboard.cmake or mpconfigvariant_*.cmake can now set MICROPY_BOARD_PINS. If it isn't set, the build uses ${MICROPY_BOARD_DIR}/pins.csv as before, so existing boards are unaffected.

Testing

Built an esp32c6 board (UM_TINYC6) with two variants on ESP-IDF v5.5.5: one pointing MICROPY_BOARD_PINS at pins.csv, the other at pins_d.csv, and I flashed both board revisions and checked that each build generated pins.c from the correct CSV.

Generative AI

I used generative AI tools when creating this PR, but I found the existing rp2 support, directed the AI to add it to the esp32 port, and then personally checked and verified the change, before making builds.

I also created the variant pin files, flashed the boards and tested them myself.

This PR was generated by me, not my AI.

SeonR

Allow `mpconfigboard.cmake` or `mpconfigvariant_*.cmake` to specify a
custom `MICROPY_BOARD_PINS` to override `${MICROPY_BOARD_DIR}/pins.csv`.

This lets a single board definition support hardware revisions that have
different pin mappings by using board variants.

This was copied from the existing behavior of the rp2 port.

Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
@github-actions

Copy link
Copy Markdown

Code size report:

Reference:  mimxrt/modmachine: Fix machine.deepsleep(ms) for the MIMXRT1176 port. [09f5bb4]
Comparison: esp32/esp32_common: Make a board's pins.csv configurable for variants. [merge of 1259001]
  mpy-cross:    +0 +0.000% 
   bare-arm:    +0 +0.000% 
minimal x86:    +0 +0.000% 
   unix x64:    +0 +0.000% standard
      stm32:    +0 +0.000% PYBV10
      esp32:    +0 +0.000% ESP32_GENERIC
     mimxrt:    +0 +0.000% TEENSY40
        rp2:    +0 +0.000% RPI_PICO_W
       samd:    +0 +0.000% ADAFRUIT_ITSYBITSY_M4_EXPRESS
  qemu rv32:    +0 +0.000% VIRT_RV32

@dpgeorge dpgeorge left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, looks good, it's a straight application of the rp2 port's 1a060e8

@UnexpectedMaker

Copy link
Copy Markdown
Contributor Author

Wicked, thanks @dpgeorge - now I can PR a stack of new UM board changes that used it!

UnexpectedMaker added a commit to UnexpectedMaker/micropython that referenced this pull request Oct 5, 2026
Add Series D variants to the Unexpected Maker TinyS3, ProS3, FeatherS3,
TinyC6 and TinyPICO boards.  Each board now has a standard variant and a
D variant that uses its own `pins_d.csv` via `MICROPY_BOARD_PINS` and its
own frozen manifest.  D variants include a MAX17048 fuel gauge driver and
a new `*d.py` helper module, and report a `[D]` board name.

The TinyC6[D] also includes an FXL6408 IO expander driver, which is used
to switch between the onboard and external antenna.

Add the new EdgeS3[D] board, which includes the MAX17048 fuel gauge and
FXL6408 IO expander drivers.

Also fix the I2C SCL and SDA pins, which were swapped in the TinyS3 and
ProS3 `pins.csv`.

This requires PR micropython#19728 so that the builds use the correct pins file for
each variant:
micropython#19728

Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
UnexpectedMaker added a commit to UnexpectedMaker/micropython that referenced this pull request Oct 5, 2026
Add Series D variants to the Unexpected Maker TinyS3, ProS3, FeatherS3,
TinyC6 and TinyPICO boards.  Each board now has a standard variant and a
D variant that uses its own `pins_d.csv` via `MICROPY_BOARD_PINS` and its
own frozen manifest.  D variants include a MAX17048 fuel gauge driver and
a new `*d.py` helper module, and report a `[D]` board name.

The TinyC6[D] also includes an FXL6408 IO expander driver, which is used
to switch between the onboard and external antenna.

Add the new EdgeS3[D] board, which includes the MAX17048 fuel gauge and
FXL6408 IO expander drivers.

Also fix the I2C SCL and SDA pins, which were swapped in the TinyS3 and
ProS3 `pins.csv`.

This requires PR micropython#19728 so that the builds use the correct pins file for
each variant:
micropython#19728

Signed-off-by: Seon Rozenblum <seon@unexpectedmaker.com>
@dpgeorge dpgeorge added this to the release-1.30 milestone Oct 6, 2026
@dpgeorge
dpgeorge merged commit 96ba4d0 into micropython:master Oct 10, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants