You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
esp32c3: fast_isr.S uses RISC-V atomic ops (lr.w/sc.w) but C3 lacks the A extension #2576
src/platforms/esp/32/drivers/gpio_isr_rx/fast_isr.S is gated only by #ifdef __riscv (line 49). That matches every Espressif RISC-V chip, including:
Chip
ISA
Atomic (A) ext?
ESP32-C3
RV32IMC
no
ESP32-C2
RV32IMC
no
ESP32-C6
RV32IMAC
yes
ESP32-H2
RV32IMAC
yes
ESP32-C5
RV32IMAC
yes
ESP32-P4
RV32IMAFC
yes
The ISR body uses RV32A load-reserved / store-conditional (lr.w / sc.w) at lines 150 and 160 — those opcodes need the A extension. On ESP32-C3 the assembler rejects them.
The accompanying C++ file gpio_isr_rx_mcpwm.cpp.hppis properly gated:
ESP32-C3/C2 do not have MCPWM, so the C++ glue is correctly skipped — only the .S is the outlier.
The file's own header comment explicitly says the target is ESP32-C6 (RV32IMAC), so the C3 inclusion is purely incidental from the loose preprocessor gate.
Affected jobs
Every esp32c3 workflow (every example).
Any future RV32IMC Espressif chip will hit the same.
Proposed fix
Tighten the gate in fast_isr.S to require the atomic extension. GCC predefines __riscv_atomic (and __riscv_a) when the A extension is enabled by -march= flags. RV32IMC chips never define it.
- #ifdef __riscv // Only compile for RISC-V platforms (ESP32-C6)+ // The fast ISR uses RV32A lr.w/sc.w atomics for the circular-buffer+ // index update. Only compile on RISC-V cores that ship the A extension+ // (ESP32-C6/H2/C5/P4 — RV32IMAC+). ESP32-C3/C2 are RV32IMC and would+ // fail the assembler with "extension `zalrsc' required". The companion+ // C++ glue in gpio_isr_rx_mcpwm.cpp.hpp already guards on+ // SOC_MCPWM_SUPPORTED, which excludes C3/C2 anyway — this aligns the+ // assembly with that gate.+ #if defined(__riscv) && defined(__riscv_atomic)
(Symmetric #endif comment update.)
Repro
bash compile esp32c3 --examples Blink
Filed automatically while triaging broken builds; intent is to open a PR immediately.
Activity