Skip to content

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

Open
UnexpectedMaker wants to merge 1 commit into
micropython:masterfrom
UnexpectedMaker:variants
Open

UnexpectedMaker wants to merge 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

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.

2 participants