From 13cec981dff63b6331d93604b2d175946e281cd0 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Sat, 17 Dec 2022 00:37:37 +0800 Subject: [PATCH 1/2] esp_pm: Fix build error when CONFIG_PM_PROFILING is enabled --- components/esp_pm/pm_impl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/esp_pm/pm_impl.c b/components/esp_pm/pm_impl.c index 69f84f074eb..463c4be7479 100644 --- a/components/esp_pm/pm_impl.c +++ b/components/esp_pm/pm_impl.c @@ -646,7 +646,7 @@ void IRAM_ATTR vApplicationSleep( TickType_t xExpectedIdleTime ) int64_t sleep_time_us = MIN(wakeup_delay_us, time_until_next_alarm); if (sleep_time_us >= configEXPECTED_IDLE_TIME_BEFORE_SLEEP * portTICK_PERIOD_MS * 1000LL) { esp_sleep_enable_timer_wakeup(sleep_time_us - LIGHT_SLEEP_EARLY_WAKEUP_US); -#ifdef CONFIG_PM_TRACE +#if CONFIG_PM_TRACE && SOC_PM_SUPPORT_RTC_PERIPH_PD /* to force tracing GPIOs to keep state */ esp_sleep_pd_config(ESP_PD_DOMAIN_RTC_PERIPH, ESP_PD_OPTION_ON); #endif From 2f504695e4cdeab5e2a09d01d7251bfd888c55d8 Mon Sep 17 00:00:00 2001 From: Darian Leung Date: Tue, 29 Nov 2022 18:58:54 +0800 Subject: [PATCH 2/2] esp_pm: Fix string formatting type errors This commit fixes a string formatting error in esp_pm with CONFIG_PM_PROFILING is enabled. Closes https://github.com/espressif/esp-idf/issues/10347 --- components/esp_pm/pm_impl.c | 3 ++- components/esp_pm/test/CMakeLists.txt | 1 - components/esp_pm/test/test_pm.c | 3 ++- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/components/esp_pm/pm_impl.c b/components/esp_pm/pm_impl.c index 463c4be7479..44949c26fdd 100644 --- a/components/esp_pm/pm_impl.c +++ b/components/esp_pm/pm_impl.c @@ -7,6 +7,7 @@ #include #include #include +#include #include #include "esp_attr.h" @@ -704,7 +705,7 @@ void esp_pm_impl_dump_stats(FILE* out) /* don't display light sleep mode if it's not enabled */ continue; } - fprintf(out, "%-8s %-3dM%-7s %-10lld %-2d%%\n", + fprintf(out, "%-8s %-3"PRIu32"M%-7s %-10lld %-2d%%\n", s_mode_names[i], s_cpu_freq_by_mode[i].freq_mhz, "", //Empty space to align columns diff --git a/components/esp_pm/test/CMakeLists.txt b/components/esp_pm/test/CMakeLists.txt index 27ca808e7a0..34851aeb16f 100644 --- a/components/esp_pm/test/CMakeLists.txt +++ b/components/esp_pm/test/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRC_DIRS . PRIV_REQUIRES unity esp_pm ulp driver esp_timer test_utils) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/components/esp_pm/test/test_pm.c b/components/esp_pm/test/test_pm.c index e9961e4e986..2965a66a688 100644 --- a/components/esp_pm/test/test_pm.c +++ b/components/esp_pm/test/test_pm.c @@ -1,5 +1,6 @@ #include #include +#include #include #include #include @@ -351,7 +352,7 @@ TEST_CASE("esp_timer produces correct delays with light sleep", "[pm]") test_args_t *p_args = (test_args_t *) arg; int64_t t_end = esp_clk_rtc_time(); int32_t ms_diff = (t_end - p_args->t_start) / 1000; - printf("timer #%d %dms\n", p_args->cur_interval, ms_diff); + printf("timer #%d %"PRIi32"ms\n", p_args->cur_interval, ms_diff); p_args->intervals[p_args->cur_interval++] = ms_diff; // Deliberately make timer handler run longer. // We check that this doesn't affect the result.