aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMathias K <kesmtp@freenet.de>2011-12-16 07:48:39 +0100
committerØyvind Harboe <oyvindharboe@gmail.com>2012-01-04 17:56:46 +0000
commit16b6b5e7a86353dbc0c4823fe3d772c0faca7c1c (patch)
tree4950e26d07d60b16b3223e085227c583418c2ef8 /src
parent42cb62cf3b47b982d6444948b483f9c6ce32de05 (diff)
Change return value on error.
On wrong parameters a error is signalized to the calling function. Change-Id: I484443fdb39938e20382edc9246d5ec546a5c960 Signed-off-by: Mathias K <kesmtp@freenet.de> Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com> Reviewed-on: http://openocd.zylin.com/282 Tested-by: jenkins Reviewed-by: Øyvind Harboe <oyvindharboe@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/flash/nand/davinci.c6
-rw-r--r--src/flash/nand/lpc3180.c3
-rw-r--r--src/flash/nand/lpc32xx.c3
-rw-r--r--src/flash/nand/mx3.c4
-rw-r--r--src/flash/nand/orion.c4
-rw-r--r--src/flash/nor/at91sam3.c1
-rw-r--r--src/flash/nor/at91sam7.c4
-rw-r--r--src/flash/nor/avrf.c7
-rw-r--r--src/flash/nor/cfi.c3
-rw-r--r--src/flash/nor/ecos.c3
-rw-r--r--src/flash/nor/em357.c18
-rw-r--r--src/flash/nor/faux.c3
-rw-r--r--src/flash/nor/fm3.c8
-rw-r--r--src/flash/nor/kinetis.c4
-rw-r--r--src/flash/nor/lpc2000.c3
-rw-r--r--src/flash/nor/lpc288x.c3
-rw-r--r--src/flash/nor/lpc2900.c8
-rw-r--r--src/flash/nor/ocl.c3
-rw-r--r--src/flash/nor/pic32mx.c9
-rw-r--r--src/flash/nor/stellaris.c8
-rw-r--r--src/flash/nor/stm32f1x.c19
-rw-r--r--src/flash/nor/stm32f2x.c3
-rw-r--r--src/flash/nor/stm32lx.c3
-rw-r--r--src/flash/nor/stmsmi.c3
-rw-r--r--src/flash/nor/str7x.c7
-rw-r--r--src/flash/nor/str9x.c3
-rw-r--r--src/flash/nor/str9xpec.c43
-rw-r--r--src/flash/nor/tms470.c6
-rw-r--r--src/flash/nor/virtual.c3
-rw-r--r--src/hello.c2
-rw-r--r--src/helper/ioutil.c7
-rw-r--r--src/jtag/drivers/at91rm9200.c2
-rw-r--r--src/jtag/drivers/buspirate.c24
-rw-r--r--src/jtag/drivers/ft2232.c7
-rw-r--r--src/jtag/drivers/parport.c3
-rw-r--r--src/jtag/drivers/presto.c2
-rw-r--r--src/jtag/drivers/ulink.c7
-rw-r--r--src/jtag/drivers/vsllink.c20
-rw-r--r--src/pld/pld.c6
-rw-r--r--src/pld/virtex2.c6
-rw-r--r--src/target/arm920t.c9
-rw-r--r--src/target/armv4_5.c4
-rw-r--r--src/target/etm.c19
-rw-r--r--src/target/mips32.c2
-rw-r--r--src/target/mips_m4k.c2
-rw-r--r--src/target/oocd_trace.c5
-rw-r--r--src/target/target.c8
-rw-r--r--src/target/target_request.c2
-rw-r--r--src/target/xscale.c17
-rw-r--r--src/xsvf/xsvf.c3
50 files changed, 132 insertions, 220 deletions
diff --git a/src/flash/nand/davinci.c b/src/flash/nand/davinci.c
index b7fe66ea..e12fc461 100644
--- a/src/flash/nand/davinci.c
+++ b/src/flash/nand/davinci.c
@@ -689,10 +689,7 @@ NAND_DEVICE_COMMAND_HANDLER(davinci_nand_device_command)
* Plus someday, optionally, ALE and CLE masks.
*/
if (CMD_ARGC < 5) {
- LOG_ERROR("parameters: %s target "
- "chip_addr hwecc_mode aemif_addr",
- CMD_ARGV[0]);
- goto fail;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(ulong, CMD_ARGV[2], chip);
@@ -783,6 +780,7 @@ fail:
struct nand_flash_controller davinci_nand_controller = {
.name = "davinci",
+ .usage = "chip_addr hwecc_mode aemif_addr",
.nand_device_command = davinci_nand_device_command,
.init = davinci_init,
.reset = davinci_reset,
diff --git a/src/flash/nand/lpc3180.c b/src/flash/nand/lpc3180.c
index f196af79..9d8cbae1 100644
--- a/src/flash/nand/lpc3180.c
+++ b/src/flash/nand/lpc3180.c
@@ -45,8 +45,7 @@ NAND_DEVICE_COMMAND_HANDLER(lpc3180_nand_device_command)
{
if (CMD_ARGC < 3)
{
- LOG_WARNING("incomplete 'lpc3180' nand flash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
uint32_t osc_freq;
diff --git a/src/flash/nand/lpc32xx.c b/src/flash/nand/lpc32xx.c
index ffb322c2..addc323b 100644
--- a/src/flash/nand/lpc32xx.c
+++ b/src/flash/nand/lpc32xx.c
@@ -75,8 +75,7 @@ static dmac_ll_t dmalist[(2048/256) * 2 + 1];
NAND_DEVICE_COMMAND_HANDLER(lpc32xx_nand_device_command)
{
if (CMD_ARGC < 3) {
- LOG_WARNING("incomplete 'lpc32xx' nand flash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
uint32_t osc_freq;
diff --git a/src/flash/nand/mx3.c b/src/flash/nand/mx3.c
index 45591e39..54ba1f9b 100644
--- a/src/flash/nand/mx3.c
+++ b/src/flash/nand/mx3.c
@@ -76,8 +76,7 @@ NAND_DEVICE_COMMAND_HANDLER(imx31_nand_device_command)
if (CMD_ARGC < 3)
{
- LOG_ERROR ("use \"nand device imx31 target noecc|hwecc\"");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/*
* check hwecc requirements
@@ -851,6 +850,7 @@ static int do_data_output (struct nand_device *nand)
struct nand_flash_controller imx31_nand_flash_controller = {
.name = "imx31",
+ .usage = "nand device imx31 target noecc|hwecc",
.nand_device_command = &imx31_nand_device_command,
.init = &imx31_init,
.reset = &imx31_reset,
diff --git a/src/flash/nand/orion.c b/src/flash/nand/orion.c
index 5b0c9642..e6a33eb6 100644
--- a/src/flash/nand/orion.c
+++ b/src/flash/nand/orion.c
@@ -121,8 +121,7 @@ NAND_DEVICE_COMMAND_HANDLER(orion_nand_device_command)
uint8_t ale, cle;
if (CMD_ARGC != 3) {
- LOG_ERROR("arguments must be: <target_id> <NAND_address>");
- return ERROR_NAND_DEVICE_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
hw = calloc(1, sizeof(*hw));
@@ -156,6 +155,7 @@ static int orion_nand_init(struct nand_device *nand)
struct nand_flash_controller orion_nand_controller =
{
.name = "orion",
+ .usage = "<target_id> <NAND_address>",
.command = orion_nand_command,
.address = orion_nand_address,
.read_data = orion_nand_read,
diff --git a/src/flash/nor/at91sam3.c b/src/flash/nor/at91sam3.c
index a5fbd43a..dac901ec 100644
--- a/src/flash/nor/at91sam3.c
+++ b/src/flash/nor/at91sam3.c
@@ -3117,7 +3117,6 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
switch (CMD_ARGC) {
default:
- command_print(CMD_CTX,"Too many parameters\n");
return ERROR_COMMAND_SYNTAX_ERROR;
break;
case 0:
diff --git a/src/flash/nor/at91sam7.c b/src/flash/nor/at91sam7.c
index 74d9ba3d..2b822b7d 100644
--- a/src/flash/nor/at91sam7.c
+++ b/src/flash/nor/at91sam7.c
@@ -1203,8 +1203,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
if (CMD_ARGC != 2)
{
- command_print(CMD_CTX, "at91sam7 gpnvm <bit> <set | clear>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
bank = get_flash_bank_by_num_noprobe(0);
@@ -1295,6 +1294,7 @@ static const struct command_registration at91sam7_command_handlers[] = {
struct flash_driver at91sam7_flash = {
.name = "at91sam7",
+ .usage = "gpnvm <bit> <set | clear>",
.commands = at91sam7_command_handlers,
.flash_bank_command = at91sam7_flash_bank_command,
.erase = at91sam7_erase,
diff --git a/src/flash/nor/avrf.c b/src/flash/nor/avrf.c
index 5a2482e4..1ade4526 100644
--- a/src/flash/nor/avrf.c
+++ b/src/flash/nor/avrf.c
@@ -191,8 +191,7 @@ FLASH_BANK_COMMAND_HANDLER(avrf_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank avr configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
avrf_info = malloc(sizeof(struct avrf_flash_bank));
@@ -451,8 +450,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "avr mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -482,6 +480,7 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
static const struct command_registration avrf_exec_command_handlers[] = {
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = avrf_handle_mass_erase_command,
.mode = COMMAND_EXEC,
.help = "erase entire device",
diff --git a/src/flash/nor/cfi.c b/src/flash/nor/cfi.c
index a4092b62..98633795 100644
--- a/src/flash/nor/cfi.c
+++ b/src/flash/nor/cfi.c
@@ -818,8 +818,7 @@ FLASH_BANK_COMMAND_HANDLER(cfi_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank cfi configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* both widths must:
diff --git a/src/flash/nor/ecos.c b/src/flash/nor/ecos.c
index c850f4f9..cae89358 100644
--- a/src/flash/nor/ecos.c
+++ b/src/flash/nor/ecos.c
@@ -111,8 +111,7 @@ FLASH_BANK_COMMAND_HANDLER(ecosflash_flash_bank_command)
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank ecosflash configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
info = malloc(sizeof(struct ecosflash_flash_bank));
diff --git a/src/flash/nor/em357.c b/src/flash/nor/em357.c
index c400187d..c045d577 100644
--- a/src/flash/nor/em357.c
+++ b/src/flash/nor/em357.c
@@ -104,8 +104,7 @@ FLASH_BANK_COMMAND_HANDLER(em357_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank em357 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
em357_info = malloc(sizeof(struct em357_flash_bank));
@@ -768,8 +767,7 @@ COMMAND_HANDLER(em357_handle_lock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -813,8 +811,7 @@ COMMAND_HANDLER(em357_handle_unlock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -892,8 +889,7 @@ COMMAND_HANDLER(em357_handle_mass_erase_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "em357 mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -923,23 +919,23 @@ COMMAND_HANDLER(em357_handle_mass_erase_command)
static const struct command_registration em357_exec_command_handlers[] = {
{
.name = "lock",
+ .usage = "<bank>",
.handler = em357_handle_lock_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Lock entire flash device.",
},
{
.name = "unlock",
+ .usage = "<bank>",
.handler = em357_handle_unlock_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Unlock entire protected flash device.",
},
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = em357_handle_mass_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Erase entire flash device.",
},
COMMAND_REGISTRATION_DONE
diff --git a/src/flash/nor/faux.c b/src/flash/nor/faux.c
index 92851ed0..75ea9d60 100644
--- a/src/flash/nor/faux.c
+++ b/src/flash/nor/faux.c
@@ -44,8 +44,7 @@ FLASH_BANK_COMMAND_HANDLER(faux_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank faux configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
info = malloc(sizeof(struct faux_flash_bank));
diff --git a/src/flash/nor/fm3.c b/src/flash/nor/fm3.c
index e852589b..78e71d29 100644
--- a/src/flash/nor/fm3.c
+++ b/src/flash/nor/fm3.c
@@ -69,8 +69,7 @@ FLASH_BANK_COMMAND_HANDLER(fm3_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank fm3 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
fm3_info = malloc(sizeof(struct fm3_flash_bank));
@@ -847,8 +846,7 @@ COMMAND_HANDLER(fm3_handle_chip_erase_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "fm3 chip_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -875,9 +873,9 @@ COMMAND_HANDLER(fm3_handle_chip_erase_command)
static const struct command_registration fm3_exec_command_handlers[] = {
{
.name = "chip_erase",
+ .usage = "<bank>",
.handler = fm3_handle_chip_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Erase entire Flash device.",
},
COMMAND_REGISTRATION_DONE
diff --git a/src/flash/nor/kinetis.c b/src/flash/nor/kinetis.c
index 18975498..0cfbd7ad 100644
--- a/src/flash/nor/kinetis.c
+++ b/src/flash/nor/kinetis.c
@@ -70,9 +70,7 @@ FLASH_BANK_COMMAND_HANDLER(kinetis_flash_bank_command)
struct kinetis_flash_bank *bank_info;
if (CMD_ARGC < 6) {
- LOG_ERROR("incomplete flash_bank kinetis configuration %d",
- CMD_ARGC);
- return ERROR_FLASH_OPERATION_FAILED;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
LOG_INFO("add flash_bank kinetis %s", bank->name);
diff --git a/src/flash/nor/lpc2000.c b/src/flash/nor/lpc2000.c
index b639d1ef..b4e17e7e 100644
--- a/src/flash/nor/lpc2000.c
+++ b/src/flash/nor/lpc2000.c
@@ -481,8 +481,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2000_flash_bank_command)
if (CMD_ARGC < 8)
{
- LOG_WARNING("incomplete flash_bank lpc2000 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc2000_info = malloc(sizeof(struct lpc2000_flash_bank));
diff --git a/src/flash/nor/lpc288x.c b/src/flash/nor/lpc288x.c
index 589527f7..d5fde948 100644
--- a/src/flash/nor/lpc288x.c
+++ b/src/flash/nor/lpc288x.c
@@ -184,8 +184,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc288x_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank LPC288x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc288x_info = malloc(sizeof(struct lpc288x_flash_bank));
diff --git a/src/flash/nor/lpc2900.c b/src/flash/nor/lpc2900.c
index 7bb9f141..4960e9c6 100644
--- a/src/flash/nor/lpc2900.c
+++ b/src/flash/nor/lpc2900.c
@@ -542,8 +542,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
if( CMD_ARGC < 1 )
{
- LOG_WARNING( "Too few arguments. Call: lpc2900 signature <bank#>" );
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -954,9 +953,9 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
static const struct command_registration lpc2900_exec_command_handlers[] = {
{
.name = "signature",
+ .usage = "<bank>",
.handler = lpc2900_handle_signature_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "Calculate and display signature of flash bank.",
},
{
@@ -1017,8 +1016,7 @@ FLASH_BANK_COMMAND_HANDLER(lpc2900_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank LPC2900 configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
lpc2900_info = malloc(sizeof(struct lpc2900_flash_bank));
diff --git a/src/flash/nor/ocl.c b/src/flash/nor/ocl.c
index 6c609239..2dd4f521 100644
--- a/src/flash/nor/ocl.c
+++ b/src/flash/nor/ocl.c
@@ -51,8 +51,7 @@ FLASH_BANK_COMMAND_HANDLER(ocl_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank ocl configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
arm7_9 = target_to_arm7_9(bank->target);
diff --git a/src/flash/nor/pic32mx.c b/src/flash/nor/pic32mx.c
index 65d93ad4..957bfc2a 100644
--- a/src/flash/nor/pic32mx.c
+++ b/src/flash/nor/pic32mx.c
@@ -172,8 +172,7 @@ FLASH_BANK_COMMAND_HANDLER(pic32mx_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank pic32mx configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
pic32mx_info = malloc(sizeof(struct pic32mx_flash_bank));
@@ -737,8 +736,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
if (CMD_ARGC != 3)
{
- command_print(CMD_CTX, "pic32mx pgm_word <addr> <value> <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
@@ -781,7 +779,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
if (CMD_ARGC < 1)
{
command_print(CMD_CTX, "pic32mx unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -837,6 +835,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
static const struct command_registration pic32mx_exec_command_handlers[] = {
{
.name = "pgm_word",
+ .usage = "<addr> <value> <bank>",
.handler = pic32mx_handle_pgm_word_command,
.mode = COMMAND_EXEC,
.help = "program a word",
diff --git a/src/flash/nor/stellaris.c b/src/flash/nor/stellaris.c
index 7351aed9..c855995f 100644
--- a/src/flash/nor/stellaris.c
+++ b/src/flash/nor/stellaris.c
@@ -438,8 +438,7 @@ FLASH_BANK_COMMAND_HANDLER(stellaris_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stellaris configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stellaris_info = calloc(sizeof(struct stellaris_flash_bank), 1);
@@ -1351,8 +1350,7 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stellaris mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1439,9 +1437,9 @@ done:
static const struct command_registration stellaris_exec_command_handlers[] = {
{
.name = "mass_erase",
+ .usage = "<bank>",
.handler = stellaris_handle_mass_erase_command,
.mode = COMMAND_EXEC,
- .usage = "bank_id",
.help = "erase entire device",
},
{
diff --git a/src/flash/nor/stm32f1x.c b/src/flash/nor/stm32f1x.c
index 8e0fda7e..5d9da903 100644
--- a/src/flash/nor/stm32f1x.c
+++ b/src/flash/nor/stm32f1x.c
@@ -130,8 +130,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stm32x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stm32x_info = malloc(sizeof(struct stm32x_flash_bank));
@@ -1329,8 +1328,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1378,8 +1376,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1426,8 +1423,7 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x options_read <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1496,9 +1492,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
if (CMD_ARGC < 4)
{
- command_print(CMD_CTX, "stm32x options_write <bank> <SWWDG | HWWDG> "
- "<RSTSTNDBY | NORSTSTNDBY> <RSTSTOP | NORSTSTOP> <BOOT0 | BOOT1>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1631,8 +1625,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "stm32x mass_erase <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
diff --git a/src/flash/nor/stm32f2x.c b/src/flash/nor/stm32f2x.c
index 7c07c536..ec5527bc 100644
--- a/src/flash/nor/stm32f2x.c
+++ b/src/flash/nor/stm32f2x.c
@@ -165,8 +165,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32x_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stm32x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stm32x_info = malloc(sizeof(struct stm32x_flash_bank));
diff --git a/src/flash/nor/stm32lx.c b/src/flash/nor/stm32lx.c
index 32b3315d..8a6ad7bc 100644
--- a/src/flash/nor/stm32lx.c
+++ b/src/flash/nor/stm32lx.c
@@ -130,8 +130,7 @@ FLASH_BANK_COMMAND_HANDLER(stm32lx_flash_bank_command)
struct stm32lx_flash_bank *stm32lx_info;
if (CMD_ARGC < 6)
{
- LOG_ERROR("incomplete flash_bank stm32lx configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
// Create the bank structure
diff --git a/src/flash/nor/stmsmi.c b/src/flash/nor/stmsmi.c
index bfec7894..df8dbe75 100644
--- a/src/flash/nor/stmsmi.c
+++ b/src/flash/nor/stmsmi.c
@@ -206,8 +206,7 @@ FLASH_BANK_COMMAND_HANDLER(stmsmi_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank stmsmi configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
stmsmi_info = malloc(sizeof(struct stmsmi_flash_bank));
diff --git a/src/flash/nor/str7x.c b/src/flash/nor/str7x.c
index 0084c67f..91ef77b7 100644
--- a/src/flash/nor/str7x.c
+++ b/src/flash/nor/str7x.c
@@ -208,8 +208,7 @@ FLASH_BANK_COMMAND_HANDLER(str7x_flash_bank_command)
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank str7x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str7x_info = malloc(sizeof(struct str7x_flash_bank));
@@ -786,8 +785,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str7x disable_jtag <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -849,6 +847,7 @@ COMMAND_HANDLER(str7x_handle_disable_jtag_command)
static const struct command_registration str7x_exec_command_handlers[] = {
{
.name = "disable_jtag",
+ .usage = "<bank>",
.handler = str7x_handle_disable_jtag_command,
.mode = COMMAND_EXEC,
.help = "disable jtag access",
diff --git a/src/flash/nor/str9x.c b/src/flash/nor/str9x.c
index 63cfd18f..5bea2068 100644
--- a/src/flash/nor/str9x.c
+++ b/src/flash/nor/str9x.c
@@ -158,8 +158,7 @@ FLASH_BANK_COMMAND_HANDLER(str9x_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank str9x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str9x_info = malloc(sizeof(struct str9x_flash_bank));
diff --git a/src/flash/nor/str9xpec.c b/src/flash/nor/str9xpec.c
index c06e6d16..6fa66a09 100644
--- a/src/flash/nor/str9xpec.c
+++ b/src/flash/nor/str9xpec.c
@@ -292,8 +292,7 @@ FLASH_BANK_COMMAND_HANDLER(str9xpec_flash_bank_command)
if (CMD_ARGC < 6)
{
- LOG_WARNING("incomplete flash_bank str9x configuration");
- return ERROR_FLASH_BANK_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
str9xpec_info = malloc(sizeof(struct str9xpec_flash_controller));
@@ -825,8 +824,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec options_read <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -939,8 +937,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec options_write <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -966,8 +963,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_cmap_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_cmap <bank> <bank0 | bank1>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -995,8 +991,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdthd_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdthd <bank> <2.4v | 2.7v>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1024,8 +1019,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdsel_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdsel <bank> <vdd | vdd_vddq>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1053,8 +1047,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_lvdwarn_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "str9xpec options_lvdwarn <bank> <vdd | vdd_vddq>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1082,8 +1075,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_lock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec lock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1105,8 +1097,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec unlock <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1135,8 +1126,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec enable_turbo <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1182,8 +1172,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "str9xpec disable_turbo <bank>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
struct flash_bank *bank;
@@ -1213,60 +1202,70 @@ COMMAND_HANDLER(str9xpec_handle_flash_disable_turbo_command)
static const struct command_registration str9xpec_config_command_handlers[] = {
{
.name = "enable_turbo",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_enable_turbo_command,
.mode = COMMAND_EXEC,
.help = "enable str9xpec turbo mode",
},
{
.name = "disable_turbo",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_disable_turbo_command,
.mode = COMMAND_EXEC,
.help = "disable str9xpec turbo mode",
},
{
.name = "options_cmap",
+ .usage = "<bank> <bank0 | bank1>",
.handler = str9xpec_handle_flash_options_cmap_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec boot sector",
},
{
.name = "options_lvdthd",
+ .usage = "<bank> <2.4v | 2.7v>",
.handler = str9xpec_handle_flash_options_lvdthd_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd threshold",
},
{
.name = "options_lvdsel",
+ .usage = "<bank> <vdd | vdd_vddq>",
.handler = str9xpec_handle_flash_options_lvdsel_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd selection",
},
{
.name = "options_lvdwarn",
+ .usage = "<bank> <vdd | vdd_vddq>",
.handler = str9xpec_handle_flash_options_lvdwarn_command,
.mode = COMMAND_EXEC,
.help = "configure str9xpec lvd warning",
},
{
.name = "options_read",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_options_read_command,
.mode = COMMAND_EXEC,
.help = "read str9xpec options",
},
{
.name = "options_write",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_options_write_command,
.mode = COMMAND_EXEC,
.help = "write str9xpec options",
},
{
.name = "lock",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_lock_command,
.mode = COMMAND_EXEC,
.help = "lock str9xpec device",
},
{
.name = "unlock",
+ .usage = "<bank>",
.handler = str9xpec_handle_flash_unlock_command,
.mode = COMMAND_EXEC,
.help = "unlock str9xpec device",
diff --git a/src/flash/nor/tms470.c b/src/flash/nor/tms470.c
index bf708be2..b28aee43 100644
--- a/src/flash/nor/tms470.c
+++ b/src/flash/nor/tms470.c
@@ -313,7 +313,6 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
{
if (CMD_ARGC > 4)
{
- command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 4)
@@ -377,7 +376,6 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
{
if (CMD_ARGC > 1)
{
- command_print(CMD_CTX, "tms470 osc_megahertz <MHz>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 1)
@@ -406,7 +404,6 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
{
if (CMD_ARGC > 1)
{
- command_print(CMD_CTX, "tms470 plldis <0 | 1>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
else if (CMD_ARGC == 1)
@@ -840,18 +837,21 @@ static int tms470_erase_sector(struct flash_bank *bank, int sector)
static const struct command_registration tms470_any_command_handlers[] = {
{
.name = "flash_keyset",
+ .usage = "<key0> <key1> <key2> <key3>",
.handler = tms470_handle_flash_keyset_command,
.mode = COMMAND_ANY,
.help = "tms470 flash_keyset <key0> <key1> <key2> <key3>",
},
{
.name = "osc_megahertz",
+ .usage = "<MHz>",
.handler = tms470_handle_osc_megahertz_command,
.mode = COMMAND_ANY,
.help = "tms470 osc_megahertz <MHz>",
},
{
.name = "plldis",
+ .usage = "<0 | 1>",
.handler = tms470_handle_plldis_command,
.mode = COMMAND_ANY,
.help = "tms470 plldis <0/1>",
diff --git a/src/flash/nor/virtual.c b/src/flash/nor/virtual.c
index e91dfc78..f1e84c29 100644
--- a/src/flash/nor/virtual.c
+++ b/src/flash/nor/virtual.c
@@ -55,8 +55,7 @@ FLASH_BANK_COMMAND_HANDLER(virtual_flash_bank_command)
{
if (CMD_ARGC < 7)
{
- LOG_WARNING("incomplete flash_bank virtual configuration");
- return ERROR_FLASH_OPERATION_FAILED;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* get the master flash bank */
diff --git a/src/hello.c b/src/hello.c
index d3fce3dc..6584aa20 100644
--- a/src/hello.c
+++ b/src/hello.c
@@ -26,7 +26,6 @@ COMMAND_HANDLER(handle_foo_command)
{
if (CMD_ARGC < 1 || CMD_ARGC > 2)
{
- LOG_ERROR("%s: incorrect number of arguments", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -82,7 +81,6 @@ static COMMAND_HELPER(handle_hello_args, const char **sep, const char **name)
{
if (CMD_ARGC > 1)
{
- LOG_ERROR("%s: too many arguments", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
if (1 == CMD_ARGC)
diff --git a/src/helper/ioutil.c b/src/helper/ioutil.c
index 3754fc5c..8dc70312 100644
--- a/src/helper/ioutil.c
+++ b/src/helper/ioutil.c
@@ -117,7 +117,6 @@ COMMAND_HANDLER(handle_cat_command)
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "cat <filename>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -143,7 +142,6 @@ COMMAND_HANDLER(handle_trunc_command)
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "trunc <filename>");
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -162,7 +160,6 @@ COMMAND_HANDLER(handle_meminfo_command)
if (CMD_ARGC != 0)
{
- command_print(CMD_CTX, "meminfo");
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -184,8 +181,6 @@ COMMAND_HANDLER(handle_append_command)
{
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX,
- "append <filename> [<string1>, [<string2>, ...]]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
@@ -644,7 +639,7 @@ static const struct command_registration ioutil_command_handlers[] = {
.handler = handle_append_command,
.mode = COMMAND_ANY,
.help = "append a variable number of strings to a file",
- .usage= "file_name [string ...]",
+ .usage = "file_name [<string1>, [<string2>, ...]]",
},
{
.name = "meminfo",
diff --git a/src/jtag/drivers/at91rm9200.c b/src/jtag/drivers/at91rm9200.c
index f7494fe3..6d0dface 100644
--- a/src/jtag/drivers/at91rm9200.c
+++ b/src/jtag/drivers/at91rm9200.c
@@ -175,7 +175,7 @@ static int at91rm9200_speed(int speed)
COMMAND_HANDLER(at91rm9200_handle_device_command)
{
if (CMD_ARGC == 0)
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
/* only if the device name wasn't overwritten by cmdline */
if (at91rm9200_device == 0)
diff --git a/src/jtag/drivers/buspirate.c b/src/jtag/drivers/buspirate.c
index 41e3e194..f3edc8a5 100644
--- a/src/jtag/drivers/buspirate.c
+++ b/src/jtag/drivers/buspirate.c
@@ -280,8 +280,7 @@ COMMAND_HANDLER(buspirate_handle_adc_command)
COMMAND_HANDLER(buspirate_handle_vreg_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_vreg <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1)
@@ -298,8 +297,7 @@ COMMAND_HANDLER(buspirate_handle_vreg_command)
COMMAND_HANDLER(buspirate_handle_pullup_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_pullup <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1)
@@ -316,8 +314,7 @@ COMMAND_HANDLER(buspirate_handle_pullup_command)
COMMAND_HANDLER(buspirate_handle_led_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_led <1|0>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (atoi(CMD_ARGV[0]) == 1) {
@@ -339,8 +336,7 @@ COMMAND_HANDLER(buspirate_handle_led_command)
COMMAND_HANDLER(buspirate_handle_mode_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_mode <normal|open-drain>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (CMD_ARGV[0][0] == 'n')
@@ -357,8 +353,7 @@ COMMAND_HANDLER(buspirate_handle_mode_command)
COMMAND_HANDLER(buspirate_handle_speed_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_speed <normal|fast>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (CMD_ARGV[0][0] == 'n')
@@ -375,8 +370,7 @@ COMMAND_HANDLER(buspirate_handle_speed_command)
COMMAND_HANDLER(buspirate_handle_port_command)
{
if (CMD_ARGC < 1) {
- LOG_ERROR("usage: buspirate_port /dev/ttyUSB0");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (buspirate_port == NULL)
@@ -395,36 +389,42 @@ static const struct command_registration buspirate_command_handlers[] = {
},
{
.name = "buspirate_vreg",
+ .usage = "<1|0>",
.handler = &buspirate_handle_vreg_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of voltage regulators",
},
{
.name = "buspirate_pullup",
+ .usage = "<1|0>",
.handler = &buspirate_handle_pullup_command,
.mode = COMMAND_CONFIG,
.help = "changes the state of pullup",
},
{
.name = "buspirate_led",
+ .usage = "<1|0>",
.handler = &buspirate_handle_led_command,
.mode = COMMAND_EXEC,
.help = "changes the state of led",
},
{
.name = "buspirate_speed",
+ .usage = "<normal|fast>",
.handler = &buspirate_handle_speed_command,
.mode = COMMAND_CONFIG,
.help = "speed of the interface",
},
{
.name = "buspirate_mode",
+ .usage = "<normal|open-drain>",
.handler = &buspirate_handle_mode_command,
.mode = COMMAND_CONFIG,
.help = "pin mode of the interface",
},
{
.name = "buspirate_port",
+ .usage = "/dev/ttyUSB0",
.handler = &buspirate_handle_port_command,
.mode = COMMAND_CONFIG,
.help = "name of the serial port to open",
diff --git a/src/jtag/drivers/ft2232.c b/src/jtag/drivers/ft2232.c
index 73aea01f..4b9bdef7 100644
--- a/src/jtag/drivers/ft2232.c
+++ b/src/jtag/drivers/ft2232.c
@@ -3431,7 +3431,7 @@ COMMAND_HANDLER(ft2232_handle_serial_command)
}
else
{
- LOG_ERROR("expected exactly one argument to ft2232_serial <serial-number>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
@@ -3440,8 +3440,7 @@ COMMAND_HANDLER(ft2232_handle_serial_command)
COMMAND_HANDLER(ft2232_handle_layout_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("Need exactly one argument to ft2232_layout");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if (layout) {
@@ -3504,7 +3503,7 @@ COMMAND_HANDLER(ft2232_handle_latency_command)
}
else
{
- LOG_ERROR("expected exactly one argument to ft2232_latency <ms>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
diff --git a/src/jtag/drivers/parport.c b/src/jtag/drivers/parport.c
index ad07791d..ec175fa9 100644
--- a/src/jtag/drivers/parport.c
+++ b/src/jtag/drivers/parport.c
@@ -449,8 +449,7 @@ COMMAND_HANDLER(parport_handle_write_on_exit_command)
{
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: parport_write_on_exit <on | off>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_ON_OFF(CMD_ARGV[0], parport_exit);
diff --git a/src/jtag/drivers/presto.c b/src/jtag/drivers/presto.c
index 4bee67dc..0de48ffd 100644
--- a/src/jtag/drivers/presto.c
+++ b/src/jtag/drivers/presto.c
@@ -740,7 +740,7 @@ COMMAND_HANDLER(presto_handle_serial_command)
}
else
{
- LOG_ERROR("expected exactly one argument to presto_serial <serial-number>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
diff --git a/src/jtag/drivers/ulink.c b/src/jtag/drivers/ulink.c
index 73f1523f..5c58da35 100644
--- a/src/jtag/drivers/ulink.c
+++ b/src/jtag/drivers/ulink.c
@@ -2320,10 +2320,9 @@ COMMAND_HANDLER(ulink_download_firmware_handler)
{
int ret;
- if (CMD_ARGC != 1) {
- LOG_ERROR("Need exactly one argument to ulink_download_firmware");
- return ERROR_FAIL;
- }
+ if (CMD_ARGC != 1)
+ return ERROR_COMMAND_SYNTAX_ERROR;
+
LOG_INFO("Downloading ULINK firmware image %s", CMD_ARGV[0]);
diff --git a/src/jtag/drivers/vsllink.c b/src/jtag/drivers/vsllink.c
index e39a4d62..fe7bdb24 100644
--- a/src/jtag/drivers/vsllink.c
+++ b/src/jtag/drivers/vsllink.c
@@ -472,9 +472,7 @@ static void vsllink_reset(int trst, int srst)
COMMAND_HANDLER(vsllink_handle_usb_vid_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for VID");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0],
@@ -485,9 +483,7 @@ COMMAND_HANDLER(vsllink_handle_usb_vid_command)
COMMAND_HANDLER(vsllink_handle_usb_pid_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for PID");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u16, CMD_ARGV[0],
versaloon_interface.usb_setting.pid);
@@ -497,9 +493,7 @@ COMMAND_HANDLER(vsllink_handle_usb_pid_command)
COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for BULKIN endpoint");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
@@ -513,9 +507,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkin_command)
COMMAND_HANDLER(vsllink_handle_usb_bulkout_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for BULKOUT endpoint");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
@@ -529,9 +521,7 @@ COMMAND_HANDLER(vsllink_handle_usb_bulkout_command)
COMMAND_HANDLER(vsllink_handle_usb_interface_command)
{
if (CMD_ARGC != 1) {
- LOG_ERROR("parameter error, "
- "should be one parameter for interface number");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[0],
diff --git a/src/pld/pld.c b/src/pld/pld.c
index 90067e34..b2623613 100644
--- a/src/pld/pld.c
+++ b/src/pld/pld.c
@@ -63,8 +63,7 @@ COMMAND_HANDLER(handle_pld_device_command)
if (CMD_ARGC < 1)
{
- LOG_WARNING("incomplete 'pld device' command");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
for (i = 0; pld_drivers[i]; i++)
@@ -155,8 +154,7 @@ COMMAND_HANDLER(handle_pld_load_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "usage: pld load <device#> <file>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned dev_id;
diff --git a/src/pld/virtex2.c b/src/pld/virtex2.c
index fdaeb61e..f4aed34f 100644
--- a/src/pld/virtex2.c
+++ b/src/pld/virtex2.c
@@ -179,8 +179,7 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: virtex2 read_stat <num>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
unsigned dev_id;
@@ -207,8 +206,7 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command)
if (CMD_ARGC < 2)
{
- LOG_WARNING("incomplete pld device 'virtex2' configuration");
- return ERROR_PLD_DEVICE_INVALID;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
tap = jtag_tap_by_string(CMD_ARGV[1]);
diff --git a/src/target/arm920t.c b/src/target/arm920t.c
index f057d7b9..1357820a 100644
--- a/src/target/arm920t.c
+++ b/src/target/arm920t.c
@@ -904,8 +904,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command)
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: arm920t read_cache <filename>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
@@ -1199,8 +1198,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command)
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: arm920t read_mmu <filename>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((output = fopen(CMD_ARGV[0], "w")) == NULL)
@@ -1650,8 +1648,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
}
else
{
- command_print(CMD_CTX,
- "usage: arm920t cp15i <opcode> [value] [address]");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
diff --git a/src/target/armv4_5.c b/src/target/armv4_5.c
index d59ab5c7..706733d2 100644
--- a/src/target/armv4_5.c
+++ b/src/target/armv4_5.c
@@ -784,10 +784,8 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
break;
default:
usage:
- command_print(CMD_CTX,
- "usage: arm disassemble <address> [<count> ['thumb']]");
count = 0;
- retval = ERROR_FAIL;
+ retval = ERROR_COMMAND_SYNTAX_ERROR;
}
while (count-- > 0) {
diff --git a/src/target/etm.c b/src/target/etm.c
index cd50e44d..27983698 100644
--- a/src/target/etm.c
+++ b/src/target/etm.c
@@ -1268,13 +1268,7 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
&tracemode);
break;
default:
- command_print(CMD_CTX, "usage: tracemode "
- "('none'|'data'|'address'|'all') "
- "context_id_bits "
- "('enable'|'disable') "
- "('enable'|'disable')"
- );
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/**
@@ -1738,8 +1732,7 @@ COMMAND_HANDLER(handle_etm_image_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: etm image <file> [base address] [type]");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
@@ -1799,8 +1792,7 @@ COMMAND_HANDLER(handle_etm_dump_command)
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: etm dump <file>");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
@@ -1866,8 +1858,7 @@ COMMAND_HANDLER(handle_etm_load_command)
if (CMD_ARGC != 1)
{
- command_print(CMD_CTX, "usage: etm load <file>");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
@@ -2206,7 +2197,7 @@ static const struct command_registration etm_exec_command_handlers[] = {
.handler = handle_etm_image_command,
.mode = COMMAND_EXEC,
.help = "load image from file with optional offset",
- .usage = "filename [offset]",
+ .usage = "<file> [base address] [type]",
},
{
.name = "dump",
diff --git a/src/target/mips32.c b/src/target/mips32.c
index 80dfb194..d9d84b72 100644
--- a/src/target/mips32.c
+++ b/src/target/mips32.c
@@ -797,7 +797,7 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "command requires more arguments.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
diff --git a/src/target/mips_m4k.c b/src/target/mips_m4k.c
index 2a64372f..4546093f 100644
--- a/src/target/mips_m4k.c
+++ b/src/target/mips_m4k.c
@@ -1140,7 +1140,7 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
/* two or more argument, access a single register/select (write if third argument is given) */
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "command requires more arguments.");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
diff --git a/src/target/oocd_trace.c b/src/target/oocd_trace.c
index 5af1ba65..d2ed4fef 100644
--- a/src/target/oocd_trace.c
+++ b/src/target/oocd_trace.c
@@ -284,8 +284,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command)
if (CMD_ARGC != 2)
{
- LOG_ERROR("incomplete 'oocd_trace config <target> <tty>' command");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
target = get_current_target(CMD_CTX);
@@ -400,7 +399,7 @@ static const struct command_registration oocd_trace_all_command_handlers[] = {
.name = "config",
.handler = handle_oocd_trace_config_command,
.mode = COMMAND_CONFIG,
- .usage = "target",
+ .usage = "<target> <tty>",
},
{
.name = "status",
diff --git a/src/target/target.c b/src/target/target.c
index eca69cf6..692b78f8 100644
--- a/src/target/target.c
+++ b/src/target/target.c
@@ -2246,9 +2246,7 @@ COMMAND_HANDLER(handle_reg_command)
return ERROR_OK;
}
- command_print(CMD_CTX, "usage: reg <#|name> [value]");
-
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
COMMAND_HANDLER(handle_poll_command)
@@ -2295,7 +2293,6 @@ COMMAND_HANDLER(handle_wait_halt_command)
int retval = parse_uint(CMD_ARGV[0], &ms);
if (ERROR_OK != retval)
{
- command_print(CMD_CTX, "usage: %s [seconds]", CMD_NAME);
return ERROR_COMMAND_SYNTAX_ERROR;
}
// convert seconds (given) to milliseconds (needed)
@@ -3155,7 +3152,6 @@ COMMAND_HANDLER(handle_bp_command)
return handle_bp_command_set(CMD_CTX, addr, asid, length, hw);
default:
- command_print(CMD_CTX, "usage: bp <address> [<asid>]<length> ['hw'|'hw_ctx']");
return ERROR_COMMAND_SYNTAX_ERROR;
}
}
@@ -3235,8 +3231,6 @@ COMMAND_HANDLER(handle_wp_command)
break;
default:
- command_print(CMD_CTX, "usage: wp [address length "
- "[(r|w|a) [value [mask]]]]");
return ERROR_COMMAND_SYNTAX_ERROR;
}
diff --git a/src/target/target_request.c b/src/target/target_request.c
index 387db2d6..c669ab4a 100644
--- a/src/target/target_request.c
+++ b/src/target/target_request.c
@@ -302,7 +302,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command)
}
else
{
- command_print(CMD_CTX, "usage: target_request debugmsgs ['enable'|'disable'|'charmsg']");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
}
diff --git a/src/target/xscale.c b/src/target/xscale.c
index 46ed8a94..484cdcea 100644
--- a/src/target/xscale.c
+++ b/src/target/xscale.c
@@ -3212,8 +3212,7 @@ COMMAND_HANDLER(xscale_handle_debug_handler_command)
if (CMD_ARGC < 2)
{
- LOG_ERROR("'xscale debug_handler <target#> <address>' command takes two required operands");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
if ((target = get_target(CMD_ARGV[0])) == NULL)
@@ -3416,7 +3415,7 @@ COMMAND_HANDLER(xscale_handle_vector_catch_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale vector_catch [mask]");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
else
{
@@ -3483,7 +3482,7 @@ COMMAND_HANDLER(xscale_handle_vector_table_command)
}
if (err)
- command_print(CMD_CTX, "usage: xscale vector_table <high|low> <index> <code>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
return ERROR_OK;
}
@@ -3569,8 +3568,7 @@ COMMAND_HANDLER(xscale_handle_trace_image_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale trace_image <file> [base address] [type]");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
retval = xscale_verify_pointer(CMD_CTX, xscale);
@@ -3629,8 +3627,7 @@ COMMAND_HANDLER(xscale_handle_dump_trace_command)
if (CMD_ARGC < 1)
{
- command_print(CMD_CTX, "usage: xscale dump_trace <file>");
- return ERROR_OK;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
trace_data = xscale->trace.data;
@@ -3763,7 +3760,7 @@ COMMAND_HANDLER(xscale_handle_cp15)
}
else
{
- command_print(CMD_CTX, "usage: cp15 [register]<, [value]>");
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
return ERROR_OK;
@@ -3859,7 +3856,7 @@ static const struct command_registration xscale_any_command_handlers[] = {
.handler = xscale_handle_debug_handler_command,
.mode = COMMAND_ANY,
.help = "Change address used for debug handler.",
- .usage = "target address",
+ .usage = "<target> <address>",
},
{
.name = "cache_clean_address",
diff --git a/src/xsvf/xsvf.c b/src/xsvf/xsvf.c
index 14b9e28d..9fda8e38 100644
--- a/src/xsvf/xsvf.c
+++ b/src/xsvf/xsvf.c
@@ -221,8 +221,7 @@ COMMAND_HANDLER(handle_xsvf_command)
if (CMD_ARGC < 2)
{
- command_print(CMD_CTX, "usage: xsvf <device#|plain> <file> [<variant>] [quiet]");
- return ERROR_FAIL;
+ return ERROR_COMMAND_SYNTAX_ERROR;
}
/* we mess with CMD_ARGV starting point below, snapshot filename here */