deep sleep: fix regression due to moving ets_update_cpu_frequency into IRAM

Deep sleep stub may call ets_update_cpu_frequency, which has been moved from ROM to IRAM.
Restore the ROM version in the linker script, call it ets_update_cpu_frequency_rom, use it in the deep sleep stub.
This commit is contained in:
Ivan Grokhotkov 2017-01-11 17:17:13 +08:00
parent d3a0580bef
commit e4811216ff
3 changed files with 14 additions and 2 deletions

View file

@ -91,7 +91,7 @@ void RTC_IRAM_ATTR esp_default_wake_deep_sleep(void) {
#if CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY > 0 #if CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY > 0
// ROM code has not started yet, so we need to set delay factor // ROM code has not started yet, so we need to set delay factor
// used by ets_delay_us first. // used by ets_delay_us first.
ets_update_cpu_frequency(ets_get_detected_xtal_freq() / 1000000); ets_update_cpu_frequency_rom(ets_get_detected_xtal_freq() / 1000000);
// This delay is configured in menuconfig, it can be used to give // This delay is configured in menuconfig, it can be used to give
// the flash chip some time to become ready. // the flash chip some time to become ready.
ets_delay_us(CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY); ets_delay_us(CONFIG_ESP32_DEEP_SLEEP_WAKEUP_DELAY);

View file

@ -383,6 +383,18 @@ void ets_delay_us(uint32_t us);
*/ */
void ets_update_cpu_frequency(uint32_t ticks_per_us); void ets_update_cpu_frequency(uint32_t ticks_per_us);
/**
* @brief Set the real CPU ticks per us to the ets, so that ets_delay_us will be accurate.
*
* @note This function only sets the tick rate for the current CPU. It is located in ROM,
* so the deep sleep stub can use it even if IRAM is not initialized yet.
*
* @param uint32_t ticks_per_us : CPU ticks per us.
*
* @return None
*/
void ets_update_cpu_frequency_rom(uint32_t ticks_per_us);
/** /**
* @brief Get the real CPU ticks per us to the ets. * @brief Get the real CPU ticks per us to the ets.
* This function do not return real CPU ticks per us, just the record in ets. It can be used to check with the real CPU frequency. * This function do not return real CPU ticks per us, just the record in ets. It can be used to check with the real CPU frequency.

View file

@ -202,7 +202,7 @@ PROVIDE ( ets_timer_init = 0x400084e8 );
PROVIDE ( ets_timer_setfn = 0x40008350 ); PROVIDE ( ets_timer_setfn = 0x40008350 );
PROVIDE ( ets_unpack_flash_code = 0x40007018 ); PROVIDE ( ets_unpack_flash_code = 0x40007018 );
PROVIDE ( ets_unpack_flash_code_legacy = 0x4000694c ); PROVIDE ( ets_unpack_flash_code_legacy = 0x4000694c );
/* PROVIDE ( ets_update_cpu_frequency = 0x40008550 ); */ /* Updates g_ticks_per_us on the current CPU only; not on the other core */ PROVIDE ( ets_update_cpu_frequency_rom = 0x40008550 ); /* Updates g_ticks_per_us on the current CPU only; not on the other core */
PROVIDE ( ets_waiti0 = 0x400067d8 ); PROVIDE ( ets_waiti0 = 0x400067d8 );
PROVIDE ( exc_cause_table = 0x3ff991d0 ); PROVIDE ( exc_cause_table = 0x3ff991d0 );
PROVIDE ( _exit_r = 0x4000bd28 ); PROVIDE ( _exit_r = 0x4000bd28 );