From 79ae930f1574bb11cbb46cfd757933b52e6cbc73 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 25 Mar 2020 00:31:27 +0700 Subject: [PATCH] fix some warnings with Wextra --- Makefile | 3 ++- .../libraries/bootloader_dfu/bootloader.c | 3 ++- .../libraries/bootloader_dfu/dfu_single_bank.c | 6 ++++-- tools/build_all.py | 15 +++++++++------ 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index 8611554..d6054c7 100644 --- a/Makefile +++ b/Makefile @@ -228,7 +228,8 @@ CFLAGS += \ -fstack-usage \ -fno-strict-aliasing \ -Wall \ - -Werror + -Werror \ + -Wfatal-errors \ CFLAGS += -Wno-error=unused-parameter diff --git a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c index 2ad777f..44465a3 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/bootloader.c @@ -442,7 +442,8 @@ uint32_t bootloader_dfu_sd_update_continue(void) uint32_t bootloader_dfu_sd_update_finalize(void) { - dfu_update_status_t update_status = {DFU_UPDATE_SD_SWAPPED, }; + dfu_update_status_t update_status = { 0 }; + update_status.status_code = DFU_UPDATE_SD_SWAPPED; bootloader_dfu_update_process(update_status); diff --git a/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c b/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c index 60a1729..80d8293 100644 --- a/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c +++ b/lib/sdk11/components/libraries/bootloader_dfu/dfu_single_bank.c @@ -164,7 +164,8 @@ static void dfu_prepare_func_app_erase(uint32_t image_size) */ static void dfu_cleared_func_app(void) { - dfu_update_status_t update_status = {DFU_BANK_0_ERASED, }; + dfu_update_status_t update_status = { 0 }; + update_status.status_code = DFU_BANK_0_ERASED; bootloader_dfu_update_process(update_status); } @@ -498,7 +499,8 @@ uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet) { case DFU_STATE_RDY: m_dfu_state = DFU_STATE_RX_INIT_PKT; - // When receiving init packet in state ready just update and fall through this case. + // When receiving init packet in state ready just update and fall through this case. + /* FALLTHRU */ case DFU_STATE_RX_INIT_PKT: // DFU initialization has been done and a start packet has been received. diff --git a/tools/build_all.py b/tools/build_all.py index 09e1b15..0243724 100644 --- a/tools/build_all.py +++ b/tools/build_all.py @@ -37,9 +37,18 @@ for board in all_boards: make_result = subprocess.run("make -j 4 BOARD={} combinehex genpkg".format(board), shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) build_duration = time.monotonic() - start_time + flash_size = "-" + sram_size = "-" + if make_result.returncode == 0: success = "\033[32msucceeded\033[0m" success_count += 1 + + out_file = glob.glob('_build/build-{}/*.out'.format(board))[0] + size_output = subprocess.run('size {}'.format(out_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") + size_list = size_output.split('\n')[1].split('\t') + flash_size = int(size_list[0]) + sram_size = int(size_list[1]) + int(size_list[2]) else: exit_status = make_result.returncode success = "\033[31mfailed\033[0m " @@ -50,12 +59,6 @@ for board in all_boards: if entry.name.endswith(extension) and "nosd" not in entry.name: shutil.copy(entry.path, bin_directory) - out_file = glob.glob('_build/build-{}/*.out'.format(board))[0] - size_output = subprocess.run('size {}'.format(out_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8") - size_list = size_output.split('\n')[1].split('\t') - flash_size = int(size_list[0]) - sram_size = int(size_list[1]) + int(size_list[2]) - print(build_format.format(board, success, "{:.2f}s".format(build_duration), flash_size, sram_size)) if make_result.returncode != 0: