Repository navigation
Description
Context
The shared parallel software-SPI GPIO backend selects ESP32-C3/C2 register addresses for every non-host build. spi_platform.h defaults W1TS to 0x60004008 and W1TC to 0x6000400c without selecting or rejecting other targets. Six independent SpiBlock*::transmit() bodies and the shared ISR engine write through these macros.
Independent inspection of the installed real classic ESP32 SDK gives GPIO_https://github.com/FastLED/FastLED/blob/94dab9c6b720ea277ec9177c93129c7dc646c5c3/ 0x3ff44000, W1TS base+8 and W1TC base+0xc. Its expected addresses are therefore 0x3ff44008/0x3ff4400c, demonstrating an actual target mismatch. No production override definition was found in src. Host simulation selects different functions and cannot expose this defect.
Source:
| #else |
| FL_GPIO_WRITE_SET(pins_to_set); /* data-high bits */ |
spi_block_1.h, spi_block_2.h, spi_block_4.h, spi_block_8.h, spi_block_16.h, spi_block_32.h in the same directory. Baseline platform blob: e7d604065dc2b942df45cd429c0050e0030202ca.
The classes are public and documented/directly callable. ParallelDevice includes them but its begin/write routes explicitly return not implemented; this issue does not invent an active producer through that wrapper.
Proposal
Select the actual target GPIO backend at the platform boundary using real vendor definitions and supported bank semantics, or reject unsupported targets explicitly. Preserve a documented explicit custom-backend contract. Do not silently use C3/C2 addresses elsewhere.
Acceptance criteria
- Show focused RED before implementation and GREEN afterward using the actual production macros, all six blocking classes and shared ISR engine where supported.
- Compile against real representative classic ESP32, C3/C2, Xtensa/RISC-V and a non-ESP target SDK. Assert actual register identity and operation width; supported paths use the correct bank and unsupported paths fail explicitly. Host MMIO simulation alone is insufficient.
- Preserve exact bits/edges, unrelated GPIO, final/empty/repeated-transfer state and data/clock ownership. Do not claim a throughput improvement without target evidence or physical timing without measurement.
- Restoring the hardcoded unconditional C3/C2 selection must fail the target-selection signal. Bind selection/header/backend/SDK inputs into test: gate software SPI changes on exhaustive production-path and mutation evidence #5031.
Decisions
Group the common register-selection cause in one child, but require each independent caller and target configuration. This is separate from #5050's BitBangChannelDriver/DigitalMultiWrite8 route and from generic FastPin optimization. Pin-index validation is tracked separately.
Part of #5024.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
zackees commentedon Nov 7, 2026
#5145 takes the GPIO registers from each ESP32 target's SDK and rejects other targets on use; it is in the merge queue. This issue stays open for: a real-target selection gate (the current test is structural, and the address checks were one-off probes), on-target byte and edge checks, audit binding for #5031, and pins 32 and above.
zackees commentedon Nov 22, 2026
Fixed on master by #5145 (19e3f38). Closing.
Evidence (origin/master 2465a62):
src/platforms/shared/spi_bitbang/spi_platform.hhas no hardcoded addresses. On ESP32 it takesGPIO_OUT_W1TS_REG/GPIO_OUT_W1TC_REGfrom the target's ownsoc/gpio_reg.h. Defining only one ofFASTLED_GPIO_W1TS_ADDR/FASTLED_GPIO_W1TC_ADDRis an#error; defining both is the explicit custom-backend contract. On every other targetFL_SPI_GPIO_AVAILABLEis 0, so all sixSpiBlock*::transmit()fail aFL_STATIC_ASSERTandspi_isr_engine.cpp.hppis not built.setPinMapping()returns false throughspiPinMappingValidand leaves the old mapping in place. The host testtests/platforms/shared/spi_bitbang/spi_platform.cppcovers the 32-pinSpiBlock32case.spi_platform.h(the unconditional0x60004008u/0x6000400Cudefaults) and ranci/tests/test_spi_platform_gpio_selection.py. Three tests failed:test_no_hardcoded_register_address,test_esp32_takes_addresses_from_the_sdkandtest_other_targets_have_no_addresses. With master's header, 5 pass. The host test runs the transmit bodies of all six widths through the production macros under simulation.Not done (explicit limitations, like #5061 and #5056):
ParallelDevicestill returns not-implemented, so no in-tree producer drives these classes on hardware.Reopen with a target build log or a capture if a real target shows the wrong register.