Skip to content

Commit

Permalink
esp_pm: Fix string formatting type errors
Browse files Browse the repository at this point in the history
This commit fixes a string formatting error in esp_pm with CONFIG_PM_PROFILING
is enabled.

Closes #10347
  • Loading branch information
Dazza0 committed Dec 21, 2022
1 parent 13cec98 commit 2f50469
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components/esp_pm/pm_impl.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#include <stdlib.h>
#include <stdbool.h>
#include <string.h>
#include <stdint.h>
#include <sys/param.h>

#include "esp_attr.h"
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion components/esp_pm/test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
3 changes: 2 additions & 1 deletion components/esp_pm/test/test_pm.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include <time.h>
#include <sys/time.h>
#include <sys/param.h>
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 2f50469

Please sign in to comment.