Xtensa ESP32: Clock frequency is different if running from IRAM or is booting from FLASH. This is a booltloader issue.

This commit is contained in:
Geoffrey 2016-12-20 16:14:17 -06:00 committed by Gregory Nutt
parent 59c5ae3eae
commit 89c33e9799

View File

@ -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 */