diff options
36 files changed, 166 insertions, 167 deletions
diff --git a/src/flash/mflash.c b/src/flash/mflash.c index ba344222..8fca4aa3 100644 --- a/src/flash/mflash.c +++ b/src/flash/mflash.c @@ -141,7 +141,7 @@ static int s3c2440_set_gpio_to_output (struct mflash_gpio_num gpio) gpio_con = S3C2440_GPJCON; } else { LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } ret = target_read_u32(target, gpio_con, &data); @@ -173,7 +173,7 @@ static int s3c2440_set_gpio_output_val (struct mflash_gpio_num gpio, uint8_t val gpio_dat = S3C2440_GPJDAT; } else { LOG_ERROR("mflash: invalid port %d%s", gpio.num, gpio.port); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } ret = target_read_u32(target, gpio_dat, &data); diff --git a/src/flash/nand/core.c b/src/flash/nand/core.c index d9bb7dea..777b2fdc 100644 --- a/src/flash/nand/core.c +++ b/src/flash/nand/core.c @@ -221,7 +221,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index, *nand = get_nand_device_by_num(num); if (!*nand) { command_print(CMD_CTX, "NAND flash device '%s' not found", str); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; } @@ -542,7 +542,7 @@ int nand_erase(struct nand_device *nand, int first_block, int last_block) return ERROR_NAND_DEVICE_NOT_PROBED; if ((first_block < 0) || (last_block >= nand->num_blocks)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* make sure we know if a block is bad before erasing it */ for (i = first_block; i <= last_block; i++) diff --git a/src/flash/nand/tcl.c b/src/flash/nand/tcl.c index e4bfb4d1..5fba1bcc 100644 --- a/src/flash/nand/tcl.c +++ b/src/flash/nand/tcl.c @@ -177,12 +177,12 @@ COMMAND_HANDLER(handle_nand_erase_command) COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset); if ((offset % p->erase_size) != 0 || offset >= size) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length); if ((length == 0) || (length % p->erase_size) != 0 || (length + offset) > size) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; offset /= p->erase_size; length /= p->erase_size; @@ -226,12 +226,12 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command) COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[1], offset); if (offset % p->erase_size) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; offset /= p->erase_size; COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], length); if (length % p->erase_size) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; length -= 1; length /= p->erase_size; diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c index 6fa9fe25..7351aed9 100644 --- a/src/flash/nor/stellaris.c +++ b/src/flash/nor/stellaris.c @@ -897,7 +897,7 @@ static int stellaris_protect(struct flash_bank *bank, int set, int first, int la { LOG_ERROR("Hardware doesn't support page-level unprotect. " "Try the 'recover' command."); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (stellaris_info->did1 == 0) diff --git a/src/flash/nor/tcl.c b/src/flash/nor/tcl.c index 92b85be7..4ba5f47c 100644 --- a/src/flash/nor/tcl.c +++ b/src/flash/nor/tcl.c @@ -848,7 +848,7 @@ COMMAND_HANDLER(handle_flash_bank_command) COMMAND_HANDLER(handle_flash_banks_command) { if (CMD_ARGC != 0) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; unsigned n = 0; for (struct flash_bank *p = flash_bank_list(); p; p = p->next, n++) diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c index 359d3aa7..bf708be2 100644 --- a/src/flash/nor/tms470.c +++ b/src/flash/nor/tms470.c @@ -314,7 +314,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) if (CMD_ARGC > 4) { command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } else if (CMD_ARGC == 4) { @@ -328,7 +328,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) { command_print(CMD_CTX, "could not process flash key %s", CMD_ARGV[i]); LOG_ERROR("could not process flash key %s", CMD_ARGV[i]); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } } @@ -337,7 +337,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command) else if (CMD_ARGC != 0) { command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (keysSet) @@ -378,7 +378,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command) if (CMD_ARGC > 1) { command_print(CMD_CTX, "tms470 osc_megahertz <MHz>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } else if (CMD_ARGC == 1) { @@ -390,7 +390,7 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command) LOG_ERROR("osc_megahertz must be positive and non-zero!"); command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!"); oscMHz = 12; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } command_print(CMD_CTX, "osc_megahertz=%d", oscMHz); @@ -407,7 +407,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command) if (CMD_ARGC > 1) { command_print(CMD_CTX, "tms470 plldis <0 | 1>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } else if (CMD_ARGC == 1) { diff --git a/src/helper/command.c b/src/helper/command.c index 65e538bb..3ed8dc87 100644 --- a/src/helper/command.c +++ b/src/helper/command.c @@ -494,7 +494,7 @@ int unregister_command(struct command_context *context, struct command *parent, const char *name) { if ((!context) || (!name)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; struct command *p = NULL; struct command **head = command_list_for_parent(context, parent); @@ -832,12 +832,12 @@ static COMMAND_HELPER(command_help_find, struct command *head, struct command **out) { if (0 == CMD_ARGC) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; *out = command_find(head, CMD_ARGV[0]); if (NULL == *out && strncmp(CMD_ARGV[0], "ocd_", 4) == 0) *out = command_find(head, CMD_ARGV[0] + 4); if (NULL == *out) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (--CMD_ARGC == 0) return ERROR_OK; CMD_ARGV++; @@ -1180,7 +1180,7 @@ COMMAND_HANDLER(handle_help_add_command) if (CMD_ARGC < 2) { LOG_ERROR("%s: insufficient arguments", CMD_NAME); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // save help text and remove it from argument list @@ -1190,7 +1190,7 @@ COMMAND_HANDLER(handle_help_add_command) if (!help && !usage) { LOG_ERROR("command name '%s' is unknown", CMD_NAME); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // likewise for the leaf command name const char *cmd_name = CMD_ARGV[--CMD_ARGC]; @@ -1399,7 +1399,7 @@ struct command_context* command_init(const char *startup_tcl, Jim_Interp *interp int command_context_mode(struct command_context *cmd_ctx, enum command_mode mode) { if (!cmd_ctx) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; cmd_ctx->mode = mode; return ERROR_OK; @@ -1503,7 +1503,7 @@ int command_parse_bool_arg(const char *in, bool *out) return ERROR_OK; if (command_parse_bool(in, out, "1", "0") == ERROR_OK) return ERROR_OK; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) @@ -1514,7 +1514,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) if (command_parse_bool_arg(in, out) != ERROR_OK) { LOG_ERROR("%s: argument '%s' is not valid", CMD_NAME, in); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // fall through } @@ -1522,7 +1522,7 @@ COMMAND_HELPER(handle_command_parse_bool, bool *out, const char *label) LOG_INFO("%s is %s", label, *out ? "enabled" : "disabled"); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; } diff --git a/src/helper/fileio.c b/src/helper/fileio.c index 9ae01344..b97ebf42 100644 --- a/src/helper/fileio.c +++ b/src/helper/fileio.c @@ -63,7 +63,7 @@ static inline int fileio_open_local(struct fileio_internal *fileio) break; default: LOG_ERROR("BUG: access neither read, write nor readwrite"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* win32 always opens in binary mode */ diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c index 211c4ba6..3754fc5c 100644 --- a/src/helper/ioutil.c +++ b/src/helper/ioutil.c @@ -118,7 +118,7 @@ COMMAND_HANDLER(handle_cat_command) if (CMD_ARGC != 1) { command_print(CMD_CTX, "cat <filename>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // NOTE!!! we only have line printing capability so we print the entire file as a single line. @@ -144,7 +144,7 @@ COMMAND_HANDLER(handle_trunc_command) if (CMD_ARGC != 1) { command_print(CMD_CTX, "trunc <filename>"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } FILE *config_file = NULL; @@ -163,7 +163,7 @@ COMMAND_HANDLER(handle_meminfo_command) if (CMD_ARGC != 0) { command_print(CMD_CTX, "meminfo"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } info = mallinfo(); @@ -186,7 +186,7 @@ COMMAND_HANDLER(handle_append_command) { command_print(CMD_CTX, "append <filename> [<string1>, [<string2>, ...]]"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } int retval = ERROR_FAIL; @@ -224,7 +224,7 @@ COMMAND_HANDLER(handle_cp_command) { if (CMD_ARGC != 2) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // NOTE!!! we only have line printing capability so we print the entire file as a single line. @@ -237,7 +237,7 @@ COMMAND_HANDLER(handle_cp_command) FILE *f = fopen(CMD_ARGV[1], "wb"); if (f == NULL) - retval = ERROR_INVALID_ARGUMENTS; + retval = ERROR_COMMAND_SYNTAX_ERROR; size_t pos = 0; for (;;) @@ -250,7 +250,7 @@ COMMAND_HANDLER(handle_cp_command) } if ((retval == ERROR_OK) && (fwrite(((char *)data) + pos, 1, chunk, f) != chunk)) - retval = ERROR_INVALID_ARGUMENTS; + retval = ERROR_COMMAND_SYNTAX_ERROR; if (retval != ERROR_OK) { @@ -405,7 +405,7 @@ void copydir(char *name, char *destdir) COMMAND_HANDLER(handle_rm_command) { if (CMD_ARGC != 1) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; bool del = false; if (rmdir(CMD_ARGV[0]) == 0) diff --git a/src/helper/log.c b/src/helper/log.c index 8a8f08a7..fa66de06 100644 --- a/src/helper/log.c +++ b/src/helper/log.c @@ -326,7 +326,7 @@ int log_add_callback(log_callback_fn fn, void *priv) for (cb = log_callbacks; cb; cb = cb->next) { if (cb->fn == fn && cb->priv == priv) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* alloc memory, it is safe just to return in case of an error, no need for the caller to check this */ @@ -357,7 +357,7 @@ int log_remove_callback(log_callback_fn fn, void *priv) } /* no such item */ - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* return allocated string w/printf() result */ diff --git a/src/helper/log.h b/src/helper/log.h index 801ae7f8..7edfa7b6 100644 --- a/src/helper/log.h +++ b/src/helper/log.h @@ -132,7 +132,6 @@ extern int debug_level; * error codes < 100 */ #define ERROR_OK (0) -#define ERROR_INVALID_ARGUMENTS ERROR_COMMAND_SYNTAX_ERROR #define ERROR_NO_CONFIG_FILE (-2) #define ERROR_BUF_TOO_SMALL (-3) /* see "Error:" log entry for meaningful message to the user. The caller should diff --git a/src/jtag/adapter.c b/src/jtag/adapter.c index a0cd5e3d..acd434c4 100644 --- a/src/jtag/adapter.c +++ b/src/jtag/adapter.c @@ -218,7 +218,7 @@ COMMAND_HANDLER(handle_reset_config_command) if (mask & m) { LOG_ERROR("extra reset_config %s spec (%s)", "gating", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (m) goto next; @@ -238,7 +238,7 @@ COMMAND_HANDLER(handle_reset_config_command) if (mask & m) { LOG_ERROR("extra reset_config %s spec (%s)", "signal", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (m) goto next; @@ -258,7 +258,7 @@ COMMAND_HANDLER(handle_reset_config_command) if (mask & m) { LOG_ERROR("extra reset_config %s spec (%s)", "combination", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (m) goto next; @@ -274,7 +274,7 @@ COMMAND_HANDLER(handle_reset_config_command) if (mask & m) { LOG_ERROR("extra reset_config %s spec (%s)", "trst_type", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (m) goto next; @@ -290,14 +290,14 @@ COMMAND_HANDLER(handle_reset_config_command) if (mask & m) { LOG_ERROR("extra reset_config %s spec (%s)", "srst_type", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (m) goto next; /* caller provided nonsense; fail */ LOG_ERROR("unknown reset_config flag (%s)", *CMD_ARGV); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; next: /* Remember the bits which were specified (mask) diff --git a/src/jtag/core.c b/src/jtag/core.c index 48eef3e1..a0feed1d 100644 --- a/src/jtag/core.c +++ b/src/jtag/core.c @@ -279,7 +279,7 @@ int jtag_register_event_callback(jtag_event_handler_t callback, void *priv) if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (*callbacks_p) @@ -303,7 +303,7 @@ int jtag_unregister_event_callback(jtag_event_handler_t callback, void *priv) if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } while (*p) diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c index b23d196b..4bee67dc 100644 --- a/src/jtag/drivers/presto.c +++ b/src/jtag/drivers/presto.c @@ -686,7 +686,7 @@ static int presto_adapter_khz(int khz, int *jtag_speed) if (khz < 0) { *jtag_speed = 0; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (khz >= 3000) *jtag_speed = 0; @@ -700,7 +700,7 @@ static int presto_jtag_speed_div(int speed, int *khz) if ((speed < 0) || (speed > 1000)) { *khz = 0; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (speed == 0) *khz = 3000; @@ -715,7 +715,7 @@ static int presto_jtag_speed(int speed) if (presto_jtag_speed_div(speed, &khz)) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } presto->jtag_speed = speed; diff --git a/src/jtag/zy1000/zy1000.c b/src/jtag/zy1000/zy1000.c index 25783fa7..22193abd 100644 --- a/src/jtag/zy1000/zy1000.c +++ b/src/jtag/zy1000/zy1000.c @@ -283,7 +283,7 @@ int zy1000_speed(int speed) { LOG_USER("valid ZY1000 jtag_speed=[8190,2]. With divisor is %dkHz / even values between 8190-2, i.e. min %dHz, max %dMHz", ZYLIN_KHZ, (ZYLIN_KHZ * 1000) / 8190, ZYLIN_KHZ / (2 * 1000)); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } int khz; @@ -325,7 +325,7 @@ COMMAND_HANDLER(handle_power_command) LOG_INFO("Target power %s", savePower ? "on" : "off"); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; diff --git a/src/pld/xilinx_bit.c b/src/pld/xilinx_bit.c index 1ae1ea8d..ea4f0ec8 100644 --- a/src/pld/xilinx_bit.c +++ b/src/pld/xilinx_bit.c @@ -82,7 +82,7 @@ int xilinx_read_bit_file(struct xilinx_bit_file *bit_file, const char *filename) int read_count; if (!filename || !bit_file) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (stat(filename, &input_stat) == -1) { diff --git a/src/server/server.c b/src/server/server.c index a7fddf67..e60eb398 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -657,7 +657,7 @@ SERVER_PORT_COMMAND() break; } default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; } @@ -676,7 +676,7 @@ SERVER_PIPE_COMMAND() break; } default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; } diff --git a/src/target/arm7_9_common.c b/src/target/arm7_9_common.c index 5fbcd4de..7ad70ea0 100644 --- a/src/target/arm7_9_common.c +++ b/src/target/arm7_9_common.c @@ -2142,7 +2142,7 @@ static int arm7_9_read_core_reg(struct target *target, struct reg *r, if (!is_arm_mode(armv4_5->core_mode)) return ERROR_FAIL; if ((num < 0) || (num > 16)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if ((mode != ARM_MODE_ANY) && (mode != armv4_5->core_mode) @@ -2205,7 +2205,7 @@ static int arm7_9_write_core_reg(struct target *target, struct reg *r, if (!is_arm_mode(armv4_5->core_mode)) return ERROR_FAIL; if ((num < 0) || (num > 16)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if ((mode != ARM_MODE_ANY) && (mode != armv4_5->core_mode) @@ -2277,7 +2277,7 @@ int arm7_9_read_memory(struct target *target, uint32_t address, uint32_t size, u /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; @@ -2457,7 +2457,7 @@ int arm7_9_write_memory(struct target *target, uint32_t address, uint32_t size, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c index 9ea7b5a1..c0d664d2 100644 --- a/src/target/arm_adi_v5.c +++ b/src/target/arm_adi_v5.c @@ -1272,7 +1272,7 @@ int dap_get_debugbase(struct adiv5_dap *dap, int ap, /* AP address is in bits 31:24 of DP_SELECT */ if (ap >= 256) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; ap_old = dap->ap_current; dap_ap_select(dap, ap); @@ -1315,7 +1315,7 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int ap, int retval = ERROR_FAIL; if (ap >= 256) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; ap_old = dap->ap_current; dap_ap_select(dap, ap); @@ -1799,7 +1799,7 @@ COMMAND_HANDLER(dap_baseaddr_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ if (apsel >= 256) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1867,7 +1867,7 @@ COMMAND_HANDLER(dap_apsel_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ if (apsel >= 256) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; break; default: return ERROR_COMMAND_SYNTAX_ERROR; @@ -1906,7 +1906,7 @@ COMMAND_HANDLER(dap_apid_command) COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel); /* AP address is in bits 31:24 of DP_SELECT */ if (apsel >= 256) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; break; default: return ERROR_COMMAND_SYNTAX_ERROR; diff --git a/src/target/arm_disassembler.c b/src/target/arm_disassembler.c index 188b6ba7..34d679c1 100644 --- a/src/target/arm_disassembler.c +++ b/src/target/arm_disassembler.c @@ -3013,7 +3013,7 @@ static int t2ev_misc(uint32_t opcode, uint32_t address, mnemonic = "ISB"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } strcpy(cp, mnemonic); return ERROR_OK; @@ -3064,7 +3064,7 @@ static int t2ev_b_misc(uint32_t opcode, uint32_t address, } undef: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } static int t2ev_data_mod_immed(uint32_t opcode, uint32_t address, @@ -3199,7 +3199,7 @@ static int t2ev_data_mod_immed(uint32_t opcode, uint32_t address, suffix2 = ".W"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (one) @@ -3288,7 +3288,7 @@ static int t2ev_data_immed(uint32_t opcode, uint32_t address, (int) (opcode & 0x1f) + 1 - immed); return ERROR_OK; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } sprintf(cp, "%s\tr%d, r%d, #%d\t; %#3.3x", mnemonic, @@ -3321,7 +3321,7 @@ static int t2ev_store_single(uint32_t opcode, uint32_t address, unsigned rt = (opcode >> 12) & 0x0f; if (rn == 0xf) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (opcode & 0x0800) op |= 1; @@ -3358,7 +3358,7 @@ static int t2ev_store_single(uint32_t opcode, uint32_t address, break; /* error */ default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } sprintf(cp, "STR%s.W\tr%d, [r%d, r%d, LSL #%d]", @@ -3381,7 +3381,7 @@ imm8: break; case 0x000: case 0x200: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* two indexed modes will write back rn */ @@ -3426,7 +3426,7 @@ static int t2ev_mul32(uint32_t opcode, uint32_t address, (int) (opcode >> 0) & 0xf, ra); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; } @@ -3462,7 +3462,7 @@ static int t2ev_mul64_div(uint32_t opcode, uint32_t address, (int) (opcode >> 0) & 0xf); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; @@ -3516,7 +3516,7 @@ static int t2ev_ldm_stm(uint32_t opcode, uint32_t address, sprintf(cp, "LDMDB.W\tr%d%s, ", rn, t ? "!" : ""); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } cp = strchr(cp, 0); @@ -3584,7 +3584,7 @@ static int t2ev_ldrex_strex(uint32_t opcode, uint32_t address, mnemonic = "STREXH"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } rd = opcode & 0xf; imm = 0; @@ -3604,12 +3604,12 @@ static int t2ev_ldrex_strex(uint32_t opcode, uint32_t address, mnemonic = "LDREXH"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } imm = 0; goto ldrex; } - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; strex: imm <<= 2; @@ -3680,7 +3680,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address, case 0: if (rd == 0xf) { if (!(opcode & (1 << 20))) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; instruction->type = ARM_TST; mnemonic = "TST"; suffix = ""; @@ -3742,7 +3742,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address, case 4: if (rd == 0xf) { if (!(opcode & (1 << 20))) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; instruction->type = ARM_TEQ; mnemonic = "TEQ"; suffix = ""; @@ -3754,7 +3754,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address, case 8: if (rd == 0xf) { if (!(opcode & (1 << 20))) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; instruction->type = ARM_CMN; mnemonic = "CMN"; suffix = ""; @@ -3774,7 +3774,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address, case 0xd: if (rd == 0xf) { if (!(opcode & (1 << 21))) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; instruction->type = ARM_CMP; mnemonic = "CMP"; suffix = ""; @@ -3788,7 +3788,7 @@ static int t2ev_data_shift(uint32_t opcode, uint32_t address, mnemonic = "RSB"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } sprintf(cp, "%s%s.W\tr%d, r%d, r%d", @@ -3857,7 +3857,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address, mnemonic = "ROR"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } instruction->type = ARM_MOV; @@ -3898,11 +3898,11 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address, case 0xa: case 0xb: if (opcode & (1 << 6)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((opcode >> 12) & 0xf) != 0xf) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (!(opcode & (1 << 20))) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; switch (((opcode >> 19) & 0x04) | ((opcode >> 4) & 0x3)) { @@ -3922,7 +3922,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address, mnemonic = "CLZ"; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } sprintf(cp, "%s\tr%d, r%d", mnemonic, @@ -3930,7 +3930,7 @@ static int t2ev_data_reg(uint32_t opcode, uint32_t address, (int) (opcode >> 0) & 0xf); break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } } @@ -3986,7 +3986,7 @@ static int t2ev_load_word(uint32_t opcode, uint32_t address, char *p1 = "]", *p2 = ""; if (!(opcode & 0x0500)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; immed = opcode & 0x00ff; @@ -4008,7 +4008,7 @@ static int t2ev_load_word(uint32_t opcode, uint32_t address, return ERROR_OK; } - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } static int t2ev_load_byte_hints(uint32_t opcode, uint32_t address, @@ -4187,7 +4187,7 @@ ldrsb_literal: goto ldrxb_immediate_t2; } - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } static int t2ev_load_halfword(uint32_t opcode, uint32_t address, @@ -4265,7 +4265,7 @@ ldrh_literal: return ERROR_OK; } - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* @@ -4377,7 +4377,7 @@ int thumb2_opcode(struct target *target, uint32_t address, struct arm_instructio * instructions; not yet handled here. */ - if (retval == ERROR_INVALID_ARGUMENTS) { + if (retval == ERROR_COMMAND_SYNTAX_ERROR) { instruction->type = ARM_UNDEFINED_INSTRUCTION; strcpy(cp, "UNDEFINED OPCODE"); return ERROR_OK; diff --git a/src/target/arm_dpm.c b/src/target/arm_dpm.c index dfd3f275..9f7af4e7 100644 --- a/src/target/arm_dpm.c +++ b/src/target/arm_dpm.c @@ -536,7 +536,7 @@ static int arm_dpm_read_core_reg(struct target *target, struct reg *r, int retval; if (regnum < 0 || regnum > 16) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (regnum == 16) { if (mode != ARM_MODE_ANY) @@ -579,7 +579,7 @@ static int arm_dpm_write_core_reg(struct target *target, struct reg *r, if (regnum < 0 || regnum > 16) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (regnum == 16) { if (mode != ARM_MODE_ANY) @@ -729,7 +729,7 @@ static int dpm_bpwp_setup(struct arm_dpm *dpm, struct dpm_bpwp *xp, /* FALL THROUGH */ default: LOG_ERROR("unsupported {break,watch}point length/alignment"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* other shared control bits: @@ -756,7 +756,7 @@ static int dpm_add_breakpoint(struct target *target, struct breakpoint *bp) int retval = ERROR_TARGET_RESOURCE_NOT_AVAILABLE; if (bp->length < 2) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (!dpm->bpwp_enable) return retval; @@ -781,7 +781,7 @@ static int dpm_remove_breakpoint(struct target *target, struct breakpoint *bp) { struct arm *arm = target_to_arm(target); struct arm_dpm *dpm = arm->dpm; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; for (unsigned i = 0; i < dpm->nbp; i++) { if (dpm->dbp[i].bp == bp) { @@ -855,7 +855,7 @@ static int dpm_remove_watchpoint(struct target *target, struct watchpoint *wp) { struct arm *arm = target_to_arm(target); struct arm_dpm *dpm = arm->dpm; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; for (unsigned i = 0; i < dpm->nwp; i++) { if (dpm->dwp[i].wp == wp) { diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c index e576d9c0..d59ab5c7 100644 --- a/src/target/armv4_5.c +++ b/src/target/armv4_5.c @@ -1185,13 +1185,13 @@ int armv4_5_run_algorithm_inner(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if ((retval = armv4_5_set_core_reg(reg, reg_params[i].value)) != ERROR_OK) @@ -1208,7 +1208,7 @@ int armv4_5_run_algorithm_inner(struct target *target, else { LOG_ERROR("BUG: can't execute algorithms when not in ARM or Thumb state"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (arm_algorithm_info->core_mode != ARM_MODE_ANY) @@ -1260,14 +1260,14 @@ int armv4_5_run_algorithm_inner(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - retval = ERROR_INVALID_ARGUMENTS; + retval = ERROR_COMMAND_SYNTAX_ERROR; continue; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - retval = ERROR_INVALID_ARGUMENTS; + retval = ERROR_COMMAND_SYNTAX_ERROR; continue; } diff --git a/src/target/armv7a.c b/src/target/armv7a.c index 67c563e6..f975c6df 100644 --- a/src/target/armv7a.c +++ b/src/target/armv7a.c @@ -748,7 +748,7 @@ int armv7a_arch_state(struct target *target) if (armv7a->common_magic != ARMV7_COMMON_MAGIC) { LOG_ERROR("BUG: called for a non-ARMv7A target"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } arm_arch_state(target); diff --git a/src/target/armv7m.c b/src/target/armv7m.c index d9e63d7f..d8aed89c 100644 --- a/src/target/armv7m.c +++ b/src/target/armv7m.c @@ -206,7 +206,7 @@ static int armv7m_read_core_reg(struct target *target, unsigned num) struct armv7m_common *armv7m = target_to_armv7m(target); if (num >= ARMV7M_NUM_REGS) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; armv7m_core_reg = armv7m->core_cache->reg_list[num].arch_info; retval = armv7m->load_core_reg_u32(target, armv7m_core_reg->type, armv7m_core_reg->num, ®_value); @@ -225,7 +225,7 @@ static int armv7m_write_core_reg(struct target *target, unsigned num) struct armv7m_common *armv7m = target_to_armv7m(target); if (num >= ARMV7M_NUM_REGS) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = buf_get_u32(armv7m->core_cache->reg_list[num].value, 0, 32); armv7m_core_reg = armv7m->core_cache->reg_list[num].arch_info; @@ -363,13 +363,13 @@ int armv7m_start_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } // regvalue = buf_get_u32(reg_params[i].value, 0, 32); @@ -452,13 +452,13 @@ int armv7m_wait_algorithm(struct target *target, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32)); diff --git a/src/target/avr32_ap7k.c b/src/target/avr32_ap7k.c index afac664b..635fe462 100644 --- a/src/target/avr32_ap7k.c +++ b/src/target/avr32_ap7k.c @@ -115,7 +115,7 @@ static int avr32_read_core_reg(struct target *target, int num) struct avr32_ap7k_common *ap7k = target_to_ap7k(target); if ((num < 0) || (num >= AVR32NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = ap7k->core_regs[num]; buf_set_u32(ap7k->core_cache->reg_list[num].value, 0, 32, reg_value); @@ -133,7 +133,7 @@ static int avr32_write_core_reg(struct target *target, int num) struct avr32_ap7k_common *ap7k = target_to_ap7k(target); if ((num < 0) || (num >= AVR32NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = buf_get_u32(ap7k->core_cache->reg_list[num].value, 0, 32); ap7k->core_regs[num] = reg_value; @@ -487,7 +487,7 @@ static int avr32_ap7k_read_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; @@ -525,7 +525,7 @@ static int avr32_ap7k_write_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; diff --git a/src/target/cortex_a.c b/src/target/cortex_a.c index 8a1ca3b0..0c2247ef 100755 --- a/src/target/cortex_a.c +++ b/src/target/cortex_a.c @@ -1906,7 +1906,7 @@ static int cortex_a8_write_apb_ab_memory(struct target *target, /* write memory through APB-AP */ - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; struct armv7a_common *armv7a = target_to_armv7a(target); struct arm *armv4_5 = &armv7a->armv4_5_common; int total_bytes = count * size; @@ -1979,7 +1979,7 @@ static int cortex_a8_read_apb_ab_memory(struct target *target, /* read memory through APB-AP */ - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; struct armv7a_common *armv7a = target_to_armv7a(target); struct arm *armv4_5 = &armv7a->armv4_5_common; int total_bytes = count * size; @@ -2047,7 +2047,7 @@ static int cortex_a8_read_phys_memory(struct target *target, { struct armv7a_common *armv7a = target_to_armv7a(target); struct adiv5_dap *swjdp = armv7a->armv4_5_common.dap; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; uint8_t apsel = swjdp->apsel; LOG_DEBUG("Reading memory at real address 0x%x; size %d; count %d", address, size, count); @@ -2132,7 +2132,7 @@ static int cortex_a8_write_phys_memory(struct target *target, { struct armv7a_common *armv7a = target_to_armv7a(target); struct adiv5_dap *swjdp = armv7a->armv4_5_common.dap; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; uint8_t apsel = swjdp->apsel; LOG_DEBUG("Writing memory to real address 0x%x; size %d; count %d", address, diff --git a/src/target/cortex_m.c b/src/target/cortex_m.c index 2fbd71da..c7cb9d48 100644 --- a/src/target/cortex_m.c +++ b/src/target/cortex_m.c @@ -1593,7 +1593,7 @@ static int cortex_m3_load_core_reg_u32(struct target *target, break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; @@ -1673,7 +1673,7 @@ static int cortex_m3_store_core_reg_u32(struct target *target, break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } return ERROR_OK; @@ -1684,7 +1684,7 @@ static int cortex_m3_read_memory(struct target *target, uint32_t address, { struct armv7m_common *armv7m = target_to_armv7m(target); struct adiv5_dap *swjdp = &armv7m->dap; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; /* cortex_m3 handles unaligned memory access */ if (count && buffer) { @@ -1709,7 +1709,7 @@ static int cortex_m3_write_memory(struct target *target, uint32_t address, { struct armv7m_common *armv7m = target_to_armv7m(target); struct adiv5_dap *swjdp = &armv7m->dap; - int retval = ERROR_INVALID_ARGUMENTS; + int retval = ERROR_COMMAND_SYNTAX_ERROR; if (count && buffer) { switch (size) { @@ -2144,7 +2144,7 @@ COMMAND_HANDLER(handle_cortex_m3_vector_catch_command) } if (i == ARRAY_SIZE(vec_ids)) { LOG_ERROR("No CM3 vector '%s'", CMD_ARGV[CMD_ARGC]); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } } write: diff --git a/src/target/dsp563xx.c b/src/target/dsp563xx.c index a0e12062..28f8bac0 100644 --- a/src/target/dsp563xx.c +++ b/src/target/dsp563xx.c @@ -336,7 +336,7 @@ static int dsp563xx_get_gdb_reg_list(struct target *target, struct reg **reg_lis *reg_list = malloc(sizeof(struct reg *) * (*reg_list_size)); if (!*reg_list) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; for (i = 0; i < DSP563XX_NUMCOREREGS; i++) { @@ -353,7 +353,7 @@ static int dsp563xx_read_core_reg(struct target *target, int num) struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); if ((num < 0) || (num >= DSP563XX_NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = dsp563xx->core_regs[num]; buf_set_u32(dsp563xx->core_cache->reg_list[num].value, 0, 32, reg_value); @@ -369,7 +369,7 @@ static int dsp563xx_write_core_reg(struct target *target, int num) struct dsp563xx_common *dsp563xx = target_to_dsp563xx(target); if ((num < 0) || (num >= DSP563XX_NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = buf_get_u32(dsp563xx->core_cache->reg_list[num].value, 0, 32); dsp563xx->core_regs[num] = reg_value; @@ -859,7 +859,7 @@ static int dsp563xx_target_create(struct target *target, Jim_Interp * interp) struct dsp563xx_common *dsp563xx = calloc(1, sizeof(struct dsp563xx_common)); if (!dsp563xx) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; dsp563xx->jtag_info.tap = target->tap; target->arch_info = dsp563xx; @@ -886,7 +886,7 @@ static int dsp563xx_examine(struct target *target) { LOG_ERROR("no IDCODE present on device"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (!target_was_examined(target)) @@ -1480,7 +1480,7 @@ static int dsp563xx_read_memory_core(struct target *target, int mem_type, uint32 move_cmd = 0x07d891; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* we use r0 to store temporary data */ @@ -1556,7 +1556,7 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad /* we only support 4 byte aligned data */ if ( (size != 4) || (!count) ) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if ( mem_type != MEM_L ) @@ -1566,13 +1566,13 @@ static int dsp563xx_read_memory(struct target *target, int mem_type, uint32_t ad if ( !(buffer_y = malloc(size*count)) ) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if ( !(buffer_x = malloc(size*count)) ) { free(buffer_y); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } err = dsp563xx_read_memory_core(target,MEM_Y,address,size,count/2,buffer_y); @@ -1647,7 +1647,7 @@ static int dsp563xx_write_memory_core(struct target *target, int mem_type, uint3 move_cmd = 0x075891; break; default: - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } /* we use r0 to store temporary data */ @@ -1716,7 +1716,7 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a /* we only support 4 byte aligned data */ if ( (size != 4) || (!count) ) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if ( mem_type != MEM_L ) @@ -1726,13 +1726,13 @@ static int dsp563xx_write_memory(struct target *target, int mem_type, uint32_t a if ( !(buffer_y = malloc(size*count)) ) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if ( !(buffer_x = malloc(size*count)) ) { free(buffer_y); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } for(i=0,i1=0;i<count;i+=2,i1++) diff --git a/src/target/embeddedice.c b/src/target/embeddedice.c index a38028c8..77e85df4 100644 --- a/src/target/embeddedice.c +++ b/src/target/embeddedice.c @@ -589,7 +589,7 @@ int embeddedice_handshake(struct arm_jtag *jtag_info, int hsbit, uint32_t timeou else { LOG_ERROR("Invalid arguments"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } retval = arm_jtag_scann(jtag_info, 0x2, TAP_IDLE); diff --git a/src/target/etm.c b/src/target/etm.c index 4e158783..cd50e44d 100644 --- a/src/target/etm.c +++ b/src/target/etm.c @@ -499,7 +499,7 @@ static int etm_read_reg_w_check(struct reg *reg, if (etm_reg->reg_info->mode == WO) { LOG_ERROR("BUG: can't read write-only register %s", r->name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } LOG_DEBUG("%s (%u)", r->name, reg_addr); @@ -585,7 +585,7 @@ static int etm_write_reg(struct reg *reg, uint32_t value) if (etm_reg->reg_info->mode == RO) { LOG_ERROR("BUG: can't write read--only register %s", r->name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } LOG_DEBUG("%s (%u): 0x%8.8" PRIx32 "", r->name, reg_addr, value); @@ -1196,7 +1196,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update, else { command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[0]); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } uint8_t context_id; @@ -1217,7 +1217,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update, break; default: command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[1]); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } bool etmv1_cycle_accurate; diff --git a/src/target/image.c b/src/target/image.c index d1db136b..c0aabecd 100644 --- a/src/target/image.c +++ b/src/target/image.c @@ -902,7 +902,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32 { LOG_DEBUG("read past end of section: 0x%8.8" PRIx32 " + 0x%8.8" PRIx32 " > 0x%8.8" PRIx32 "", offset, size, image->sections[section].size); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (image->type == IMAGE_BINARY) @@ -911,7 +911,7 @@ int image_read_section(struct image *image, int section, uint32_t offset, uint32 /* only one section in a plain binary */ if (section != 0) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* seek to offset */ if ((retval = fileio_seek(&image_binary->fileio, offset)) != ERROR_OK) @@ -999,7 +999,7 @@ int image_add_section(struct image *image, uint32_t base, uint32_t size, int fla /* only image builder supports adding sections */ if (image->type != IMAGE_BUILDER) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* see if there's a previous section */ if (image->num_sections) diff --git a/src/target/mips32.c b/src/target/mips32.c index d7f001e1..80dfb194 100644 --- a/src/target/mips32.c +++ b/src/target/mips32.c @@ -151,7 +151,7 @@ static int mips32_read_core_reg(struct target *target, int num) struct mips32_common *mips32 = target_to_mips32(target); if ((num < 0) || (num >= MIPS32NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = mips32->core_regs[num]; buf_set_u32(mips32->core_cache->reg_list[num].value, 0, 32, reg_value); @@ -169,7 +169,7 @@ static int mips32_write_core_reg(struct target *target, int num) struct mips32_common *mips32 = target_to_mips32(target); if ((num < 0) || (num >= MIPS32NUMCOREREGS)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; reg_value = buf_get_u32(mips32->core_cache->reg_list[num].value, 0, 32); mips32->core_regs[num] = reg_value; @@ -411,14 +411,14 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } mips32_set_core_reg(reg, reg_params[i].value); @@ -451,14 +451,14 @@ int mips32_run_algorithm(struct target *target, int num_mem_params, if (!reg) { LOG_ERROR("BUG: register '%s' not found", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (reg->size != reg_params[i].size) { LOG_ERROR("BUG: register '%s' size doesn't match reg_params[i].size", reg_params[i].reg_name); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } buf_set_u32(reg_params[i].value, 0, 32, buf_get_u32(reg->value, 0, 32)); diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c index 7be96a49..2a64372f 100644 --- a/src/target/mips_m4k.c +++ b/src/target/mips_m4k.c @@ -865,7 +865,7 @@ static int mips_m4k_read_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; @@ -932,7 +932,7 @@ static int mips_m4k_write_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; diff --git a/src/target/target.c b/src/target/target.c index 7763685d..eca69cf6 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1074,7 +1074,7 @@ int target_register_event_callback(int (*callback)(struct target *target, enum t if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (*callbacks_p) @@ -1099,7 +1099,7 @@ int target_register_timer_callback(int (*callback)(void *priv), int time_ms, int if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (*callbacks_p) @@ -1137,7 +1137,7 @@ int target_unregister_event_callback(int (*callback)(struct target *target, enum if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } while (c) @@ -1164,7 +1164,7 @@ static int target_unregister_timer_callback(int (*callback)(void *priv), void *p if (callback == NULL) { - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } while (c) @@ -1681,7 +1681,7 @@ int target_checksum_memory(struct target *target, uint32_t address, uint32_t siz if (buffer == NULL) { LOG_ERROR("error allocating buffer for section (%d bytes)", (int)size); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } retval = target_read_buffer(target, address, size, buffer); if (retval != ERROR_OK) diff --git a/src/target/target_request.c b/src/target/target_request.c index 1fedfb22..387db2d6 100644 --- a/src/target/target_request.c +++ b/src/target/target_request.c @@ -168,7 +168,7 @@ static int add_debug_msg_receiver(struct command_context *cmd_ctx, struct target struct debug_msg_receiver **p = &target->dbgmsg; if (target == NULL) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; /* see if there's already a list */ if (*p) diff --git a/src/target/xscale.c b/src/target/xscale.c index 93074ee2..46ed8a94 100644 --- a/src/target/xscale.c +++ b/src/target/xscale.c @@ -250,7 +250,7 @@ static void xscale_getbuf(jtag_callback_data_t arg) static int xscale_receive(struct target *target, uint32_t *buffer, int num_words) { if (num_words == 0) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; struct xscale_common *xscale = target_to_xscale(target); int retval = ERROR_OK; @@ -577,7 +577,7 @@ static int xscale_send(struct target *target, const uint8_t *buffer, int count, break; default: LOG_ERROR("BUG: size neither 4, 2 nor 1"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } jtag_add_dr_out(target->tap, 3, @@ -840,7 +840,7 @@ static int xscale_arch_state(struct target *target) if (armv4_5->common_magic != ARM_COMMON_MAGIC) { LOG_ERROR("BUG: called for a non-ARMv4/5 target"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } arm_arch_state(target); @@ -1871,7 +1871,7 @@ static int xscale_read_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; @@ -1911,7 +1911,7 @@ static int xscale_read_memory(struct target *target, uint32_t address, break; default: LOG_ERROR("invalid read size"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } } @@ -1963,7 +1963,7 @@ static int xscale_write_memory(struct target *target, uint32_t address, /* sanitize arguments */ if (((size != 4) && (size != 2) && (size != 1)) || (count == 0) || !(buffer)) - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; if (((size == 4) && (address & 0x3u)) || ((size == 2) && (address & 0x1u))) return ERROR_TARGET_UNALIGNED_ACCESS; @@ -3513,7 +3513,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) else if (strcmp("disable", CMD_ARGV[0]) == 0) xscale->trace.mode = XSCALE_TRACE_DISABLED; else - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } if (CMD_ARGC >= 2 && xscale->trace.mode != XSCALE_TRACE_DISABLED) @@ -3527,7 +3527,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) { command_print(CMD_CTX, "fill buffer count must be > 0"); xscale->trace.mode = XSCALE_TRACE_DISABLED; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } xscale->trace.buffer_fill = buffcount; xscale->trace.mode = XSCALE_TRACE_FILL; @@ -3537,7 +3537,7 @@ COMMAND_HANDLER(xscale_handle_trace_buffer_command) else { xscale->trace.mode = XSCALE_TRACE_DISABLED; - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } } @@ -3730,7 +3730,7 @@ COMMAND_HANDLER(xscale_handle_cp15) break; default: command_print(CMD_CTX, "invalid register number"); - return ERROR_INVALID_ARGUMENTS; + return ERROR_COMMAND_SYNTAX_ERROR; } reg = &xscale->reg_cache->reg_list[reg_no]; |