fix some warnings with Wextra

This commit is contained in:
hathach 2020-03-25 00:31:27 +07:00
parent 0516c2e247
commit 79ae930f15
4 changed files with 17 additions and 10 deletions

View File

@ -228,7 +228,8 @@ CFLAGS += \
-fstack-usage \ -fstack-usage \
-fno-strict-aliasing \ -fno-strict-aliasing \
-Wall \ -Wall \
-Werror -Werror \
-Wfatal-errors \
CFLAGS += -Wno-error=unused-parameter CFLAGS += -Wno-error=unused-parameter

View File

@ -442,7 +442,8 @@ uint32_t bootloader_dfu_sd_update_continue(void)
uint32_t bootloader_dfu_sd_update_finalize(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); bootloader_dfu_update_process(update_status);

View File

@ -164,7 +164,8 @@ static void dfu_prepare_func_app_erase(uint32_t image_size)
*/ */
static void dfu_cleared_func_app(void) 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); bootloader_dfu_update_process(update_status);
} }
@ -499,6 +500,7 @@ uint32_t dfu_init_pkt_handle(dfu_update_packet_t * p_packet)
case DFU_STATE_RDY: case DFU_STATE_RDY:
m_dfu_state = DFU_STATE_RX_INIT_PKT; 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: case DFU_STATE_RX_INIT_PKT:
// DFU initialization has been done and a start packet has been received. // DFU initialization has been done and a start packet has been received.

View File

@ -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) 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 build_duration = time.monotonic() - start_time
flash_size = "-"
sram_size = "-"
if make_result.returncode == 0: if make_result.returncode == 0:
success = "\033[32msucceeded\033[0m" success = "\033[32msucceeded\033[0m"
success_count += 1 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: else:
exit_status = make_result.returncode exit_status = make_result.returncode
success = "\033[31mfailed\033[0m " 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: if entry.name.endswith(extension) and "nosd" not in entry.name:
shutil.copy(entry.path, bin_directory) 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)) print(build_format.format(board, success, "{:.2f}s".format(build_duration), flash_size, sram_size))
if make_result.returncode != 0: if make_result.returncode != 0: