From 1370511dffdf29aae970c3fbb886b38a950b70cf Mon Sep 17 00:00:00 2001 From: Alexey Lapshin Date: Wed, 24 Jul 2024 01:02:37 +0700 Subject: [PATCH] fix(esp_timer): place esp_timer_get_time test to IRAM --- components/esp_timer/test_apps/main/test_esp_timer.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/esp_timer/test_apps/main/test_esp_timer.c b/components/esp_timer/test_apps/main/test_esp_timer.c index f8b5dfc404..8717baedc3 100644 --- a/components/esp_timer/test_apps/main/test_esp_timer.c +++ b/components/esp_timer/test_apps/main/test_esp_timer.c @@ -389,7 +389,7 @@ TEST_CASE("esp_timer for very short intervals", "[esp_timer]") } #if !CONFIG_IDF_TARGET_ESP32C61 // TODO: IDF-10955, test fail -TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]") +static void IRAM_ATTR test_esp_timer_get_time_performance(void) { int64_t begin = esp_timer_get_time(); volatile int64_t end; @@ -400,6 +400,11 @@ TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]") int ns_per_call = (int)((end - begin) * 1000 / iter_count); TEST_PERFORMANCE_LESS_THAN(ESP_TIMER_GET_TIME_PER_CALL, "%dns", ns_per_call); } + +TEST_CASE("esp_timer_get_time call takes less than 1us", "[esp_timer]") +{ + test_esp_timer_get_time_performance(); +} #endif static int64_t IRAM_ATTR __attribute__((noinline)) get_clock_diff(void)