diff options
Diffstat (limited to 'projects/cli-test')
-rw-r--r-- | projects/cli-test/mgmt-cli.c | 2 | ||||
-rw-r--r-- | projects/cli-test/mgmt-dfu.c | 13 | ||||
-rw-r--r-- | projects/cli-test/mgmt-fpga.c | 20 | ||||
-rw-r--r-- | projects/cli-test/mgmt-keystore.c | 20 | ||||
-rw-r--r-- | projects/cli-test/mgmt-masterkey.c | 16 | ||||
-rw-r--r-- | projects/cli-test/mgmt-misc.c | 8 | ||||
-rw-r--r-- | projects/cli-test/mgmt-show.c | 20 | ||||
-rw-r--r-- | projects/cli-test/mgmt-test.c | 4 | ||||
-rw-r--r-- | projects/cli-test/test-mkmif.c | 4 |
9 files changed, 105 insertions, 2 deletions
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 <user|so|wheel> <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 <user|so|wheel>"); @@ -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 <number>"); @@ -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 <name> <der>"); @@ -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 <name>"); @@ -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; |