From ac220f7497869a06af4cdce65b93a25786b34b8e Mon Sep 17 00:00:00 2001 From: Aditya Patwardhan Date: Tue, 31 Mar 2026 00:00:33 +0530 Subject: [PATCH] fix(regi2c): skip regi2c operations when running on FPGA regi2c (the analog i2c master) is not implemented on FPGA: the REGI2C_RTC_BUSY poll in the regi2c helpers never completes, so the 2nd-stage bootloader hangs until the WDT resets the chip (observed on the ESP32-S31 FPGA, bitstream v5.0.0-most-ip). Stub out the regi2c_impl_* macros in hal/regi2c_impl.h when HAL_CONFIG(ENV_FPGA) is set, so every regi2c call site is skipped on FPGA for all current and future targets. --- .../esp_hal_regi2c/include/hal/regi2c_impl.h | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/components/esp_hal_regi2c/include/hal/regi2c_impl.h b/components/esp_hal_regi2c/include/hal/regi2c_impl.h index 9d080ad146c..c3e6b7591de 100644 --- a/components/esp_hal_regi2c/include/hal/regi2c_impl.h +++ b/components/esp_hal_regi2c/include/hal/regi2c_impl.h @@ -9,6 +9,7 @@ #include #include "esp_rom_caps.h" #include "esp_rom_regi2c.h" +#include "hal/config.h" #ifdef __cplusplus extern "C" { @@ -46,6 +47,15 @@ void _regi2c_impl_write(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t */ void _regi2c_impl_write_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t msb, uint8_t lsb, uint8_t data); +#if HAL_CONFIG(ENV_FPGA) +// No REGI2C can be performed on FPGA, skip +#define regi2c_impl_read(...) (0) +#define regi2c_impl_read_mask(...) (0) +#define regi2c_impl_write(...) +#define regi2c_impl_write_mask(...) + +#else // !HAL_CONFIG(ENV_FPGA) + #if NON_OS_BUILD /* If compiling for the non-FreeRTOS builds (e.g. bootloader), REGI2C read/write operations are always atomic */ @@ -85,7 +95,9 @@ void _regi2c_impl_write_mask(uint8_t block, uint8_t host_id, uint8_t reg_add, ui _regi2c_impl_write_mask(__VA_ARGS__); \ } while(0) -#endif +#endif // NON_OS_BUILD + +#endif // HAL_CONFIG(ENV_FPGA) #ifdef __cplusplus }