From b159bf0bb24a99c7d3ff1b3855f840add63198e5 Mon Sep 17 00:00:00 2001 From: Paul Selkirk Date: Wed, 11 Oct 2017 21:26:27 -0400 Subject: Cleanup 'unused parameter' warnings, a couple of which are actual coding errors. --- Makefile | 2 +- .../TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c | 4 ++++ .../TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c | 6 ++++++ projects/cli-test/mgmt-cli.c | 2 ++ projects/cli-test/mgmt-dfu.c | 13 +++++++++++++ projects/cli-test/mgmt-fpga.c | 20 ++++++++++++++++++-- projects/cli-test/mgmt-keystore.c | 20 ++++++++++++++++++++ projects/cli-test/mgmt-masterkey.c | 16 ++++++++++++++++ projects/cli-test/mgmt-misc.c | 8 ++++++++ projects/cli-test/mgmt-show.c | 20 ++++++++++++++++++++ projects/cli-test/mgmt-test.c | 4 ++++ projects/cli-test/test-mkmif.c | 4 ++++ projects/hsm/mgmt-bootloader.c | 4 ++++ projects/hsm/mgmt-cli.c | 2 ++ projects/hsm/mgmt-firmware.c | 4 ++++ projects/hsm/mgmt-fpga.c | 20 ++++++++++++++++++-- projects/hsm/mgmt-keystore.c | 14 ++++++++++++++ projects/hsm/mgmt-masterkey.c | 16 ++++++++++++++++ projects/hsm/mgmt-misc.c | 4 ++++ projects/hsm/mgmt-task.c | 4 ++++ projects/libhal-test/gettimeofday.c | 2 ++ projects/libhal-test/printf.c | 2 ++ stm-rtc.c | 2 +- stm-uart.c | 2 +- syscalls.c | 5 +++++ 25 files changed, 193 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index e058edd..d04b4d4 100644 --- a/Makefile +++ b/Makefile @@ -99,7 +99,7 @@ SIZE=$(PREFIX)size STM32_CFLAGS_OPTIMIZATION ?= -ggdb -Og # whew, that's a lot of cflags -CFLAGS = $(STM32_CFLAGS_OPTIMIZATION) -Wall -Warray-bounds #-Wextra +CFLAGS = $(STM32_CFLAGS_OPTIMIZATION) -Wall -Warray-bounds -Wextra CFLAGS += -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork CFLAGS += -mfloat-abi=hard -mfpu=fpv4-sp-d16 CFLAGS += -DUSE_STDPERIPH_DRIVER -DSTM32F4XX -DSTM32F429xx diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c index fa08bb5..f64e6ce 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_hal_msp.c @@ -87,19 +87,23 @@ void HAL_RNG_MspDeInit(RNG_HandleTypeDef* hrng) void HAL_SRAM_MspInit(SRAM_HandleTypeDef* hsram) { + hsram = hsram; } void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef* hsram) { + hsram = hsram; } void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef* hsdram) { + hsdram = hsdram; } void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef* hsdram) { + hsdram = hsdram; } void HAL_UART_MspInit(UART_HandleTypeDef* huart) diff --git a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c index 32b7707..d3bafb2 100644 --- a/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c +++ b/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F4/TARGET_CRYPTECH_ALPHA/stm32f4xx_it.c @@ -143,6 +143,7 @@ __weak void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart) /* NOTE: This function Should not be modified, when the callback is needed, the HAL_UART1_RxCpltCallback could be implemented in the user file */ + huart = huart; } __weak void HAL_UART2_RxCpltCallback(UART_HandleTypeDef *huart) @@ -150,6 +151,7 @@ __weak void HAL_UART2_RxCpltCallback(UART_HandleTypeDef *huart) /* NOTE: This function Should not be modified, when the callback is needed, the HAL_UART2_RxCpltCallback could be implemented in the user file */ + huart = huart; } /** @@ -175,6 +177,7 @@ __weak void HAL_UART1_RxHalfCpltCallback(UART_HandleTypeDef *huart) /* NOTE: This function Should not be modified, when the callback is needed, the HAL_UART1_RxHalfCpltCallback could be implemented in the user file */ + huart = huart; } __weak void HAL_UART2_RxHalfCpltCallback(UART_HandleTypeDef *huart) @@ -182,10 +185,13 @@ __weak void HAL_UART2_RxHalfCpltCallback(UART_HandleTypeDef *huart) /* NOTE: This function Should not be modified, when the callback is needed, the HAL_UART2_RxHalfCpltCallback could be implemented in the user file */ + huart = huart; } void HAL_UART_ErrorCallback(UART_HandleTypeDef *huart) { + huart = huart; + /* I dunno, just trap it for now */ Error_Handler(); } diff --git a/projects/cli-test/mgmt-cli.c b/projects/cli-test/mgmt-cli.c index b3dbabf..6910c4d 100644 --- a/projects/cli-test/mgmt-cli.c +++ b/projects/cli-test/mgmt-cli.c @@ -97,6 +97,8 @@ static uint8_t uart_rx; */ void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart) { + huart = huart; + ringbuf_write_char(&uart_ringbuf, uart_rx); } diff --git a/projects/cli-test/mgmt-dfu.c b/projects/cli-test/mgmt-dfu.c index 5c9b4b7..7b78d38 100644 --- a/projects/cli-test/mgmt-dfu.c +++ b/projects/cli-test/mgmt-dfu.c @@ -58,6 +58,10 @@ __IO uint32_t *dfu_code_ptr = &CRYPTECH_FIRMWARE_START + 1; static int cmd_dfu_dump(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "First 256 bytes from DFU application address %p:\r\n", dfu_firmware); uart_send_hexdump(STM_UART_MGMT, (uint8_t *) dfu_firmware, 0, 0xff); @@ -70,6 +74,10 @@ static int cmd_dfu_erase(struct cli_def *cli, const char *command, char *argv[], { int status; + command = command; + argv = argv; + argc = argc; + cli_print(cli, "Erasing flash address %p to %p - expect the CLI to crash now", dfu_firmware, dfu_firmware_end); @@ -84,6 +92,11 @@ static int cmd_dfu_erase(struct cli_def *cli, const char *command, char *argv[], static int cmd_dfu_jump(struct cli_def *cli, const char *command, char *argv[], int argc) { uint32_t i; + + command = command; + argv = argv; + argc = argc; + /* Load first byte from the DFU_FIRMWARE_PTR to verify it contains an IVT before * jumping there. */ diff --git a/projects/cli-test/mgmt-fpga.c b/projects/cli-test/mgmt-fpga.c index b1b0973..da539f1 100644 --- a/projects/cli-test/mgmt-fpga.c +++ b/projects/cli-test/mgmt-fpga.c @@ -54,8 +54,8 @@ static int _flash_write_callback(uint8_t *buf, size_t len) if (fpgacfg_erase_sector(dfu_offset / FPGACFG_SECTOR_SIZE) != 1) return CLI_ERROR; - int res = fpgacfg_write_data(dfu_offset, buf, BITSTREAM_UPLOAD_CHUNK_SIZE) == 1; - dfu_offset += BITSTREAM_UPLOAD_CHUNK_SIZE; + int res = fpgacfg_write_data(dfu_offset, buf, len) == 1; + dfu_offset += len; return res; } @@ -63,6 +63,10 @@ static int cmd_fpga_bitstream_upload(struct cli_def *cli, const char *command, c { uint8_t buf[BITSTREAM_UPLOAD_CHUNK_SIZE]; + command = command; + argv = argv; + argc = argc; + dfu_offset = 0; fpgacfg_access_control(ALLOW_ARM); @@ -83,6 +87,10 @@ static int cmd_fpga_bitstream_upload(struct cli_def *cli, const char *command, c static int cmd_fpga_bitstream_erase(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + fpgacfg_access_control(ALLOW_ARM); cli_print(cli, "Checking if FPGA config memory is accessible"); @@ -110,6 +118,10 @@ static int cmd_fpga_bitstream_erase(struct cli_def *cli, const char *command, ch static int cmd_fpga_reset(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + fpgacfg_access_control(ALLOW_FPGA); fpgacfg_reset_fpga(RESET_FULL); cli_print(cli, "FPGA has been reset"); @@ -119,6 +131,10 @@ static int cmd_fpga_reset(struct cli_def *cli, const char *command, char *argv[] static int cmd_fpga_reset_registers(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + fpgacfg_access_control(ALLOW_FPGA); fpgacfg_reset_fpga(RESET_REGISTERS); cli_print(cli, "FPGA registers have been reset"); diff --git a/projects/cli-test/mgmt-keystore.c b/projects/cli-test/mgmt-keystore.c index bc2bc0c..ea1f263 100644 --- a/projects/cli-test/mgmt-keystore.c +++ b/projects/cli-test/mgmt-keystore.c @@ -59,6 +59,8 @@ static int cmd_keystore_set_pin(struct cli_def *cli, const char *command, char * hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 2) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore set pin "); @@ -91,6 +93,8 @@ static int cmd_keystore_clear_pin(struct cli_def *cli, const char *command, char hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore clear pin "); @@ -122,6 +126,8 @@ static int cmd_keystore_set_pin_iterations(struct cli_def *cli, const char *comm hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore set pin iterations "); @@ -156,6 +162,8 @@ static int cmd_keystore_set_key(struct cli_def *cli, const char *command, char * hal_error_t status; int hint = 0; + command = command; + if (argc != 2) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore set key "); @@ -187,6 +195,8 @@ static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, cha hal_error_t status; hal_uuid_t name; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore delete key "); @@ -214,6 +224,10 @@ static int cmd_keystore_show_data(struct cli_def *cli, const char *command, char uint8_t buf[KEYSTORE_PAGE_SIZE]; uint32_t i; + command = command; + argv = argv; + argc = argc; + if (keystore_check_id() != 1) { cli_print(cli, "ERROR: The keystore memory is not accessible."); } @@ -318,6 +332,10 @@ static int show_keys(struct cli_def *cli, const char *title) static int cmd_keystore_show_keys(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + if (show_keys(cli, "Keystore:")) return CLI_OK; else @@ -329,6 +347,8 @@ static int cmd_keystore_erase(struct cli_def *cli, const char *command, char *ar hal_error_t err; int status; + command = command; + if (argc != 1 || strcmp(argv[0], "YesIAmSure") != 0) { cli_print(cli, "Syntax: keystore erase YesIAmSure"); return CLI_ERROR; diff --git a/projects/cli-test/mgmt-masterkey.c b/projects/cli-test/mgmt-masterkey.c index 623d19b..0f6e352 100644 --- a/projects/cli-test/mgmt-masterkey.c +++ b/projects/cli-test/mgmt-masterkey.c @@ -83,6 +83,10 @@ static int cmd_masterkey_status(struct cli_def *cli, const char *command, char * hal_error_t status; uint8_t buf[KEK_LENGTH] = {0}; + command = command; + argv = argv; + argc = argc; + cli_print(cli, "Status of master key:\n"); status = hal_mkm_volatile_read(NULL, 0); @@ -122,6 +126,8 @@ static int cmd_masterkey_set(struct cli_def *cli, const char *command, char *arg hal_error_t err; int i; + command = command; + if ((i = _parse_hex_groups(&buf[0], sizeof(buf), argv, argc)) != 1) { cli_print(cli, "Failed parsing master key (%i)", i); return CLI_OK; @@ -143,6 +149,10 @@ static int cmd_masterkey_erase(struct cli_def *cli, const char *command, char *a { hal_error_t err; + command = command; + argv = argv; + argc = argc; + if ((err = hal_mkm_volatile_erase(KEK_LENGTH)) == LIBHAL_OK) { cli_print(cli, "Erased master key from volatile memory"); } else { @@ -157,6 +167,8 @@ static int cmd_masterkey_unsecure_set(struct cli_def *cli, const char *command, hal_error_t err; int i; + command = command; + if ((i = _parse_hex_groups(&buf[0], sizeof(buf), argv, argc)) != 1) { cli_print(cli, "Failed parsing master key (%i)", i); return CLI_OK; @@ -178,6 +190,10 @@ static int cmd_masterkey_unsecure_erase(struct cli_def *cli, const char *command { hal_error_t err; + command = command; + argv = argv; + argc = argc; + if ((err = hal_mkm_flash_erase(KEK_LENGTH)) == LIBHAL_OK) { cli_print(cli, "Erased unsecure master key from flash"); } else { diff --git a/projects/cli-test/mgmt-misc.c b/projects/cli-test/mgmt-misc.c index 7db08f2..4be9a4b 100644 --- a/projects/cli-test/mgmt-misc.c +++ b/projects/cli-test/mgmt-misc.c @@ -120,6 +120,10 @@ static int cmd_filetransfer(struct cli_def *cli, const char *command, char *argv { uint8_t buf[FILETRANSFER_UPLOAD_CHUNK_SIZE]; + command = command; + argv = argv; + argc = argc; + demo_crc = hal_crc32_init(); cli_receive_data(cli, &buf[0], sizeof(buf), _count_bytes_callback); demo_crc = hal_crc32_finalize(demo_crc); @@ -129,6 +133,10 @@ static int cmd_filetransfer(struct cli_def *cli, const char *command, char *argv static int cmd_reboot(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "\n\n\nRebooting\n\n\n"); HAL_NVIC_SystemReset(); diff --git a/projects/cli-test/mgmt-show.c b/projects/cli-test/mgmt-show.c index f124830..e829744 100644 --- a/projects/cli-test/mgmt-show.c +++ b/projects/cli-test/mgmt-show.c @@ -56,6 +56,10 @@ static int cmd_show_cpuspeed(struct cli_def *cli, const char *command, char *arg { volatile uint32_t hclk; + command = command; + argv = argv; + argc = argc; + hclk = HAL_RCC_GetHCLKFreq(); cli_print(cli, "HSE_VALUE: %li", HSE_VALUE); cli_print(cli, "HCLK: %li (%i MHz)", hclk, (int) hclk / 1000 / 1000); @@ -65,6 +69,10 @@ static int cmd_show_cpuspeed(struct cli_def *cli, const char *command, char *arg static int cmd_show_fpga_status(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "FPGA has %sloaded a bitstream", fpgacfg_check_done() ? "":"NOT "); return CLI_OK; } @@ -74,6 +82,10 @@ static int cmd_show_fpga_cores(struct cli_def *cli, const char *command, char *a hal_core_t *core; const hal_core_info_t *info; + command = command; + argv = argv; + argc = argc; + if (! fpgacfg_check_done()) { cli_print(cli, "FPGA has not loaded a bitstream"); return CLI_OK; @@ -90,6 +102,10 @@ static int cmd_show_fpga_cores(struct cli_def *cli, const char *command, char *a static int cmd_show_keystore_status(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "Keystore memory is %sonline", (keystore_check_id() != 1) ? "NOT ":""); return CLI_OK; } @@ -99,6 +115,10 @@ static int cmd_show_keystore_data(struct cli_def *cli, const char *command, char uint8_t buf[KEYSTORE_PAGE_SIZE]; uint32_t i; + command = command; + argv = argv; + argc = argc; + if (keystore_check_id() != 1) { cli_print(cli, "ERROR: The keystore memory is not accessible."); } diff --git a/projects/cli-test/mgmt-test.c b/projects/cli-test/mgmt-test.c index 1a22996..9b9972d 100644 --- a/projects/cli-test/mgmt-test.c +++ b/projects/cli-test/mgmt-test.c @@ -52,6 +52,8 @@ static int cmd_test_sdram(struct cli_def *cli, const char *command, char *argv[] // run external memory initialization sequence int ok, num_cycles = 1, i, test_completed; + command = command; + if (argc == 1) { num_cycles = strtol(argv[0], NULL, 0); if (num_cycles > 100) num_cycles = 100; @@ -106,6 +108,8 @@ static int cmd_test_fmc(struct cli_def *cli, const char *command, char *argv[], { int i, num_cycles = 1, num_rounds = 100000; + command = command; + if (argc >= 1) { num_cycles = strtol(argv[0], NULL, 0); if (num_cycles > 100000) num_cycles = 100000; diff --git a/projects/cli-test/test-mkmif.c b/projects/cli-test/test-mkmif.c index bb41b4d..6321dde 100644 --- a/projects/cli-test/test-mkmif.c +++ b/projects/cli-test/test-mkmif.c @@ -142,6 +142,10 @@ int cmd_test_mkmif(struct cli_def *cli, const char *command, char *argv[], int a hal_core_t *core = hal_core_find(MKMIF_NAME, NULL); hal_error_t res; + command = command; + argv = argv; + argc = argc; + if (core == NULL) { cli_print(cli, "MKMIF core not present, not testing.\n"); return HAL_ERROR_CORE_NOT_FOUND; diff --git a/projects/hsm/mgmt-bootloader.c b/projects/hsm/mgmt-bootloader.c index 738686e..ce24560 100644 --- a/projects/hsm/mgmt-bootloader.c +++ b/projects/hsm/mgmt-bootloader.c @@ -60,6 +60,10 @@ static int _flash_write_callback(uint8_t *buf, size_t len) static int cmd_bootloader_upload(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + if (user < HAL_USER_SO) { cli_print(cli, "Permission denied."); return CLI_ERROR; diff --git a/projects/hsm/mgmt-cli.c b/projects/hsm/mgmt-cli.c index ab9cf44..23a0a40 100644 --- a/projects/hsm/mgmt-cli.c +++ b/projects/hsm/mgmt-cli.c @@ -103,6 +103,8 @@ static uint8_t uart_rx; */ void HAL_UART1_RxCpltCallback(UART_HandleTypeDef *huart) { + huart = huart; + ringbuf_write_char(&uart_ringbuf, uart_rx); task_wake(cli_task); } diff --git a/projects/hsm/mgmt-firmware.c b/projects/hsm/mgmt-firmware.c index ec8a69d..85eb78b 100644 --- a/projects/hsm/mgmt-firmware.c +++ b/projects/hsm/mgmt-firmware.c @@ -49,6 +49,10 @@ extern hal_user_t user; static int cmd_firmware_upload(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + if (user < HAL_USER_SO) { cli_print(cli, "Permission denied."); return CLI_ERROR; diff --git a/projects/hsm/mgmt-fpga.c b/projects/hsm/mgmt-fpga.c index 06f2a26..f6c6f20 100644 --- a/projects/hsm/mgmt-fpga.c +++ b/projects/hsm/mgmt-fpga.c @@ -62,13 +62,17 @@ static int _flash_write_callback(uint8_t *buf, size_t len) if (fpgacfg_erase_sector(dfu_offset / FPGACFG_SECTOR_SIZE) != 1) return CLI_ERROR; - int res = fpgacfg_write_data(dfu_offset, buf, BITSTREAM_UPLOAD_CHUNK_SIZE) == 1; - dfu_offset += BITSTREAM_UPLOAD_CHUNK_SIZE; + int res = fpgacfg_write_data(dfu_offset, buf, len) == 1; + dfu_offset += len; return res; } static int cmd_fpga_bitstream_upload(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + if (user < HAL_USER_SO) { cli_print(cli, "Permission denied."); return CLI_ERROR; @@ -96,6 +100,10 @@ static int cmd_fpga_bitstream_upload(struct cli_def *cli, const char *command, c static int cmd_fpga_bitstream_erase(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + fpgacfg_access_control(ALLOW_ARM); cli_print(cli, "Checking if FPGA config memory is accessible"); @@ -123,6 +131,10 @@ static int cmd_fpga_bitstream_erase(struct cli_def *cli, const char *command, ch static int cmd_fpga_reset(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + fpgacfg_access_control(ALLOW_FPGA); fpgacfg_reset_fpga(RESET_FULL); hal_core_reset_table(); @@ -136,6 +148,10 @@ static int cmd_fpga_show_cores(struct cli_def *cli, const char *command, char *a hal_core_t *core; const hal_core_info_t *info; + command = command; + argv = argv; + argc = argc; + if (! fpgacfg_check_done()) { cli_print(cli, "FPGA has not loaded a bitstream"); return CLI_OK; diff --git a/projects/hsm/mgmt-keystore.c b/projects/hsm/mgmt-keystore.c index 9bd9dbf..100c428 100644 --- a/projects/hsm/mgmt-keystore.c +++ b/projects/hsm/mgmt-keystore.c @@ -59,6 +59,8 @@ static int cmd_keystore_set_pin(struct cli_def *cli, const char *command, char * hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 2) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore set pin "); @@ -91,6 +93,8 @@ static int cmd_keystore_clear_pin(struct cli_def *cli, const char *command, char hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore clear pin "); @@ -122,6 +126,8 @@ static int cmd_keystore_set_pin_iterations(struct cli_def *cli, const char *comm hal_error_t status; hal_client_handle_t client = { -1 }; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore set pin iterations "); @@ -145,6 +151,8 @@ static int cmd_keystore_delete_key(struct cli_def *cli, const char *command, cha hal_error_t status; hal_uuid_t name; + command = command; + if (argc != 1) { cli_print(cli, "Wrong number of arguments (%i).", argc); cli_print(cli, "Syntax: keystore delete key "); @@ -276,6 +284,10 @@ static int show_pin(struct cli_def *cli, char *label, hal_user_t user) static int cmd_keystore_show_keys(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + int err = 0; err |= show_keys(cli, "Keystore:"); @@ -293,6 +305,8 @@ static int cmd_keystore_erase(struct cli_def *cli, const char *command, char *ar hal_error_t err; int status; + command = command; + if (argc != 1 || strcmp(argv[0], "YesIAmSure") != 0) { cli_print(cli, "Syntax: keystore erase YesIAmSure"); return CLI_ERROR; diff --git a/projects/hsm/mgmt-masterkey.c b/projects/hsm/mgmt-masterkey.c index 9f5e4d0..8675637 100644 --- a/projects/hsm/mgmt-masterkey.c +++ b/projects/hsm/mgmt-masterkey.c @@ -82,6 +82,10 @@ static int cmd_masterkey_status(struct cli_def *cli, const char *command, char * { hal_error_t status; + command = command; + argv = argv; + argc = argc; + cli_print(cli, "Status of master key:\n"); status = hal_mkm_volatile_read(NULL, 0); @@ -132,6 +136,8 @@ static int _masterkey_set(struct cli_def *cli, char *argv[], int argc, static int cmd_masterkey_set(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + return _masterkey_set(cli, argv, argc, "volatile", hal_mkm_volatile_write); } @@ -139,6 +145,10 @@ static int cmd_masterkey_erase(struct cli_def *cli, const char *command, char *a { hal_error_t err; + command = command; + argv = argv; + argc = argc; + if ((err = hal_mkm_volatile_erase(KEK_LENGTH)) == LIBHAL_OK) { cli_print(cli, "Erased master key from volatile memory"); } else { @@ -149,6 +159,8 @@ static int cmd_masterkey_erase(struct cli_def *cli, const char *command, char *a static int cmd_masterkey_unsecure_set(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + return _masterkey_set(cli, argv, argc, "flash", hal_mkm_flash_write); } @@ -156,6 +168,10 @@ static int cmd_masterkey_unsecure_erase(struct cli_def *cli, const char *command { hal_error_t err; + command = command; + argv = argv; + argc = argc; + if ((err = hal_mkm_flash_erase(KEK_LENGTH)) == LIBHAL_OK) { cli_print(cli, "Erased unsecure master key from flash"); } else { diff --git a/projects/hsm/mgmt-misc.c b/projects/hsm/mgmt-misc.c index ccd032b..e834b7d 100644 --- a/projects/hsm/mgmt-misc.c +++ b/projects/hsm/mgmt-misc.c @@ -115,6 +115,10 @@ int cli_receive_data(struct cli_def *cli, uint8_t *buf, size_t len, cli_data_cal static int cmd_reboot(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "\n\n\nRebooting\n\n\n"); HAL_NVIC_SystemReset(); diff --git a/projects/hsm/mgmt-task.c b/projects/hsm/mgmt-task.c index ac1a737..beffc32 100644 --- a/projects/hsm/mgmt-task.c +++ b/projects/hsm/mgmt-task.c @@ -52,6 +52,10 @@ extern size_t request_queue_max(void); static int cmd_task_show(struct cli_def *cli, const char *command, char *argv[], int argc) { + command = command; + argv = argv; + argc = argc; + cli_print(cli, "name state stack high water"); cli_print(cli, "-------- -------- ----------------"); diff --git a/projects/libhal-test/gettimeofday.c b/projects/libhal-test/gettimeofday.c index b13485d..f7a87f1 100644 --- a/projects/libhal-test/gettimeofday.c +++ b/projects/libhal-test/gettimeofday.c @@ -56,6 +56,8 @@ int gettimeofday(struct timeval *tv, struct timezone *tz) { uint32_t tick = HAL_GetTick(); /* uptime in ms */ + tz = tz; + tv->tv_sec = tick / 1000; tv->tv_usec = (tick % 1000) * 1000; diff --git a/projects/libhal-test/printf.c b/projects/libhal-test/printf.c index 18feb8d..85af09b 100644 --- a/projects/libhal-test/printf.c +++ b/projects/libhal-test/printf.c @@ -362,6 +362,8 @@ You must write your own putchar() *****************************************************************************/ int vprintf_help(unsigned c, void **ptr) { + ptr = ptr; + putchar(c); return 0 ; } diff --git a/stm-rtc.c b/stm-rtc.c index 3118d23..3f66ee4 100644 --- a/stm-rtc.c +++ b/stm-rtc.c @@ -96,7 +96,7 @@ HAL_StatusTypeDef rtc_read_bytes (const uint16_t i2c_addr, uint8_t *buf, const u { HAL_StatusTypeDef res; - while (HAL_I2C_Master_Receive (&hi2c_rtc, i2c_addr, buf, len, 1000) != HAL_OK) { + while (HAL_I2C_Master_Receive (&hi2c_rtc, i2c_addr, buf, len, timeout) != HAL_OK) { res = HAL_I2C_GetError (&hi2c_rtc); if (res != HAL_I2C_ERROR_AF) { return res; diff --git a/stm-uart.c b/stm-uart.c index f54d95e..59089fe 100644 --- a/stm-uart.c +++ b/stm-uart.c @@ -249,7 +249,7 @@ HAL_StatusTypeDef uart_send_hexdump(stm_uart_port_t port, const uint8_t *buf, uart_send_string2(port, "00 -- "); - for (i = 0; i <= end_offset; i++) { + for (i = start_offset; i <= end_offset; i++) { if (i && (! (i % 16))) { uart_send_string2(port, "\r\n"); diff --git a/syscalls.c b/syscalls.c index d7b7211..2243d0b 100644 --- a/syscalls.c +++ b/syscalls.c @@ -101,6 +101,9 @@ int _write_r (struct _reent *r, int file, char * ptr, int len) int _close_r (struct _reent *r, int file) { + r = r; + file = file; + return 0; } @@ -115,6 +118,8 @@ caddr_t _sbrk_r (struct _reent *r, int incr) static char * heap_end; char * prev_heap_end; + r = r; + if (heap_end == NULL) heap_end = & end; -- cgit v1.2.3