diff --git a/configs/esp32-core/include/board.h b/configs/esp32-core/include/board.h index fb0c327482..45e3d109af 100644 --- a/configs/esp32-core/include/board.h +++ b/configs/esp32-core/include/board.h @@ -50,15 +50,22 @@ #endif /* Clock reconfiguration is currently disabled, so the CPU will be running - * at the XTAL frequency. + * at the XTAL frequency or at two times the XTAL frequency, depending upon + * how we load the code: + * + * - If we load the code into FLASH at address 0x1000 where it is started by + * the second level bootloader, then the frequency is the crystal + * frequency. + * - If we load the code into IRAM after the second level bootloader has run + * this frequency will be twice the crystal frequency. + * + * Don't ask me for an explanation. */ -#if 0 -# define BOARD_CLOCK_FREQUENCY 80000000 -#else - /* Hmmm... actually appears to be running at about 2 x the XTAL frequency */ - +#ifdef CONFIG_ESP32CORE_RUN_IRAM # define BOARD_CLOCK_FREQUENCY (2 * BOARD_XTAL_FREQUENCY) +#else +# define BOARD_CLOCK_FREQUENCY BOARD_XTAL_FREQUENCY #endif #endif /* __CONFIGS_ESP32_CORE_INCLUDE_BOARD_H */