From 00ce75784abf8cd566fcee825c67a216f30bbd2d Mon Sep 17 00:00:00 2001 From: Rahul Tank Date: Wed, 7 Dec 2022 15:23:10 +0530 Subject: [PATCH] Nimble: Fixed compilation issues in nimble examples after removing "-Wno-format" option --- examples/bluetooth/blufi/main/CMakeLists.txt | 1 - examples/bluetooth/blufi/main/blufi_example_main.c | 2 +- examples/bluetooth/nimble/blemesh/main/CMakeLists.txt | 1 - examples/bluetooth/nimble/blemesh/main/app_mesh.c | 2 +- examples/bluetooth/nimble/bleprph/main/CMakeLists.txt | 1 - examples/bluetooth/nimble/bleprph/main/main.c | 4 ++-- .../bluetooth/nimble/bleprph_wifi_coex/main/CMakeLists.txt | 1 - examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c | 4 ++-- .../blecent_throughput/components/cmd_system/CMakeLists.txt | 1 - .../blecent_throughput/components/cmd_system/cmd_system.c | 6 +++--- 10 files changed, 9 insertions(+), 14 deletions(-) diff --git a/examples/bluetooth/blufi/main/CMakeLists.txt b/examples/bluetooth/blufi/main/CMakeLists.txt index a49dfc6a092..a8b056e73a7 100644 --- a/examples/bluetooth/blufi/main/CMakeLists.txt +++ b/examples/bluetooth/blufi/main/CMakeLists.txt @@ -2,4 +2,3 @@ idf_component_register(SRCS "blufi_example_main.c" "blufi_security.c" "blufi_init.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/bluetooth/blufi/main/blufi_example_main.c b/examples/bluetooth/blufi/main/blufi_example_main.c index b2bc6084172..09dda5ca3a7 100644 --- a/examples/bluetooth/blufi/main/blufi_example_main.c +++ b/examples/bluetooth/blufi/main/blufi_example_main.c @@ -423,7 +423,7 @@ static void example_event_callback(esp_blufi_cb_event_t event, esp_blufi_cb_para break; } case ESP_BLUFI_EVENT_RECV_CUSTOM_DATA: - BLUFI_INFO("Recv Custom Data %d\n", param->custom_data.data_len); + BLUFI_INFO("Recv Custom Data %" PRIu32 "\n", param->custom_data.data_len); esp_log_buffer_hex("Custom Data", param->custom_data.data, param->custom_data.data_len); break; case ESP_BLUFI_EVENT_RECV_USERNAME: diff --git a/examples/bluetooth/nimble/blemesh/main/CMakeLists.txt b/examples/bluetooth/nimble/blemesh/main/CMakeLists.txt index 37b2d2ae1c9..99da938f3bb 100644 --- a/examples/bluetooth/nimble/blemesh/main/CMakeLists.txt +++ b/examples/bluetooth/nimble/blemesh/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "app_mesh.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/bluetooth/nimble/blemesh/main/app_mesh.c b/examples/bluetooth/nimble/blemesh/main/app_mesh.c index 9c3e5af0ee7..03d4e7dc0fc 100644 --- a/examples/bluetooth/nimble/blemesh/main/app_mesh.c +++ b/examples/bluetooth/nimble/blemesh/main/app_mesh.c @@ -361,7 +361,7 @@ static const struct bt_mesh_comp comp = { static int output_number(bt_mesh_output_action_t action, uint32_t number) { - ESP_LOGI(tag, "OOB Number: %u\n", number); + ESP_LOGI(tag, "OOB Number: %" PRIu32 "\n", number); return 0; } diff --git a/examples/bluetooth/nimble/bleprph/main/CMakeLists.txt b/examples/bluetooth/nimble/bleprph/main/CMakeLists.txt index 4195d94b040..9e539a9fc04 100644 --- a/examples/bluetooth/nimble/bleprph/main/CMakeLists.txt +++ b/examples/bluetooth/nimble/bleprph/main/CMakeLists.txt @@ -3,4 +3,3 @@ set(srcs "main.c" idf_component_register(SRCS "${srcs}" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/bluetooth/nimble/bleprph/main/main.c b/examples/bluetooth/nimble/bleprph/main/main.c index 8aec386e388..9aef943c8ae 100644 --- a/examples/bluetooth/nimble/bleprph/main/main.c +++ b/examples/bluetooth/nimble/bleprph/main/main.c @@ -349,11 +349,11 @@ bleprph_gap_event(struct ble_gap_event *event, void *arg) if (event->passkey.params.action == BLE_SM_IOACT_DISP) { pkey.action = event->passkey.params.action; pkey.passkey = 123456; // This is the passkey to be entered on peer - ESP_LOGI(tag, "Enter passkey %d on the peer side", pkey.passkey); + ESP_LOGI(tag, "Enter passkey %" PRIu32 "on the peer side", pkey.passkey); rc = ble_sm_inject_io(event->passkey.conn_handle, &pkey); ESP_LOGI(tag, "ble_sm_inject_io result: %d\n", rc); } else if (event->passkey.params.action == BLE_SM_IOACT_NUMCMP) { - ESP_LOGI(tag, "Passkey on device's display: %d", event->passkey.params.numcmp); + ESP_LOGI(tag, "Passkey on device's display: %" PRIu32 , event->passkey.params.numcmp); ESP_LOGI(tag, "Accept or reject the passkey through console in this format -> key Y or key N"); pkey.action = event->passkey.params.action; if (scli_receive_key(&key)) { diff --git a/examples/bluetooth/nimble/bleprph_wifi_coex/main/CMakeLists.txt b/examples/bluetooth/nimble/bleprph_wifi_coex/main/CMakeLists.txt index b00c4016c4f..e8a76d0b091 100644 --- a/examples/bluetooth/nimble/bleprph_wifi_coex/main/CMakeLists.txt +++ b/examples/bluetooth/nimble/bleprph_wifi_coex/main/CMakeLists.txt @@ -1,3 +1,2 @@ idf_component_register(SRCS "main.c" "gatt_svr.c" INCLUDE_DIRS ".") -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c index 9580f653977..70b647189dc 100644 --- a/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c +++ b/examples/bluetooth/nimble/bleprph_wifi_coex/main/main.c @@ -167,7 +167,7 @@ static void cmd_ping_on_ping_success(esp_ping_handle_t hdl, void *args) esp_ping_get_profile(hdl, ESP_PING_PROF_IPADDR, &target_addr, sizeof(target_addr)); esp_ping_get_profile(hdl, ESP_PING_PROF_SIZE, &recv_len, sizeof(recv_len)); esp_ping_get_profile(hdl, ESP_PING_PROF_TIMEGAP, &elapsed_time, sizeof(elapsed_time)); - printf("%d bytes from %s icmp_seq=%d ttl=%d time=%d ms\n", + printf("%" PRIu32 "bytes from %s icmp_seq=%d ttl=%d time=%" PRIu32 "ms\n", recv_len, inet_ntoa(target_addr.u_addr.ip4), seqno, ttl, elapsed_time); } @@ -197,7 +197,7 @@ static void cmd_ping_on_ping_end(esp_ping_handle_t hdl, void *args) } else { printf("\n--- %s ping statistics ---\n", inet6_ntoa(*ip_2_ip6(&target_addr))); } - printf("%d packets transmitted, %d received, %d%% packet loss, time %dms\n", + printf("%" PRIu32 "packets transmitted, %" PRIu32 " received, %" PRIu32 "%% packet loss, time %" PRIu32 "ms\n", transmitted, received, loss, total_time_ms); // delete the ping sessions, so that we clean up all resources and can create a new ping session // we don't have to call delete function in the callback, instead we can call delete function from other tasks diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/CMakeLists.txt b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/CMakeLists.txt index bdf7f1569e5..81198d65110 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/CMakeLists.txt +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/CMakeLists.txt @@ -2,4 +2,3 @@ idf_component_register(SRCS "cmd_system.c" INCLUDE_DIRS "." PRIV_REQUIRES driver REQUIRES console spi_flash) -target_compile_options(${COMPONENT_LIB} PRIVATE "-Wno-format") diff --git a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c index ba004560639..d2783da708a 100644 --- a/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c +++ b/examples/bluetooth/nimble/throughput_app/blecent_throughput/components/cmd_system/cmd_system.c @@ -63,7 +63,7 @@ static int get_version(int argc, char **argv) printf("Chip info:\r\n"); printf("\tmodel:%s\r\n", info.model == CHIP_ESP32 ? "ESP32" : "Unknow"); 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" : "", @@ -107,7 +107,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; } @@ -126,7 +126,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); - ESP_LOGI(TAG, "min heap size: %u", heap_size); + ESP_LOGI(TAG, "min heap size: %" PRIu32 , heap_size); return 0; }