Merge branch 'ci/fix_test_switch_ota_v5.1' into 'release/v5.1'

fix(app_update): Fix CI test_switch_ota by increasing deepsleep (v5.1)

See merge request espressif/esp-idf!25465
This commit is contained in:
Mahavir Jain 2023-08-24 12:16:51 +08:00
commit 5758b66a9f
5 changed files with 24 additions and 14 deletions

View File

@ -1,5 +1,5 @@
/* /*
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
* *
* SPDX-License-Identifier: Apache-2.0 * SPDX-License-Identifier: Apache-2.0
*/ */
@ -185,8 +185,8 @@ static void erase_ota_data(void)
static void reboot_as_deep_sleep(void) static void reboot_as_deep_sleep(void)
{ {
ESP_LOGI(TAG, "reboot as deep sleep"); ESP_LOGI(TAG, "reboot as deep sleep");
esp_sleep_enable_timer_wakeup(2000); esp_deep_sleep(20000);
esp_deep_sleep_start(); TEST_FAIL_MESSAGE("Should never be reachable except when sleep is rejected, abort");
} }
/* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx. /* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx.

View File

@ -435,9 +435,12 @@ esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain,
/** /**
* @brief Enter deep sleep with the configured wakeup options * @brief Enter deep sleep with the configured wakeup options
* *
* This function does not return. * @note In general, the function does not return, but if the sleep is rejected,
* then it returns from it.
*
* The reason for the rejection can be such as a short sleep time.
*/ */
void esp_deep_sleep_start(void) __attribute__((__noreturn__)); void esp_deep_sleep_start(void);
/** /**
* @brief Enter light sleep with the configured wakeup options * @brief Enter light sleep with the configured wakeup options
@ -461,9 +464,14 @@ esp_err_t esp_light_sleep_start(void);
* Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup * Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup
* followed by a call to esp_deep_sleep_start. * followed by a call to esp_deep_sleep_start.
* *
* @note In general, the function does not return, but if the sleep is rejected,
* then it returns from it.
*
* The reason for the rejection can be such as a short sleep time.
*
* @param time_in_us deep-sleep time, unit: microsecond * @param time_in_us deep-sleep time, unit: microsecond
*/ */
void esp_deep_sleep(uint64_t time_in_us) __attribute__((__noreturn__)); void esp_deep_sleep(uint64_t time_in_us);
/** /**

View File

@ -866,15 +866,15 @@ void IRAM_ATTR esp_deep_sleep_start(void)
// Enter sleep // Enter sleep
if (esp_sleep_start(force_pd_flags | pd_flags, ESP_SLEEP_MODE_DEEP_SLEEP) == ESP_ERR_SLEEP_REJECT) { if (esp_sleep_start(force_pd_flags | pd_flags, ESP_SLEEP_MODE_DEEP_SLEEP) == ESP_ERR_SLEEP_REJECT) {
ESP_EARLY_LOGW(TAG, "Deep sleep request is rejected"); ESP_EARLY_LOGE(TAG, "Deep sleep request is rejected");
} else {
// Because RTC is in a slower clock domain than the CPU, it
// can take several CPU cycles for the sleep mode to start.
while (1) {
;
}
} }
// Never returns here, except that the sleep is rejected.
// Because RTC is in a slower clock domain than the CPU, it
// can take several CPU cycles for the sleep mode to start.
while (1) {
;
}
// Never returns here
esp_ipc_isr_release_other_cpu(); esp_ipc_isr_release_other_cpu();
portEXIT_CRITICAL(&spinlock_rtc_deep_sleep); portEXIT_CRITICAL(&spinlock_rtc_deep_sleep);
} }

View File

@ -225,6 +225,7 @@ static int deep_sleep(int argc, char **argv)
rtc_gpio_isolate(GPIO_NUM_12); rtc_gpio_isolate(GPIO_NUM_12);
#endif #endif
esp_deep_sleep_start(); esp_deep_sleep_start();
return 1;
} }
static void register_deep_sleep(void) static void register_deep_sleep(void)

View File

@ -273,6 +273,7 @@ static int deep_sleep(int argc, char **argv)
#endif //CONFIG_IDF_TARGET_ESP32 #endif //CONFIG_IDF_TARGET_ESP32
esp_deep_sleep_start(); esp_deep_sleep_start();
return 1;
} }
static void register_deep_sleep(void) static void register_deep_sleep(void)