Repository navigation
fix(esp32c3): gate fast_isr.S on __riscv_atomic, not bare __riscv - #2577
Conversation
`fast_isr.S` uses RV32A load-reserved / store-conditional (`lr.w` / `sc.w`) for the lock-free write-index update, but was gated only by `#ifdef __riscv`. That matches **every** Espressif RISC-V chip — including ESP32-C3 / C2 which are RV32IMC (no A extension). On those chips the assembler rejects the opcodes: fast_isr.S:150: Error: unrecognized opcode `lr.w t0,(t4)', extension `zalrsc' required fast_isr.S:160: Error: unrecognized opcode `sc.w t5,t1,(t4)', extension `zalrsc' required breaking every `esp32c3` example build on master before any user code is compiled. The companion C++ glue `gpio_isr_rx_mcpwm.cpp.hpp` already gates on `SOC_MCPWM_SUPPORTED` which excludes C3/C2 (no MCPWM peripheral), so the assembly was the only file leaking into those builds. Fix: require `__riscv_atomic` (GCC's standard predefine for the A extension) alongside `__riscv`. C6 / H2 / C5 / P4 (RV32IMAC+) still compile the fast ISR; C3 / C2 cleanly skip it. Fixes #2576
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughTightens preprocessor guard in fast GPIO ISR assembly from ChangesAtomic Extension Guard Tightening
Estimated code review effort🎯 1 (Trivial) | ⏱️ ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Summary
esp32c3example build on master fails at:#ifdef __riscv, which matches every Espressif RISC-V chip — including ESP32-C3 / C2 (RV32IMC, no atomic extension). The companion C++ gluegpio_isr_rx_mcpwm.cpp.hppalready excludes those chips viaSOC_MCPWM_SUPPORTED(C3/C2 lack MCPWM), so the assembly was the only file leaking into those builds.__riscv_atomic(GCC's standard predefine for the A extension) alongside__riscv. C6 / H2 / C5 / P4 (RV32IMAC+) still compile the fast ISR; C3 / C2 cleanly skip it.Fixes #2576
Test plan
bash lintclean (cpp_linting / etc.).esp32c3workflow should now reach actual compilation.esp32c6/esp32h2/esp32p4workflows must continue to include the fast ISR (no regression).Generated with Claude Code (https://claude.com/claude-code)
Summary by CodeRabbit