Skip to content

Commit 28aec95

Browse files
fix(app_update): Fix CI test_switch_ota by increasing deepsleep
It increases the deepsleep time from 2000 to 20000. 2000 is too small for esp32-s3 chip.
1 parent c7d8b06 commit 28aec95

File tree

3 files changed

+23
-15
lines changed

3 files changed

+23
-15
lines changed

components/app_update/test_apps/main/test_switch_ota.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -185,8 +185,8 @@ static void erase_ota_data(void)
185185
static void reboot_as_deep_sleep(void)
186186
{
187187
ESP_LOGI(TAG, "reboot as deep sleep");
188-
esp_sleep_enable_timer_wakeup(2000);
189-
esp_deep_sleep_start();
188+
esp_deep_sleep(20000);
189+
TEST_FAIL_MESSAGE("Should never be reachable except when sleep is rejected, abort");
190190
}
191191

192192
/* @brief Copies a current app to next partition (OTA0-15), after that ESP is rebooting and run this (the next) OTAx.

components/esp_hw_support/include/esp_sleep.h

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD
2+
* SPDX-FileCopyrightText: 2015-2023 Espressif Systems (Shanghai) CO LTD
33
*
44
* SPDX-License-Identifier: Apache-2.0
55
*/
@@ -415,9 +415,12 @@ esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain,
415415
/**
416416
* @brief Enter deep sleep with the configured wakeup options
417417
*
418-
* This function does not return.
418+
* @note In general, the function does not return, but if the sleep is rejected,
419+
* then it returns from it.
420+
*
421+
* The reason for the rejection can be such as a short sleep time.
419422
*/
420-
void esp_deep_sleep_start(void) __attribute__((__noreturn__));
423+
void esp_deep_sleep_start(void);
421424

422425
/**
423426
* @brief Enter light sleep with the configured wakeup options
@@ -441,9 +444,14 @@ esp_err_t esp_light_sleep_start(void);
441444
* Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup
442445
* followed by a call to esp_deep_sleep_start.
443446
*
447+
* @note In general, the function does not return, but if the sleep is rejected,
448+
* then it returns from it.
449+
*
450+
* The reason for the rejection can be such as a short sleep time.
451+
*
444452
* @param time_in_us deep-sleep time, unit: microsecond
445453
*/
446-
void esp_deep_sleep(uint64_t time_in_us) __attribute__((__noreturn__));
454+
void esp_deep_sleep(uint64_t time_in_us);
447455

448456

449457
/**

components/esp_hw_support/sleep_modes.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -856,15 +856,15 @@ void IRAM_ATTR esp_deep_sleep_start(void)
856856

857857
// Enter sleep
858858
if (esp_sleep_start(force_pd_flags | pd_flags, ESP_SLEEP_MODE_DEEP_SLEEP) == ESP_ERR_SLEEP_REJECT) {
859-
ESP_EARLY_LOGW(TAG, "Deep sleep request is rejected");
860-
}
861-
862-
// Because RTC is in a slower clock domain than the CPU, it
863-
// can take several CPU cycles for the sleep mode to start.
864-
while (1) {
865-
;
859+
ESP_EARLY_LOGE(TAG, "Deep sleep request is rejected");
860+
} else {
861+
// Because RTC is in a slower clock domain than the CPU, it
862+
// can take several CPU cycles for the sleep mode to start.
863+
while (1) {
864+
;
865+
}
866866
}
867-
// Never returns here
867+
// Never returns here, except that the sleep is rejected.
868868
esp_ipc_isr_release_other_cpu();
869869
portEXIT_CRITICAL(&spinlock_rtc_deep_sleep);
870870
}

0 commit comments

Comments
 (0)