unit test: add sleep test case for esp32s3
#include "esp_rom_sys.h"
#include "esp_timer.h"
-#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
-
#if CONFIG_IDF_TARGET_ESP32
#include "esp32/clk.h"
#elif CONFIG_IDF_TARGET_ESP32S2
@@ -284,8 +282,10 @@ static void check_wake_stub(void)
{
TEST_ASSERT_EQUAL(ESP_RST_DEEPSLEEP, esp_reset_reason());
TEST_ASSERT_EQUAL_HEX32((uint32_t) &wake_stub, s_wake_stub_var);
+#if !CONFIG_IDF_TARGET_ESP32S3
/* ROM code clears wake stub entry address */
TEST_ASSERT_NULL(esp_get_deep_sleep_wake_stub());
+#endif
}
TEST_CASE_MULTIPLE_STAGES("can set sleep wake stub", "[deepsleep][reset=DEEPSLEEP_RESET]",
@@ -318,7 +318,12 @@ static void prepare_wake_stub_from_rtc(void)
a memory capability (as it's an implementation detail). So to test this we need to allocate
the stack statically.
*/
+#if CONFIG_IDF_TARGET_ESP32S3
+ uint8_t *sleep_stack = (uint8_t *)heap_caps_malloc(1024, MALLOC_CAP_RTCRAM);
+ TEST_ASSERT((uint32_t)sleep_stack >= SOC_RTC_DRAM_LOW && (uint32_t)sleep_stack < SOC_RTC_DRAM_HIGH);
+#else
static RTC_FAST_ATTR uint8_t sleep_stack[1024];
+#endif
static RTC_FAST_ATTR StaticTask_t sleep_task;
/* normally BSS like sleep_stack will be cleared on reset, but RTC memory is not cleared on
@@ -423,7 +428,7 @@ __attribute__((unused)) static uint32_t get_cause(void)
return wakeup_cause;
}
-#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
+#if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
// Fails on S2 IDF-2903
// This test case verifies deactivation of trigger for wake up sources
@@ -498,7 +503,7 @@ TEST_CASE("disable source trigger behavior", "[deepsleep]")
// Disable ext0 wakeup source, as this might interfere with other tests
ESP_ERROR_CHECK(esp_sleep_disable_wakeup_source(ESP_SLEEP_WAKEUP_EXT0));
}
-#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2)
+#endif // !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S2, ESP32S3)
#endif //SOC_RTCIO_INPUT_OUTPUT_SUPPORTED
@@ -537,8 +542,6 @@ static void check_time_deepsleep(void)
TEST_CASE_MULTIPLE_STAGES("check a time after wakeup from deep sleep", "[deepsleep][reset=DEEPSLEEP_RESET]", trigger_deepsleep, check_time_deepsleep);
-#endif // #if !TEMPORARY_DISABLED_FOR_TARGETS(ESP32S3)
-
#if SOC_GPIO_SUPPORT_DEEPSLEEP_WAKEUP
static void gpio_deepsleep_wakeup_config(void)
{
