diff --git a/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/CMakeLists.txt b/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/CMakeLists.txt index 8d40b820ad92..15809a21ef5a 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/CMakeLists.txt +++ b/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/CMakeLists.txt @@ -21,4 +21,3 @@ else() idf_component_get_property(experimental_cpp_component_lib experimental_cpp_component COMPONENT_LIB) target_link_libraries(${COMPONENT_LIB} PUBLIC ${log_lib} ${mqtt_lib} ${experimental_cpp_component_lib}) endif() -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp b/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp index 96cb290ccfc7..125e0aeec785 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp +++ b/examples/cxx/experimental/esp_mqtt_cxx/components/esp_mqtt_cxx/esp_mqtt_cxx.cpp @@ -7,6 +7,7 @@ #include #include #include +#include #include "mqtt_client.h" #include "esp_log.h" @@ -126,7 +127,7 @@ Client::Client(esp_mqtt_client_config_t const &config) : handler(esp_mqtt_clien void Client::mqtt_event_handler(void *handler_args, esp_event_base_t base, int32_t event_id, void *event_data) noexcept { - ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%d", base, event_id); + ESP_LOGD(TAG, "Event dispatched from event loop base=%s, event_id=%" PRIi32, base, event_id); auto *event = static_cast(event_data); auto &client = *static_cast(handler_args); switch (event->event_id) { diff --git a/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/CMakeLists.txt b/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/CMakeLists.txt index 020135ce8dcd..e06e5975be1e 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/CMakeLists.txt +++ b/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "mqtt_ssl_example.cpp" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/mqtt_ssl_example.cpp b/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/mqtt_ssl_example.cpp index 8493d52d0352..21fd2f9d4c24 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/mqtt_ssl_example.cpp +++ b/examples/cxx/experimental/esp_mqtt_cxx/ssl/main/mqtt_ssl_example.cpp @@ -9,6 +9,7 @@ #include #include +#include #include "esp_mqtt_client_config.hpp" #include "nvs_flash.h" #include "protocol_examples_common.h" @@ -49,7 +50,7 @@ namespace mqtt = idf::mqtt; extern "C" void app_main(void) { ESP_LOGI(TAG, "[APP] Startup.."); - ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); + ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size()); ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version()); esp_log_level_set("*", ESP_LOG_INFO); diff --git a/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/CMakeLists.txt b/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/CMakeLists.txt index f9c2aeec8322..eeaa9534e544 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/CMakeLists.txt +++ b/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "mqtt_tcp_example.cpp" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/mqtt_tcp_example.cpp b/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/mqtt_tcp_example.cpp index edfb53550848..c1e6f3b77eda 100644 --- a/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/mqtt_tcp_example.cpp +++ b/examples/cxx/experimental/esp_mqtt_cxx/tcp/main/mqtt_tcp_example.cpp @@ -7,6 +7,8 @@ CONDITIONS OF ANY KIND, either express or implied. */ +#include + #include "nvs_flash.h" #include "protocol_examples_common.h" @@ -44,7 +46,7 @@ class MyClient final : public mqtt::Client { extern "C" void app_main(void) { ESP_LOGI(TAG, "[APP] Startup.."); - ESP_LOGI(TAG, "[APP] Free memory: %d bytes", esp_get_free_heap_size()); + ESP_LOGI(TAG, "[APP] Free memory: %" PRIu32 " bytes", esp_get_free_heap_size()); ESP_LOGI(TAG, "[APP] IDF version: %s", esp_get_idf_version()); esp_log_level_set("*", ESP_LOG_INFO); diff --git a/examples/system/console/advanced/components/cmd_nvs/CMakeLists.txt b/examples/system/console/advanced/components/cmd_nvs/CMakeLists.txt index 830ba46f7124..073e3ce6da4d 100644 --- a/examples/system/console/advanced/components/cmd_nvs/CMakeLists.txt +++ b/examples/system/console/advanced/components/cmd_nvs/CMakeLists.txt @@ -1,5 +1,3 @@ idf_component_register(SRCS "cmd_nvs.c" INCLUDE_DIRS . REQUIRES console nvs_flash) - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/console/advanced/components/cmd_nvs/cmd_nvs.c b/examples/system/console/advanced/components/cmd_nvs/cmd_nvs.c index df2382e96f39..5451008b18d6 100644 --- a/examples/system/console/advanced/components/cmd_nvs/cmd_nvs.c +++ b/examples/system/console/advanced/components/cmd_nvs/cmd_nvs.c @@ -292,12 +292,12 @@ static esp_err_t get_value_from_nvs(const char *key, const char *str_type) } else if (type == NVS_TYPE_I32) { int32_t value; if ((err = nvs_get_i32(nvs, key, &value)) == ESP_OK) { - printf("%d\n", value); + printf("%"PRIi32"\n", value); } } else if (type == NVS_TYPE_U32) { uint32_t value; if ((err = nvs_get_u32(nvs, key, &value)) == ESP_OK) { - printf("%u\n", value); + printf("%"PRIu32"\n", value); } } else if (type == NVS_TYPE_I64) { int64_t value; diff --git a/examples/system/console/advanced/components/cmd_system/CMakeLists.txt b/examples/system/console/advanced/components/cmd_system/CMakeLists.txt index def29cca8f9c..f54289c18cca 100644 --- a/examples/system/console/advanced/components/cmd_system/CMakeLists.txt +++ b/examples/system/console/advanced/components/cmd_system/CMakeLists.txt @@ -1,5 +1,3 @@ idf_component_register(SRCS "cmd_system.c" INCLUDE_DIRS . REQUIRES console spi_flash driver) - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/console/advanced/components/cmd_system/cmd_system.c b/examples/system/console/advanced/components/cmd_system/cmd_system.c index 5c170662401b..60f9468bb8a4 100644 --- a/examples/system/console/advanced/components/cmd_system/cmd_system.c +++ b/examples/system/console/advanced/components/cmd_system/cmd_system.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include "esp_log.h" #include "esp_console.h" @@ -105,7 +106,7 @@ static int get_version(int argc, char **argv) printf("Chip info:\r\n"); printf("\tmodel:%s\r\n", model); printf("\tcores:%d\r\n", info.cores); - printf("\tfeature:%s%s%s%s%d%s\r\n", + printf("\tfeature:%s%s%s%s%"PRIu32"%s\r\n", info.features & CHIP_FEATURE_WIFI_BGN ? "/802.11bgn" : "", info.features & CHIP_FEATURE_BLE ? "/BLE" : "", info.features & CHIP_FEATURE_BT ? "/BT" : "", @@ -149,7 +150,7 @@ static void register_restart(void) static int free_mem(int argc, char **argv) { - printf("%d\n", esp_get_free_heap_size()); + printf("%"PRIu32"\n", esp_get_free_heap_size()); return 0; } @@ -168,7 +169,7 @@ static void register_free(void) static int heap_size(int argc, char **argv) { uint32_t heap_size = heap_caps_get_minimum_free_size(MALLOC_CAP_DEFAULT); - printf("min heap size: %u\n", heap_size); + printf("min heap size: %"PRIu32"\n", heap_size); return 0; } diff --git a/examples/system/deep_sleep/main/CMakeLists.txt b/examples/system/deep_sleep/main/CMakeLists.txt index fdfc9800e091..5474deaa87bb 100644 --- a/examples/system/deep_sleep/main/CMakeLists.txt +++ b/examples/system/deep_sleep/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "deep_sleep_example_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/deep_sleep/main/deep_sleep_example_main.c b/examples/system/deep_sleep/main/deep_sleep_example_main.c index c4470bef0552..f3ea42cd06d1 100644 --- a/examples/system/deep_sleep/main/deep_sleep_example_main.c +++ b/examples/system/deep_sleep/main/deep_sleep_example_main.c @@ -12,6 +12,7 @@ #include #include #include +#include #include "sdkconfig.h" #include "soc/soc_caps.h" #include "freertos/FreeRTOS.h" @@ -203,7 +204,7 @@ void app_main(void) touch_pad_sleep_channel_read_smooth(TOUCH_PAD_NUM9, &touch_value); wake_threshold = touch_value * 0.1; // wakeup when touch sensor crosses 10% of background level touch_pad_sleep_set_threshold(TOUCH_PAD_NUM9, wake_threshold); - printf("Touch pad #%d average: %d, wakeup threshold set to %d\n", + printf("Touch pad #%d average: %"PRIu32", wakeup threshold set to %"PRIu32"\n", TOUCH_PAD_NUM9, touch_value, (uint32_t)(touch_value * 0.1)); #endif printf("Enabling touch pad wakeup\n"); diff --git a/examples/system/flash_suspend/main/CMakeLists.txt b/examples/system/flash_suspend/main/CMakeLists.txt index 025ef441f8c9..5d6d0f9979b7 100644 --- a/examples/system/flash_suspend/main/CMakeLists.txt +++ b/examples/system/flash_suspend/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "app_main.c" INCLUDE_DIRS "") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/flash_suspend/main/app_main.c b/examples/system/flash_suspend/main/app_main.c index 73c744c94327..faae5610d493 100644 --- a/examples/system/flash_suspend/main/app_main.c +++ b/examples/system/flash_suspend/main/app_main.c @@ -13,6 +13,7 @@ #include #include +#include #include "sdkconfig.h" #include "esp_log.h" #include "esp_attr.h" @@ -92,7 +93,7 @@ void app_main(void) { //Get the partition used for SPI1 erase operation const esp_partition_t *part = s_get_partition(); - ESP_LOGI(TAG, "found partition '%s' at offset 0x%x with size 0x%x", part->label, part->address, part->size); + ESP_LOGI(TAG, "found partition '%s' at offset 0x%"PRIx32" with size 0x%"PRIx32, part->label, part->address, part->size); //Erase whole region ESP_ERROR_CHECK(esp_flash_erase_region(part->flash_chip, part->address, part->size)); diff --git a/examples/system/freertos/real_time_stats/main/CMakeLists.txt b/examples/system/freertos/real_time_stats/main/CMakeLists.txt index 8b40d4d62f68..0488bd10d390 100644 --- a/examples/system/freertos/real_time_stats/main/CMakeLists.txt +++ b/examples/system/freertos/real_time_stats/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "real_time_stats_example_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c b/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c index 9b3b9ce87ddc..03639c1b209e 100644 --- a/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c +++ b/examples/system/freertos/real_time_stats/main/real_time_stats_example_main.c @@ -9,6 +9,7 @@ #include #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/semphr.h" @@ -109,7 +110,7 @@ static esp_err_t print_real_time_stats(TickType_t xTicksToWait) if (k >= 0) { uint32_t task_elapsed_time = end_array[k].ulRunTimeCounter - start_array[i].ulRunTimeCounter; uint32_t percentage_time = (task_elapsed_time * 100UL) / (total_elapsed_time * portNUM_PROCESSORS); - printf("| %s | %d | %d%%\n", start_array[i].pcTaskName, task_elapsed_time, percentage_time); + printf("| %s | %"PRIu32" | %"PRIu32"%%\n", start_array[i].pcTaskName, task_elapsed_time, percentage_time); } } @@ -155,7 +156,7 @@ static void stats_task(void *arg) //Print real time stats periodically while (1) { - printf("\n\nGetting real time stats over %d ticks\n", STATS_TICKS); + printf("\n\nGetting real time stats over %"PRIu32" ticks\n", STATS_TICKS); if (print_real_time_stats(STATS_TICKS) == ESP_OK) { printf("Real time stats obtained\n"); } else { diff --git a/examples/system/himem/main/CMakeLists.txt b/examples/system/himem/main/CMakeLists.txt index 91b5375c39a9..56b7332142ed 100644 --- a/examples/system/himem/main/CMakeLists.txt +++ b/examples/system/himem/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "himem_example_main.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/himem/main/himem_example_main.c b/examples/system/himem/main/himem_example_main.c index c619e8a00a1f..5616b326805e 100644 --- a/examples/system/himem/main/himem_example_main.c +++ b/examples/system/himem/main/himem_example_main.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/queue.h" @@ -40,7 +41,7 @@ static bool check_mem_seed(int seed, void *mem, int len, int phys_addr) for (int i = 0; i < len / 4; i++) { uint32_t ex = rand_r(&rseed); if (ex != *p) { - printf("check_mem_seed: %x has 0x%08x expected 0x%08x\n", phys_addr+((char*)p-(char*)mem), *p, ex); + printf("check_mem_seed: %x has 0x%08"PRIx32" expected 0x%08"PRIx32"\n", phys_addr+((char*)p-(char*)mem), *p, ex); return false; } p++; diff --git a/examples/system/ipc/ipc_isr/main/CMakeLists.txt b/examples/system/ipc/ipc_isr/main/CMakeLists.txt index 1e7d6dbe1f93..2082ac374416 100644 --- a/examples/system/ipc/ipc_isr/main/CMakeLists.txt +++ b/examples/system/ipc/ipc_isr/main/CMakeLists.txt @@ -1,4 +1,3 @@ idf_component_register(SRCS "main.c" "asm_funcs.S" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/ipc/ipc_isr/main/main.c b/examples/system/ipc/ipc_isr/main/main.c index 52fbcc0f9f4e..f35eb8966858 100644 --- a/examples/system/ipc/ipc_isr/main/main.c +++ b/examples/system/ipc/ipc_isr/main/main.c @@ -9,6 +9,7 @@ #include #include +#include #include "esp_timer.h" #include "esp_log.h" #include "esp_ipc_isr.h" @@ -36,26 +37,26 @@ void app_main(void) uint32_t ps_other_cpu = 0; ESP_LOGI(TAG, "call get_ps_other_cpu"); esp_ipc_isr_asm_call_blocking(get_ps_other_cpu, &ps_other_cpu); - ESP_LOGI(TAG, "PS_INTLEVEL = 0x%x", ps_other_cpu & XCHAL_PS_INTLEVEL_MASK); - ESP_LOGI(TAG, "PS_EXCM = 0x%x", (ps_other_cpu & XCHAL_PS_EXCM_MASK) >> XCHAL_PS_EXCM_SHIFT); - ESP_LOGI(TAG, "PS_UM = 0x%x", (ps_other_cpu & XCHAL_PS_UM_MASK) >> XCHAL_PS_UM_SHIFT); + ESP_LOGI(TAG, "PS_INTLEVEL = 0x%"PRIx32, ps_other_cpu & XCHAL_PS_INTLEVEL_MASK); + ESP_LOGI(TAG, "PS_EXCM = 0x%"PRIx32, (ps_other_cpu & XCHAL_PS_EXCM_MASK) >> XCHAL_PS_EXCM_SHIFT); + ESP_LOGI(TAG, "PS_UM = 0x%"PRIx32, (ps_other_cpu & XCHAL_PS_UM_MASK) >> XCHAL_PS_UM_SHIFT); ESP_LOGI(TAG, "call extended_ipc_isr_asm"); arg_data_t arg = { 0 }; arg.in[0] = 0x01; arg.in[1] = 0x02; arg.in[2] = 0x03; - ESP_LOGI(TAG, "in[0] = 0x%x", arg.in[0]); - ESP_LOGI(TAG, "in[1] = 0x%x", arg.in[1]); - ESP_LOGI(TAG, "in[2] = 0x%x", arg.in[2]); + ESP_LOGI(TAG, "in[0] = 0x%"PRIx32, arg.in[0]); + ESP_LOGI(TAG, "in[1] = 0x%"PRIx32, arg.in[1]); + ESP_LOGI(TAG, "in[2] = 0x%"PRIx32, arg.in[2]); esp_ipc_isr_asm_call_blocking(extended_ipc_isr_asm, (void*)&arg); - ESP_LOGI(TAG, "out[0] = (in[0] | in[1] | in[2]) = 0x%x", arg.out[0]); + ESP_LOGI(TAG, "out[0] = (in[0] | in[1] | in[2]) = 0x%"PRIx32, arg.out[0]); assert(0x03 == arg.out[0]); - ESP_LOGI(TAG, "out[1] = (in[0] & in[1] & in[2]) = 0x%x", arg.out[1]); + ESP_LOGI(TAG, "out[1] = (in[0] & in[1] & in[2]) = 0x%"PRIx32, arg.out[1]); assert(0x06 == arg.out[1]); - ESP_LOGI(TAG, "out[2] = in[2] = 0x%x", arg.out[2]); + ESP_LOGI(TAG, "out[2] = in[2] = 0x%"PRIx32, arg.out[2]); assert(0x03 == arg.out[2]); - ESP_LOGI(TAG, "out[3] = PS of other cpu = 0x%x", arg.out[3]); + ESP_LOGI(TAG, "out[3] = PS of other cpu = 0x%"PRIx32, arg.out[3]); assert(ps_other_cpu == arg.out[3]); ESP_LOGI(TAG, "End"); } diff --git a/examples/system/ota/advanced_https_ota/main/CMakeLists.txt b/examples/system/ota/advanced_https_ota/main/CMakeLists.txt index de23aa9b8f5c..0e102c7ca224 100644 --- a/examples/system/ota/advanced_https_ota/main/CMakeLists.txt +++ b/examples/system/ota/advanced_https_ota/main/CMakeLists.txt @@ -3,4 +3,3 @@ idf_component_register(SRCS "advanced_https_ota_example.c" "ble_helper/bluedroid INCLUDE_DIRS "." "./ble_helper/include/" # Embed the server root certificate into the final binary EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c index 434f612ca2b8..5b620a54318f 100644 --- a/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c +++ b/examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c @@ -7,6 +7,7 @@ CONDITIONS OF ANY KIND, either express or implied. */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "freertos/event_groups.h" @@ -65,7 +66,7 @@ static esp_err_t validate_image_header(esp_app_desc_t *new_app_info) */ const uint32_t hw_sec_version = esp_efuse_read_secure_version(); if (new_app_info->secure_version < hw_sec_version) { - ESP_LOGW(TAG, "New firmware security version is less than eFuse programmed, %d < %d", new_app_info->secure_version, hw_sec_version); + ESP_LOGW(TAG, "New firmware security version is less than eFuse programmed, %"PRIu32" < %"PRIu32, new_app_info->secure_version, hw_sec_version); return ESP_FAIL; } #endif diff --git a/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c b/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c index c09955f1cead..60843e796bf6 100644 --- a/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c +++ b/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c @@ -4,6 +4,7 @@ * SPDX-License-Identifier: Apache-2.0 */ +#include #include "bluedroid_gatts.h" #include "esp_log.h" #include "string.h" @@ -170,7 +171,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat esp_ble_gatts_create_service(gatts_if, &gl_profile_tab[PROFILE_A_APP_ID].service_id, GATTS_NUM_HANDLE_TEST_A); break; case ESP_GATTS_READ_EVT: { - ESP_LOGI(TAG, "GATT_READ_EVT, conn_id %d, trans_id %d, handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle); + ESP_LOGI(TAG, "GATT_READ_EVT, conn_id %d, trans_id %"PRIu32", handle %d\n", param->read.conn_id, param->read.trans_id, param->read.handle); esp_gatt_rsp_t rsp; memset(&rsp, 0, sizeof(esp_gatt_rsp_t)); rsp.attr_value.handle = param->read.handle; @@ -184,7 +185,7 @@ void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gat break; } case ESP_GATTS_WRITE_EVT: { - ESP_LOGI(TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %d, handle %d", param->write.conn_id, param->write.trans_id, param->write.handle); + ESP_LOGI(TAG, "GATT_WRITE_EVT, conn_id %d, trans_id %"PRIu32", handle %d", param->write.conn_id, param->write.trans_id, param->write.handle); if (!param->write.is_prep) { ESP_LOGI(TAG, "GATT_WRITE_EVT, value len %d, value :", param->write.len); esp_log_buffer_hex(TAG, param->write.value, param->write.len); diff --git a/examples/system/ota/native_ota_example/main/CMakeLists.txt b/examples/system/ota/native_ota_example/main/CMakeLists.txt index 37004b19d0a7..dea9a5a5ad53 100644 --- a/examples/system/ota/native_ota_example/main/CMakeLists.txt +++ b/examples/system/ota/native_ota_example/main/CMakeLists.txt @@ -3,4 +3,3 @@ idf_build_get_property(project_dir PROJECT_DIR) idf_component_register(SRCS "native_ota_example.c" INCLUDE_DIRS "." EMBED_TXTFILES ${project_dir}/server_certs/ca_cert.pem) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/ota/native_ota_example/main/native_ota_example.c b/examples/system/ota/native_ota_example/main/native_ota_example.c index 287405436f2f..d311f9e769b2 100644 --- a/examples/system/ota/native_ota_example/main/native_ota_example.c +++ b/examples/system/ota/native_ota_example/main/native_ota_example.c @@ -7,6 +7,7 @@ CONDITIONS OF ANY KIND, either express or implied. */ #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_system.h" @@ -87,11 +88,11 @@ static void ota_example_task(void *pvParameter) const esp_partition_t *running = esp_ota_get_running_partition(); if (configured != running) { - ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08x, but running from offset 0x%08x", + ESP_LOGW(TAG, "Configured OTA boot partition at offset 0x%08"PRIx32", but running from offset 0x%08"PRIx32, configured->address, running->address); ESP_LOGW(TAG, "(This can happen if either the OTA boot data or preferred boot image become corrupted somehow.)"); } - ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08x)", + ESP_LOGI(TAG, "Running partition type %d subtype %d (offset 0x%08"PRIx32")", running->type, running->subtype, running->address); esp_http_client_config_t config = { @@ -134,7 +135,7 @@ static void ota_example_task(void *pvParameter) update_partition = esp_ota_get_next_update_partition(NULL); assert(update_partition != NULL); - ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%x", + ESP_LOGI(TAG, "Writing to partition subtype %d at offset 0x%"PRIx32, update_partition->subtype, update_partition->address); int binary_file_length = 0; diff --git a/examples/system/pthread/main/CMakeLists.txt b/examples/system/pthread/main/CMakeLists.txt index c2c7b693187f..8e83aec55f3d 100644 --- a/examples/system/pthread/main/CMakeLists.txt +++ b/examples/system/pthread/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "pthread_example.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/pthread/main/pthread_example.c b/examples/system/pthread/main/pthread_example.c index 43204d1bbb36..cb55bcc19c05 100644 --- a/examples/system/pthread/main/pthread_example.c +++ b/examples/system/pthread/main/pthread_example.c @@ -9,6 +9,7 @@ #include #include #include +#include #include "freertos/FreeRTOS.h" #include "freertos/task.h" #include "esp_pthread.h" @@ -25,7 +26,7 @@ void app_main(void) // Create a pthread with the default parameters res = pthread_create(&thread1, NULL, example_thread, NULL); assert(res == 0); - printf("Created thread 0x%x\n", thread1); + printf("Created thread 0x%"PRIx32"\n", thread1); // Create a pthread with a larger stack size using the standard API res = pthread_attr_init(&attr); @@ -33,7 +34,7 @@ void app_main(void) pthread_attr_setstacksize(&attr, 16384); res = pthread_create(&thread2, &attr, example_thread, NULL); assert(res == 0); - printf("Created larger stack thread 0x%x\n", thread2); + printf("Created larger stack thread 0x%"PRIx32"\n", thread2); res = pthread_join(thread1, NULL); assert(res == 0); @@ -49,7 +50,7 @@ void app_main(void) res = pthread_create(&thread1, NULL, example_thread, NULL); assert(res == 0); - printf("Created thread 0x%x with new default config\n", thread1); + printf("Created thread 0x%"PRIx32" with new default config\n", thread1); res = pthread_join(thread1, NULL); assert(res == 0); printf("Thread has exited\n\n"); @@ -58,10 +59,10 @@ void app_main(void) static void *example_thread(void * arg) { usleep(250 * 1000); - printf("This thread has ID 0x%x and %u bytes free stack\n", pthread_self(), uxTaskGetStackHighWaterMark(NULL)); + printf("This thread has ID 0x%"PRIx32" and %u bytes free stack\n", pthread_self(), uxTaskGetStackHighWaterMark(NULL)); sleep(1); - printf("Thread 0x%x exiting\n", pthread_self()); + printf("Thread 0x%"PRIx32" exiting\n", pthread_self()); return NULL; } diff --git a/examples/system/sysview_tracing/main/CMakeLists.txt b/examples/system/sysview_tracing/main/CMakeLists.txt index b09c036fba66..0f466b71d68b 100644 --- a/examples/system/sysview_tracing/main/CMakeLists.txt +++ b/examples/system/sysview_tracing/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "sysview_tracing.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/sysview_tracing/main/sysview_tracing.c b/examples/system/sysview_tracing/main/sysview_tracing.c index 99aa8e711480..330357b23c50 100644 --- a/examples/system/sysview_tracing/main/sysview_tracing.c +++ b/examples/system/sysview_tracing/main/sysview_tracing.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "esp_log.h" #include "freertos/FreeRTOS.h" #include "freertos/task.h" @@ -126,7 +127,7 @@ static void example_task(void *p) SYSVIEW_EXAMPLE_WAIT_EVENT_START(); xTaskNotifyWait(0, 0, &event_val, portMAX_DELAY); SYSVIEW_EXAMPLE_WAIT_EVENT_END(event_val); - ESP_LOGI(TAG, "Task[%p]: received event %d", xTaskGetCurrentTaskHandle(), event_val); + ESP_LOGI(TAG, "Task[%p]: received event %"PRIu32, xTaskGetCurrentTaskHandle(), event_val); } } diff --git a/examples/system/sysview_tracing_heap_log/main/CMakeLists.txt b/examples/system/sysview_tracing_heap_log/main/CMakeLists.txt index be25fb9d0fce..0383353f0a17 100644 --- a/examples/system/sysview_tracing_heap_log/main/CMakeLists.txt +++ b/examples/system/sysview_tracing_heap_log/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "sysview_heap_log.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c index 6136ca63c33d..bd21ed86b594 100644 --- a/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c +++ b/examples/system/sysview_tracing_heap_log/main/sysview_heap_log.c @@ -7,6 +7,7 @@ CONDITIONS OF ANY KIND, either express or implied. */ +#include #include "esp_sysview_trace.h" #include "esp_heap_trace.h" #include "esp_log.h" @@ -57,7 +58,7 @@ static void alloc_task(void *p) void *p = malloc(sz/2); // WARNING: the previous allocated memory is intentionally not deallocated in order to cause memory leak! p = malloc(sz); - ESP_LOGI(TAG, "Task[%p]: allocated %d bytes @ %p", xTaskGetCurrentTaskHandle(), sz, p); + ESP_LOGI(TAG, "Task[%p]: allocated %"PRIu32" bytes @ %p", xTaskGetCurrentTaskHandle(), sz, p); if (xQueueSend(queue, ( void * )&p, portMAX_DELAY) != pdPASS) { ESP_LOGE(TAG, "Failed to send to queue!"); } @@ -96,7 +97,7 @@ void app_main(void) for (int i = 0; i < num_allocers; i++) { ESP_LOGI(TAG, "Wait notify %d", i); uint32_t val = ulTaskNotifyTake(pdFALSE, portMAX_DELAY); - ESP_LOGI(TAG, "Got notify val %d", val); + ESP_LOGI(TAG, "Got notify val %"PRIu32, val); } // here GDB will stop at brekpoint and execute OpenOCD command to stop tracing heap_trace_stop(); diff --git a/examples/system/ulp_fsm/ulp/main/CMakeLists.txt b/examples/system/ulp_fsm/ulp/main/CMakeLists.txt index d3b107916710..a75dc6afb0c2 100644 --- a/examples/system/ulp_fsm/ulp/main/CMakeLists.txt +++ b/examples/system/ulp_fsm/ulp/main/CMakeLists.txt @@ -19,5 +19,3 @@ set(ulp_exp_dep_srcs "ulp_example_main.c") # 4. Call function to build ULP binary and embed in project using the argument # values above. ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}") - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/ulp_fsm/ulp/main/ulp_example_main.c b/examples/system/ulp_fsm/ulp/main/ulp_example_main.c index c7cac8783ccf..1607e7b07718 100644 --- a/examples/system/ulp_fsm/ulp/main/ulp_example_main.c +++ b/examples/system/ulp_fsm/ulp/main/ulp_example_main.c @@ -8,6 +8,7 @@ */ #include +#include #include "esp_sleep.h" #include "nvs.h" #include "nvs_flash.h" @@ -106,18 +107,18 @@ static void update_pulse_count(void) uint32_t pulse_count = 0; esp_err_t err = nvs_get_u32(handle, count_key, &pulse_count); assert(err == ESP_OK || err == ESP_ERR_NVS_NOT_FOUND); - printf("Read pulse count from NVS: %5d\n", pulse_count); + printf("Read pulse count from NVS: %5"PRIu32"\n", pulse_count); /* ULP program counts signal edges, convert that to the number of pulses */ uint32_t pulse_count_from_ulp = (ulp_edge_count & UINT16_MAX) / 2; /* In case of an odd number of edges, keep one until next time */ ulp_edge_count = ulp_edge_count % 2; - printf("Pulse count from ULP: %5d\n", pulse_count_from_ulp); + printf("Pulse count from ULP: %5"PRIu32"\n", pulse_count_from_ulp); /* Save the new pulse count to NVS */ pulse_count += pulse_count_from_ulp; ESP_ERROR_CHECK(nvs_set_u32(handle, count_key, pulse_count)); ESP_ERROR_CHECK(nvs_commit(handle)); nvs_close(handle); - printf("Wrote updated pulse count to NVS: %5d\n", pulse_count); + printf("Wrote updated pulse count to NVS: %5"PRIu32"\n", pulse_count); } diff --git a/examples/system/ulp_fsm/ulp_adc/main/CMakeLists.txt b/examples/system/ulp_fsm/ulp_adc/main/CMakeLists.txt index c2ec53235851..b5768ee1a933 100644 --- a/examples/system/ulp_fsm/ulp_adc/main/CMakeLists.txt +++ b/examples/system/ulp_fsm/ulp_adc/main/CMakeLists.txt @@ -19,5 +19,3 @@ set(ulp_exp_dep_srcs "ulp_adc_example_main.c") # 4. Call function to build ULP binary and embed in project using the argument # values above. ulp_embed_binary(${ulp_app_name} "${ulp_s_sources}" "${ulp_exp_dep_srcs}") - -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/system/ulp_fsm/ulp_adc/main/ulp_adc_example_main.c b/examples/system/ulp_fsm/ulp_adc/main/ulp_adc_example_main.c index 6b3ff56485fd..df269b7f572d 100644 --- a/examples/system/ulp_fsm/ulp_adc/main/ulp_adc_example_main.c +++ b/examples/system/ulp_fsm/ulp_adc/main/ulp_adc_example_main.c @@ -9,6 +9,7 @@ #include #include +#include #include "esp_sleep.h" #include "nvs.h" #include "nvs_flash.h" @@ -42,10 +43,10 @@ void app_main(void) init_ulp_program(); } else { printf("Deep sleep wakeup\n"); - printf("ULP did %d measurements since last reset\n", ulp_sample_counter & UINT16_MAX); - printf("Thresholds: low=%d high=%d\n", ulp_low_thr, ulp_high_thr); + printf("ULP did %"PRIu32" measurements since last reset\n", ulp_sample_counter & UINT16_MAX); + printf("Thresholds: low=%"PRIu32" high=%"PRIu32"\n", ulp_low_thr, ulp_high_thr); ulp_last_result &= UINT16_MAX; - printf("Value=%d was %s threshold\n", ulp_last_result, + printf("Value=%"PRIu32" was %s threshold\n", ulp_last_result, ulp_last_result < ulp_low_thr ? "below" : "above"); } printf("Entering deep sleep\n\n"); diff --git a/examples/system/ulp_riscv/adc/main/CMakeLists.txt b/examples/system/ulp_riscv/adc/main/CMakeLists.txt index f2af6ba2975a..e7a558b58338 100644 --- a/examples/system/ulp_riscv/adc/main/CMakeLists.txt +++ b/examples/system/ulp_riscv/adc/main/CMakeLists.txt @@ -1,8 +1,6 @@ idf_component_register(SRCS "ulp_riscv_adc_example_main.c" INCLUDE_DIRS "" REQUIRES soc ulp esp_adc) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") - # # ULP support additions to component CMakeLists.txt. # diff --git a/examples/system/ulp_riscv/adc/main/ulp_riscv_adc_example_main.c b/examples/system/ulp_riscv/adc/main/ulp_riscv_adc_example_main.c index b18951b6d43a..8a00c8fd7220 100644 --- a/examples/system/ulp_riscv/adc/main/ulp_riscv_adc_example_main.c +++ b/examples/system/ulp_riscv/adc/main/ulp_riscv_adc_example_main.c @@ -13,6 +13,7 @@ */ #include +#include #include "esp_sleep.h" #include "ulp_riscv.h" #include "ulp_riscv_adc.h" @@ -39,8 +40,8 @@ void app_main(void) /* ULP Risc-V read and detected a temperature above the limit */ if (cause == ESP_SLEEP_WAKEUP_ULP) { printf("ULP-RISC-V woke up the main CPU\n"); - printf("Threshold: high = %d\n", ulp_adc_threshold); - printf("Value = %d was above threshold\n", ulp_wakeup_result); + printf("Threshold: high = %"PRIu32"\n", ulp_adc_threshold); + printf("Value = %"PRIu32" was above threshold\n", ulp_wakeup_result); } /* Go back to sleep, only the ULP Risc-V will run */