Skip to content

Commit 53ff7d4

Browse files
committed
Merge branch 'ci/fix_test_switch_ota' into 'master'
fix(app_update): Fix CI test_switch_ota by increasing deepsleep See merge request espressif/esp-idf!24801
2 parents 6f5f7fd + f07fcbe commit 53ff7d4

File tree

5 files changed

+24
-14
lines changed

5 files changed

+24
-14
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: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,9 +426,12 @@ esp_err_t esp_sleep_pd_config(esp_sleep_pd_domain_t domain,
426426
/**
427427
* @brief Enter deep sleep with the configured wakeup options
428428
*
429-
* This function does not return.
429+
* @note In general, the function does not return, but if the sleep is rejected,
430+
* then it returns from it.
431+
*
432+
* The reason for the rejection can be such as a short sleep time.
430433
*/
431-
void esp_deep_sleep_start(void) __attribute__((__noreturn__));
434+
void esp_deep_sleep_start(void);
432435

433436
/**
434437
* @brief Enter light sleep with the configured wakeup options
@@ -452,9 +455,14 @@ esp_err_t esp_light_sleep_start(void);
452455
* Call to this function is equivalent to a call to esp_deep_sleep_enable_timer_wakeup
453456
* followed by a call to esp_deep_sleep_start.
454457
*
458+
* @note In general, the function does not return, but if the sleep is rejected,
459+
* then it returns from it.
460+
*
461+
* The reason for the rejection can be such as a short sleep time.
462+
*
455463
* @param time_in_us deep-sleep time, unit: microsecond
456464
*/
457-
void esp_deep_sleep(uint64_t time_in_us) __attribute__((__noreturn__));
465+
void esp_deep_sleep(uint64_t time_in_us);
458466

459467

460468
/**

components/esp_hw_support/sleep_modes.c

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

885885
// Enter sleep
886886
if (esp_sleep_start(force_pd_flags | pd_flags, ESP_SLEEP_MODE_DEEP_SLEEP) == ESP_ERR_SLEEP_REJECT) {
887-
ESP_EARLY_LOGW(TAG, "Deep sleep request is rejected");
888-
}
889-
890-
// Because RTC is in a slower clock domain than the CPU, it
891-
// can take several CPU cycles for the sleep mode to start.
892-
while (1) {
893-
;
887+
ESP_EARLY_LOGE(TAG, "Deep sleep request is rejected");
888+
} else {
889+
// Because RTC is in a slower clock domain than the CPU, it
890+
// can take several CPU cycles for the sleep mode to start.
891+
while (1) {
892+
;
893+
}
894894
}
895-
// Never returns here
895+
// Never returns here, except that the sleep is rejected.
896896
esp_ipc_isr_release_other_cpu();
897897
portEXIT_CRITICAL(&spinlock_rtc_deep_sleep);
898898
}

examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,7 @@ static int deep_sleep(int argc, char **argv)
225225
rtc_gpio_isolate(GPIO_NUM_12);
226226
#endif
227227
esp_deep_sleep_start();
228+
return 1;
228229
}
229230

230231
static void register_deep_sleep(void)

examples/system/console/advanced/components/cmd_system/cmd_system_sleep.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ static int deep_sleep(int argc, char **argv)
9292
#endif //CONFIG_IDF_TARGET_ESP32
9393

9494
esp_deep_sleep_start();
95+
return 1;
9596
}
9697

9798
static void register_deep_sleep(void)

0 commit comments

Comments
 (0)