helper/command: change prototype of command_print/command_print_sameline
To prepare for handling TCL return values consistently, all calls to command_print/command_print_sameline should switch to CMD as first parameter. Change prototype of command_print() and command_print_sameline() to pass CMD instead of CMD_CTX. Since the first parameter is currently not used, the change can be done though scripts without manual coding. This patch is created using the command: sed -i PATTERN $(find src/ doc/ -type f) with all the following patters: 's/\(command_print(cmd\)->ctx,/\1,/' 's/\(command_print(CMD\)_CTX,/\1,/' 's/\(command_print(struct command_\)context \*context,/\1invocation *cmd,/' 's/\(command_print_sameline(cmd\)->ctx,/\1,/' 's/\(command_print_sameline(CMD\)_CTX,/\1,/' 's/\(command_print_sameline(struct command_\)context \*context,/\1invocation *cmd,/' This change is inspired by http://openocd.zylin.com/1815 from Paul Fertser but is now done through scripting. Change-Id: I3386d8f96cdc477e7a2308dd18269de3bed04385 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Signed-off-by: Paul Fertser <fercerpav@gmail.com> Reviewed-on: http://openocd.zylin.com/5081 Tested-by: jenkins Reviewed-by: Tomas Vanek <vanekt@fbl.cz>bscan_optimization
parent
6916550938
commit
6cb5ba6f11
|
@ -16,7 +16,7 @@ COMMAND_HANDLER(handle_hello_command)
|
||||||
const char *sep, *name;
|
const char *sep, *name;
|
||||||
int retval = CALL_COMMAND_HANDLER(handle_hello_args);
|
int retval = CALL_COMMAND_HANDLER(handle_hello_args);
|
||||||
if (ERROR_OK == retval)
|
if (ERROR_OK == retval)
|
||||||
command_print(CMD_CTX, "Greetings%s%s!", sep, name);
|
command_print(CMD, "Greetings%s%s!", sep, name);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
@endcode
|
@endcode
|
||||||
|
|
|
@ -423,7 +423,7 @@ COMMAND_HANDLER(mg_probe_cmd)
|
||||||
ret = mg_mflash_probe();
|
ret = mg_mflash_probe();
|
||||||
|
|
||||||
if (ret == ERROR_OK) {
|
if (ret == ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "",
|
"mflash (total %" PRIu32 " sectors) found at 0x%8.8" PRIx32 "",
|
||||||
mflash_bank->drv_info->tot_sects,
|
mflash_bank->drv_info->tot_sects,
|
||||||
mflash_bank->base);
|
mflash_bank->base);
|
||||||
|
@ -799,7 +799,7 @@ COMMAND_HANDLER(mg_write_cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration_measure(&bench) == ERROR_OK) {
|
if (duration_measure(&bench) == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "wrote %zu bytes from file %s "
|
command_print(CMD, "wrote %zu bytes from file %s "
|
||||||
"in %fs (%0.3f kB/s)", filesize, CMD_ARGV[1],
|
"in %fs (%0.3f kB/s)", filesize, CMD_ARGV[1],
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
||||||
}
|
}
|
||||||
|
@ -866,7 +866,7 @@ COMMAND_HANDLER(mg_dump_cmd)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration_measure(&bench) == ERROR_OK) {
|
if (duration_measure(&bench) == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "dump image (address 0x%8.8" PRIx32 " "
|
command_print(CMD, "dump image (address 0x%8.8" PRIx32 " "
|
||||||
"size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)",
|
"size %" PRIu32 ") to file %s in %fs (%0.3f kB/s)",
|
||||||
address, size, CMD_ARGV[1],
|
address, size, CMD_ARGV[1],
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, size));
|
duration_elapsed(&bench), duration_kbps(&bench, size));
|
||||||
|
|
|
@ -547,14 +547,14 @@ COMMAND_HANDLER(handle_at91sam9_cle_command)
|
||||||
unsigned num, address_line;
|
unsigned num, address_line;
|
||||||
|
|
||||||
if (CMD_ARGC != 2) {
|
if (CMD_ARGC != 2) {
|
||||||
command_print(CMD_CTX, "incorrect number of arguments for 'at91sam9 cle' command");
|
command_print(CMD, "incorrect number of arguments for 'at91sam9 cle' command");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
nand = get_nand_device_by_num(num);
|
nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "invalid nand device number: %s", CMD_ARGV[0]);
|
command_print(CMD, "invalid nand device number: %s", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -582,7 +582,7 @@ COMMAND_HANDLER(handle_at91sam9_ale_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
nand = get_nand_device_by_num(num);
|
nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "invalid nand device number: %s", CMD_ARGV[0]);
|
command_print(CMD, "invalid nand device number: %s", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +610,7 @@ COMMAND_HANDLER(handle_at91sam9_rdy_busy_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
nand = get_nand_device_by_num(num);
|
nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "invalid nand device number: %s", CMD_ARGV[0]);
|
command_print(CMD, "invalid nand device number: %s", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -641,7 +641,7 @@ COMMAND_HANDLER(handle_at91sam9_ce_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
nand = get_nand_device_by_num(num);
|
nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "invalid nand device number: %s", CMD_ARGV[0]);
|
command_print(CMD, "invalid nand device number: %s", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -217,7 +217,7 @@ COMMAND_HELPER(nand_command_get_device, unsigned name_index,
|
||||||
COMMAND_PARSE_NUMBER(uint, str, num);
|
COMMAND_PARSE_NUMBER(uint, str, num);
|
||||||
*nand = get_nand_device_by_num(num);
|
*nand = get_nand_device_by_num(num);
|
||||||
if (!*nand) {
|
if (!*nand) {
|
||||||
command_print(CMD_CTX, "NAND flash device '%s' not found", str);
|
command_print(CMD, "NAND flash device '%s' not found", str);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -59,7 +59,7 @@ int nand_fileio_start(struct command_invocation *cmd,
|
||||||
struct nand_fileio_state *state)
|
struct nand_fileio_state *state)
|
||||||
{
|
{
|
||||||
if (state->address % nand->page_size) {
|
if (state->address % nand->page_size) {
|
||||||
command_print(cmd->ctx, "only page-aligned addresses are supported");
|
command_print(cmd, "only page-aligned addresses are supported");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ int nand_fileio_start(struct command_invocation *cmd,
|
||||||
int retval = fileio_open(&state->fileio, filename, filemode, FILEIO_BINARY);
|
int retval = fileio_open(&state->fileio, filename, filemode, FILEIO_BINARY);
|
||||||
if (ERROR_OK != retval) {
|
if (ERROR_OK != retval) {
|
||||||
const char *msg = (FILEIO_READ == filemode) ? "read" : "write";
|
const char *msg = (FILEIO_READ == filemode) ? "read" : "write";
|
||||||
command_print(cmd->ctx, "failed to open '%s' for %s access",
|
command_print(cmd, "failed to open '%s' for %s access",
|
||||||
filename, msg);
|
filename, msg);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (NULL == nand->device) {
|
if (NULL == nand->device) {
|
||||||
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
|
command_print(CMD, "#%s: not probed", CMD_ARGV[0]);
|
||||||
return ERROR_NAND_DEVICE_NOT_PROBED;
|
return ERROR_NAND_DEVICE_NOT_PROBED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -139,7 +139,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
|
||||||
if (need_size) {
|
if (need_size) {
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], state->size);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[3], state->size);
|
||||||
if (state->size % nand->page_size) {
|
if (state->size % nand->page_size) {
|
||||||
command_print(CMD_CTX, "only page-aligned sizes are supported");
|
command_print(CMD, "only page-aligned sizes are supported");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,7 @@ COMMAND_HELPER(nand_fileio_parse_args, struct nand_fileio_state *state,
|
||||||
else if (sw_ecc && !strcmp(CMD_ARGV[i], "oob_softecc_kw"))
|
else if (sw_ecc && !strcmp(CMD_ARGV[i], "oob_softecc_kw"))
|
||||||
state->oob_format |= NAND_OOB_SW_ECC_KW;
|
state->oob_format |= NAND_OOB_SW_ECC_KW;
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "unknown option: %s", CMD_ARGV[i]);
|
command_print(CMD, "unknown option: %s", CMD_ARGV[i]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1290,7 +1290,7 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
struct nand_device *nand = get_nand_device_by_num(num);
|
struct nand_device *nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "nand device '#%s' is out of bounds", CMD_ARGV[0]);
|
command_print(CMD, "nand device '#%s' is out of bounds", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1310,10 +1310,10 @@ COMMAND_HANDLER(handle_lpc3180_select_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
|
if (lpc3180_info->selected_controller == LPC3180_MLC_CONTROLLER)
|
||||||
command_print(CMD_CTX, "%s controller selected",
|
command_print(CMD, "%s controller selected",
|
||||||
selected[lpc3180_info->selected_controller]);
|
selected[lpc3180_info->selected_controller]);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
lpc3180_info->is_bulk ? "%s controller selected bulk mode is available" :
|
lpc3180_info->is_bulk ? "%s controller selected bulk mode is available" :
|
||||||
"%s controller selected bulk mode is not available",
|
"%s controller selected bulk mode is not available",
|
||||||
selected[lpc3180_info->selected_controller]);
|
selected[lpc3180_info->selected_controller]);
|
||||||
|
|
|
@ -1760,7 +1760,7 @@ COMMAND_HANDLER(handle_lpc32xx_select_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], num);
|
||||||
struct nand_device *nand = get_nand_device_by_num(num);
|
struct nand_device *nand = get_nand_device_by_num(num);
|
||||||
if (!nand) {
|
if (!nand) {
|
||||||
command_print(CMD_CTX, "nand device '#%s' is out of bounds",
|
command_print(CMD, "nand device '#%s' is out of bounds",
|
||||||
CMD_ARGV[0]);
|
CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1778,7 +1778,7 @@ COMMAND_HANDLER(handle_lpc32xx_select_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s controller selected",
|
command_print(CMD, "%s controller selected",
|
||||||
selected[lpc32xx_info->selected_controller]);
|
selected[lpc32xx_info->selected_controller]);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -157,7 +157,7 @@ COMMAND_HANDLER(handle_mxc_biswap_command)
|
||||||
|
|
||||||
int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &nand);
|
int retval = CALL_COMMAND_HANDLER(nand_command_get_device, 0, &nand);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "invalid nand device number or name: %s", CMD_ARGV[0]);
|
command_print(CMD, "invalid nand device number or name: %s", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -169,9 +169,9 @@ COMMAND_HANDLER(handle_mxc_biswap_command)
|
||||||
mxc_nf_info->flags.biswap_enabled = false;
|
mxc_nf_info->flags.biswap_enabled = false;
|
||||||
}
|
}
|
||||||
if (mxc_nf_info->flags.biswap_enabled)
|
if (mxc_nf_info->flags.biswap_enabled)
|
||||||
command_print(CMD_CTX, "BI-swapping enabled on %s", nand->name);
|
command_print(CMD, "BI-swapping enabled on %s", nand->name);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "BI-swapping disabled on %s", nand->name);
|
command_print(CMD, "BI-swapping disabled on %s", nand->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,20 +37,20 @@ COMMAND_HANDLER(handle_nand_list_command)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!nand_devices) {
|
if (!nand_devices) {
|
||||||
command_print(CMD_CTX, "no NAND flash devices configured");
|
command_print(CMD, "no NAND flash devices configured");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = nand_devices, i = 0; p; p = p->next, i++) {
|
for (p = nand_devices, i = 0; p; p = p->next, i++) {
|
||||||
if (p->device)
|
if (p->device)
|
||||||
command_print(CMD_CTX, "#%i: %s (%s) "
|
command_print(CMD, "#%i: %s (%s) "
|
||||||
"pagesize: %i, buswidth: %i,\n\t"
|
"pagesize: %i, buswidth: %i,\n\t"
|
||||||
"blocksize: %i, blocks: %i",
|
"blocksize: %i, blocks: %i",
|
||||||
i, p->device->name, p->manufacturer->name,
|
i, p->device->name, p->manufacturer->name,
|
||||||
p->page_size, p->bus_width,
|
p->page_size, p->bus_width,
|
||||||
p->erase_size, p->num_blocks);
|
p->erase_size, p->num_blocks);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "#%i: not probed", i);
|
command_print(CMD, "#%i: not probed", i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -87,7 +87,7 @@ COMMAND_HANDLER(handle_nand_info_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (NULL == p->device) {
|
if (NULL == p->device) {
|
||||||
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
|
command_print(CMD, "#%s: not probed", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ COMMAND_HANDLER(handle_nand_info_command)
|
||||||
if (last >= p->num_blocks)
|
if (last >= p->num_blocks)
|
||||||
last = p->num_blocks - 1;
|
last = p->num_blocks - 1;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"#%i: %s (%s) pagesize: %i, buswidth: %i, erasesize: %i",
|
"#%i: %s (%s) pagesize: %i, buswidth: %i, erasesize: %i",
|
||||||
i++,
|
i++,
|
||||||
p->device->name,
|
p->device->name,
|
||||||
|
@ -123,7 +123,7 @@ COMMAND_HANDLER(handle_nand_info_command)
|
||||||
else
|
else
|
||||||
bad_state = " (block condition unknown)";
|
bad_state = " (block condition unknown)";
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"\t#%i: 0x%8.8" PRIx32 " (%" PRId32 "kB) %s%s",
|
"\t#%i: 0x%8.8" PRIx32 " (%" PRId32 "kB) %s%s",
|
||||||
j,
|
j,
|
||||||
p->blocks[j].offset,
|
p->blocks[j].offset,
|
||||||
|
@ -147,7 +147,7 @@ COMMAND_HANDLER(handle_nand_probe_command)
|
||||||
|
|
||||||
retval = nand_probe(p);
|
retval = nand_probe(p);
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "NAND flash device '%s (%s)' found",
|
command_print(CMD, "NAND flash device '%s (%s)' found",
|
||||||
p->device->name, p->manufacturer->name);
|
p->device->name, p->manufacturer->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ COMMAND_HANDLER(handle_nand_erase_command)
|
||||||
|
|
||||||
retval = nand_erase(p, offset, offset + length - 1);
|
retval = nand_erase(p, offset, offset + length - 1);
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "erased blocks %lu to %lu "
|
command_print(CMD, "erased blocks %lu to %lu "
|
||||||
"on NAND flash device #%s '%s'",
|
"on NAND flash device #%s '%s'",
|
||||||
offset, offset + length - 1,
|
offset, offset + length - 1,
|
||||||
CMD_ARGV[0], p->device->name);
|
CMD_ARGV[0], p->device->name);
|
||||||
|
@ -233,7 +233,7 @@ COMMAND_HANDLER(handle_nand_check_bad_blocks_command)
|
||||||
|
|
||||||
retval = nand_build_bbt(p, first, last);
|
retval = nand_build_bbt(p, first, last);
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "checked NAND flash device for bad blocks, "
|
command_print(CMD, "checked NAND flash device for bad blocks, "
|
||||||
"use \"nand info\" command to list blocks");
|
"use \"nand info\" command to list blocks");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -253,7 +253,7 @@ COMMAND_HANDLER(handle_nand_write_command)
|
||||||
while (s.size > 0) {
|
while (s.size > 0) {
|
||||||
int bytes_read = nand_fileio_read(nand, &s);
|
int bytes_read = nand_fileio_read(nand, &s);
|
||||||
if (bytes_read <= 0) {
|
if (bytes_read <= 0) {
|
||||||
command_print(CMD_CTX, "error while reading file");
|
command_print(CMD, "error while reading file");
|
||||||
nand_fileio_cleanup(&s);
|
nand_fileio_cleanup(&s);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -262,7 +262,7 @@ COMMAND_HANDLER(handle_nand_write_command)
|
||||||
retval = nand_write_page(nand, s.address / nand->page_size,
|
retval = nand_write_page(nand, s.address / nand->page_size,
|
||||||
s.page, s.page_size, s.oob, s.oob_size);
|
s.page, s.page_size, s.oob, s.oob_size);
|
||||||
if (ERROR_OK != retval) {
|
if (ERROR_OK != retval) {
|
||||||
command_print(CMD_CTX, "failed writing file %s "
|
command_print(CMD, "failed writing file %s "
|
||||||
"to NAND flash %s at offset 0x%8.8" PRIx32,
|
"to NAND flash %s at offset 0x%8.8" PRIx32,
|
||||||
CMD_ARGV[1], CMD_ARGV[0], s.address);
|
CMD_ARGV[1], CMD_ARGV[0], s.address);
|
||||||
nand_fileio_cleanup(&s);
|
nand_fileio_cleanup(&s);
|
||||||
|
@ -272,7 +272,7 @@ COMMAND_HANDLER(handle_nand_write_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nand_fileio_finish(&s) == ERROR_OK) {
|
if (nand_fileio_finish(&s) == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "wrote file %s to NAND flash %s up to "
|
command_print(CMD, "wrote file %s to NAND flash %s up to "
|
||||||
"offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
"offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
||||||
CMD_ARGV[1], CMD_ARGV[0], s.address, duration_elapsed(&s.bench),
|
CMD_ARGV[1], CMD_ARGV[0], s.address, duration_elapsed(&s.bench),
|
||||||
duration_kbps(&s.bench, total_bytes));
|
duration_kbps(&s.bench, total_bytes));
|
||||||
|
@ -302,7 +302,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
|
||||||
retval = nand_read_page(nand, dev.address / dev.page_size,
|
retval = nand_read_page(nand, dev.address / dev.page_size,
|
||||||
dev.page, dev.page_size, dev.oob, dev.oob_size);
|
dev.page, dev.page_size, dev.oob, dev.oob_size);
|
||||||
if (ERROR_OK != retval) {
|
if (ERROR_OK != retval) {
|
||||||
command_print(CMD_CTX, "reading NAND flash page failed");
|
command_print(CMD, "reading NAND flash page failed");
|
||||||
nand_fileio_cleanup(&dev);
|
nand_fileio_cleanup(&dev);
|
||||||
nand_fileio_cleanup(&file);
|
nand_fileio_cleanup(&file);
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -310,7 +310,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
|
||||||
|
|
||||||
int bytes_read = nand_fileio_read(nand, &file);
|
int bytes_read = nand_fileio_read(nand, &file);
|
||||||
if (bytes_read <= 0) {
|
if (bytes_read <= 0) {
|
||||||
command_print(CMD_CTX, "error while reading file");
|
command_print(CMD, "error while reading file");
|
||||||
nand_fileio_cleanup(&dev);
|
nand_fileio_cleanup(&dev);
|
||||||
nand_fileio_cleanup(&file);
|
nand_fileio_cleanup(&file);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -318,7 +318,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
|
||||||
|
|
||||||
if ((dev.page && memcmp(dev.page, file.page, dev.page_size)) ||
|
if ((dev.page && memcmp(dev.page, file.page, dev.page_size)) ||
|
||||||
(dev.oob && memcmp(dev.oob, file.oob, dev.oob_size))) {
|
(dev.oob && memcmp(dev.oob, file.oob, dev.oob_size))) {
|
||||||
command_print(CMD_CTX, "NAND flash contents differ "
|
command_print(CMD, "NAND flash contents differ "
|
||||||
"at 0x%8.8" PRIx32, dev.address);
|
"at 0x%8.8" PRIx32, dev.address);
|
||||||
nand_fileio_cleanup(&dev);
|
nand_fileio_cleanup(&dev);
|
||||||
nand_fileio_cleanup(&file);
|
nand_fileio_cleanup(&file);
|
||||||
|
@ -330,7 +330,7 @@ COMMAND_HANDLER(handle_nand_verify_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nand_fileio_finish(&file) == ERROR_OK) {
|
if (nand_fileio_finish(&file) == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "verified file %s in NAND flash %s "
|
command_print(CMD, "verified file %s in NAND flash %s "
|
||||||
"up to offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
"up to offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
||||||
CMD_ARGV[1], CMD_ARGV[0], dev.address, duration_elapsed(&file.bench),
|
CMD_ARGV[1], CMD_ARGV[0], dev.address, duration_elapsed(&file.bench),
|
||||||
duration_kbps(&file.bench, dev.size));
|
duration_kbps(&file.bench, dev.size));
|
||||||
|
@ -354,7 +354,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
|
||||||
retval = nand_read_page(nand, s.address / nand->page_size,
|
retval = nand_read_page(nand, s.address / nand->page_size,
|
||||||
s.page, s.page_size, s.oob, s.oob_size);
|
s.page, s.page_size, s.oob, s.oob_size);
|
||||||
if (ERROR_OK != retval) {
|
if (ERROR_OK != retval) {
|
||||||
command_print(CMD_CTX, "reading NAND flash page failed");
|
command_print(CMD, "reading NAND flash page failed");
|
||||||
nand_fileio_cleanup(&s);
|
nand_fileio_cleanup(&s);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -374,7 +374,7 @@ COMMAND_HANDLER(handle_nand_dump_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (nand_fileio_finish(&s) == ERROR_OK) {
|
if (nand_fileio_finish(&s) == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "dumped %zu bytes in %fs (%0.3f KiB/s)",
|
command_print(CMD, "dumped %zu bytes in %fs (%0.3f KiB/s)",
|
||||||
filesize, duration_elapsed(&s.bench),
|
filesize, duration_elapsed(&s.bench),
|
||||||
duration_kbps(&s.bench, filesize));
|
duration_kbps(&s.bench, filesize));
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (NULL == p->device) {
|
if (NULL == p->device) {
|
||||||
command_print(CMD_CTX, "#%s: not probed", CMD_ARGV[0]);
|
command_print(CMD, "#%s: not probed", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -400,7 +400,7 @@ COMMAND_HANDLER(handle_nand_raw_access_command)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[1], p->use_raw);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[1], p->use_raw);
|
||||||
|
|
||||||
const char *msg = p->use_raw ? "enabled" : "disabled";
|
const char *msg = p->use_raw ? "enabled" : "disabled";
|
||||||
command_print(CMD_CTX, "raw access is %s", msg);
|
command_print(CMD, "raw access is %s", msg);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -502,13 +502,13 @@ COMMAND_HANDLER(handle_nand_init_command)
|
||||||
static int nand_list_walker(struct nand_flash_controller *c, void *x)
|
static int nand_list_walker(struct nand_flash_controller *c, void *x)
|
||||||
{
|
{
|
||||||
struct command_invocation *cmd = x;
|
struct command_invocation *cmd = x;
|
||||||
command_print(cmd->ctx, " %s", c->name);
|
command_print(cmd, " %s", c->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_HANDLER(handle_nand_list_drivers)
|
COMMAND_HANDLER(handle_nand_list_drivers)
|
||||||
{
|
{
|
||||||
command_print(CMD_CTX, "Available NAND flash controller drivers:");
|
command_print(CMD, "Available NAND flash controller drivers:");
|
||||||
return nand_driver_walk(&nand_list_walker, CMD);
|
return nand_driver_walk(&nand_list_walker, CMD);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -791,9 +791,9 @@ COMMAND_HANDLER(ambiqmicro_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "ambiqmicro mass erase complete");
|
command_print(CMD, "ambiqmicro mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "ambiqmicro mass erase failed");
|
command_print(CMD, "ambiqmicro mass erase failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -815,9 +815,9 @@ COMMAND_HANDLER(ambiqmicro_handle_page_erase_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (ambiqmicro_erase(bank, first, last) == ERROR_OK)
|
if (ambiqmicro_erase(bank, first, last) == ERROR_OK)
|
||||||
command_print(CMD_CTX, "ambiqmicro page erase complete");
|
command_print(CMD, "ambiqmicro page erase complete");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "ambiqmicro page erase failed");
|
command_print(CMD, "ambiqmicro page erase failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -838,7 +838,7 @@ COMMAND_HANDLER(ambiqmicro_handle_program_otp_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], offset);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], offset);
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], count);
|
||||||
|
|
||||||
command_print(CMD_CTX, "offset=0x%08x count=%d", offset, count);
|
command_print(CMD, "offset=0x%08x count=%d", offset, count);
|
||||||
|
|
||||||
CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||||
|
|
||||||
|
|
|
@ -256,7 +256,7 @@ static struct sam3_chip *get_current_sam3(struct command_invocation *cmd)
|
||||||
|
|
||||||
t = get_current_target(cmd->ctx);
|
t = get_current_target(cmd->ctx);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
command_print(cmd->ctx, "No current target?");
|
command_print(cmd, "No current target?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -264,7 +264,7 @@ static struct sam3_chip *get_current_sam3(struct command_invocation *cmd)
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* this should not happen */
|
/* this should not happen */
|
||||||
/* the command is not registered until the chip is created? */
|
/* the command is not registered until the chip is created? */
|
||||||
command_print(cmd->ctx, "No SAM3 chips exist?");
|
command_print(cmd, "No SAM3 chips exist?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ static struct sam3_chip *get_current_sam3(struct command_invocation *cmd)
|
||||||
return p;
|
return p;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
command_print(cmd->ctx, "Cannot find SAM3 chip?");
|
command_print(cmd, "Cannot find SAM3 chip?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3549,7 +3549,7 @@ COMMAND_HANDLER(sam3_handle_info_command)
|
||||||
if (pChip->details.bank[0].pBank == NULL) {
|
if (pChip->details.bank[0].pBank == NULL) {
|
||||||
x = 0;
|
x = 0;
|
||||||
need_define:
|
need_define:
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"Please define bank %d via command: flash bank %s ... ",
|
"Please define bank %d via command: flash bank %s ... ",
|
||||||
x,
|
x,
|
||||||
at91sam3_flash.name);
|
at91sam3_flash.name);
|
||||||
|
@ -3608,7 +3608,7 @@ COMMAND_HANDLER(sam3_handle_gpnvm_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pChip->details.bank[0].pBank == NULL) {
|
if (pChip->details.bank[0].pBank == NULL) {
|
||||||
command_print(CMD_CTX, "Bank0 must be defined first via: flash bank %s ...",
|
command_print(CMD, "Bank0 must be defined first via: flash bank %s ...",
|
||||||
at91sam3_flash.name);
|
at91sam3_flash.name);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -3647,22 +3647,22 @@ showall:
|
||||||
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), x, &v);
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), x, &v);
|
||||||
if (r != ERROR_OK)
|
if (r != ERROR_OK)
|
||||||
break;
|
break;
|
||||||
command_print(CMD_CTX, "sam3-gpnvm%u: %u", x, v);
|
command_print(CMD, "sam3-gpnvm%u: %u", x, v);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
|
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
|
||||||
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
|
||||||
command_print(CMD_CTX, "sam3-gpnvm%u: %u", who, v);
|
command_print(CMD, "sam3-gpnvm%u: %u", who, v);
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "sam3-gpnvm invalid GPNVM: %u", who);
|
command_print(CMD, "sam3-gpnvm invalid GPNVM: %u", who);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who == -1) {
|
if (who == -1) {
|
||||||
command_print(CMD_CTX, "Missing GPNVM number");
|
command_print(CMD, "Missing GPNVM number");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3672,7 +3672,7 @@ showall:
|
||||||
(0 == strcmp("clear", CMD_ARGV[0]))) /* quietly accept both */
|
(0 == strcmp("clear", CMD_ARGV[0]))) /* quietly accept both */
|
||||||
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
|
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "Unknown command: %s", CMD_ARGV[0]);
|
command_print(CMD, "Unknown command: %s", CMD_ARGV[0]);
|
||||||
r = ERROR_COMMAND_SYNTAX_ERROR;
|
r = ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -3697,7 +3697,7 @@ COMMAND_HANDLER(sam3_handle_slowclk_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
|
||||||
if (v > 200000) {
|
if (v > 200000) {
|
||||||
/* absurd slow clock of 200Khz? */
|
/* absurd slow clock of 200Khz? */
|
||||||
command_print(CMD_CTX, "Absurd/illegal slow clock freq: %d\n", (int)(v));
|
command_print(CMD, "Absurd/illegal slow clock freq: %d\n", (int)(v));
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
pChip->cfg.slow_freq = v;
|
pChip->cfg.slow_freq = v;
|
||||||
|
@ -3705,11 +3705,11 @@ COMMAND_HANDLER(sam3_handle_slowclk_command)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
/* error */
|
/* error */
|
||||||
command_print(CMD_CTX, "Too many parameters");
|
command_print(CMD, "Too many parameters");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "Slowclk freq: %d.%03dkhz",
|
command_print(CMD, "Slowclk freq: %d.%03dkhz",
|
||||||
(int)(pChip->cfg.slow_freq / 1000),
|
(int)(pChip->cfg.slow_freq / 1000),
|
||||||
(int)(pChip->cfg.slow_freq % 1000));
|
(int)(pChip->cfg.slow_freq % 1000));
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -235,7 +235,7 @@ static struct sam4_chip *get_current_sam4(struct command_invocation *cmd)
|
||||||
|
|
||||||
t = get_current_target(cmd->ctx);
|
t = get_current_target(cmd->ctx);
|
||||||
if (!t) {
|
if (!t) {
|
||||||
command_print(cmd->ctx, "No current target?");
|
command_print(cmd, "No current target?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ static struct sam4_chip *get_current_sam4(struct command_invocation *cmd)
|
||||||
if (!p) {
|
if (!p) {
|
||||||
/* this should not happen */
|
/* this should not happen */
|
||||||
/* the command is not registered until the chip is created? */
|
/* the command is not registered until the chip is created? */
|
||||||
command_print(cmd->ctx, "No SAM4 chips exist?");
|
command_print(cmd, "No SAM4 chips exist?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -252,7 +252,7 @@ static struct sam4_chip *get_current_sam4(struct command_invocation *cmd)
|
||||||
return p;
|
return p;
|
||||||
p = p->next;
|
p = p->next;
|
||||||
}
|
}
|
||||||
command_print(cmd->ctx, "Cannot find SAM4 chip?");
|
command_print(cmd, "Cannot find SAM4 chip?");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3029,7 +3029,7 @@ COMMAND_HANDLER(sam4_handle_info_command)
|
||||||
if (pChip->details.bank[0].pBank == NULL) {
|
if (pChip->details.bank[0].pBank == NULL) {
|
||||||
x = 0;
|
x = 0;
|
||||||
need_define:
|
need_define:
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"Please define bank %d via command: flash bank %s ... ",
|
"Please define bank %d via command: flash bank %s ... ",
|
||||||
x,
|
x,
|
||||||
at91sam4_flash.name);
|
at91sam4_flash.name);
|
||||||
|
@ -3088,7 +3088,7 @@ COMMAND_HANDLER(sam4_handle_gpnvm_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pChip->details.bank[0].pBank == NULL) {
|
if (pChip->details.bank[0].pBank == NULL) {
|
||||||
command_print(CMD_CTX, "Bank0 must be defined first via: flash bank %s ...",
|
command_print(CMD, "Bank0 must be defined first via: flash bank %s ...",
|
||||||
at91sam4_flash.name);
|
at91sam4_flash.name);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -3127,23 +3127,23 @@ showall:
|
||||||
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), x, &v);
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), x, &v);
|
||||||
if (r != ERROR_OK)
|
if (r != ERROR_OK)
|
||||||
break;
|
break;
|
||||||
command_print(CMD_CTX, "sam4-gpnvm%u: %u", x, v);
|
command_print(CMD, "sam4-gpnvm%u: %u", x, v);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
|
if ((who >= 0) && (((unsigned)(who)) < pChip->details.n_gpnvms)) {
|
||||||
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
|
r = FLASHD_GetGPNVM(&(pChip->details.bank[0]), who, &v);
|
||||||
if (r == ERROR_OK)
|
if (r == ERROR_OK)
|
||||||
command_print(CMD_CTX, "sam4-gpnvm%u: %u", who, v);
|
command_print(CMD, "sam4-gpnvm%u: %u", who, v);
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "sam4-gpnvm invalid GPNVM: %u", who);
|
command_print(CMD, "sam4-gpnvm invalid GPNVM: %u", who);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who == -1) {
|
if (who == -1) {
|
||||||
command_print(CMD_CTX, "Missing GPNVM number");
|
command_print(CMD, "Missing GPNVM number");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3153,7 +3153,7 @@ showall:
|
||||||
(0 == strcmp("clear", CMD_ARGV[0]))) /* quietly accept both */
|
(0 == strcmp("clear", CMD_ARGV[0]))) /* quietly accept both */
|
||||||
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
|
r = FLASHD_ClrGPNVM(&(pChip->details.bank[0]), who);
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "Unknown command: %s", CMD_ARGV[0]);
|
command_print(CMD, "Unknown command: %s", CMD_ARGV[0]);
|
||||||
r = ERROR_COMMAND_SYNTAX_ERROR;
|
r = ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
@ -3178,7 +3178,7 @@ COMMAND_HANDLER(sam4_handle_slowclk_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], v);
|
||||||
if (v > 200000) {
|
if (v > 200000) {
|
||||||
/* absurd slow clock of 200Khz? */
|
/* absurd slow clock of 200Khz? */
|
||||||
command_print(CMD_CTX, "Absurd/illegal slow clock freq: %d\n", (int)(v));
|
command_print(CMD, "Absurd/illegal slow clock freq: %d\n", (int)(v));
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
pChip->cfg.slow_freq = v;
|
pChip->cfg.slow_freq = v;
|
||||||
|
@ -3186,11 +3186,11 @@ COMMAND_HANDLER(sam4_handle_slowclk_command)
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
/* error */
|
/* error */
|
||||||
command_print(CMD_CTX, "Too many parameters");
|
command_print(CMD, "Too many parameters");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "Slowclk freq: %d.%03dkhz",
|
command_print(CMD, "Slowclk freq: %d.%03dkhz",
|
||||||
(int)(pChip->cfg.slow_freq / 1000),
|
(int)(pChip->cfg.slow_freq / 1000),
|
||||||
(int)(pChip->cfg.slow_freq % 1000));
|
(int)(pChip->cfg.slow_freq % 1000));
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1067,7 +1067,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
|
||||||
if (bank == NULL)
|
if (bank == NULL)
|
||||||
return ERROR_FLASH_BANK_INVALID;
|
return ERROR_FLASH_BANK_INVALID;
|
||||||
if (strcmp(bank->driver->name, "at91sam7")) {
|
if (strcmp(bank->driver->name, "at91sam7")) {
|
||||||
command_print(CMD_CTX, "not an at91sam7 flash bank '%s'", CMD_ARGV[0]);
|
command_print(CMD, "not an at91sam7 flash bank '%s'", CMD_ARGV[0]);
|
||||||
return ERROR_FLASH_BANK_INVALID;
|
return ERROR_FLASH_BANK_INVALID;
|
||||||
}
|
}
|
||||||
if (bank->target->state != TARGET_HALTED) {
|
if (bank->target->state != TARGET_HALTED) {
|
||||||
|
@ -1091,7 +1091,7 @@ COMMAND_HANDLER(at91sam7_handle_gpnvm_command)
|
||||||
|
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], bit);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], bit);
|
||||||
if ((bit < 0) || (bit >= at91sam7_info->num_nvmbits)) {
|
if ((bit < 0) || (bit >= at91sam7_info->num_nvmbits)) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"gpnvm bit '#%s' is out of bounds for target %s",
|
"gpnvm bit '#%s' is out of bounds for target %s",
|
||||||
CMD_ARGV[0],
|
CMD_ARGV[0],
|
||||||
at91sam7_info->target_name);
|
at91sam7_info->target_name);
|
||||||
|
|
|
@ -947,9 +947,9 @@ COMMAND_HANDLER(samd_handle_chip_erase_command)
|
||||||
* perform the erase. */
|
* perform the erase. */
|
||||||
res = target_write_u8(target, SAMD_DSU + SAMD_DSU_CTRL_EXT, (1<<4));
|
res = target_write_u8(target, SAMD_DSU + SAMD_DSU_CTRL_EXT, (1<<4));
|
||||||
if (res == ERROR_OK)
|
if (res == ERROR_OK)
|
||||||
command_print(CMD_CTX, "chip erase started");
|
command_print(CMD, "chip erase started");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "write to DSU CTRL failed");
|
command_print(CMD, "write to DSU CTRL failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -961,7 +961,7 @@ COMMAND_HANDLER(samd_handle_set_security_command)
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
|
|
||||||
if (CMD_ARGC < 1 || (CMD_ARGC >= 1 && (strcmp(CMD_ARGV[0], "enable")))) {
|
if (CMD_ARGC < 1 || (CMD_ARGC >= 1 && (strcmp(CMD_ARGV[0], "enable")))) {
|
||||||
command_print(CMD_CTX, "supply the \"enable\" argument to proceed.");
|
command_print(CMD, "supply the \"enable\" argument to proceed.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -975,9 +975,9 @@ COMMAND_HANDLER(samd_handle_set_security_command)
|
||||||
|
|
||||||
/* Check (and clear) error conditions */
|
/* Check (and clear) error conditions */
|
||||||
if (res == ERROR_OK)
|
if (res == ERROR_OK)
|
||||||
command_print(CMD_CTX, "chip secured on next power-cycle");
|
command_print(CMD, "chip secured on next power-cycle");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "failed to secure chip");
|
command_print(CMD, "failed to secure chip");
|
||||||
}
|
}
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
|
@ -1008,7 +1008,7 @@ COMMAND_HANDLER(samd_handle_eeprom_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code > 6) {
|
if (code > 6) {
|
||||||
command_print(CMD_CTX, "Invalid EEPROM size. Please see "
|
command_print(CMD, "Invalid EEPROM size. Please see "
|
||||||
"datasheet for a list valid sizes.");
|
"datasheet for a list valid sizes.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1022,10 +1022,10 @@ COMMAND_HANDLER(samd_handle_eeprom_command)
|
||||||
uint32_t size = ((val >> 4) & 0x7); /* grab size code */
|
uint32_t size = ((val >> 4) & 0x7); /* grab size code */
|
||||||
|
|
||||||
if (size == 0x7)
|
if (size == 0x7)
|
||||||
command_print(CMD_CTX, "EEPROM is disabled");
|
command_print(CMD, "EEPROM is disabled");
|
||||||
else {
|
else {
|
||||||
/* Otherwise, 6 is 256B, 0 is 16KB */
|
/* Otherwise, 6 is 256B, 0 is 16KB */
|
||||||
command_print(CMD_CTX, "EEPROM size is %u bytes",
|
command_print(CMD, "EEPROM size is %u bytes",
|
||||||
(2 << (13 - size)));
|
(2 << (13 - size)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1038,7 +1038,7 @@ COMMAND_HANDLER(samd_handle_eeprom_command)
|
||||||
static COMMAND_HELPER(get_u64_from_hexarg, unsigned int num, uint64_t *value)
|
static COMMAND_HELPER(get_u64_from_hexarg, unsigned int num, uint64_t *value)
|
||||||
{
|
{
|
||||||
if (num >= CMD_ARGC) {
|
if (num >= CMD_ARGC) {
|
||||||
command_print(CMD_CTX, "Too few Arguments.");
|
command_print(CMD, "Too few Arguments.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,12 +1049,12 @@ static COMMAND_HELPER(get_u64_from_hexarg, unsigned int num, uint64_t *value)
|
||||||
*value = strtoull(&(CMD_ARGV[num][2]), &check, 16);
|
*value = strtoull(&(CMD_ARGV[num][2]), &check, 16);
|
||||||
if ((value == 0 && errno == ERANGE) ||
|
if ((value == 0 && errno == ERANGE) ||
|
||||||
check == NULL || *check != 0) {
|
check == NULL || *check != 0) {
|
||||||
command_print(CMD_CTX, "Invalid 64-bit hex value in argument %d.",
|
command_print(CMD, "Invalid 64-bit hex value in argument %d.",
|
||||||
num + 1);
|
num + 1);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Argument %d needs to be a hex value.", num + 1);
|
command_print(CMD, "Argument %d needs to be a hex value.", num + 1);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1067,7 +1067,7 @@ COMMAND_HANDLER(samd_handle_nvmuserrow_command)
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
if (CMD_ARGC > 2) {
|
if (CMD_ARGC > 2) {
|
||||||
command_print(CMD_CTX, "Too much Arguments given.");
|
command_print(CMD, "Too much Arguments given.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1105,7 +1105,7 @@ COMMAND_HANDLER(samd_handle_nvmuserrow_command)
|
||||||
uint64_t value;
|
uint64_t value;
|
||||||
res = read_userrow(target, &value);
|
res = read_userrow(target, &value);
|
||||||
if (res == ERROR_OK)
|
if (res == ERROR_OK)
|
||||||
command_print(CMD_CTX, "NVMUSERROW: 0x%016"PRIX64, value);
|
command_print(CMD, "NVMUSERROW: 0x%016"PRIX64, value);
|
||||||
else
|
else
|
||||||
LOG_ERROR("NVMUSERROW could not be read.");
|
LOG_ERROR("NVMUSERROW could not be read.");
|
||||||
}
|
}
|
||||||
|
@ -1145,7 +1145,7 @@ COMMAND_HANDLER(samd_handle_bootloader_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (code > 6) {
|
if (code > 6) {
|
||||||
command_print(CMD_CTX, "Invalid bootloader size. Please "
|
command_print(CMD, "Invalid bootloader size. Please "
|
||||||
"see datasheet for a list valid sizes.");
|
"see datasheet for a list valid sizes.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1166,7 +1166,7 @@ COMMAND_HANDLER(samd_handle_bootloader_command)
|
||||||
nb = (2 << (8 - size)) * page_size;
|
nb = (2 << (8 - size)) * page_size;
|
||||||
|
|
||||||
/* There are 4 pages per row */
|
/* There are 4 pages per row */
|
||||||
command_print(CMD_CTX, "Bootloader size is %" PRIu32 " bytes (%" PRIu32 " rows)",
|
command_print(CMD, "Bootloader size is %" PRIu32 " bytes (%" PRIu32 " rows)",
|
||||||
nb, (uint32_t)(nb / (page_size * 4)));
|
nb, (uint32_t)(nb / (page_size * 4)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -765,9 +765,9 @@ COMMAND_HANDLER(same5_handle_chip_erase_command)
|
||||||
* perform the erase. */
|
* perform the erase. */
|
||||||
int res = target_write_u8(target, SAMD_DSU + SAMD_DSU_CTRL_EXT, (1<<4));
|
int res = target_write_u8(target, SAMD_DSU + SAMD_DSU_CTRL_EXT, (1<<4));
|
||||||
if (res == ERROR_OK)
|
if (res == ERROR_OK)
|
||||||
command_print(CMD_CTX, "chip erase started");
|
command_print(CMD, "chip erase started");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "write to DSU CTRL failed");
|
command_print(CMD, "write to DSU CTRL failed");
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
@ -781,7 +781,7 @@ COMMAND_HANDLER(same5_handle_userpage_command)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
if (CMD_ARGC > 2) {
|
if (CMD_ARGC > 2) {
|
||||||
command_print(CMD_CTX, "Too much Arguments given.");
|
command_print(CMD, "Too much Arguments given.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -806,7 +806,7 @@ COMMAND_HANDLER(same5_handle_userpage_command)
|
||||||
int res2 = target_read_memory(target, SAMD_USER_ROW, 4, 2, buffer);
|
int res2 = target_read_memory(target, SAMD_USER_ROW, 4, 2, buffer);
|
||||||
if (res2 == ERROR_OK) {
|
if (res2 == ERROR_OK) {
|
||||||
uint64_t value = target_buffer_get_u64(target, buffer);
|
uint64_t value = target_buffer_get_u64(target, buffer);
|
||||||
command_print(CMD_CTX, "USER PAGE: 0x%016"PRIX64, value);
|
command_print(CMD, "USER PAGE: 0x%016"PRIX64, value);
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("USER PAGE could not be read.");
|
LOG_ERROR("USER PAGE could not be read.");
|
||||||
}
|
}
|
||||||
|
@ -829,7 +829,7 @@ COMMAND_HANDLER(same5_handle_bootloader_command)
|
||||||
unsigned long size = strtoul(CMD_ARGV[0], NULL, 0);
|
unsigned long size = strtoul(CMD_ARGV[0], NULL, 0);
|
||||||
uint32_t code = (size + 8191) / 8192;
|
uint32_t code = (size + 8191) / 8192;
|
||||||
if (code > 15) {
|
if (code > 15) {
|
||||||
command_print(CMD_CTX, "Invalid bootloader size. Please "
|
command_print(CMD, "Invalid bootloader size. Please "
|
||||||
"see datasheet for a list valid sizes.");
|
"see datasheet for a list valid sizes.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -842,7 +842,7 @@ COMMAND_HANDLER(same5_handle_bootloader_command)
|
||||||
if (res2 == ERROR_OK) {
|
if (res2 == ERROR_OK) {
|
||||||
uint32_t code = (val >> 26) & 0xf; /* grab size code */
|
uint32_t code = (val >> 26) & 0xf; /* grab size code */
|
||||||
uint32_t size = (15 - code) * 8192;
|
uint32_t size = (15 - code) * 8192;
|
||||||
command_print(CMD_CTX, "Bootloader protected in the first %"
|
command_print(CMD, "Bootloader protected in the first %"
|
||||||
PRIu32 " bytes", size);
|
PRIu32 " bytes", size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -672,22 +672,22 @@ showall:
|
||||||
r = samv_get_gpnvm(target, x, &v);
|
r = samv_get_gpnvm(target, x, &v);
|
||||||
if (r != ERROR_OK)
|
if (r != ERROR_OK)
|
||||||
break;
|
break;
|
||||||
command_print(CMD_CTX, "samv-gpnvm%u: %u", x, v);
|
command_print(CMD, "samv-gpnvm%u: %u", x, v);
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
if ((who >= 0) && (((unsigned)who) < SAMV_NUM_GPNVM_BITS)) {
|
if ((who >= 0) && (((unsigned)who) < SAMV_NUM_GPNVM_BITS)) {
|
||||||
r = samv_get_gpnvm(target, who, &v);
|
r = samv_get_gpnvm(target, who, &v);
|
||||||
command_print(CMD_CTX, "samv-gpnvm%u: %u", who, v);
|
command_print(CMD, "samv-gpnvm%u: %u", who, v);
|
||||||
return r;
|
return r;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "invalid gpnvm: %u", who);
|
command_print(CMD, "invalid gpnvm: %u", who);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (who == -1) {
|
if (who == -1) {
|
||||||
command_print(CMD_CTX, "missing gpnvm number");
|
command_print(CMD, "missing gpnvm number");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -696,7 +696,7 @@ showall:
|
||||||
else if (!strcmp("clr", CMD_ARGV[0]) || !strcmp("clear", CMD_ARGV[0]))
|
else if (!strcmp("clr", CMD_ARGV[0]) || !strcmp("clear", CMD_ARGV[0]))
|
||||||
r = samv_clear_gpnvm(target, who);
|
r = samv_clear_gpnvm(target, who);
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "unknown command: %s", CMD_ARGV[0]);
|
command_print(CMD, "unknown command: %s", CMD_ARGV[0]);
|
||||||
r = ERROR_COMMAND_SYNTAX_ERROR;
|
r = ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
return r;
|
return r;
|
||||||
|
|
|
@ -433,9 +433,9 @@ COMMAND_HANDLER(avrf_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "avr mass erase complete");
|
command_print(CMD, "avr mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "avr mass erase failed");
|
command_print(CMD, "avr mass erase failed");
|
||||||
|
|
||||||
LOG_DEBUG("%s", __func__);
|
LOG_DEBUG("%s", __func__);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1093,7 +1093,7 @@ COMMAND_HANDLER(efm32x_handle_debuglock_command)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "efm32x debug interface locked, reset the device to apply");
|
command_print(CMD, "efm32x debug interface locked, reset the device to apply");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -776,7 +776,7 @@ COMMAND_HANDLER(em357_handle_lock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (em357_erase_options(bank) != ERROR_OK) {
|
if (em357_erase_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "em357 failed to erase options");
|
command_print(CMD, "em357 failed to erase options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,11 +784,11 @@ COMMAND_HANDLER(em357_handle_lock_command)
|
||||||
em357_info->option_bytes.RDP = 0;
|
em357_info->option_bytes.RDP = 0;
|
||||||
|
|
||||||
if (em357_write_options(bank) != ERROR_OK) {
|
if (em357_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "em357 failed to lock device");
|
command_print(CMD, "em357 failed to lock device");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "em357 locked");
|
command_print(CMD, "em357 locked");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -813,16 +813,16 @@ COMMAND_HANDLER(em357_handle_unlock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (em357_erase_options(bank) != ERROR_OK) {
|
if (em357_erase_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "em357 failed to unlock device");
|
command_print(CMD, "em357 failed to unlock device");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (em357_write_options(bank) != ERROR_OK) {
|
if (em357_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "em357 failed to lock device");
|
command_print(CMD, "em357 failed to lock device");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "em357 unlocked.\n"
|
command_print(CMD, "em357 unlocked.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
|
|
||||||
|
@ -886,9 +886,9 @@ COMMAND_HANDLER(em357_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "em357 mass erase complete");
|
command_print(CMD, "em357 mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "em357 mass erase failed");
|
command_print(CMD, "em357 mass erase failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -516,7 +516,7 @@ COMMAND_HANDLER(handle_esirisc_flash_mass_erase_command)
|
||||||
|
|
||||||
retval = esirisc_flash_mass_erase(bank);
|
retval = esirisc_flash_mass_erase(bank);
|
||||||
|
|
||||||
command_print(CMD_CTX, "mass erase %s",
|
command_print(CMD, "mass erase %s",
|
||||||
(retval == ERROR_OK) ? "successful" : "failed");
|
(retval == ERROR_OK) ? "successful" : "failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -536,7 +536,7 @@ COMMAND_HANDLER(handle_esirisc_flash_ref_erase_command)
|
||||||
|
|
||||||
retval = esirisc_flash_ref_erase(bank);
|
retval = esirisc_flash_ref_erase(bank);
|
||||||
|
|
||||||
command_print(CMD_CTX, "erase reference cell %s",
|
command_print(CMD, "erase reference cell %s",
|
||||||
(retval == ERROR_OK) ? "successful" : "failed");
|
(retval == ERROR_OK) ? "successful" : "failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -958,9 +958,9 @@ COMMAND_HANDLER(fm3_handle_chip_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "fm3 chip erase complete");
|
command_print(CMD, "fm3 chip erase complete");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "fm3 chip erase failed");
|
command_print(CMD, "fm3 chip erase failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -2895,7 +2895,7 @@ COMMAND_HANDLER(kinetis_nvm_partition)
|
||||||
flex_nvm_partition_code = (uint8_t)((sim_fcfg1 >> 8) & 0x0f);
|
flex_nvm_partition_code = (uint8_t)((sim_fcfg1 >> 8) & 0x0f);
|
||||||
switch (flex_nvm_partition_code) {
|
switch (flex_nvm_partition_code) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "No EEPROM backup, data flash only");
|
command_print(CMD, "No EEPROM backup, data flash only");
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
|
@ -2903,10 +2903,10 @@ COMMAND_HANDLER(kinetis_nvm_partition)
|
||||||
case 4:
|
case 4:
|
||||||
case 5:
|
case 5:
|
||||||
case 6:
|
case 6:
|
||||||
command_print(CMD_CTX, "EEPROM backup %d KB", 4 << flex_nvm_partition_code);
|
command_print(CMD, "EEPROM backup %d KB", 4 << flex_nvm_partition_code);
|
||||||
break;
|
break;
|
||||||
case 8:
|
case 8:
|
||||||
command_print(CMD_CTX, "No data flash, EEPROM backup only");
|
command_print(CMD, "No data flash, EEPROM backup only");
|
||||||
break;
|
break;
|
||||||
case 0x9:
|
case 0x9:
|
||||||
case 0xA:
|
case 0xA:
|
||||||
|
@ -2914,13 +2914,13 @@ COMMAND_HANDLER(kinetis_nvm_partition)
|
||||||
case 0xC:
|
case 0xC:
|
||||||
case 0xD:
|
case 0xD:
|
||||||
case 0xE:
|
case 0xE:
|
||||||
command_print(CMD_CTX, "data flash %d KB", 4 << (flex_nvm_partition_code & 7));
|
command_print(CMD, "data flash %d KB", 4 << (flex_nvm_partition_code & 7));
|
||||||
break;
|
break;
|
||||||
case 0xf:
|
case 0xf:
|
||||||
command_print(CMD_CTX, "No EEPROM backup, data flash only (DEPART not set)");
|
command_print(CMD, "No EEPROM backup, data flash only (DEPART not set)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX, "Unsupported EEPROM backup size code 0x%02" PRIx8, flex_nvm_partition_code);
|
command_print(CMD, "Unsupported EEPROM backup size code 0x%02" PRIx8, flex_nvm_partition_code);
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
|
@ -2986,7 +2986,7 @@ COMMAND_HANDLER(kinetis_nvm_partition)
|
||||||
if (result != ERROR_OK)
|
if (result != ERROR_OK)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
command_print(CMD_CTX, "FlexNVM partition set. Please reset MCU.");
|
command_print(CMD, "FlexNVM partition set. Please reset MCU.");
|
||||||
|
|
||||||
if (k_chip) {
|
if (k_chip) {
|
||||||
first_nvm_bank = k_chip->num_pflash_blocks;
|
first_nvm_bank = k_chip->num_pflash_blocks;
|
||||||
|
@ -2996,7 +2996,7 @@ COMMAND_HANDLER(kinetis_nvm_partition)
|
||||||
k_chip->probed = false;
|
k_chip->probed = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "FlexNVM banks will be re-probed to set new data flash size.");
|
command_print(CMD, "FlexNVM banks will be re-probed to set new data flash size.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3015,12 +3015,12 @@ COMMAND_HANDLER(kinetis_fcf_source_handler)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (allow_fcf_writes) {
|
if (allow_fcf_writes) {
|
||||||
command_print(CMD_CTX, "Arbitrary Flash Configuration Field writes enabled.");
|
command_print(CMD, "Arbitrary Flash Configuration Field writes enabled.");
|
||||||
command_print(CMD_CTX, "Protection info writes to FCF disabled.");
|
command_print(CMD, "Protection info writes to FCF disabled.");
|
||||||
LOG_WARNING("BEWARE: incorrect flash configuration may permanently lock the device.");
|
LOG_WARNING("BEWARE: incorrect flash configuration may permanently lock the device.");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Protection info writes to Flash Configuration Field enabled.");
|
command_print(CMD, "Protection info writes to Flash Configuration Field enabled.");
|
||||||
command_print(CMD_CTX, "Arbitrary FCF writes disabled. Mode safe from unwanted locking of the device.");
|
command_print(CMD, "Arbitrary FCF writes disabled. Mode safe from unwanted locking of the device.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -3035,7 +3035,7 @@ COMMAND_HANDLER(kinetis_fopt_handler)
|
||||||
fcf_fopt = (uint8_t)strtoul(CMD_ARGV[0], NULL, 0);
|
fcf_fopt = (uint8_t)strtoul(CMD_ARGV[0], NULL, 0);
|
||||||
fcf_fopt_configured = true;
|
fcf_fopt_configured = true;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "FCF_FOPT 0x%02" PRIx8, fcf_fopt);
|
command_print(CMD, "FCF_FOPT 0x%02" PRIx8, fcf_fopt);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1579,11 +1579,11 @@ COMMAND_HANDLER(lpc2000_handle_part_id_command)
|
||||||
int status_code = get_lpc2000_part_id(bank, &part_id);
|
int status_code = get_lpc2000_part_id(bank, &part_id);
|
||||||
if (status_code != 0x0) {
|
if (status_code != 0x0) {
|
||||||
if (status_code == ERROR_FLASH_OPERATION_FAILED) {
|
if (status_code == ERROR_FLASH_OPERATION_FAILED) {
|
||||||
command_print(CMD_CTX, "no sufficient working area specified, can't access LPC2000 IAP interface");
|
command_print(CMD, "no sufficient working area specified, can't access LPC2000 IAP interface");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "lpc2000 IAP returned status code %i", status_code);
|
command_print(CMD, "lpc2000 IAP returned status code %i", status_code);
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "lpc2000 part id: 0x%8.8" PRIx32, part_id);
|
command_print(CMD, "lpc2000 part id: 0x%8.8" PRIx32, part_id);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -501,7 +501,7 @@ COMMAND_HANDLER(lpc2900_handle_signature_command)
|
||||||
if (status != ERROR_OK)
|
if (status != ERROR_OK)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
command_print(CMD_CTX, "signature: 0x%8.8" PRIx32
|
command_print(CMD, "signature: 0x%8.8" PRIx32
|
||||||
":0x%8.8" PRIx32
|
":0x%8.8" PRIx32
|
||||||
":0x%8.8" PRIx32
|
":0x%8.8" PRIx32
|
||||||
":0x%8.8" PRIx32,
|
":0x%8.8" PRIx32,
|
||||||
|
@ -595,11 +595,11 @@ COMMAND_HANDLER(lpc2900_handle_password_command)
|
||||||
lpc2900_info->risky = !strcmp(CMD_ARGV[1], ISS_PASSWORD);
|
lpc2900_info->risky = !strcmp(CMD_ARGV[1], ISS_PASSWORD);
|
||||||
|
|
||||||
if (!lpc2900_info->risky) {
|
if (!lpc2900_info->risky) {
|
||||||
command_print(CMD_CTX, "Wrong password (use '%s')", ISS_PASSWORD);
|
command_print(CMD, "Wrong password (use '%s')", ISS_PASSWORD);
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"Potentially dangerous operation allowed in next command!");
|
"Potentially dangerous operation allowed in next command!");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -622,7 +622,7 @@ COMMAND_HANDLER(lpc2900_handle_write_custom_command)
|
||||||
|
|
||||||
/* Check if command execution is allowed. */
|
/* Check if command execution is allowed. */
|
||||||
if (!lpc2900_info->risky) {
|
if (!lpc2900_info->risky) {
|
||||||
command_print(CMD_CTX, "Command execution not allowed!");
|
command_print(CMD, "Command execution not allowed!");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
lpc2900_info->risky = 0;
|
lpc2900_info->risky = 0;
|
||||||
|
@ -721,7 +721,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
|
||||||
|
|
||||||
/* Check if command execution is allowed. */
|
/* Check if command execution is allowed. */
|
||||||
if (!lpc2900_info->risky) {
|
if (!lpc2900_info->risky) {
|
||||||
command_print(CMD_CTX, "Command execution not allowed! "
|
command_print(CMD, "Command execution not allowed! "
|
||||||
"(use 'password' command first)");
|
"(use 'password' command first)");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -734,7 +734,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
|
||||||
if ((first >= bank->num_sectors) ||
|
if ((first >= bank->num_sectors) ||
|
||||||
(last >= bank->num_sectors) ||
|
(last >= bank->num_sectors) ||
|
||||||
(first > last)) {
|
(first > last)) {
|
||||||
command_print(CMD_CTX, "Illegal sector range");
|
command_print(CMD, "Illegal sector range");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,7 +773,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_sector_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"Sectors security will become effective after next power cycle");
|
"Sectors security will become effective after next power cycle");
|
||||||
|
|
||||||
/* Update the sector security status */
|
/* Update the sector security status */
|
||||||
|
@ -803,7 +803,7 @@ COMMAND_HANDLER(lpc2900_handle_secure_jtag_command)
|
||||||
|
|
||||||
/* Check if command execution is allowed. */
|
/* Check if command execution is allowed. */
|
||||||
if (!lpc2900_info->risky) {
|
if (!lpc2900_info->risky) {
|
||||||
command_print(CMD_CTX, "Command execution not allowed! "
|
command_print(CMD, "Command execution not allowed! "
|
||||||
"(use 'password' command first)");
|
"(use 'password' command first)");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
|
@ -772,7 +772,7 @@ COMMAND_HANDLER(max32xxx_handle_mass_erase_command)
|
||||||
int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
int retval = CALL_COMMAND_HANDLER(flash_command_get_bank, 0, &bank);
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "max32xxx mass_erase <bank>");
|
command_print(CMD, "max32xxx mass_erase <bank>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -784,9 +784,9 @@ COMMAND_HANDLER(max32xxx_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "max32xxx mass erase complete");
|
command_print(CMD, "max32xxx mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "max32xxx mass erase failed");
|
command_print(CMD, "max32xxx mass erase failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||||
uint32_t addr, len;
|
uint32_t addr, len;
|
||||||
|
|
||||||
if (CMD_ARGC != 3) {
|
if (CMD_ARGC != 3) {
|
||||||
command_print(CMD_CTX, "max32xxx protection_set <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_set <bank> <addr> <size>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,7 +811,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||||
/* Convert the range to the page numbers */
|
/* Convert the range to the page numbers */
|
||||||
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
||||||
LOG_WARNING("Error parsing address");
|
LOG_WARNING("Error parsing address");
|
||||||
command_print(CMD_CTX, "max32xxx protection_set <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_set <bank> <addr> <size>");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
/* Mask off the top portion on the address */
|
/* Mask off the top portion on the address */
|
||||||
|
@ -819,7 +819,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||||
|
|
||||||
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
||||||
LOG_WARNING("Error parsing length");
|
LOG_WARNING("Error parsing length");
|
||||||
command_print(CMD_CTX, "max32xxx protection_set <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_set <bank> <addr> <size>");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -840,9 +840,9 @@ COMMAND_HANDLER(max32xxx_handle_protection_set_command)
|
||||||
len = addr + (len / info->sector_size) - 1;
|
len = addr + (len / info->sector_size) - 1;
|
||||||
|
|
||||||
if (max32xxx_protect(bank, 1, addr, len) == ERROR_OK)
|
if (max32xxx_protect(bank, 1, addr, len) == ERROR_OK)
|
||||||
command_print(CMD_CTX, "max32xxx protection set complete");
|
command_print(CMD, "max32xxx protection set complete");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "max32xxx protection set failed");
|
command_print(CMD, "max32xxx protection set failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -855,7 +855,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||||
uint32_t addr, len;
|
uint32_t addr, len;
|
||||||
|
|
||||||
if (CMD_ARGC != 3) {
|
if (CMD_ARGC != 3) {
|
||||||
command_print(CMD_CTX, "max32xxx protection_clr <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_clr <bank> <addr> <size>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -867,7 +867,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||||
/* Convert the range to the page numbers */
|
/* Convert the range to the page numbers */
|
||||||
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
if (1 != sscanf(CMD_ARGV[1], "0x%"SCNx32, &addr)) {
|
||||||
LOG_WARNING("Error parsing address");
|
LOG_WARNING("Error parsing address");
|
||||||
command_print(CMD_CTX, "max32xxx protection_clr <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_clr <bank> <addr> <size>");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
/* Mask off the top portion on the address */
|
/* Mask off the top portion on the address */
|
||||||
|
@ -875,7 +875,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||||
|
|
||||||
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
if (1 != sscanf(CMD_ARGV[2], "0x%"SCNx32, &len)) {
|
||||||
LOG_WARNING("Error parsing length");
|
LOG_WARNING("Error parsing length");
|
||||||
command_print(CMD_CTX, "max32xxx protection_clr <bank> <addr> <size>");
|
command_print(CMD, "max32xxx protection_clr <bank> <addr> <size>");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -896,9 +896,9 @@ COMMAND_HANDLER(max32xxx_handle_protection_clr_command)
|
||||||
len = addr + (len / info->sector_size) - 1;
|
len = addr + (len / info->sector_size) - 1;
|
||||||
|
|
||||||
if (max32xxx_protect(bank, 0, addr, len) == ERROR_OK)
|
if (max32xxx_protect(bank, 0, addr, len) == ERROR_OK)
|
||||||
command_print(CMD_CTX, "max32xxx protection clear complete");
|
command_print(CMD, "max32xxx protection clear complete");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "max32xxx protection clear failed");
|
command_print(CMD, "max32xxx protection clear failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -911,7 +911,7 @@ COMMAND_HANDLER(max32xxx_handle_protection_check_command)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "max32xxx protection_check <bank>");
|
command_print(CMD, "max32xxx protection_check <bank>");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -425,7 +425,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_read_byte_command)
|
||||||
retval = target_read_u32(target, UFMD, &uflash_data);
|
retval = target_read_u32(target, UFMD, &uflash_data);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
command_print(CMD_CTX, "Read userflash %s region:\n"
|
command_print(CMD, "Read userflash %s region:\n"
|
||||||
"address = 0x%04x,\n"
|
"address = 0x%04x,\n"
|
||||||
"value = 0x%02x.", CMD_ARGV[0], uflash_addr, uflash_data);
|
"value = 0x%02x.", CMD_ARGV[0], uflash_addr, uflash_data);
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -467,7 +467,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_write_byte_command)
|
||||||
|
|
||||||
int page_num = uflash_addr/USERFLASH_PAGE_SIZE;
|
int page_num = uflash_addr/USERFLASH_PAGE_SIZE;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Write userflash %s region:\n"
|
command_print(CMD, "Write userflash %s region:\n"
|
||||||
"address = 0x%04x,\n"
|
"address = 0x%04x,\n"
|
||||||
"value = 0x%02x.\n"
|
"value = 0x%02x.\n"
|
||||||
"Please wait ... ", CMD_ARGV[0], uflash_addr, uflash_data);
|
"Please wait ... ", CMD_ARGV[0], uflash_addr, uflash_data);
|
||||||
|
@ -483,7 +483,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_write_byte_command)
|
||||||
|
|
||||||
/* write dump to userflash */
|
/* write dump to userflash */
|
||||||
niietcm4_load_uflash_page(bank, uflash_dump, page_num, mem_type);
|
niietcm4_load_uflash_page(bank, uflash_dump, page_num, mem_type);
|
||||||
command_print(CMD_CTX, "done!");
|
command_print(CMD, "done!");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,7 +520,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_full_erase_command)
|
||||||
retval = niietcm4_uopstatus_check(bank);
|
retval = niietcm4_uopstatus_check(bank);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
command_print(CMD_CTX, "Userflash full erase done!");
|
command_print(CMD, "Userflash full erase done!");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -563,7 +563,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_erase_command)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "Erase %s userflash pages %d through %d done!", CMD_ARGV[0], first, last);
|
command_print(CMD, "Erase %s userflash pages %d through %d done!", CMD_ARGV[0], first, last);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -621,9 +621,9 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_check_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (uflash_data & INFOWORD3_LOCK_IFB_UF)
|
if (uflash_data & INFOWORD3_LOCK_IFB_UF)
|
||||||
command_print(CMD_CTX, "All sectors of info userflash are not protected!");
|
command_print(CMD, "All sectors of info userflash are not protected!");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "All sectors of info userflash are protected!");
|
command_print(CMD, "All sectors of info userflash are protected!");
|
||||||
} else {
|
} else {
|
||||||
uflash_addr = UF_LOCK_ADDR;
|
uflash_addr = UF_LOCK_ADDR;
|
||||||
uflash_cmd = UFMC_MAGIC_KEY | UFMC_READ_IFB;
|
uflash_cmd = UFMC_MAGIC_KEY | UFMC_READ_IFB;
|
||||||
|
@ -645,10 +645,10 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_check_command)
|
||||||
|
|
||||||
for (j = 0; j < 8; j++) {
|
for (j = 0; j < 8; j++) {
|
||||||
if (uflash_data & 0x1)
|
if (uflash_data & 0x1)
|
||||||
command_print(CMD_CTX, "Userflash sector #%03d: 0x%04x (0x100) is not protected!",
|
command_print(CMD, "Userflash sector #%03d: 0x%04x (0x100) is not protected!",
|
||||||
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
|
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "Userflash sector #%03d: 0x%04x (0x100) is protected!",
|
command_print(CMD, "Userflash sector #%03d: 0x%04x (0x100) is protected!",
|
||||||
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
|
i*8+j, (i*8+j)*USERFLASH_PAGE_SIZE);
|
||||||
uflash_data = uflash_data >> 1;
|
uflash_data = uflash_data >> 1;
|
||||||
}
|
}
|
||||||
|
@ -693,11 +693,11 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_command)
|
||||||
|
|
||||||
int set;
|
int set;
|
||||||
if (strcmp("on", CMD_ARGV[3]) == 0) {
|
if (strcmp("on", CMD_ARGV[3]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to enable %s userflash sectors %d through %d protection. Please wait ... ",
|
command_print(CMD, "Try to enable %s userflash sectors %d through %d protection. Please wait ... ",
|
||||||
CMD_ARGV[0], first, last);
|
CMD_ARGV[0], first, last);
|
||||||
set = 1;
|
set = 1;
|
||||||
} else if (strcmp("off", CMD_ARGV[3]) == 0) {
|
} else if (strcmp("off", CMD_ARGV[3]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to disable %s userflash sectors %d through %d protection. Please wait ... ",
|
command_print(CMD, "Try to disable %s userflash sectors %d through %d protection. Please wait ... ",
|
||||||
CMD_ARGV[0], first, last);
|
CMD_ARGV[0], first, last);
|
||||||
set = 0;
|
set = 0;
|
||||||
} else
|
} else
|
||||||
|
@ -707,7 +707,7 @@ COMMAND_HANDLER(niietcm4_handle_uflash_protect_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "done!");
|
command_print(CMD, "done!");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,10 +733,10 @@ COMMAND_HANDLER(niietcm4_handle_bflash_info_remap_command)
|
||||||
|
|
||||||
int set;
|
int set;
|
||||||
if (strcmp("on", CMD_ARGV[0]) == 0) {
|
if (strcmp("on", CMD_ARGV[0]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to enable bootflash info region remap. Please wait ...");
|
command_print(CMD, "Try to enable bootflash info region remap. Please wait ...");
|
||||||
set = 1;
|
set = 1;
|
||||||
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
|
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to disable bootflash info region remap. Please wait ...");
|
command_print(CMD, "Try to disable bootflash info region remap. Please wait ...");
|
||||||
set = 0;
|
set = 0;
|
||||||
} else
|
} else
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
@ -756,7 +756,7 @@ COMMAND_HANDLER(niietcm4_handle_bflash_info_remap_command)
|
||||||
|
|
||||||
/* write dump to userflash */
|
/* write dump to userflash */
|
||||||
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
||||||
command_print(CMD_CTX, "done!");
|
command_print(CMD, "done!");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -814,7 +814,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_cfg_command)
|
||||||
else
|
else
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Try to configure external memory boot interface:\n"
|
command_print(CMD, "Try to configure external memory boot interface:\n"
|
||||||
"port = %s\n"
|
"port = %s\n"
|
||||||
"pin = %s\n"
|
"pin = %s\n"
|
||||||
"func = %s\n"
|
"func = %s\n"
|
||||||
|
@ -833,7 +833,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_cfg_command)
|
||||||
|
|
||||||
/* write dump to userflash */
|
/* write dump to userflash */
|
||||||
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
||||||
command_print(CMD_CTX, "done!");
|
command_print(CMD, "done!");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -861,10 +861,10 @@ COMMAND_HANDLER(niietcm4_handle_extmem_boot_command)
|
||||||
int set;
|
int set;
|
||||||
|
|
||||||
if (strcmp("on", CMD_ARGV[0]) == 0) {
|
if (strcmp("on", CMD_ARGV[0]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to enable boot from external memory. Please wait ...");
|
command_print(CMD, "Try to enable boot from external memory. Please wait ...");
|
||||||
set = 1;
|
set = 1;
|
||||||
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
|
} else if (strcmp("off", CMD_ARGV[0]) == 0) {
|
||||||
command_print(CMD_CTX, "Try to disable boot from external memory. Please wait ...");
|
command_print(CMD, "Try to disable boot from external memory. Please wait ...");
|
||||||
set = 0;
|
set = 0;
|
||||||
} else
|
} else
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
@ -884,7 +884,7 @@ COMMAND_HANDLER(niietcm4_handle_extmem_boot_command)
|
||||||
|
|
||||||
/* write dump to userflash */
|
/* write dump to userflash */
|
||||||
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
niietcm4_load_uflash_page(bank, uflash_dump, 0, 1);
|
||||||
command_print(CMD_CTX, "done!");
|
command_print(CMD, "done!");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -900,7 +900,7 @@ COMMAND_HANDLER(niietcm4_handle_service_mode_erase_command)
|
||||||
return retval;
|
return retval;
|
||||||
struct target *target = bank->target;
|
struct target *target = bank->target;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Try to perform service mode erase. Please wait ...");
|
command_print(CMD, "Try to perform service mode erase. Please wait ...");
|
||||||
|
|
||||||
retval = target_write_u32(target, SERVICE_MODE_ERASE_ADDR, 1);
|
retval = target_write_u32(target, SERVICE_MODE_ERASE_ADDR, 1);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
|
@ -923,7 +923,7 @@ COMMAND_HANDLER(niietcm4_handle_service_mode_erase_command)
|
||||||
}
|
}
|
||||||
busy_sleep(1); /* can use busy sleep for short times. */
|
busy_sleep(1); /* can use busy sleep for short times. */
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "done! All data erased.");
|
command_print(CMD, "done! All data erased.");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -938,7 +938,7 @@ COMMAND_HANDLER(niietcm4_handle_driver_info_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "niietcm4 flash driver\n"
|
command_print(CMD, "niietcm4 flash driver\n"
|
||||||
"version: %d.%d\n"
|
"version: %d.%d\n"
|
||||||
"author: Bogdan Kolbov\n"
|
"author: Bogdan Kolbov\n"
|
||||||
"mail: kolbov@niiet.ru",
|
"mail: kolbov@niiet.ru",
|
||||||
|
|
|
@ -1827,11 +1827,11 @@ COMMAND_HANDLER(numicro_handle_chip_erase_command)
|
||||||
|
|
||||||
retval = numicro_fmc_cmd(target, ISPCMD_CHIPERASE, 0, 0, &rdat);
|
retval = numicro_fmc_cmd(target, ISPCMD_CHIPERASE, 0, 0, &rdat);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "numicro chip_erase failed");
|
command_print(CMD, "numicro chip_erase failed");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "numicro chip_erase complete");
|
command_print(CMD, "numicro chip_erase complete");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -858,7 +858,7 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (address < bank->base || address >= (bank->base + bank->size)) {
|
if (address < bank->base || address >= (bank->base + bank->size)) {
|
||||||
command_print(CMD_CTX, "flash address '%s' is out of bounds", CMD_ARGV[0]);
|
command_print(CMD, "flash address '%s' is out of bounds", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,9 +870,9 @@ COMMAND_HANDLER(pic32mx_handle_pgm_word_command)
|
||||||
res = ERROR_FLASH_OPERATION_FAILED;
|
res = ERROR_FLASH_OPERATION_FAILED;
|
||||||
|
|
||||||
if (res == ERROR_OK)
|
if (res == ERROR_OK)
|
||||||
command_print(CMD_CTX, "pic32mx pgm word complete");
|
command_print(CMD, "pic32mx pgm word complete");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "pic32mx pgm word failed (status = 0x%x)", status);
|
command_print(CMD, "pic32mx pgm word failed (status = 0x%x)", status);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -885,7 +885,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
|
||||||
int timeout = 10;
|
int timeout = 10;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "pic32mx unlock <bank>");
|
command_print(CMD, "pic32mx unlock <bank>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -907,7 +907,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
|
||||||
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
|
mips_ejtag_drscan_8(ejtag_info, &mchip_cmd);
|
||||||
if (mchip_cmd & (1 << 7)) {
|
if (mchip_cmd & (1 << 7)) {
|
||||||
/* device is not locked */
|
/* device is not locked */
|
||||||
command_print(CMD_CTX, "pic32mx is already unlocked, erasing anyway");
|
command_print(CMD, "pic32mx is already unlocked, erasing anyway");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* unlock/erase device */
|
/* unlock/erase device */
|
||||||
|
@ -931,7 +931,7 @@ COMMAND_HANDLER(pic32mx_handle_unlock_command)
|
||||||
/* select ejtag tap */
|
/* select ejtag tap */
|
||||||
mips_ejtag_set_instr(ejtag_info, MTAP_SW_ETAP);
|
mips_ejtag_set_instr(ejtag_info, MTAP_SW_ETAP);
|
||||||
|
|
||||||
command_print(CMD_CTX, "pic32mx unlocked.\n"
|
command_print(CMD, "pic32mx unlocked.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
|
|
||||||
|
|
|
@ -913,9 +913,9 @@ COMMAND_HANDLER(psoc4_handle_mass_erase_command)
|
||||||
|
|
||||||
retval = psoc4_mass_erase(bank);
|
retval = psoc4_mass_erase(bank);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "psoc mass erase complete");
|
command_print(CMD, "psoc mass erase complete");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "psoc mass erase failed");
|
command_print(CMD, "psoc mass erase failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1501,9 +1501,9 @@ COMMAND_HANDLER(psoc5lp_handle_mass_erase_command)
|
||||||
|
|
||||||
retval = psoc5lp_spc_erase_all(bank->target);
|
retval = psoc5lp_spc_erase_all(bank->target);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "PSoC 5LP erase succeeded");
|
command_print(CMD, "PSoC 5LP erase succeeded");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "PSoC 5LP erase failed");
|
command_print(CMD, "PSoC 5LP erase failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1336,9 +1336,9 @@ COMMAND_HANDLER(stellaris_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stellaris mass erase complete");
|
command_print(CMD, "stellaris mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "stellaris mass erase failed");
|
command_print(CMD, "stellaris mass erase failed");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1186,7 +1186,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (stm32x_erase_options(bank) != ERROR_OK) {
|
if (stm32x_erase_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to erase options");
|
command_print(CMD, "stm32x failed to erase options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1194,11 +1194,11 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
stm32x_info->option_bytes.rdp = 0;
|
stm32x_info->option_bytes.rdp = 0;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to lock device");
|
command_print(CMD, "stm32x failed to lock device");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32x locked");
|
command_print(CMD, "stm32x locked");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1227,16 +1227,16 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (stm32x_erase_options(bank) != ERROR_OK) {
|
if (stm32x_erase_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to erase options");
|
command_print(CMD, "stm32x failed to erase options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to unlock device");
|
command_print(CMD, "stm32x failed to unlock device");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32x unlocked.\n"
|
command_print(CMD, "stm32x unlocked.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
|
|
||||||
|
@ -1281,30 +1281,30 @@ COMMAND_HANDLER(stm32x_handle_options_read_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (optionbyte & (1 << OPT_ERROR))
|
if (optionbyte & (1 << OPT_ERROR))
|
||||||
command_print(CMD_CTX, "option byte complement error");
|
command_print(CMD, "option byte complement error");
|
||||||
|
|
||||||
command_print(CMD_CTX, "option byte register = 0x%" PRIx32 "", optionbyte);
|
command_print(CMD, "option byte register = 0x%" PRIx32 "", optionbyte);
|
||||||
command_print(CMD_CTX, "write protection register = 0x%" PRIx32 "", protection);
|
command_print(CMD, "write protection register = 0x%" PRIx32 "", protection);
|
||||||
|
|
||||||
command_print(CMD_CTX, "read protection: %s",
|
command_print(CMD, "read protection: %s",
|
||||||
(optionbyte & (1 << OPT_READOUT)) ? "on" : "off");
|
(optionbyte & (1 << OPT_READOUT)) ? "on" : "off");
|
||||||
|
|
||||||
/* user option bytes are offset depending on variant */
|
/* user option bytes are offset depending on variant */
|
||||||
optionbyte >>= stm32x_info->option_offset;
|
optionbyte >>= stm32x_info->option_offset;
|
||||||
|
|
||||||
command_print(CMD_CTX, "watchdog: %sware",
|
command_print(CMD, "watchdog: %sware",
|
||||||
(optionbyte & (1 << OPT_RDWDGSW)) ? "soft" : "hard");
|
(optionbyte & (1 << OPT_RDWDGSW)) ? "soft" : "hard");
|
||||||
|
|
||||||
command_print(CMD_CTX, "stop mode: %sreset generated upon entry",
|
command_print(CMD, "stop mode: %sreset generated upon entry",
|
||||||
(optionbyte & (1 << OPT_RDRSTSTOP)) ? "no " : "");
|
(optionbyte & (1 << OPT_RDRSTSTOP)) ? "no " : "");
|
||||||
|
|
||||||
command_print(CMD_CTX, "standby mode: %sreset generated upon entry",
|
command_print(CMD, "standby mode: %sreset generated upon entry",
|
||||||
(optionbyte & (1 << OPT_RDRSTSTDBY)) ? "no " : "");
|
(optionbyte & (1 << OPT_RDRSTSTDBY)) ? "no " : "");
|
||||||
|
|
||||||
if (stm32x_info->has_dual_banks)
|
if (stm32x_info->has_dual_banks)
|
||||||
command_print(CMD_CTX, "boot: bank %d", (optionbyte & (1 << OPT_BFB2)) ? 0 : 1);
|
command_print(CMD, "boot: bank %d", (optionbyte & (1 << OPT_BFB2)) ? 0 : 1);
|
||||||
|
|
||||||
command_print(CMD_CTX, "user data = 0x%02" PRIx16 "", user_data);
|
command_print(CMD, "user data = 0x%02" PRIx16 "", user_data);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1383,7 +1383,7 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_erase_options(bank) != ERROR_OK) {
|
if (stm32x_erase_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to erase options");
|
command_print(CMD, "stm32x failed to erase options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1391,11 +1391,11 @@ COMMAND_HANDLER(stm32x_handle_options_write_command)
|
||||||
stm32x_info->option_bytes.data = useropt;
|
stm32x_info->option_bytes.data = useropt;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32x failed to write options");
|
command_print(CMD, "stm32x failed to write options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32x write options complete.\n"
|
command_print(CMD, "stm32x write options complete.\n"
|
||||||
"INFO: %spower cycle is required "
|
"INFO: %spower cycle is required "
|
||||||
"for the new settings to take effect.",
|
"for the new settings to take effect.",
|
||||||
stm32x_info->can_load_options
|
stm32x_info->can_load_options
|
||||||
|
@ -1504,9 +1504,9 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32x mass erase complete");
|
command_print(CMD, "stm32x mass erase complete");
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "stm32x mass erase failed");
|
command_print(CMD, "stm32x mass erase failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1415,7 +1415,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_read_options(bank) != ERROR_OK) {
|
if (stm32x_read_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to read options", bank->driver->name);
|
command_print(CMD, "%s failed to read options", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1423,11 +1423,11 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
stm32x_info->option_bytes.RDP = 0;
|
stm32x_info->option_bytes.RDP = 0;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to lock device", bank->driver->name);
|
command_print(CMD, "%s failed to lock device", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s locked", bank->driver->name);
|
command_print(CMD, "%s locked", bank->driver->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1454,7 +1454,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_read_options(bank) != ERROR_OK) {
|
if (stm32x_read_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to read options", bank->driver->name);
|
command_print(CMD, "%s failed to read options", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1466,11 +1466,11 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to unlock device", bank->driver->name);
|
command_print(CMD, "%s failed to unlock device", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s unlocked.\n"
|
command_print(CMD, "%s unlocked.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.", bank->driver->name);
|
"for the new settings to take effect.", bank->driver->name);
|
||||||
|
|
||||||
|
@ -1525,7 +1525,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "stm32x mass_erase <bank>");
|
command_print(CMD, "stm32x mass_erase <bank>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1540,9 +1540,9 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32x mass erase complete");
|
command_print(CMD, "stm32x mass erase complete");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32x mass erase failed");
|
command_print(CMD, "stm32x mass erase failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1555,7 +1555,7 @@ COMMAND_HANDLER(stm32f2x_handle_options_read_command)
|
||||||
struct stm32x_flash_bank *stm32x_info = NULL;
|
struct stm32x_flash_bank *stm32x_info = NULL;
|
||||||
|
|
||||||
if (CMD_ARGC != 1) {
|
if (CMD_ARGC != 1) {
|
||||||
command_print(CMD_CTX, "stm32f2x options_read <bank>");
|
command_print(CMD, "stm32f2x options_read <bank>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1572,20 +1572,20 @@ COMMAND_HANDLER(stm32f2x_handle_options_read_command)
|
||||||
if (stm32x_info->has_boot_addr) {
|
if (stm32x_info->has_boot_addr) {
|
||||||
uint32_t boot_addr = stm32x_info->option_bytes.boot_addr;
|
uint32_t boot_addr = stm32x_info->option_bytes.boot_addr;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32f2x user_options 0x%03X,"
|
command_print(CMD, "stm32f2x user_options 0x%03X,"
|
||||||
" boot_add0 0x%04X, boot_add1 0x%04X",
|
" boot_add0 0x%04X, boot_add1 0x%04X",
|
||||||
stm32x_info->option_bytes.user_options,
|
stm32x_info->option_bytes.user_options,
|
||||||
boot_addr & 0xffff, (boot_addr & 0xffff0000) >> 16);
|
boot_addr & 0xffff, (boot_addr & 0xffff0000) >> 16);
|
||||||
if (stm32x_info->has_optcr2_pcrop) {
|
if (stm32x_info->has_optcr2_pcrop) {
|
||||||
command_print(CMD_CTX, "stm32f2x optcr2_pcrop 0x%08X",
|
command_print(CMD, "stm32f2x optcr2_pcrop 0x%08X",
|
||||||
stm32x_info->option_bytes.optcr2_pcrop);
|
stm32x_info->option_bytes.optcr2_pcrop);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32f2x user_options 0x%03X",
|
command_print(CMD, "stm32f2x user_options 0x%03X",
|
||||||
stm32x_info->option_bytes.user_options);
|
stm32x_info->option_bytes.user_options);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32f2x user_options 0x%02X",
|
command_print(CMD, "stm32f2x user_options 0x%02X",
|
||||||
stm32x_info->option_bytes.user_options);
|
stm32x_info->option_bytes.user_options);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1601,7 +1601,7 @@ COMMAND_HANDLER(stm32f2x_handle_options_write_command)
|
||||||
uint16_t user_options, boot_addr0, boot_addr1, options_mask;
|
uint16_t user_options, boot_addr0, boot_addr1, options_mask;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "stm32f2x options_write <bank> ...");
|
command_print(CMD, "stm32f2x options_write <bank> ...");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1616,7 +1616,7 @@ COMMAND_HANDLER(stm32f2x_handle_options_write_command)
|
||||||
stm32x_info = bank->driver_priv;
|
stm32x_info = bank->driver_priv;
|
||||||
if (stm32x_info->has_boot_addr) {
|
if (stm32x_info->has_boot_addr) {
|
||||||
if (CMD_ARGC != 4) {
|
if (CMD_ARGC != 4) {
|
||||||
command_print(CMD_CTX, "stm32f2x options_write <bank> <user_options>"
|
command_print(CMD, "stm32f2x options_write <bank> <user_options>"
|
||||||
" <boot_addr0> <boot_addr1>");
|
" <boot_addr0> <boot_addr1>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1625,7 +1625,7 @@ COMMAND_HANDLER(stm32f2x_handle_options_write_command)
|
||||||
stm32x_info->option_bytes.boot_addr = boot_addr0 | (((uint32_t) boot_addr1) << 16);
|
stm32x_info->option_bytes.boot_addr = boot_addr0 | (((uint32_t) boot_addr1) << 16);
|
||||||
} else {
|
} else {
|
||||||
if (CMD_ARGC != 2) {
|
if (CMD_ARGC != 2) {
|
||||||
command_print(CMD_CTX, "stm32f2x options_write <bank> <user_options>");
|
command_print(CMD, "stm32f2x options_write <bank> <user_options>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1634,14 +1634,14 @@ COMMAND_HANDLER(stm32f2x_handle_options_write_command)
|
||||||
options_mask = !stm32x_info->has_extra_options ? ~0xfc :
|
options_mask = !stm32x_info->has_extra_options ? ~0xfc :
|
||||||
~(((0xf00 << (stm32x_info->protection_bits - 12)) | 0xff) & 0xffc);
|
~(((0xf00 << (stm32x_info->protection_bits - 12)) | 0xff) & 0xffc);
|
||||||
if (user_options & options_mask) {
|
if (user_options & options_mask) {
|
||||||
command_print(CMD_CTX, "stm32f2x invalid user_options");
|
command_print(CMD, "stm32f2x invalid user_options");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
stm32x_info->option_bytes.user_options = user_options;
|
stm32x_info->option_bytes.user_options = user_options;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32f2x failed to write options");
|
command_print(CMD, "stm32f2x failed to write options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1649,7 +1649,7 @@ COMMAND_HANDLER(stm32f2x_handle_options_write_command)
|
||||||
/* ... and reprogramming of whole flash */
|
/* ... and reprogramming of whole flash */
|
||||||
stm32x_info->probed = false;
|
stm32x_info->probed = false;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32f2x write options complete.\n"
|
command_print(CMD, "stm32f2x write options complete.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1663,7 +1663,7 @@ COMMAND_HANDLER(stm32f2x_handle_optcr2_write_command)
|
||||||
uint32_t optcr2_pcrop;
|
uint32_t optcr2_pcrop;
|
||||||
|
|
||||||
if (CMD_ARGC != 2) {
|
if (CMD_ARGC != 2) {
|
||||||
command_print(CMD_CTX, "stm32f2x optcr2_write <bank> <optcr2_value>");
|
command_print(CMD, "stm32f2x optcr2_write <bank> <optcr2_value>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1673,11 +1673,11 @@ COMMAND_HANDLER(stm32f2x_handle_optcr2_write_command)
|
||||||
|
|
||||||
stm32x_info = bank->driver_priv;
|
stm32x_info = bank->driver_priv;
|
||||||
if (!stm32x_info->has_optcr2_pcrop) {
|
if (!stm32x_info->has_optcr2_pcrop) {
|
||||||
command_print(CMD_CTX, "no optcr2 register");
|
command_print(CMD, "no optcr2 register");
|
||||||
return ERROR_COMMAND_ARGUMENT_INVALID;
|
return ERROR_COMMAND_ARGUMENT_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "INFO: To disable PCROP, set PCROP_RDP"
|
command_print(CMD, "INFO: To disable PCROP, set PCROP_RDP"
|
||||||
" with PCROPi bits STILL SET, then\nlock device and"
|
" with PCROPi bits STILL SET, then\nlock device and"
|
||||||
" finally unlock it. Clears PCROP and mass erases flash.");
|
" finally unlock it. Clears PCROP and mass erases flash.");
|
||||||
|
|
||||||
|
@ -1689,18 +1689,18 @@ COMMAND_HANDLER(stm32f2x_handle_optcr2_write_command)
|
||||||
stm32x_info->option_bytes.optcr2_pcrop = optcr2_pcrop;
|
stm32x_info->option_bytes.optcr2_pcrop = optcr2_pcrop;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "stm32f2x failed to write options");
|
command_print(CMD, "stm32f2x failed to write options");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32f2x optcr2_write complete.");
|
command_print(CMD, "stm32f2x optcr2_write complete.");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_HANDLER(stm32x_handle_otp_command)
|
COMMAND_HANDLER(stm32x_handle_otp_command)
|
||||||
{
|
{
|
||||||
if (CMD_ARGC < 2) {
|
if (CMD_ARGC < 2) {
|
||||||
command_print(CMD_CTX, "stm32x otp <bank> (enable|disable|show)");
|
command_print(CMD, "stm32x otp <bank> (enable|disable|show)");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1714,7 +1714,7 @@ COMMAND_HANDLER(stm32x_handle_otp_command)
|
||||||
} else if (strcmp(CMD_ARGV[1], "disable") == 0) {
|
} else if (strcmp(CMD_ARGV[1], "disable") == 0) {
|
||||||
stm32x_otp_disable(bank);
|
stm32x_otp_disable(bank);
|
||||||
} else if (strcmp(CMD_ARGV[1], "show") == 0) {
|
} else if (strcmp(CMD_ARGV[1], "show") == 0) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"OTP memory bank #%d is %s for write commands.",
|
"OTP memory bank #%d is %s for write commands.",
|
||||||
bank->bank_number,
|
bank->bank_number,
|
||||||
stm32x_is_otp_unlocked(bank) ? "enabled" : "disabled");
|
stm32x_is_otp_unlocked(bank) ? "enabled" : "disabled");
|
||||||
|
@ -1722,7 +1722,7 @@ COMMAND_HANDLER(stm32x_handle_otp_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Failed: not an OTP bank.");
|
command_print(CMD, "Failed: not an OTP bank.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -952,7 +952,7 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_read_options(bank) != ERROR_OK) {
|
if (stm32x_read_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to read options",
|
command_print(CMD, "%s failed to read options",
|
||||||
bank->driver->name);
|
bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -960,11 +960,11 @@ COMMAND_HANDLER(stm32x_handle_lock_command)
|
||||||
stm32x_info->option_bytes.RDP = 0;
|
stm32x_info->option_bytes.RDP = 0;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to lock device",
|
command_print(CMD, "%s failed to lock device",
|
||||||
bank->driver->name);
|
bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%s locked", bank->driver->name);
|
command_print(CMD, "%s locked", bank->driver->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -998,7 +998,7 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32x_read_options(bank) != ERROR_OK) {
|
if (stm32x_read_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to read options", bank->driver->name);
|
command_print(CMD, "%s failed to read options", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,10 +1007,10 @@ COMMAND_HANDLER(stm32x_handle_unlock_command)
|
||||||
stm32x_info->option_bytes.RDP = 0xAA;
|
stm32x_info->option_bytes.RDP = 0xAA;
|
||||||
|
|
||||||
if (stm32x_write_options(bank) != ERROR_OK) {
|
if (stm32x_write_options(bank) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to unlock device", bank->driver->name);
|
command_print(CMD, "%s failed to unlock device", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%s unlocked.\n", bank->driver->name);
|
command_print(CMD, "%s unlocked.\n", bank->driver->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1056,7 +1056,7 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "stm32h7x mass_erase <bank>");
|
command_print(CMD, "stm32h7x mass_erase <bank>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1071,9 +1071,9 @@ COMMAND_HANDLER(stm32x_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32h7x mass erase complete");
|
command_print(CMD, "stm32h7x mass erase complete");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32h7x mass erase failed");
|
command_print(CMD, "stm32h7x mass erase failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -835,7 +835,7 @@ COMMAND_HANDLER(stm32l4_handle_mass_erase_command)
|
||||||
uint32_t action;
|
uint32_t action;
|
||||||
|
|
||||||
if (CMD_ARGC < 1) {
|
if (CMD_ARGC < 1) {
|
||||||
command_print(CMD_CTX, "stm32l4x mass_erase <STM32L4 bank>");
|
command_print(CMD, "stm32l4x mass_erase <STM32L4 bank>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -851,9 +851,9 @@ COMMAND_HANDLER(stm32l4_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32l4x mass erase complete");
|
command_print(CMD, "stm32l4x mass erase complete");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32l4x mass erase failed");
|
command_print(CMD, "stm32l4x mass erase failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -862,7 +862,7 @@ COMMAND_HANDLER(stm32l4_handle_mass_erase_command)
|
||||||
COMMAND_HANDLER(stm32l4_handle_option_read_command)
|
COMMAND_HANDLER(stm32l4_handle_option_read_command)
|
||||||
{
|
{
|
||||||
if (CMD_ARGC < 2) {
|
if (CMD_ARGC < 2) {
|
||||||
command_print(CMD_CTX, "stm32l4x option_read <STM32L4 bank> <option_reg offset>");
|
command_print(CMD, "stm32l4x option_read <STM32L4 bank> <option_reg offset>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -880,7 +880,7 @@ COMMAND_HANDLER(stm32l4_handle_option_read_command)
|
||||||
if (ERROR_OK != retval)
|
if (ERROR_OK != retval)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Option Register: <0x%" PRIx32 "> = 0x%" PRIx32 "", reg_addr, value);
|
command_print(CMD, "Option Register: <0x%" PRIx32 "> = 0x%" PRIx32 "", reg_addr, value);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -888,7 +888,7 @@ COMMAND_HANDLER(stm32l4_handle_option_read_command)
|
||||||
COMMAND_HANDLER(stm32l4_handle_option_write_command)
|
COMMAND_HANDLER(stm32l4_handle_option_write_command)
|
||||||
{
|
{
|
||||||
if (CMD_ARGC < 3) {
|
if (CMD_ARGC < 3) {
|
||||||
command_print(CMD_CTX, "stm32l4x option_write <STM32L4 bank> <option_reg offset> <value> [mask]");
|
command_print(CMD, "stm32l4x option_write <STM32L4 bank> <option_reg offset> <value> [mask]");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -906,7 +906,7 @@ COMMAND_HANDLER(stm32l4_handle_option_write_command)
|
||||||
if (CMD_ARGC > 3)
|
if (CMD_ARGC > 3)
|
||||||
mask = strtoul(CMD_ARGV[3], NULL, 16);
|
mask = strtoul(CMD_ARGV[3], NULL, 16);
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s Option written.\n"
|
command_print(CMD, "%s Option written.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.", bank->driver->name);
|
"for the new settings to take effect.", bank->driver->name);
|
||||||
|
|
||||||
|
@ -937,7 +937,7 @@ COMMAND_HANDLER(stm32l4_handle_option_load_command)
|
||||||
/* Write the OBLLAUNCH bit in CR -> Cause device "POR" and option bytes reload */
|
/* Write the OBLLAUNCH bit in CR -> Cause device "POR" and option bytes reload */
|
||||||
retval = target_write_u32(target, stm32l4_get_flash_reg(bank, STM32_FLASH_CR), FLASH_OBLLAUNCH);
|
retval = target_write_u32(target, stm32l4_get_flash_reg(bank, STM32_FLASH_CR), FLASH_OBLLAUNCH);
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32l4x option load (POR) completed.");
|
command_print(CMD, "stm32l4x option load (POR) completed.");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -962,7 +962,7 @@ COMMAND_HANDLER(stm32l4_handle_lock_command)
|
||||||
|
|
||||||
/* set readout protection level 1 by erasing the RDP option byte */
|
/* set readout protection level 1 by erasing the RDP option byte */
|
||||||
if (stm32l4_write_option(bank, STM32_FLASH_OPTR, 0, 0x000000FF) != ERROR_OK) {
|
if (stm32l4_write_option(bank, STM32_FLASH_OPTR, 0, 0x000000FF) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to lock device", bank->driver->name);
|
command_print(CMD, "%s failed to lock device", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -989,7 +989,7 @@ COMMAND_HANDLER(stm32l4_handle_unlock_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (stm32l4_write_option(bank, STM32_FLASH_OPTR, RDP_LEVEL_0, 0x000000FF) != ERROR_OK) {
|
if (stm32l4_write_option(bank, STM32_FLASH_OPTR, RDP_LEVEL_0, 0x000000FF) != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s failed to unlock device", bank->driver->name);
|
command_print(CMD, "%s failed to unlock device", bank->driver->name);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -324,9 +324,9 @@ COMMAND_HANDLER(stm32lx_handle_mass_erase_command)
|
||||||
for (i = 0; i < bank->num_sectors; i++)
|
for (i = 0; i < bank->num_sectors; i++)
|
||||||
bank->sectors[i].is_erased = 1;
|
bank->sectors[i].is_erased = 1;
|
||||||
|
|
||||||
command_print(CMD_CTX, "stm32lx mass erase complete");
|
command_print(CMD, "stm32lx mass erase complete");
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "stm32lx mass erase failed");
|
command_print(CMD, "stm32lx mass erase failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -345,9 +345,9 @@ COMMAND_HANDLER(stm32lx_handle_lock_command)
|
||||||
retval = stm32lx_lock(bank);
|
retval = stm32lx_lock(bank);
|
||||||
|
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "STM32Lx locked, takes effect after power cycle.");
|
command_print(CMD, "STM32Lx locked, takes effect after power cycle.");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "STM32Lx lock failed");
|
command_print(CMD, "STM32Lx lock failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -365,9 +365,9 @@ COMMAND_HANDLER(stm32lx_handle_unlock_command)
|
||||||
retval = stm32lx_unlock(bank);
|
retval = stm32lx_unlock(bank);
|
||||||
|
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "STM32Lx unlocked, takes effect after power cycle.");
|
command_print(CMD, "STM32Lx unlocked, takes effect after power cycle.");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "STM32Lx unlock failed");
|
command_print(CMD, "STM32Lx unlock failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
|
@ -746,7 +746,7 @@ COMMAND_HANDLER(str9xpec_handle_part_id_command)
|
||||||
|
|
||||||
idcode = buf_get_u32(buffer, 0, 32);
|
idcode = buf_get_u32(buffer, 0, 32);
|
||||||
|
|
||||||
command_print(CMD_CTX, "str9xpec part id: 0x%8.8" PRIx32 "", idcode);
|
command_print(CMD, "str9xpec part id: 0x%8.8" PRIx32 "", idcode);
|
||||||
|
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
|
@ -780,33 +780,33 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_read_command)
|
||||||
|
|
||||||
/* boot bank */
|
/* boot bank */
|
||||||
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_CSMAPBIT, 1))
|
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_CSMAPBIT, 1))
|
||||||
command_print(CMD_CTX, "CS Map: bank1");
|
command_print(CMD, "CS Map: bank1");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "CS Map: bank0");
|
command_print(CMD, "CS Map: bank0");
|
||||||
|
|
||||||
/* OTP lock */
|
/* OTP lock */
|
||||||
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_OTPBIT, 1))
|
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_OTPBIT, 1))
|
||||||
command_print(CMD_CTX, "OTP Lock: OTP Locked");
|
command_print(CMD, "OTP Lock: OTP Locked");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "OTP Lock: OTP Unlocked");
|
command_print(CMD, "OTP Lock: OTP Unlocked");
|
||||||
|
|
||||||
/* LVD Threshold */
|
/* LVD Threshold */
|
||||||
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDTHRESBIT, 1))
|
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDTHRESBIT, 1))
|
||||||
command_print(CMD_CTX, "LVD Threshold: 2.7v");
|
command_print(CMD, "LVD Threshold: 2.7v");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "LVD Threshold: 2.4v");
|
command_print(CMD, "LVD Threshold: 2.4v");
|
||||||
|
|
||||||
/* LVD reset warning */
|
/* LVD reset warning */
|
||||||
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDWARNBIT, 1))
|
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDWARNBIT, 1))
|
||||||
command_print(CMD_CTX, "LVD Reset Warning: VDD or VDDQ Inputs");
|
command_print(CMD, "LVD Reset Warning: VDD or VDDQ Inputs");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "LVD Reset Warning: VDD Input Only");
|
command_print(CMD, "LVD Reset Warning: VDD Input Only");
|
||||||
|
|
||||||
/* LVD reset select */
|
/* LVD reset select */
|
||||||
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDSELBIT, 1))
|
if (buf_get_u32(str9xpec_info->options, STR9XPEC_OPT_LVDSELBIT, 1))
|
||||||
command_print(CMD_CTX, "LVD Reset Selection: VDD or VDDQ Inputs");
|
command_print(CMD, "LVD Reset Selection: VDD or VDDQ Inputs");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "LVD Reset Selection: VDD Input Only");
|
command_print(CMD, "LVD Reset Selection: VDD Input Only");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -885,7 +885,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_options_write_command)
|
||||||
if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
|
if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
|
||||||
return ERROR_FLASH_OPERATION_FAILED;
|
return ERROR_FLASH_OPERATION_FAILED;
|
||||||
|
|
||||||
command_print(CMD_CTX, "str9xpec write options complete.\n"
|
command_print(CMD, "str9xpec write options complete.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
|
|
||||||
|
@ -1017,7 +1017,7 @@ COMMAND_HANDLER(str9xpec_handle_flash_unlock_command)
|
||||||
if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
|
if ((status & ISC_STATUS_ERROR) != STR9XPEC_ISC_SUCCESS)
|
||||||
return ERROR_FLASH_OPERATION_FAILED;
|
return ERROR_FLASH_OPERATION_FAILED;
|
||||||
|
|
||||||
command_print(CMD_CTX, "str9xpec unlocked.\n"
|
command_print(CMD, "str9xpec unlocked.\n"
|
||||||
"INFO: a reset or power cycle is required "
|
"INFO: a reset or power cycle is required "
|
||||||
"for the new settings to take effect.");
|
"for the new settings to take effect.");
|
||||||
|
|
||||||
|
@ -1045,19 +1045,19 @@ COMMAND_HANDLER(str9xpec_handle_flash_enable_turbo_command)
|
||||||
tap0 = str9xpec_info->tap;
|
tap0 = str9xpec_info->tap;
|
||||||
if (tap0 == NULL) {
|
if (tap0 == NULL) {
|
||||||
/* things are *WRONG* */
|
/* things are *WRONG* */
|
||||||
command_print(CMD_CTX, "**STR9FLASH** (tap0) invalid chain?");
|
command_print(CMD, "**STR9FLASH** (tap0) invalid chain?");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
tap1 = tap0->next_tap;
|
tap1 = tap0->next_tap;
|
||||||
if (tap1 == NULL) {
|
if (tap1 == NULL) {
|
||||||
/* things are *WRONG* */
|
/* things are *WRONG* */
|
||||||
command_print(CMD_CTX, "**STR9FLASH** (tap1) invalid chain?");
|
command_print(CMD, "**STR9FLASH** (tap1) invalid chain?");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
tap2 = tap1->next_tap;
|
tap2 = tap1->next_tap;
|
||||||
if (tap2 == NULL) {
|
if (tap2 == NULL) {
|
||||||
/* things are *WRONG* */
|
/* things are *WRONG* */
|
||||||
command_print(CMD_CTX, "**STR9FLASH** (tap2) invalid chain?");
|
command_print(CMD, "**STR9FLASH** (tap2) invalid chain?");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -111,7 +111,7 @@ COMMAND_HANDLER(handle_flash_info_command)
|
||||||
if (retval == ERROR_FLASH_OPER_UNSUPPORTED)
|
if (retval == ERROR_FLASH_OPER_UNSUPPORTED)
|
||||||
LOG_WARNING("Flash protection check is not implemented.");
|
LOG_WARNING("Flash protection check is not implemented.");
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"#%d : %s at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32
|
"#%d : %s at " TARGET_ADDR_FMT ", size 0x%8.8" PRIx32
|
||||||
", buswidth %i, chipwidth %i",
|
", buswidth %i, chipwidth %i",
|
||||||
p->bank_number,
|
p->bank_number,
|
||||||
|
@ -140,7 +140,7 @@ COMMAND_HANDLER(handle_flash_info_command)
|
||||||
else if (!show_sectors || !prot_block_available)
|
else if (!show_sectors || !prot_block_available)
|
||||||
protect_state = "protection state unknown";
|
protect_state = "protection state unknown";
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
|
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
|
||||||
j,
|
j,
|
||||||
block_array[j].offset,
|
block_array[j].offset,
|
||||||
|
@ -152,7 +152,7 @@ COMMAND_HANDLER(handle_flash_info_command)
|
||||||
if (p->driver->info != NULL) {
|
if (p->driver->info != NULL) {
|
||||||
retval = p->driver->info(p, buf, sizeof(buf));
|
retval = p->driver->info(p, buf, sizeof(buf));
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "%s", buf);
|
command_print(CMD, "%s", buf);
|
||||||
else
|
else
|
||||||
LOG_ERROR("error retrieving flash info");
|
LOG_ERROR("error retrieving flash info");
|
||||||
}
|
}
|
||||||
|
@ -176,12 +176,12 @@ COMMAND_HANDLER(handle_flash_probe_command)
|
||||||
if (p) {
|
if (p) {
|
||||||
retval = p->driver->probe(p);
|
retval = p->driver->probe(p);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"flash '%s' found at " TARGET_ADDR_FMT,
|
"flash '%s' found at " TARGET_ADDR_FMT,
|
||||||
p->driver->name,
|
p->driver->name,
|
||||||
p->base);
|
p->base);
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "flash bank '#%s' is out of bounds", CMD_ARGV[0]);
|
command_print(CMD, "flash bank '#%s' is out of bounds", CMD_ARGV[0]);
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,9 +202,9 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
|
||||||
int j;
|
int j;
|
||||||
retval = p->driver->erase_check(p);
|
retval = p->driver->erase_check(p);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "successfully checked erase state");
|
command_print(CMD, "successfully checked erase state");
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"unknown error when checking erase state of flash bank #%s at "
|
"unknown error when checking erase state of flash bank #%s at "
|
||||||
TARGET_ADDR_FMT,
|
TARGET_ADDR_FMT,
|
||||||
CMD_ARGV[0],
|
CMD_ARGV[0],
|
||||||
|
@ -222,7 +222,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
|
||||||
erase_state = "erase state unknown";
|
erase_state = "erase state unknown";
|
||||||
|
|
||||||
blank = false;
|
blank = false;
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
|
"\t#%3i: 0x%8.8" PRIx32 " (0x%" PRIx32 " %" PRIi32 "kB) %s",
|
||||||
j,
|
j,
|
||||||
p->sectors[j].offset,
|
p->sectors[j].offset,
|
||||||
|
@ -232,7 +232,7 @@ COMMAND_HANDLER(handle_flash_erase_check_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (blank)
|
if (blank)
|
||||||
command_print(CMD_CTX, "\tBank is erased");
|
command_print(CMD, "\tBank is erased");
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -267,7 +267,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], length);
|
||||||
|
|
||||||
if (length <= 0) {
|
if (length <= 0) {
|
||||||
command_print(CMD_CTX, "Length must be >0");
|
command_print(CMD, "Length must be >0");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -289,7 +289,7 @@ COMMAND_HANDLER(handle_flash_erase_address_command)
|
||||||
retval = flash_erase_address_range(target, do_pad, address, length);
|
retval = flash_erase_address_range(target, do_pad, address, length);
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "erased address " TARGET_ADDR_FMT " (length %"
|
command_print(CMD, "erased address " TARGET_ADDR_FMT " (length %"
|
||||||
PRIi32 ")"
|
PRIi32 ")"
|
||||||
" in %fs (%0.3f KiB/s)", address, length,
|
" in %fs (%0.3f KiB/s)", address, length,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, length));
|
duration_elapsed(&bench), duration_kbps(&bench, length));
|
||||||
|
@ -320,13 +320,13 @@ COMMAND_HANDLER(handle_flash_erase_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], last);
|
||||||
|
|
||||||
if (!(first <= last)) {
|
if (!(first <= last)) {
|
||||||
command_print(CMD_CTX, "ERROR: "
|
command_print(CMD, "ERROR: "
|
||||||
"first sector must be <= last");
|
"first sector must be <= last");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(last <= (uint32_t)(p->num_sectors - 1))) {
|
if (!(last <= (uint32_t)(p->num_sectors - 1))) {
|
||||||
command_print(CMD_CTX, "ERROR: "
|
command_print(CMD, "ERROR: "
|
||||||
"last sector must be <= %" PRIu32,
|
"last sector must be <= %" PRIu32,
|
||||||
p->num_sectors - 1);
|
p->num_sectors - 1);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -338,7 +338,7 @@ COMMAND_HANDLER(handle_flash_erase_command)
|
||||||
retval = flash_driver_erase(p, first, last);
|
retval = flash_driver_erase(p, first, last);
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "erased sectors %" PRIu32 " "
|
command_print(CMD, "erased sectors %" PRIu32 " "
|
||||||
"through %" PRIu32 " on flash bank %d "
|
"through %" PRIu32 " on flash bank %d "
|
||||||
"in %fs", first, last, p->bank_number, duration_elapsed(&bench));
|
"in %fs", first, last, p->bank_number, duration_elapsed(&bench));
|
||||||
}
|
}
|
||||||
|
@ -377,14 +377,14 @@ COMMAND_HANDLER(handle_flash_protect_command)
|
||||||
COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set);
|
COMMAND_PARSE_ON_OFF(CMD_ARGV[3], set);
|
||||||
|
|
||||||
if (!(first <= last)) {
|
if (!(first <= last)) {
|
||||||
command_print(CMD_CTX, "ERROR: "
|
command_print(CMD, "ERROR: "
|
||||||
"first %s must be <= last",
|
"first %s must be <= last",
|
||||||
(p->num_prot_blocks) ? "block" : "sector");
|
(p->num_prot_blocks) ? "block" : "sector");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(last <= (uint32_t)(num_blocks - 1))) {
|
if (!(last <= (uint32_t)(num_blocks - 1))) {
|
||||||
command_print(CMD_CTX, "ERROR: "
|
command_print(CMD, "ERROR: "
|
||||||
"last %s must be <= %" PRIu32,
|
"last %s must be <= %" PRIu32,
|
||||||
(p->num_prot_blocks) ? "block" : "sector",
|
(p->num_prot_blocks) ? "block" : "sector",
|
||||||
num_blocks - 1);
|
num_blocks - 1);
|
||||||
|
@ -393,7 +393,7 @@ COMMAND_HANDLER(handle_flash_protect_command)
|
||||||
|
|
||||||
retval = flash_driver_protect(p, set, first, last);
|
retval = flash_driver_protect(p, set, first, last);
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s protection for %s %" PRIu32
|
command_print(CMD, "%s protection for %s %" PRIu32
|
||||||
" through %" PRIu32 " on flash bank %d",
|
" through %" PRIu32 " on flash bank %d",
|
||||||
(set) ? "set" : "cleared",
|
(set) ? "set" : "cleared",
|
||||||
(p->num_prot_blocks) ? "blocks" : "sectors",
|
(p->num_prot_blocks) ? "blocks" : "sectors",
|
||||||
|
@ -421,12 +421,12 @@ COMMAND_HANDLER(handle_flash_write_image_command)
|
||||||
auto_erase = 1;
|
auto_erase = 1;
|
||||||
CMD_ARGV++;
|
CMD_ARGV++;
|
||||||
CMD_ARGC--;
|
CMD_ARGC--;
|
||||||
command_print(CMD_CTX, "auto erase enabled");
|
command_print(CMD, "auto erase enabled");
|
||||||
} else if (strcmp(CMD_ARGV[0], "unlock") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "unlock") == 0) {
|
||||||
auto_unlock = true;
|
auto_unlock = true;
|
||||||
CMD_ARGV++;
|
CMD_ARGV++;
|
||||||
CMD_ARGC--;
|
CMD_ARGC--;
|
||||||
command_print(CMD_CTX, "auto unlock enabled");
|
command_print(CMD, "auto unlock enabled");
|
||||||
} else
|
} else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -463,7 +463,7 @@ COMMAND_HANDLER(handle_flash_write_image_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "wrote %" PRIu32 " bytes from file %s "
|
command_print(CMD, "wrote %" PRIu32 " bytes from file %s "
|
||||||
"in %fs (%0.3f KiB/s)", written, CMD_ARGV[0],
|
"in %fs (%0.3f KiB/s)", written, CMD_ARGV[0],
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, written));
|
duration_elapsed(&bench), duration_kbps(&bench, written));
|
||||||
}
|
}
|
||||||
|
@ -602,7 +602,7 @@ COMMAND_HANDLER(handle_flash_fill_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((retval == ERROR_OK) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "wrote %" PRIu32 " bytes to " TARGET_ADDR_FMT
|
command_print(CMD, "wrote %" PRIu32 " bytes to " TARGET_ADDR_FMT
|
||||||
" in %fs (%0.3f KiB/s)", size_bytes, address,
|
" in %fs (%0.3f KiB/s)", size_bytes, address,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, size_bytes));
|
duration_elapsed(&bench), duration_kbps(&bench, size_bytes));
|
||||||
}
|
}
|
||||||
|
@ -716,7 +716,7 @@ COMMAND_HANDLER(handle_flash_write_bank_command)
|
||||||
free(buffer);
|
free(buffer);
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "wrote %zu bytes from file %s to flash bank %u"
|
command_print(CMD, "wrote %zu bytes from file %s to flash bank %u"
|
||||||
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
||||||
length, CMD_ARGV[1], bank->bank_number, offset,
|
length, CMD_ARGV[1], bank->bank_number, offset,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, length));
|
duration_elapsed(&bench), duration_kbps(&bench, length));
|
||||||
|
@ -798,7 +798,7 @@ COMMAND_HANDLER(handle_flash_read_bank_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration_measure(&bench) == ERROR_OK)
|
if (duration_measure(&bench) == ERROR_OK)
|
||||||
command_print(CMD_CTX, "wrote %zd bytes to file %s from flash bank %u"
|
command_print(CMD, "wrote %zd bytes to file %s from flash bank %u"
|
||||||
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
||||||
written, CMD_ARGV[1], p->bank_number, offset,
|
written, CMD_ARGV[1], p->bank_number, offset,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, written));
|
duration_elapsed(&bench), duration_kbps(&bench, written));
|
||||||
|
@ -900,23 +900,23 @@ COMMAND_HANDLER(handle_flash_verify_bank_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (duration_measure(&bench) == ERROR_OK)
|
if (duration_measure(&bench) == ERROR_OK)
|
||||||
command_print(CMD_CTX, "read %zd bytes from file %s and flash bank %u"
|
command_print(CMD, "read %zd bytes from file %s and flash bank %u"
|
||||||
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
" at offset 0x%8.8" PRIx32 " in %fs (%0.3f KiB/s)",
|
||||||
length, CMD_ARGV[1], p->bank_number, offset,
|
length, CMD_ARGV[1], p->bank_number, offset,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, length));
|
duration_elapsed(&bench), duration_kbps(&bench, length));
|
||||||
|
|
||||||
differ = memcmp(buffer_file, buffer_flash, length);
|
differ = memcmp(buffer_file, buffer_flash, length);
|
||||||
command_print(CMD_CTX, "contents %s", differ ? "differ" : "match");
|
command_print(CMD, "contents %s", differ ? "differ" : "match");
|
||||||
if (differ) {
|
if (differ) {
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
int diffs = 0;
|
int diffs = 0;
|
||||||
for (t = 0; t < length; t++) {
|
for (t = 0; t < length; t++) {
|
||||||
if (buffer_flash[t] == buffer_file[t])
|
if (buffer_flash[t] == buffer_file[t])
|
||||||
continue;
|
continue;
|
||||||
command_print(CMD_CTX, "diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
|
command_print(CMD, "diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
|
||||||
diffs, t + offset, buffer_flash[t], buffer_file[t]);
|
diffs, t + offset, buffer_flash[t], buffer_file[t]);
|
||||||
if (diffs++ >= 127) {
|
if (diffs++ >= 127) {
|
||||||
command_print(CMD_CTX, "More than 128 errors, the rest are not printed.");
|
command_print(CMD, "More than 128 errors, the rest are not printed.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
keep_alive();
|
keep_alive();
|
||||||
|
@ -952,7 +952,7 @@ COMMAND_HANDLER(handle_flash_padded_value_command)
|
||||||
|
|
||||||
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], p->default_padded_value);
|
COMMAND_PARSE_NUMBER(u8, CMD_ARGV[1], p->default_padded_value);
|
||||||
|
|
||||||
command_print(CMD_CTX, "Default padded value set to 0x%" PRIx8 " for flash bank %u", \
|
command_print(CMD, "Default padded value set to 0x%" PRIx8 " for flash bank %u", \
|
||||||
p->default_padded_value, p->bank_number);
|
p->default_padded_value, p->bank_number);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
|
|
@ -301,7 +301,7 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
|
||||||
int start = (0 == strncmp(CMD_ARGV[i], "0x", 2)) ? 2 : 0;
|
int start = (0 == strncmp(CMD_ARGV[i], "0x", 2)) ? 2 : 0;
|
||||||
|
|
||||||
if (1 != sscanf(&CMD_ARGV[i][start], "%" SCNx32 "", &flashKeys[i])) {
|
if (1 != sscanf(&CMD_ARGV[i][start], "%" SCNx32 "", &flashKeys[i])) {
|
||||||
command_print(CMD_CTX, "could not process flash key %s",
|
command_print(CMD, "could not process flash key %s",
|
||||||
CMD_ARGV[i]);
|
CMD_ARGV[i]);
|
||||||
LOG_ERROR("could not process flash key %s", CMD_ARGV[i]);
|
LOG_ERROR("could not process flash key %s", CMD_ARGV[i]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
@ -310,19 +310,19 @@ COMMAND_HANDLER(tms470_handle_flash_keyset_command)
|
||||||
|
|
||||||
keysSet = 1;
|
keysSet = 1;
|
||||||
} else if (CMD_ARGC != 0) {
|
} else if (CMD_ARGC != 0) {
|
||||||
command_print(CMD_CTX, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
|
command_print(CMD, "tms470 flash_keyset <key0> <key1> <key2> <key3>");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (keysSet) {
|
if (keysSet) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "",
|
"using flash keys 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 ", 0x%08" PRIx32 "",
|
||||||
flashKeys[0],
|
flashKeys[0],
|
||||||
flashKeys[1],
|
flashKeys[1],
|
||||||
flashKeys[2],
|
flashKeys[2],
|
||||||
flashKeys[3]);
|
flashKeys[3]);
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "flash keys not set");
|
command_print(CMD, "flash keys not set");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -352,12 +352,12 @@ COMMAND_HANDLER(tms470_handle_osc_megahertz_command)
|
||||||
|
|
||||||
if (oscMHz <= 0) {
|
if (oscMHz <= 0) {
|
||||||
LOG_ERROR("osc_megahertz must be positive and non-zero!");
|
LOG_ERROR("osc_megahertz must be positive and non-zero!");
|
||||||
command_print(CMD_CTX, "osc_megahertz must be positive and non-zero!");
|
command_print(CMD, "osc_megahertz must be positive and non-zero!");
|
||||||
oscMHz = 12;
|
oscMHz = 12;
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "osc_megahertz=%d", oscMHz);
|
command_print(CMD, "osc_megahertz=%d", oscMHz);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -375,7 +375,7 @@ COMMAND_HANDLER(tms470_handle_plldis_command)
|
||||||
plldis = plldis ? 1 : 0;
|
plldis = plldis ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "plldis=%d", plldis);
|
command_print(CMD, "plldis=%d", plldis);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1284,9 +1284,9 @@ COMMAND_HANDLER(xmc4xxx_handle_flash_password_command)
|
||||||
|
|
||||||
fb->pw_set = true;
|
fb->pw_set = true;
|
||||||
|
|
||||||
command_print(CMD_CTX, "XMC4xxx flash passwords set to:\n");
|
command_print(CMD, "XMC4xxx flash passwords set to:\n");
|
||||||
command_print(CMD_CTX, "-0x%08"PRIx32"\n", fb->pw1);
|
command_print(CMD, "-0x%08"PRIx32"\n", fb->pw1);
|
||||||
command_print(CMD_CTX, "-0x%08"PRIx32"\n", fb->pw2);
|
command_print(CMD, "-0x%08"PRIx32"\n", fb->pw2);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -89,7 +89,7 @@ COMMAND_HANDLER(handle_hello_command)
|
||||||
const char *sep, *name;
|
const char *sep, *name;
|
||||||
int retval = CALL_COMMAND_HANDLER(handle_hello_args, &sep, &name);
|
int retval = CALL_COMMAND_HANDLER(handle_hello_args, &sep, &name);
|
||||||
if (ERROR_OK == retval)
|
if (ERROR_OK == retval)
|
||||||
command_print(CMD_CTX, "Greetings%s%s!", sep, name);
|
command_print(CMD, "Greetings%s%s!", sep, name);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -502,7 +502,7 @@ void command_output_text(struct command_context *context, const char *data)
|
||||||
context->output_handler(context, data);
|
context->output_handler(context, data);
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_print_sameline(struct command_context *context, const char *format, ...)
|
void command_print_sameline(struct command_invocation *cmd, const char *format, ...)
|
||||||
{
|
{
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ void command_print_sameline(struct command_context *context, const char *format,
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
}
|
}
|
||||||
|
|
||||||
void command_print(struct command_context *context, const char *format, ...)
|
void command_print(struct command_invocation *cmd, const char *format, ...)
|
||||||
{
|
{
|
||||||
char *string;
|
char *string;
|
||||||
|
|
||||||
|
|
|
@ -353,9 +353,9 @@ struct command_context *copy_command_context(struct command_context *cmd_ctx);
|
||||||
*/
|
*/
|
||||||
void command_done(struct command_context *context);
|
void command_done(struct command_context *context);
|
||||||
|
|
||||||
void command_print(struct command_context *context, const char *format, ...)
|
void command_print(struct command_invocation *cmd, const char *format, ...)
|
||||||
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
|
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
|
||||||
void command_print_sameline(struct command_context *context, const char *format, ...)
|
void command_print_sameline(struct command_invocation *cmd, const char *format, ...)
|
||||||
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
|
__attribute__ ((format (PRINTF_ATTRIBUTE_FORMAT, 2, 3)));
|
||||||
int command_run_line(struct command_context *context, char *line);
|
int command_run_line(struct command_context *context, char *line);
|
||||||
int command_run_linef(struct command_context *context, const char *format, ...)
|
int command_run_linef(struct command_context *context, const char *format, ...)
|
||||||
|
@ -409,7 +409,7 @@ DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
|
||||||
do { \
|
do { \
|
||||||
int retval_macro_tmp = parse_ ## type(in, &(out)); \
|
int retval_macro_tmp = parse_ ## type(in, &(out)); \
|
||||||
if (ERROR_OK != retval_macro_tmp) { \
|
if (ERROR_OK != retval_macro_tmp) { \
|
||||||
command_print(CMD_CTX, stringify(out) \
|
command_print(CMD, stringify(out) \
|
||||||
" option value ('%s') is not valid", in); \
|
" option value ('%s') is not valid", in); \
|
||||||
return retval_macro_tmp; \
|
return retval_macro_tmp; \
|
||||||
} \
|
} \
|
||||||
|
@ -429,9 +429,9 @@ DECLARE_PARSE_WRAPPER(_target_addr, target_addr_t);
|
||||||
bool value; \
|
bool value; \
|
||||||
int retval_macro_tmp = command_parse_bool_arg(in, &value); \
|
int retval_macro_tmp = command_parse_bool_arg(in, &value); \
|
||||||
if (ERROR_OK != retval_macro_tmp) { \
|
if (ERROR_OK != retval_macro_tmp) { \
|
||||||
command_print(CMD_CTX, stringify(out) \
|
command_print(CMD, stringify(out) \
|
||||||
" option value ('%s') is not valid", in); \
|
" option value ('%s') is not valid", in); \
|
||||||
command_print(CMD_CTX, " choices are '%s' or '%s'", \
|
command_print(CMD, " choices are '%s' or '%s'", \
|
||||||
on, off); \
|
on, off); \
|
||||||
return retval_macro_tmp; \
|
return retval_macro_tmp; \
|
||||||
} \
|
} \
|
||||||
|
|
|
@ -113,10 +113,10 @@ COMMAND_HANDLER(handle_cat_command)
|
||||||
|
|
||||||
int retval = load_file(CMD_ARGV[0], &data, &len);
|
int retval = load_file(CMD_ARGV[0], &data, &len);
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s", data);
|
command_print(CMD, "%s", data);
|
||||||
free(data);
|
free(data);
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "%s not found", CMD_ARGV[0]);
|
command_print(CMD, "%s not found", CMD_ARGV[0]);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -146,10 +146,10 @@ COMMAND_HANDLER(handle_meminfo_command)
|
||||||
info = mallinfo();
|
info = mallinfo();
|
||||||
|
|
||||||
if (prev > 0)
|
if (prev > 0)
|
||||||
command_print(CMD_CTX, "Diff: %d", prev - info.fordblks);
|
command_print(CMD, "Diff: %d", prev - info.fordblks);
|
||||||
prev = info.fordblks;
|
prev = info.fordblks;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Available ram: %d", info.fordblks);
|
command_print(CMD, "Available ram: %d", info.fordblks);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ COMMAND_HANDLER(handle_cp_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
command_print(CMD_CTX, "%zu", len - pos);
|
command_print(CMD, "%zu", len - pos);
|
||||||
|
|
||||||
pos += chunk;
|
pos += chunk;
|
||||||
|
|
||||||
|
@ -226,9 +226,9 @@ COMMAND_HANDLER(handle_cp_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]);
|
command_print(CMD, "Copied %s to %s", CMD_ARGV[0], CMD_ARGV[1]);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "copy failed");
|
command_print(CMD, "copy failed");
|
||||||
|
|
||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
free(data);
|
free(data);
|
||||||
|
|
|
@ -213,7 +213,7 @@ COMMAND_HANDLER(handle_debug_level_command)
|
||||||
} else if (CMD_ARGC > 1)
|
} else if (CMD_ARGC > 1)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX, "debug_level: %i", debug_level);
|
command_print(CMD, "debug_level: %i", debug_level);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,10 +114,10 @@ COMMAND_HANDLER(handle_interface_list_command)
|
||||||
if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0)
|
if (strcmp(CMD_NAME, "interface_list") == 0 && CMD_ARGC > 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX, "The following debug interfaces are available:");
|
command_print(CMD, "The following debug interfaces are available:");
|
||||||
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) {
|
for (unsigned i = 0; NULL != jtag_interfaces[i]; i++) {
|
||||||
const char *name = jtag_interfaces[i]->name;
|
const char *name = jtag_interfaces[i]->name;
|
||||||
command_print(CMD_CTX, "%u: %s", i + 1, name);
|
command_print(CMD, "%u: %s", i + 1, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -394,7 +394,7 @@ next:
|
||||||
modes[5] = "";
|
modes[5] = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s %s%s%s%s%s",
|
command_print(CMD, "%s %s%s%s%s%s",
|
||||||
modes[0], modes[1],
|
modes[0], modes[1],
|
||||||
modes[2], modes[3], modes[4], modes[5]);
|
modes[2], modes[3], modes[4], modes[5]);
|
||||||
|
|
||||||
|
@ -411,7 +411,7 @@ COMMAND_HANDLER(handle_adapter_nsrst_delay_command)
|
||||||
|
|
||||||
jtag_set_nsrst_delay(delay);
|
jtag_set_nsrst_delay(delay);
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "adapter_nsrst_delay: %u", jtag_get_nsrst_delay());
|
command_print(CMD, "adapter_nsrst_delay: %u", jtag_get_nsrst_delay());
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -425,7 +425,7 @@ COMMAND_HANDLER(handle_adapter_nsrst_assert_width_command)
|
||||||
|
|
||||||
jtag_set_nsrst_assert_width(width);
|
jtag_set_nsrst_assert_width(width);
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "adapter_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
|
command_print(CMD, "adapter_nsrst_assert_width: %u", jtag_get_nsrst_assert_width());
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -450,9 +450,9 @@ COMMAND_HANDLER(handle_adapter_khz_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (cur_speed)
|
if (cur_speed)
|
||||||
command_print(CMD_CTX, "adapter speed: %d kHz", cur_speed);
|
command_print(CMD, "adapter speed: %d kHz", cur_speed);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "adapter speed: RCLK - adaptive");
|
command_print(CMD, "adapter speed: RCLK - adaptive");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -464,7 +464,7 @@ COMMAND_HANDLER(handle_usb_location_command)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
jtag_usb_set_location(CMD_ARGV[0]);
|
jtag_usb_set_location(CMD_ARGV[0]);
|
||||||
|
|
||||||
command_print(CMD_CTX, "adapter usb location: %s", jtag_usb_get_location());
|
command_print(CMD, "adapter usb location: %s", jtag_usb_get_location());
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -269,10 +269,10 @@ COMMAND_HANDLER(aice_handle_aice_info_command)
|
||||||
{
|
{
|
||||||
LOG_DEBUG("aice_handle_aice_info_command");
|
LOG_DEBUG("aice_handle_aice_info_command");
|
||||||
|
|
||||||
command_print(CMD_CTX, "Description: %s", param.device_desc);
|
command_print(CMD, "Description: %s", param.device_desc);
|
||||||
command_print(CMD_CTX, "Serial number: %s", param.serial);
|
command_print(CMD, "Serial number: %s", param.serial);
|
||||||
if (strncmp(aice_port->name, "aice_pipe", 9) == 0)
|
if (strncmp(aice_port->name, "aice_pipe", 9) == 0)
|
||||||
command_print(CMD_CTX, "Adapter: %s", param.adapter_name);
|
command_print(CMD, "Adapter: %s", param.adapter_name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,9 +165,9 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
|
|
||||||
aice_scan_jtag_chain();
|
aice_scan_jtag_chain();
|
||||||
tap = jtag_all_taps();
|
tap = jtag_all_taps();
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
" TapName Enabled IdCode Expected IrLen IrCap IrMask");
|
" TapName Enabled IdCode Expected IrLen IrCap IrMask");
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"-- ------------------- -------- ---------- ---------- ----- ----- ------");
|
"-- ------------------- -------- ---------- ---------- ----- ----- ------");
|
||||||
|
|
||||||
while (tap) {
|
while (tap) {
|
||||||
|
@ -183,7 +183,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
||||||
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
|
"%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
|
||||||
tap->abs_chain_position,
|
tap->abs_chain_position,
|
||||||
tap->dotted_name,
|
tap->dotted_name,
|
||||||
|
@ -200,7 +200,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
if (tap->ignore_version)
|
if (tap->ignore_version)
|
||||||
expected_id[2] = '*';
|
expected_id[2] = '*';
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
" %s",
|
" %s",
|
||||||
expected_id);
|
expected_id);
|
||||||
}
|
}
|
||||||
|
|
|
@ -548,7 +548,7 @@ COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "parport port = %u", amt_jtagaccel_port);
|
command_print(CMD, "parport port = %u", amt_jtagaccel_port);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -556,7 +556,7 @@ COMMAND_HANDLER(amt_jtagaccel_handle_parport_port_command)
|
||||||
COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command)
|
COMMAND_HANDLER(amt_jtagaccel_handle_rtck_command)
|
||||||
{
|
{
|
||||||
if (CMD_ARGC == 0) {
|
if (CMD_ARGC == 0) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"amt_jtagaccel RTCK feature %s",
|
"amt_jtagaccel RTCK feature %s",
|
||||||
(rtck_enabled) ? "enabled" : "disabled");
|
(rtck_enabled) ? "enabled" : "disabled");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -199,7 +199,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"BCM2835 GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
"BCM2835 GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
||||||
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
||||||
|
|
||||||
|
@ -211,7 +211,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_tck)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: tck = %d", tck_gpio);
|
command_print(CMD, "BCM2835 GPIO config: tck = %d", tck_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_tms)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: tms = %d", tms_gpio);
|
command_print(CMD, "BCM2835 GPIO config: tms = %d", tms_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_tdo)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: tdo = %d", tdo_gpio);
|
command_print(CMD, "BCM2835 GPIO config: tdo = %d", tdo_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -238,7 +238,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_tdi)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: tdi = %d", tdi_gpio);
|
command_print(CMD, "BCM2835 GPIO config: tdi = %d", tdi_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -247,7 +247,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_srst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: srst = %d", srst_gpio);
|
command_print(CMD, "BCM2835 GPIO config: srst = %d", srst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_jtag_gpionum_trst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 GPIO config: trst = %d", trst_gpio);
|
command_print(CMD, "BCM2835 GPIO config: trst = %d", trst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_swd_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"BCM2835 GPIO nums: swclk = %d, swdio = %d",
|
"BCM2835 GPIO nums: swclk = %d, swdio = %d",
|
||||||
swclk_gpio, swdio_gpio);
|
swclk_gpio, swdio_gpio);
|
||||||
|
|
||||||
|
@ -281,7 +281,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_swd_gpionum_swclk)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 num: swclk = %d", swclk_gpio);
|
command_print(CMD, "BCM2835 num: swclk = %d", swclk_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,7 +290,7 @@ COMMAND_HANDLER(bcm2835gpio_handle_swd_gpionum_swdio)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "BCM2835 num: swdio = %d", swdio_gpio);
|
command_print(CMD, "BCM2835 num: swdio = %d", swdio_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -442,7 +442,7 @@ COMMAND_HANDLER(ft232r_handle_jtag_nums_command)
|
||||||
if (tdo_gpio < 0)
|
if (tdo_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R nums: TCK = %d %s, TMS = %d %s, TDI = %d %s, TDO = %d %s",
|
"FT232R nums: TCK = %d %s, TMS = %d %s, TDI = %d %s, TDO = %d %s",
|
||||||
tck_gpio, ft232r_bit_number_to_name(tck_gpio),
|
tck_gpio, ft232r_bit_number_to_name(tck_gpio),
|
||||||
tms_gpio, ft232r_bit_number_to_name(tms_gpio),
|
tms_gpio, ft232r_bit_number_to_name(tms_gpio),
|
||||||
|
@ -462,7 +462,7 @@ COMMAND_HANDLER(ft232r_handle_tck_num_command)
|
||||||
if (tck_gpio < 0)
|
if (tck_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: TCK = %d %s", tck_gpio, ft232r_bit_number_to_name(tck_gpio));
|
"FT232R num: TCK = %d %s", tck_gpio, ft232r_bit_number_to_name(tck_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -478,7 +478,7 @@ COMMAND_HANDLER(ft232r_handle_tms_num_command)
|
||||||
if (tms_gpio < 0)
|
if (tms_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: TMS = %d %s", tms_gpio, ft232r_bit_number_to_name(tms_gpio));
|
"FT232R num: TMS = %d %s", tms_gpio, ft232r_bit_number_to_name(tms_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -494,7 +494,7 @@ COMMAND_HANDLER(ft232r_handle_tdo_num_command)
|
||||||
if (tdo_gpio < 0)
|
if (tdo_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: TDO = %d %s", tdo_gpio, ft232r_bit_number_to_name(tdo_gpio));
|
"FT232R num: TDO = %d %s", tdo_gpio, ft232r_bit_number_to_name(tdo_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -510,7 +510,7 @@ COMMAND_HANDLER(ft232r_handle_tdi_num_command)
|
||||||
if (tdi_gpio < 0)
|
if (tdi_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: TDI = %d %s", tdi_gpio, ft232r_bit_number_to_name(tdi_gpio));
|
"FT232R num: TDI = %d %s", tdi_gpio, ft232r_bit_number_to_name(tdi_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -526,7 +526,7 @@ COMMAND_HANDLER(ft232r_handle_trst_num_command)
|
||||||
if (ntrst_gpio < 0)
|
if (ntrst_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: TRST = %d %s", ntrst_gpio, ft232r_bit_number_to_name(ntrst_gpio));
|
"FT232R num: TRST = %d %s", ntrst_gpio, ft232r_bit_number_to_name(ntrst_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -542,7 +542,7 @@ COMMAND_HANDLER(ft232r_handle_srst_num_command)
|
||||||
if (nsysrst_gpio < 0)
|
if (nsysrst_gpio < 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R num: SRST = %d %s", nsysrst_gpio, ft232r_bit_number_to_name(nsysrst_gpio));
|
"FT232R num: SRST = %d %s", nsysrst_gpio, ft232r_bit_number_to_name(nsysrst_gpio));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -555,7 +555,7 @@ COMMAND_HANDLER(ft232r_handle_restore_serial_command)
|
||||||
else if (CMD_ARGC != 0)
|
else if (CMD_ARGC != 0)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"FT232R restore serial: 0x%04X (%s)",
|
"FT232R restore serial: 0x%04X (%s)",
|
||||||
ft232r_restore_bitmode, ft232r_restore_bitmode == 0xFFFF ? "disabled" : "enabled");
|
ft232r_restore_bitmode, ft232r_restore_bitmode == 0xFFFF ? "disabled" : "enabled");
|
||||||
|
|
||||||
|
|
|
@ -930,7 +930,7 @@ COMMAND_HANDLER(ftdi_handle_tdo_sample_edge_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = Jim_Nvp_value2name_simple(nvp_ftdi_jtag_modes, ftdi_jtag_mode);
|
n = Jim_Nvp_value2name_simple(nvp_ftdi_jtag_modes, ftdi_jtag_mode);
|
||||||
command_print(CMD_CTX, "ftdi samples TDO on %s edge of TCK", n->name);
|
command_print(CMD, "ftdi samples TDO on %s edge of TCK", n->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -515,7 +515,7 @@ COMMAND_HANDLER(gw16012_handle_parport_port_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "parport port = %u", gw16012_port);
|
command_print(CMD, "parport port = %u", gw16012_port);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -221,7 +221,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"imx_gpio GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
"imx_gpio GPIO config: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
||||||
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
||||||
|
|
||||||
|
@ -233,7 +233,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_tck)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: tck = %d", tck_gpio);
|
command_print(CMD, "imx_gpio GPIO config: tck = %d", tck_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +242,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_tms)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: tms = %d", tms_gpio);
|
command_print(CMD, "imx_gpio GPIO config: tms = %d", tms_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -251,7 +251,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_tdo)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: tdo = %d", tdo_gpio);
|
command_print(CMD, "imx_gpio GPIO config: tdo = %d", tdo_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_tdi)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: tdi = %d", tdi_gpio);
|
command_print(CMD, "imx_gpio GPIO config: tdi = %d", tdi_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -269,7 +269,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_srst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: srst = %d", srst_gpio);
|
command_print(CMD, "imx_gpio GPIO config: srst = %d", srst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ COMMAND_HANDLER(imx_gpio_handle_jtag_gpionum_trst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio GPIO config: trst = %d", trst_gpio);
|
command_print(CMD, "imx_gpio GPIO config: trst = %d", trst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ COMMAND_HANDLER(imx_gpio_handle_swd_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"imx_gpio GPIO nums: swclk = %d, swdio = %d",
|
"imx_gpio GPIO nums: swclk = %d, swdio = %d",
|
||||||
swclk_gpio, swdio_gpio);
|
swclk_gpio, swdio_gpio);
|
||||||
|
|
||||||
|
@ -303,7 +303,7 @@ COMMAND_HANDLER(imx_gpio_handle_swd_gpionum_swclk)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio num: swclk = %d", swclk_gpio);
|
command_print(CMD, "imx_gpio num: swclk = %d", swclk_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ COMMAND_HANDLER(imx_gpio_handle_swd_gpionum_swdio)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "imx_gpio num: swdio = %d", swdio_gpio);
|
command_print(CMD, "imx_gpio num: swdio = %d", swdio_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -923,17 +923,17 @@ COMMAND_HANDLER(jlink_usb_command)
|
||||||
int tmp;
|
int tmp;
|
||||||
|
|
||||||
if (CMD_ARGC != 1) {
|
if (CMD_ARGC != 1) {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink usb.");
|
command_print(CMD, "Need exactly one argument for jlink usb.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
|
if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
|
||||||
command_print(CMD_CTX, "Invalid USB address: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid USB address: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp < JAYLINK_USB_ADDRESS_0 || tmp > JAYLINK_USB_ADDRESS_3) {
|
if (tmp < JAYLINK_USB_ADDRESS_0 || tmp > JAYLINK_USB_ADDRESS_3) {
|
||||||
command_print(CMD_CTX, "Invalid USB address: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid USB address: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,17 +950,17 @@ COMMAND_HANDLER(jlink_serial_command)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (CMD_ARGC != 1) {
|
if (CMD_ARGC != 1) {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink serial.");
|
command_print(CMD, "Need exactly one argument for jlink serial.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = jaylink_parse_serial_number(CMD_ARGV[0], &serial_number);
|
ret = jaylink_parse_serial_number(CMD_ARGV[0], &serial_number);
|
||||||
|
|
||||||
if (ret == JAYLINK_ERR) {
|
if (ret == JAYLINK_ERR) {
|
||||||
command_print(CMD_CTX, "Invalid serial number: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid serial number: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
} else if (ret != JAYLINK_OK) {
|
} else if (ret != JAYLINK_OK) {
|
||||||
command_print(CMD_CTX, "jaylink_parse_serial_number() failed: %s.",
|
command_print(CMD, "jaylink_parse_serial_number() failed: %s.",
|
||||||
jaylink_strerror(ret));
|
jaylink_strerror(ret));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -979,20 +979,20 @@ COMMAND_HANDLER(jlink_handle_hwstatus_command)
|
||||||
ret = jaylink_get_hardware_status(devh, &status);
|
ret = jaylink_get_hardware_status(devh, &status);
|
||||||
|
|
||||||
if (ret != JAYLINK_OK) {
|
if (ret != JAYLINK_OK) {
|
||||||
command_print(CMD_CTX, "jaylink_get_hardware_status() failed: %s.",
|
command_print(CMD, "jaylink_get_hardware_status() failed: %s.",
|
||||||
jaylink_strerror(ret));
|
jaylink_strerror(ret));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "VTarget = %u.%03u V",
|
command_print(CMD, "VTarget = %u.%03u V",
|
||||||
status.target_voltage / 1000, status.target_voltage % 1000);
|
status.target_voltage / 1000, status.target_voltage % 1000);
|
||||||
|
|
||||||
command_print(CMD_CTX, "TCK = %u TDI = %u TDO = %u TMS = %u SRST = %u "
|
command_print(CMD, "TCK = %u TDI = %u TDO = %u TMS = %u SRST = %u "
|
||||||
"TRST = %u", status.tck, status.tdi, status.tdo, status.tms,
|
"TRST = %u", status.tck, status.tdi, status.tdo, status.tms,
|
||||||
status.tres, status.trst);
|
status.tres, status.trst);
|
||||||
|
|
||||||
if (status.target_voltage < 1500)
|
if (status.target_voltage < 1500)
|
||||||
command_print(CMD_CTX, "Target voltage too low. Check target power.");
|
command_print(CMD, "Target voltage too low. Check target power.");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1003,7 +1003,7 @@ COMMAND_HANDLER(jlink_handle_free_memory_command)
|
||||||
uint32_t tmp;
|
uint32_t tmp;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_GET_FREE_MEMORY)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_GET_FREE_MEMORY)) {
|
||||||
command_print(CMD_CTX, "Retrieval of free memory is not supported by "
|
command_print(CMD, "Retrieval of free memory is not supported by "
|
||||||
"the device.");
|
"the device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1011,12 +1011,12 @@ COMMAND_HANDLER(jlink_handle_free_memory_command)
|
||||||
ret = jaylink_get_free_memory(devh, &tmp);
|
ret = jaylink_get_free_memory(devh, &tmp);
|
||||||
|
|
||||||
if (ret != JAYLINK_OK) {
|
if (ret != JAYLINK_OK) {
|
||||||
command_print(CMD_CTX, "jaylink_get_free_memory() failed: %s.",
|
command_print(CMD, "jaylink_get_free_memory() failed: %s.",
|
||||||
jaylink_strerror(ret));
|
jaylink_strerror(ret));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "Device has %u bytes of free memory.", tmp);
|
command_print(CMD, "Device has %u bytes of free memory.", tmp);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1038,10 +1038,10 @@ COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "JTAG command version: %i", version);
|
command_print(CMD, "JTAG command version: %i", version);
|
||||||
} else if (CMD_ARGC == 1) {
|
} else if (CMD_ARGC == 1) {
|
||||||
if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
|
if (sscanf(CMD_ARGV[0], "%i", &tmp) != 1) {
|
||||||
command_print(CMD_CTX, "Invalid argument: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid argument: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1053,11 +1053,11 @@ COMMAND_HANDLER(jlink_handle_jlink_jtag_command)
|
||||||
jtag_command_version = JAYLINK_JTAG_VERSION_3;
|
jtag_command_version = JAYLINK_JTAG_VERSION_3;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX, "Invalid argument: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid argument: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink jtag.");
|
command_print(CMD, "Need exactly one argument for jlink jtag.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1070,13 +1070,13 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
|
||||||
int enable;
|
int enable;
|
||||||
|
|
||||||
if (CMD_ARGC != 1) {
|
if (CMD_ARGC != 1) {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink "
|
command_print(CMD, "Need exactly one argument for jlink "
|
||||||
"targetpower.");
|
"targetpower.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
|
||||||
command_print(CMD_CTX, "Target power supply is not supported by the "
|
command_print(CMD, "Target power supply is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1086,14 +1086,14 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
|
||||||
} else if (!strcmp(CMD_ARGV[0], "off")) {
|
} else if (!strcmp(CMD_ARGV[0], "off")) {
|
||||||
enable = false;
|
enable = false;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Invalid argument: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid argument: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = jaylink_set_target_power(devh, enable);
|
ret = jaylink_set_target_power(devh, enable);
|
||||||
|
|
||||||
if (ret != JAYLINK_OK) {
|
if (ret != JAYLINK_OK) {
|
||||||
command_print(CMD_CTX, "jaylink_set_target_power() failed: %s.",
|
command_print(CMD, "jaylink_set_target_power() failed: %s.",
|
||||||
jaylink_strerror(ret));
|
jaylink_strerror(ret));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1104,31 +1104,31 @@ COMMAND_HANDLER(jlink_handle_target_power_command)
|
||||||
static void show_config_usb_address(struct command_invocation *cmd)
|
static void show_config_usb_address(struct command_invocation *cmd)
|
||||||
{
|
{
|
||||||
if (config.usb_address != tmp_config.usb_address)
|
if (config.usb_address != tmp_config.usb_address)
|
||||||
command_print(cmd->ctx, "USB address: %u [%u]", config.usb_address,
|
command_print(cmd, "USB address: %u [%u]", config.usb_address,
|
||||||
tmp_config.usb_address);
|
tmp_config.usb_address);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "USB address: %u", config.usb_address);
|
command_print(cmd, "USB address: %u", config.usb_address);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_config_ip_address(struct command_invocation *cmd)
|
static void show_config_ip_address(struct command_invocation *cmd)
|
||||||
{
|
{
|
||||||
if (!memcmp(config.ip_address, tmp_config.ip_address, 4))
|
if (!memcmp(config.ip_address, tmp_config.ip_address, 4))
|
||||||
command_print(cmd->ctx, "IP address: %d.%d.%d.%d",
|
command_print(cmd, "IP address: %d.%d.%d.%d",
|
||||||
config.ip_address[3], config.ip_address[2],
|
config.ip_address[3], config.ip_address[2],
|
||||||
config.ip_address[1], config.ip_address[0]);
|
config.ip_address[1], config.ip_address[0]);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "IP address: %d.%d.%d.%d [%d.%d.%d.%d]",
|
command_print(cmd, "IP address: %d.%d.%d.%d [%d.%d.%d.%d]",
|
||||||
config.ip_address[3], config.ip_address[2],
|
config.ip_address[3], config.ip_address[2],
|
||||||
config.ip_address[1], config.ip_address[0],
|
config.ip_address[1], config.ip_address[0],
|
||||||
tmp_config.ip_address[3], tmp_config.ip_address[2],
|
tmp_config.ip_address[3], tmp_config.ip_address[2],
|
||||||
tmp_config.ip_address[1], tmp_config.ip_address[0]);
|
tmp_config.ip_address[1], tmp_config.ip_address[0]);
|
||||||
|
|
||||||
if (!memcmp(config.subnet_mask, tmp_config.subnet_mask, 4))
|
if (!memcmp(config.subnet_mask, tmp_config.subnet_mask, 4))
|
||||||
command_print(cmd->ctx, "Subnet mask: %d.%d.%d.%d",
|
command_print(cmd, "Subnet mask: %d.%d.%d.%d",
|
||||||
config.subnet_mask[3], config.subnet_mask[2],
|
config.subnet_mask[3], config.subnet_mask[2],
|
||||||
config.subnet_mask[1], config.subnet_mask[0]);
|
config.subnet_mask[1], config.subnet_mask[0]);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "Subnet mask: %d.%d.%d.%d [%d.%d.%d.%d]",
|
command_print(cmd, "Subnet mask: %d.%d.%d.%d [%d.%d.%d.%d]",
|
||||||
config.subnet_mask[3], config.subnet_mask[2],
|
config.subnet_mask[3], config.subnet_mask[2],
|
||||||
config.subnet_mask[1], config.subnet_mask[0],
|
config.subnet_mask[1], config.subnet_mask[0],
|
||||||
tmp_config.subnet_mask[3], tmp_config.subnet_mask[2],
|
tmp_config.subnet_mask[3], tmp_config.subnet_mask[2],
|
||||||
|
@ -1138,12 +1138,12 @@ static void show_config_ip_address(struct command_invocation *cmd)
|
||||||
static void show_config_mac_address(struct command_invocation *cmd)
|
static void show_config_mac_address(struct command_invocation *cmd)
|
||||||
{
|
{
|
||||||
if (!memcmp(config.mac_address, tmp_config.mac_address, 6))
|
if (!memcmp(config.mac_address, tmp_config.mac_address, 6))
|
||||||
command_print(cmd->ctx, "MAC address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x",
|
command_print(cmd, "MAC address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x",
|
||||||
config.mac_address[5], config.mac_address[4],
|
config.mac_address[5], config.mac_address[4],
|
||||||
config.mac_address[3], config.mac_address[2],
|
config.mac_address[3], config.mac_address[2],
|
||||||
config.mac_address[1], config.mac_address[0]);
|
config.mac_address[1], config.mac_address[0]);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "MAC address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x "
|
command_print(cmd, "MAC address: %.02x:%.02x:%.02x:%.02x:%.02x:%.02x "
|
||||||
"[%.02x:%.02x:%.02x:%.02x:%.02x:%.02x]",
|
"[%.02x:%.02x:%.02x:%.02x:%.02x:%.02x]",
|
||||||
config.mac_address[5], config.mac_address[4],
|
config.mac_address[5], config.mac_address[4],
|
||||||
config.mac_address[3], config.mac_address[2],
|
config.mac_address[3], config.mac_address[2],
|
||||||
|
@ -1169,15 +1169,15 @@ static void show_config_target_power(struct command_invocation *cmd)
|
||||||
current_target_power = "on";
|
current_target_power = "on";
|
||||||
|
|
||||||
if (config.target_power != tmp_config.target_power)
|
if (config.target_power != tmp_config.target_power)
|
||||||
command_print(cmd->ctx, "Target power supply: %s [%s]", target_power,
|
command_print(cmd, "Target power supply: %s [%s]", target_power,
|
||||||
current_target_power);
|
current_target_power);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "Target power supply: %s", target_power);
|
command_print(cmd, "Target power supply: %s", target_power);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void show_config(struct command_invocation *cmd)
|
static void show_config(struct command_invocation *cmd)
|
||||||
{
|
{
|
||||||
command_print(cmd->ctx, "J-Link device configuration:");
|
command_print(cmd, "J-Link device configuration:");
|
||||||
|
|
||||||
show_config_usb_address(cmd);
|
show_config_usb_address(cmd);
|
||||||
|
|
||||||
|
@ -1346,7 +1346,7 @@ COMMAND_HANDLER(jlink_handle_config_usb_address_command)
|
||||||
uint8_t tmp;
|
uint8_t tmp;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Reading configuration is not supported by the "
|
command_print(CMD, "Reading configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1355,18 +1355,18 @@ COMMAND_HANDLER(jlink_handle_config_usb_address_command)
|
||||||
show_config_usb_address(CMD);
|
show_config_usb_address(CMD);
|
||||||
} else if (CMD_ARGC == 1) {
|
} else if (CMD_ARGC == 1) {
|
||||||
if (sscanf(CMD_ARGV[0], "%" SCNd8, &tmp) != 1) {
|
if (sscanf(CMD_ARGV[0], "%" SCNd8, &tmp) != 1) {
|
||||||
command_print(CMD_CTX, "Invalid USB address: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid USB address: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tmp > JAYLINK_USB_ADDRESS_3) {
|
if (tmp > JAYLINK_USB_ADDRESS_3) {
|
||||||
command_print(CMD_CTX, "Invalid USB address: %u.", tmp);
|
command_print(CMD, "Invalid USB address: %u.", tmp);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_config.usb_address = tmp;
|
tmp_config.usb_address = tmp;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink config "
|
command_print(CMD, "Need exactly one argument for jlink config "
|
||||||
"usb.");
|
"usb.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1379,13 +1379,13 @@ COMMAND_HANDLER(jlink_handle_config_target_power_command)
|
||||||
int enable;
|
int enable;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Reading configuration is not supported by the "
|
command_print(CMD, "Reading configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_SET_TARGET_POWER)) {
|
||||||
command_print(CMD_CTX, "Target power supply is not supported by the "
|
command_print(CMD, "Target power supply is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1398,13 +1398,13 @@ COMMAND_HANDLER(jlink_handle_config_target_power_command)
|
||||||
} else if (!strcmp(CMD_ARGV[0], "off")) {
|
} else if (!strcmp(CMD_ARGV[0], "off")) {
|
||||||
enable = false;
|
enable = false;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Invalid argument: %s.", CMD_ARGV[0]);
|
command_print(CMD, "Invalid argument: %s.", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tmp_config.target_power = enable;
|
tmp_config.target_power = enable;
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink config "
|
command_print(CMD, "Need exactly one argument for jlink config "
|
||||||
"targetpower.");
|
"targetpower.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1420,13 +1420,13 @@ COMMAND_HANDLER(jlink_handle_config_mac_address_command)
|
||||||
const char *str;
|
const char *str;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Reading configuration is not supported by the "
|
command_print(CMD, "Reading configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_ETHERNET)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_ETHERNET)) {
|
||||||
command_print(CMD_CTX, "Ethernet connectivity is not supported by the "
|
command_print(CMD, "Ethernet connectivity is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1438,7 +1438,7 @@ COMMAND_HANDLER(jlink_handle_config_mac_address_command)
|
||||||
|
|
||||||
if ((strlen(str) != 17) || (str[2] != ':' || str[5] != ':' || \
|
if ((strlen(str) != 17) || (str[2] != ':' || str[5] != ':' || \
|
||||||
str[8] != ':' || str[11] != ':' || str[14] != ':')) {
|
str[8] != ':' || str[11] != ':' || str[14] != ':')) {
|
||||||
command_print(CMD_CTX, "Invalid MAC address format.");
|
command_print(CMD, "Invalid MAC address format.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1448,18 +1448,18 @@ COMMAND_HANDLER(jlink_handle_config_mac_address_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) {
|
if (!(addr[0] | addr[1] | addr[2] | addr[3] | addr[4] | addr[5])) {
|
||||||
command_print(CMD_CTX, "Invalid MAC address: zero address.");
|
command_print(CMD, "Invalid MAC address: zero address.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(0x01 & addr[0])) {
|
if (!(0x01 & addr[0])) {
|
||||||
command_print(CMD_CTX, "Invalid MAC address: multicast address.");
|
command_print(CMD, "Invalid MAC address: multicast address.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(tmp_config.mac_address, addr, sizeof(addr));
|
memcpy(tmp_config.mac_address, addr, sizeof(addr));
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Need exactly one argument for jlink config "
|
command_print(CMD, "Need exactly one argument for jlink config "
|
||||||
" mac.");
|
" mac.");
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
@ -1508,13 +1508,13 @@ COMMAND_HANDLER(jlink_handle_config_ip_address_command)
|
||||||
uint8_t subnet_bits = 24;
|
uint8_t subnet_bits = 24;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Reading configuration is not supported by the "
|
command_print(CMD, "Reading configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_ETHERNET)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_ETHERNET)) {
|
||||||
command_print(CMD_CTX, "Ethernet connectivity is not supported by the "
|
command_print(CMD, "Ethernet connectivity is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1565,19 +1565,19 @@ COMMAND_HANDLER(jlink_handle_config_write_command)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Reading configuration is not supported by the "
|
command_print(CMD, "Reading configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_WRITE_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_WRITE_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Writing configuration is not supported by the "
|
command_print(CMD, "Writing configuration is not supported by the "
|
||||||
"device.");
|
"device.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!memcmp(&config, &tmp_config, sizeof(struct device_config))) {
|
if (!memcmp(&config, &tmp_config, sizeof(struct device_config))) {
|
||||||
command_print(CMD_CTX, "Operation not performed due to no changes in "
|
command_print(CMD, "Operation not performed due to no changes in "
|
||||||
"the configuration.");
|
"the configuration.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1602,7 +1602,7 @@ COMMAND_HANDLER(jlink_handle_config_write_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
memcpy(&tmp_config, &config, sizeof(struct device_config));
|
memcpy(&tmp_config, &config, sizeof(struct device_config));
|
||||||
command_print(CMD_CTX, "The new device configuration applies after power "
|
command_print(CMD, "The new device configuration applies after power "
|
||||||
"cycling the J-Link device.");
|
"cycling the J-Link device.");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1611,7 +1611,7 @@ COMMAND_HANDLER(jlink_handle_config_write_command)
|
||||||
COMMAND_HANDLER(jlink_handle_config_command)
|
COMMAND_HANDLER(jlink_handle_config_command)
|
||||||
{
|
{
|
||||||
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
if (!jaylink_has_cap(caps, JAYLINK_DEV_CAP_READ_CONFIG)) {
|
||||||
command_print(CMD_CTX, "Device doesn't support reading configuration.");
|
command_print(CMD, "Device doesn't support reading configuration.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1732,7 +1732,7 @@ COMMAND_HANDLER(jlink_handle_emucom_read_command)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s", buf + length);
|
command_print(CMD, "%s", buf + length);
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -185,7 +185,7 @@ COMMAND_HANDLER(opendous_handle_opendous_hw_jtag_command)
|
||||||
{
|
{
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "opendous hw jtag %i", opendous_hw_jtag_version);
|
command_print(CMD, "opendous hw jtag %i", opendous_hw_jtag_version);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1: {
|
case 1: {
|
||||||
|
|
|
@ -413,7 +413,7 @@ COMMAND_HANDLER(parport_handle_parport_port_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "parport port = 0x%" PRIx16 "", parport_port);
|
command_print(CMD, "parport port = 0x%" PRIx16 "", parport_port);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -470,7 +470,7 @@ COMMAND_HANDLER(parport_handle_parport_toggling_time_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "parport toggling time = %" PRIu32 " ns",
|
command_print(CMD, "parport toggling time = %" PRIu32 " ns",
|
||||||
parport_toggling_time_ns);
|
parport_toggling_time_ns);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -356,7 +356,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"SysfsGPIO nums: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
"SysfsGPIO nums: tck = %d, tms = %d, tdi = %d, tdo = %d",
|
||||||
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
tck_gpio, tms_gpio, tdi_gpio, tdo_gpio);
|
||||||
|
|
||||||
|
@ -368,7 +368,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_tck)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tck_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: tck = %d", tck_gpio);
|
command_print(CMD, "SysfsGPIO num: tck = %d", tck_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_tms)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tms_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: tms = %d", tms_gpio);
|
command_print(CMD, "SysfsGPIO num: tms = %d", tms_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_tdo)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdo_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: tdo = %d", tdo_gpio);
|
command_print(CMD, "SysfsGPIO num: tdo = %d", tdo_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +395,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_tdi)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], tdi_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: tdi = %d", tdi_gpio);
|
command_print(CMD, "SysfsGPIO num: tdi = %d", tdi_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +404,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_srst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], srst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: srst = %d", srst_gpio);
|
command_print(CMD, "SysfsGPIO num: srst = %d", srst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,7 +413,7 @@ COMMAND_HANDLER(sysfsgpio_handle_jtag_gpionum_trst)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], trst_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: trst = %d", trst_gpio);
|
command_print(CMD, "SysfsGPIO num: trst = %d", trst_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ COMMAND_HANDLER(sysfsgpio_handle_swd_gpionums)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"SysfsGPIO nums: swclk = %d, swdio = %d",
|
"SysfsGPIO nums: swclk = %d, swdio = %d",
|
||||||
swclk_gpio, swdio_gpio);
|
swclk_gpio, swdio_gpio);
|
||||||
|
|
||||||
|
@ -438,7 +438,7 @@ COMMAND_HANDLER(sysfsgpio_handle_swd_gpionum_swclk)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swclk_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: swclk = %d", swclk_gpio);
|
command_print(CMD, "SysfsGPIO num: swclk = %d", swclk_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ COMMAND_HANDLER(sysfsgpio_handle_swd_gpionum_swdio)
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[0], swdio_gpio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "SysfsGPIO num: swdio = %d", swdio_gpio);
|
command_print(CMD, "SysfsGPIO num: swdio = %d", swdio_gpio);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -952,9 +952,9 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
char expected_id[12];
|
char expected_id[12];
|
||||||
|
|
||||||
tap = jtag_all_taps();
|
tap = jtag_all_taps();
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
" TapName Enabled IdCode Expected IrLen IrCap IrMask");
|
" TapName Enabled IdCode Expected IrLen IrCap IrMask");
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"-- ------------------- -------- ---------- ---------- ----- ----- ------");
|
"-- ------------------- -------- ---------- ---------- ----- ----- ------");
|
||||||
|
|
||||||
while (tap) {
|
while (tap) {
|
||||||
|
@ -970,7 +970,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
expected = buf_get_u32(tap->expected, 0, tap->ir_length);
|
||||||
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
expected_mask = buf_get_u32(tap->expected_mask, 0, tap->ir_length);
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
|
"%2d %-18s %c 0x%08x %s %5d 0x%02x 0x%02x",
|
||||||
tap->abs_chain_position,
|
tap->abs_chain_position,
|
||||||
tap->dotted_name,
|
tap->dotted_name,
|
||||||
|
@ -987,7 +987,7 @@ COMMAND_HANDLER(handle_scan_chain_command)
|
||||||
if (tap->ignore_version)
|
if (tap->ignore_version)
|
||||||
expected_id[2] = '*';
|
expected_id[2] = '*';
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
" %s",
|
" %s",
|
||||||
expected_id);
|
expected_id);
|
||||||
}
|
}
|
||||||
|
@ -1008,7 +1008,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_delay_command)
|
||||||
|
|
||||||
jtag_set_ntrst_delay(delay);
|
jtag_set_ntrst_delay(delay);
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
|
command_print(CMD, "jtag_ntrst_delay: %u", jtag_get_ntrst_delay());
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1022,7 +1022,7 @@ COMMAND_HANDLER(handle_jtag_ntrst_assert_width_command)
|
||||||
|
|
||||||
jtag_set_ntrst_assert_width(delay);
|
jtag_set_ntrst_assert_width(delay);
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
|
command_print(CMD, "jtag_ntrst_assert_width: %u", jtag_get_ntrst_assert_width());
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1047,9 +1047,9 @@ COMMAND_HANDLER(handle_jtag_rclk_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (cur_khz)
|
if (cur_khz)
|
||||||
command_print(CMD_CTX, "RCLK not supported - fallback to %d kHz", cur_khz);
|
command_print(CMD, "RCLK not supported - fallback to %d kHz", cur_khz);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "RCLK - adaptive");
|
command_print(CMD, "RCLK - adaptive");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ COMMAND_HANDLER(handle_irscan_command)
|
||||||
tap = jtag_tap_by_string(CMD_ARGV[i*2]);
|
tap = jtag_tap_by_string(CMD_ARGV[i*2]);
|
||||||
if (tap == NULL) {
|
if (tap == NULL) {
|
||||||
free(fields);
|
free(fields);
|
||||||
command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i*2]);
|
command_print(CMD, "Tap: %s unknown", CMD_ARGV[i*2]);
|
||||||
|
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1193,7 +1193,7 @@ COMMAND_HANDLER(handle_verify_ircapture_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
|
const char *status = jtag_will_verify_capture_ir() ? "enabled" : "disabled";
|
||||||
command_print(CMD_CTX, "verify Capture-IR is %s", status);
|
command_print(CMD, "verify Capture-IR is %s", status);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1210,7 +1210,7 @@ COMMAND_HANDLER(handle_verify_jtag_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *status = jtag_will_verify() ? "enabled" : "disabled";
|
const char *status = jtag_will_verify() ? "enabled" : "disabled";
|
||||||
command_print(CMD_CTX, "verify jtag capture is %s", status);
|
command_print(CMD, "verify jtag capture is %s", status);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1232,7 +1232,7 @@ COMMAND_HANDLER(handle_tms_sequence_command)
|
||||||
tap_use_new_tms_table(use_new_table);
|
tap_use_new_tms_table(use_new_table);
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "tms sequence is %s",
|
command_print(CMD, "tms sequence is %s",
|
||||||
tap_uses_new_tms_table() ? "short" : "long");
|
tap_uses_new_tms_table() ? "short" : "long");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -116,12 +116,12 @@ COMMAND_HANDLER(handle_pld_devices_command)
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
if (!pld_devices) {
|
if (!pld_devices) {
|
||||||
command_print(CMD_CTX, "no pld devices configured");
|
command_print(CMD, "no pld devices configured");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (p = pld_devices; p; p = p->next)
|
for (p = pld_devices; p; p = p->next)
|
||||||
command_print(CMD_CTX, "#%i: %s", i++, p->driver->name);
|
command_print(CMD, "#%i: %s", i++, p->driver->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -141,13 +141,13 @@ COMMAND_HANDLER(handle_pld_load_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
|
||||||
p = get_pld_device_by_num(dev_id);
|
p = get_pld_device_by_num(dev_id);
|
||||||
if (!p) {
|
if (!p) {
|
||||||
command_print(CMD_CTX, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
|
command_print(CMD, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = p->driver->load(p, CMD_ARGV[1]);
|
retval = p->driver->load(p, CMD_ARGV[1]);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "failed loading file %s to pld device %u",
|
command_print(CMD, "failed loading file %s to pld device %u",
|
||||||
CMD_ARGV[1], dev_id);
|
CMD_ARGV[1], dev_id);
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@ COMMAND_HANDLER(handle_pld_load_command)
|
||||||
gettimeofday(&end, NULL);
|
gettimeofday(&end, NULL);
|
||||||
timeval_subtract(&duration, &end, &start);
|
timeval_subtract(&duration, &end, &start);
|
||||||
|
|
||||||
command_print(CMD_CTX, "loaded file %s to pld device %u in %jis %jius",
|
command_print(CMD, "loaded file %s to pld device %u in %jis %jius",
|
||||||
CMD_ARGV[1], dev_id,
|
CMD_ARGV[1], dev_id,
|
||||||
(intmax_t)duration.tv_sec, (intmax_t)duration.tv_usec);
|
(intmax_t)duration.tv_sec, (intmax_t)duration.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
|
@ -183,13 +183,13 @@ COMMAND_HANDLER(virtex2_handle_read_stat_command)
|
||||||
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
|
COMMAND_PARSE_NUMBER(uint, CMD_ARGV[0], dev_id);
|
||||||
device = get_pld_device_by_num(dev_id);
|
device = get_pld_device_by_num(dev_id);
|
||||||
if (!device) {
|
if (!device) {
|
||||||
command_print(CMD_CTX, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
|
command_print(CMD, "pld device '#%s' is out of bounds", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtex2_read_stat(device, &status);
|
virtex2_read_stat(device, &status);
|
||||||
|
|
||||||
command_print(CMD_CTX, "virtex2 status register: 0x%8.8" PRIx32 "", status);
|
command_print(CMD, "virtex2 status register: 0x%8.8" PRIx32 "", status);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -205,7 +205,7 @@ PLD_DEVICE_COMMAND_HANDLER(virtex2_pld_device_command)
|
||||||
|
|
||||||
tap = jtag_tap_by_string(CMD_ARGV[1]);
|
tap = jtag_tap_by_string(CMD_ARGV[1]);
|
||||||
if (tap == NULL) {
|
if (tap == NULL) {
|
||||||
command_print(CMD_CTX, "Tap: %s does not exist", CMD_ARGV[1]);
|
command_print(CMD, "Tap: %s does not exist", CMD_ARGV[1]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3494,7 +3494,7 @@ COMMAND_HANDLER(handle_gdb_sync_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
if (current_gdb_connection == NULL) {
|
if (current_gdb_connection == NULL) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"gdb_sync command can only be run from within gdb using \"monitor gdb_sync\"");
|
"gdb_sync command can only be run from within gdb using \"monitor gdb_sync\"");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -769,7 +769,7 @@ COMMAND_HANDLER(handle_bindto_command)
|
||||||
{
|
{
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "bindto name: %s", bindto_name);
|
command_print(CMD, "bindto name: %s", bindto_name);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
free(bindto_name);
|
free(bindto_name);
|
||||||
|
@ -828,7 +828,7 @@ COMMAND_HELPER(server_port_command, unsigned short *out)
|
||||||
{
|
{
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "%d", *out);
|
command_print(CMD, "%d", *out);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
|
@ -847,7 +847,7 @@ COMMAND_HELPER(server_pipe_command, char **out)
|
||||||
{
|
{
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "%s", *out);
|
command_print(CMD, "%s", *out);
|
||||||
break;
|
break;
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
|
|
|
@ -382,7 +382,7 @@ COMMAND_HANDLER(handle_svf_command)
|
||||||
if (strcmp(CMD_ARGV[i], "-tap") == 0) {
|
if (strcmp(CMD_ARGV[i], "-tap") == 0) {
|
||||||
tap = jtag_tap_by_string(CMD_ARGV[i+1]);
|
tap = jtag_tap_by_string(CMD_ARGV[i+1]);
|
||||||
if (!tap) {
|
if (!tap) {
|
||||||
command_print(CMD_CTX, "Tap: %s unknown", CMD_ARGV[i+1]);
|
command_print(CMD, "Tap: %s unknown", CMD_ARGV[i+1]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
|
@ -401,7 +401,7 @@ COMMAND_HANDLER(handle_svf_command)
|
||||||
svf_fd = fopen(CMD_ARGV[i], "r");
|
svf_fd = fopen(CMD_ARGV[i], "r");
|
||||||
if (svf_fd == NULL) {
|
if (svf_fd == NULL) {
|
||||||
int err = errno;
|
int err = errno;
|
||||||
command_print(CMD_CTX, "open(\"%s\"): %s", CMD_ARGV[i], strerror(err));
|
command_print(CMD, "open(\"%s\"): %s", CMD_ARGV[i], strerror(err));
|
||||||
/* no need to free anything now */
|
/* no need to free anything now */
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
} else
|
} else
|
||||||
|
@ -534,7 +534,7 @@ COMMAND_HANDLER(handle_svf_command)
|
||||||
time_measure_m = time_measure_s / 60;
|
time_measure_m = time_measure_s / 60;
|
||||||
time_measure_s %= 60;
|
time_measure_s %= 60;
|
||||||
if (time_measure_ms < 1000)
|
if (time_measure_ms < 1000)
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"\r\nTime used: %dm%ds%" PRId64 "ms ",
|
"\r\nTime used: %dm%ds%" PRId64 "ms ",
|
||||||
time_measure_m,
|
time_measure_m,
|
||||||
time_measure_s,
|
time_measure_s,
|
||||||
|
@ -579,13 +579,13 @@ free_all:
|
||||||
svf_free_xxd_para(&svf_para.sir_para);
|
svf_free_xxd_para(&svf_para.sir_para);
|
||||||
|
|
||||||
if (ERROR_OK == ret)
|
if (ERROR_OK == ret)
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"svf file programmed %s for %d commands with %d errors",
|
"svf file programmed %s for %d commands with %d errors",
|
||||||
(svf_ignore_error > 1) ? "unsuccessfully" : "successfully",
|
(svf_ignore_error > 1) ? "unsuccessfully" : "successfully",
|
||||||
command_num,
|
command_num,
|
||||||
(svf_ignore_error > 1) ? (svf_ignore_error - 1) : 0);
|
(svf_ignore_error > 1) ? (svf_ignore_error - 1) : 0);
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "svf file programmed failed");
|
command_print(CMD, "svf file programmed failed");
|
||||||
|
|
||||||
svf_ignore_error = 0;
|
svf_ignore_error = 0;
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -2572,7 +2572,7 @@ COMMAND_HANDLER(aarch64_mask_interrupts_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, aarch64->isrmasking_mode);
|
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, aarch64->isrmasking_mode);
|
||||||
command_print(CMD_CTX, "aarch64 interrupt mask %s", n->name);
|
command_print(CMD, "aarch64 interrupt mask %s", n->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ static int arm720t_verify_pointer(struct command_invocation *cmd,
|
||||||
struct arm720t_common *arm720t)
|
struct arm720t_common *arm720t)
|
||||||
{
|
{
|
||||||
if (arm720t->common_magic != ARM720T_COMMON_MAGIC) {
|
if (arm720t->common_magic != ARM720T_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not an ARM720");
|
command_print(cmd, "target is not an ARM720");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -447,7 +447,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ COMMAND_HANDLER(arm720t_handle_cp15_command)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
retval = arm720t_read_cp15(target, opcode, &value);
|
retval = arm720t_read_cp15(target, opcode, &value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "couldn't access cp15 with opcode 0x%8.8" PRIx32 "", opcode);
|
command_print(CMD, "couldn't access cp15 with opcode 0x%8.8" PRIx32 "", opcode);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -468,17 +468,17 @@ COMMAND_HANDLER(arm720t_handle_cp15_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "0x%8.8" PRIx32 ": 0x%8.8" PRIx32 "", opcode, value);
|
command_print(CMD, "0x%8.8" PRIx32 ": 0x%8.8" PRIx32 "", opcode, value);
|
||||||
} else if (CMD_ARGC == 2) {
|
} else if (CMD_ARGC == 2) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
||||||
|
|
||||||
retval = arm720t_write_cp15(target, opcode, value);
|
retval = arm720t_write_cp15(target, opcode, value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "couldn't access cp15 with opcode 0x%8.8" PRIx32 "", opcode);
|
command_print(CMD, "couldn't access cp15 with opcode 0x%8.8" PRIx32 "", opcode);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "0x%8.8" PRIx32 ": 0x%8.8" PRIx32 "", opcode, value);
|
command_print(CMD, "0x%8.8" PRIx32 ": 0x%8.8" PRIx32 "", opcode, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2747,14 +2747,14 @@ COMMAND_HANDLER(handle_arm7_9_dbgrq_command)
|
||||||
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
||||||
|
|
||||||
if (!is_arm7_9(arm7_9)) {
|
if (!is_arm7_9(arm7_9)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM7/ARM9 target");
|
command_print(CMD, "current target isn't an ARM7/ARM9 target");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0)
|
if (CMD_ARGC > 0)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->use_dbgrq);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->use_dbgrq);
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"use of EmbeddedICE dbgrq instead of breakpoint for target halt %s",
|
"use of EmbeddedICE dbgrq instead of breakpoint for target halt %s",
|
||||||
(arm7_9->use_dbgrq) ? "enabled" : "disabled");
|
(arm7_9->use_dbgrq) ? "enabled" : "disabled");
|
||||||
|
|
||||||
|
@ -2767,14 +2767,14 @@ COMMAND_HANDLER(handle_arm7_9_fast_memory_access_command)
|
||||||
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
||||||
|
|
||||||
if (!is_arm7_9(arm7_9)) {
|
if (!is_arm7_9(arm7_9)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM7/ARM9 target");
|
command_print(CMD, "current target isn't an ARM7/ARM9 target");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0)
|
if (CMD_ARGC > 0)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->fast_memory_access);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->fast_memory_access);
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"fast memory access is %s",
|
"fast memory access is %s",
|
||||||
(arm7_9->fast_memory_access) ? "enabled" : "disabled");
|
(arm7_9->fast_memory_access) ? "enabled" : "disabled");
|
||||||
|
|
||||||
|
@ -2787,14 +2787,14 @@ COMMAND_HANDLER(handle_arm7_9_dcc_downloads_command)
|
||||||
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
struct arm7_9_common *arm7_9 = target_to_arm7_9(target);
|
||||||
|
|
||||||
if (!is_arm7_9(arm7_9)) {
|
if (!is_arm7_9(arm7_9)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM7/ARM9 target");
|
command_print(CMD, "current target isn't an ARM7/ARM9 target");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0)
|
if (CMD_ARGC > 0)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->dcc_downloads);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], arm7_9->dcc_downloads);
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"dcc downloads are %s",
|
"dcc downloads are %s",
|
||||||
(arm7_9->dcc_downloads) ? "enabled" : "disabled");
|
(arm7_9->dcc_downloads) ? "enabled" : "disabled");
|
||||||
|
|
||||||
|
|
|
@ -511,7 +511,7 @@ static int arm920t_verify_pointer(struct command_invocation *cmd,
|
||||||
struct arm920t_common *arm920t)
|
struct arm920t_common *arm920t)
|
||||||
{
|
{
|
||||||
if (arm920t->common_magic != ARM920T_COMMON_MAGIC) {
|
if (arm920t->common_magic != ARM920T_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, arm920_not);
|
command_print(cmd, arm920_not);
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1103,7 +1103,7 @@ COMMAND_HANDLER(arm920t_handle_read_cache_command)
|
||||||
/* restore CP15 MMU and Cache settings */
|
/* restore CP15 MMU and Cache settings */
|
||||||
arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_ctrl_saved);
|
arm920t_write_cp15_physical(target, CP15PHYS_CTRL, cp15_ctrl_saved);
|
||||||
|
|
||||||
command_print(CMD_CTX, "cache content successfully output to %s",
|
command_print(CMD, "cache content successfully output to %s",
|
||||||
CMD_ARGV[0]);
|
CMD_ARGV[0]);
|
||||||
|
|
||||||
fclose(output);
|
fclose(output);
|
||||||
|
@ -1415,7 +1415,7 @@ COMMAND_HANDLER(arm920t_handle_read_mmu_command)
|
||||||
(i_tlb[i].cam & 0x20) ? "(valid)" : "(invalid)");
|
(i_tlb[i].cam & 0x20) ? "(valid)" : "(invalid)");
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "mmu content successfully output to %s",
|
command_print(CMD, "mmu content successfully output to %s",
|
||||||
CMD_ARGV[0]);
|
CMD_ARGV[0]);
|
||||||
|
|
||||||
fclose(output);
|
fclose(output);
|
||||||
|
@ -1456,7 +1456,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for "
|
command_print(CMD, "target must be stopped for "
|
||||||
"\"%s\" command", CMD_NAME);
|
"\"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1472,7 +1472,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
retval = arm920t_read_cp15_physical(target, address, &value);
|
retval = arm920t_read_cp15_physical(target, address, &value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %i", address);
|
"couldn't access reg %i", address);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1480,7 +1480,7 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "%i: %8.8" PRIx32,
|
command_print(CMD, "%i: %8.8" PRIx32,
|
||||||
address, value);
|
address, value);
|
||||||
} else if (CMD_ARGC == 2) {
|
} else if (CMD_ARGC == 2) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
@ -1488,12 +1488,12 @@ COMMAND_HANDLER(arm920t_handle_cp15_command)
|
||||||
retval = arm920t_write_cp15_physical(target,
|
retval = arm920t_write_cp15_physical(target,
|
||||||
address, value);
|
address, value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %i", address);
|
"couldn't access reg %i", address);
|
||||||
/* REVISIT why lie? "return retval"? */
|
/* REVISIT why lie? "return retval"? */
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%i: %8.8" PRIx32,
|
command_print(CMD, "%i: %8.8" PRIx32,
|
||||||
address, value);
|
address, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1513,7 +1513,7 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
|
||||||
|
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for "
|
command_print(CMD, "target must be stopped for "
|
||||||
"\"%s\" command", CMD_NAME);
|
"\"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1530,14 +1530,14 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
|
||||||
retval = arm920t_read_cp15_interpreted(target,
|
retval = arm920t_read_cp15_interpreted(target,
|
||||||
opcode, 0x0, &value);
|
opcode, 0x0, &value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't execute %8.8" PRIx32,
|
"couldn't execute %8.8" PRIx32,
|
||||||
opcode);
|
opcode);
|
||||||
/* REVISIT why lie? "return retval"? */
|
/* REVISIT why lie? "return retval"? */
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%8.8" PRIx32 ": %8.8" PRIx32,
|
command_print(CMD, "%8.8" PRIx32 ": %8.8" PRIx32,
|
||||||
opcode, value);
|
opcode, value);
|
||||||
} else if (CMD_ARGC == 2) {
|
} else if (CMD_ARGC == 2) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
@ -1545,13 +1545,13 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
|
||||||
retval = arm920t_write_cp15_interpreted(target,
|
retval = arm920t_write_cp15_interpreted(target,
|
||||||
opcode, value, 0);
|
opcode, value, 0);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't execute %8.8" PRIx32,
|
"couldn't execute %8.8" PRIx32,
|
||||||
opcode);
|
opcode);
|
||||||
/* REVISIT why lie? "return retval"? */
|
/* REVISIT why lie? "return retval"? */
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%8.8" PRIx32 ": %8.8" PRIx32,
|
command_print(CMD, "%8.8" PRIx32 ": %8.8" PRIx32,
|
||||||
opcode, value);
|
opcode, value);
|
||||||
} else if (CMD_ARGC == 3) {
|
} else if (CMD_ARGC == 3) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
|
@ -1561,12 +1561,12 @@ COMMAND_HANDLER(arm920t_handle_cp15i_command)
|
||||||
retval = arm920t_write_cp15_interpreted(target,
|
retval = arm920t_write_cp15_interpreted(target,
|
||||||
opcode, value, address);
|
opcode, value, address);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't execute %8.8" PRIx32, opcode);
|
"couldn't execute %8.8" PRIx32, opcode);
|
||||||
/* REVISIT why lie? "return retval"? */
|
/* REVISIT why lie? "return retval"? */
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%8.8" PRIx32 ": %8.8" PRIx32
|
command_print(CMD, "%8.8" PRIx32 ": %8.8" PRIx32
|
||||||
" %8.8" PRIx32, opcode, value, address);
|
" %8.8" PRIx32, opcode, value, address);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
|
|
|
@ -505,7 +505,7 @@ static int arm926ejs_verify_pointer(struct command_invocation *cmd,
|
||||||
struct arm926ejs_common *arm926)
|
struct arm926ejs_common *arm926)
|
||||||
{
|
{
|
||||||
if (arm926->common_magic != ARM926EJS_COMMON_MAGIC) {
|
if (arm926->common_magic != ARM926EJS_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, arm926_not);
|
command_print(cmd, arm926_not);
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -103,7 +103,7 @@ static int arm946e_verify_pointer(struct command_invocation *cmd,
|
||||||
struct arm946e_common *arm946e)
|
struct arm946e_common *arm946e)
|
||||||
{
|
{
|
||||||
if (arm946e->common_magic != ARM946E_COMMON_MAGIC) {
|
if (arm946e->common_magic != ARM946E_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not an ARM946");
|
command_print(cmd, "target is not an ARM946");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -563,7 +563,7 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_TARGET_NOT_HALTED;
|
return ERROR_TARGET_NOT_HALTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
retval = arm946e_read_cp15(target, address, &value);
|
retval = arm946e_read_cp15(target, address, &value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
command_print(CMD, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
retval = jtag_execute_queue();
|
retval = jtag_execute_queue();
|
||||||
|
@ -582,14 +582,14 @@ COMMAND_HANDLER(arm946e_handle_cp15)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
/* Return value in hex format */
|
/* Return value in hex format */
|
||||||
command_print(CMD_CTX, "0x%08" PRIx32, value);
|
command_print(CMD, "0x%08" PRIx32, value);
|
||||||
} else if (CMD_ARGC == 2) {
|
} else if (CMD_ARGC == 2) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
||||||
|
|
||||||
retval = arm946e_write_cp15(target, address, value);
|
retval = arm946e_write_cp15(target, address, value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
command_print(CMD, "%s cp15 reg %" PRIi32 " access failed", target_name(target), address);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
if (address == CP15_CTL)
|
if (address == CP15_CTL)
|
||||||
|
@ -613,7 +613,7 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_TARGET_NOT_HALTED;
|
return ERROR_TARGET_NOT_HALTED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,9 +623,9 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||||
bool bena = ((arm946e->cp15_control_reg & (icache ? CP15_CTL_ICACHE : CP15_CTL_DCACHE)) != 0)
|
bool bena = ((arm946e->cp15_control_reg & (icache ? CP15_CTL_ICACHE : CP15_CTL_DCACHE)) != 0)
|
||||||
&& (arm946e->cp15_control_reg & 0x1);
|
&& (arm946e->cp15_control_reg & 0x1);
|
||||||
if (csize == 0)
|
if (csize == 0)
|
||||||
command_print(CMD_CTX, "%s-cache absent", icache ? "I" : "D");
|
command_print(CMD, "%s-cache absent", icache ? "I" : "D");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s-cache size: %" PRIu32 "K, %s",
|
command_print(CMD, "%s-cache size: %" PRIu32 "K, %s",
|
||||||
icache ? "I" : "D", csize, bena ? "enabled" : "disabled");
|
icache ? "I" : "D", csize, bena ? "enabled" : "disabled");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -643,7 +643,7 @@ COMMAND_HANDLER(arm946e_handle_idcache)
|
||||||
|
|
||||||
/* Do not invalidate or change state, if cache is absent */
|
/* Do not invalidate or change state, if cache is absent */
|
||||||
if (csize == 0) {
|
if (csize == 0) {
|
||||||
command_print(CMD_CTX, "%s-cache absent, '%s' operation undefined", icache ? "I" : "D", CMD_ARGV[0]);
|
command_print(CMD, "%s-cache absent, '%s' operation undefined", icache ? "I" : "D", CMD_ARGV[0]);
|
||||||
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
return ERROR_TARGET_RESOURCE_NOT_AVAILABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ static int arm966e_verify_pointer(struct command_invocation *cmd,
|
||||||
struct arm966e_common *arm966e)
|
struct arm966e_common *arm966e)
|
||||||
{
|
{
|
||||||
if (arm966e->common_magic != ARM966E_COMMON_MAGIC) {
|
if (arm966e->common_magic != ARM966E_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not an ARM966");
|
command_print(cmd, "target is not an ARM966");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -175,7 +175,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -188,7 +188,7 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
retval = arm966e_read_cp15(target, address, &value);
|
retval = arm966e_read_cp15(target, address, &value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %" PRIi32,
|
"couldn't access reg %" PRIi32,
|
||||||
address);
|
address);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -197,19 +197,19 @@ COMMAND_HANDLER(arm966e_handle_cp15_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "%" PRIi32 ": %8.8" PRIx32,
|
||||||
address, value);
|
address, value);
|
||||||
} else if (CMD_ARGC == 2) {
|
} else if (CMD_ARGC == 2) {
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], value);
|
||||||
retval = arm966e_write_cp15(target, address, value);
|
retval = arm966e_write_cp15(target, address, value);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %" PRIi32,
|
"couldn't access reg %" PRIi32,
|
||||||
address);
|
address);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "%" PRIi32 ": %8.8" PRIx32,
|
||||||
address, value);
|
address, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -801,7 +801,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command)
|
||||||
/* it's uncommon, but some ARM7 chips can support this */
|
/* it's uncommon, but some ARM7 chips can support this */
|
||||||
if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC
|
if (arm7_9->common_magic != ARM7_9_COMMON_MAGIC
|
||||||
|| !arm7_9->has_vector_catch) {
|
|| !arm7_9->has_vector_catch) {
|
||||||
command_print(CMD_CTX, "target doesn't have EmbeddedICE "
|
command_print(CMD, "target doesn't have EmbeddedICE "
|
||||||
"with vector_catch");
|
"with vector_catch");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
|
@ -834,7 +834,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command)
|
||||||
|
|
||||||
/* complain if vector wasn't found */
|
/* complain if vector wasn't found */
|
||||||
if (!arm9tdmi_vectors[j].name) {
|
if (!arm9tdmi_vectors[j].name) {
|
||||||
command_print(CMD_CTX, "vector '%s' not found, leaving current setting unchanged", CMD_ARGV[i]);
|
command_print(CMD, "vector '%s' not found, leaving current setting unchanged", CMD_ARGV[i]);
|
||||||
|
|
||||||
/* reread current setting */
|
/* reread current setting */
|
||||||
vector_catch_value = buf_get_u32(
|
vector_catch_value = buf_get_u32(
|
||||||
|
@ -852,7 +852,7 @@ COMMAND_HANDLER(handle_arm9tdmi_catch_vectors_command)
|
||||||
|
|
||||||
/* output current settings */
|
/* output current settings */
|
||||||
for (unsigned i = 0; arm9tdmi_vectors[i].name; i++) {
|
for (unsigned i = 0; arm9tdmi_vectors[i].name; i++) {
|
||||||
command_print(CMD_CTX, "%s: %s", arm9tdmi_vectors[i].name,
|
command_print(CMD, "%s: %s", arm9tdmi_vectors[i].name,
|
||||||
(vector_catch_value & arm9tdmi_vectors[i].value)
|
(vector_catch_value & arm9tdmi_vectors[i].value)
|
||||||
? "catch" : "don't catch");
|
? "catch" : "don't catch");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1199,7 +1199,7 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
char tabs[16] = "";
|
char tabs[16] = "";
|
||||||
|
|
||||||
if (depth > 16) {
|
if (depth > 16) {
|
||||||
command_print(cmd->ctx, "\tTables too deep");
|
command_print(cmd, "\tTables too deep");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1207,25 +1207,25 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
snprintf(tabs, sizeof(tabs), "[L%02d] ", depth);
|
snprintf(tabs, sizeof(tabs), "[L%02d] ", depth);
|
||||||
|
|
||||||
uint32_t base_addr = dbgbase & 0xFFFFF000;
|
uint32_t base_addr = dbgbase & 0xFFFFF000;
|
||||||
command_print(cmd->ctx, "\t\tComponent base address 0x%08" PRIx32, base_addr);
|
command_print(cmd, "\t\tComponent base address 0x%08" PRIx32, base_addr);
|
||||||
|
|
||||||
retval = dap_read_part_id(ap, base_addr, &cid, &pid);
|
retval = dap_read_part_id(ap, base_addr, &cid, &pid);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(cmd->ctx, "\t\tCan't read component, the corresponding core might be turned off");
|
command_print(cmd, "\t\tCan't read component, the corresponding core might be turned off");
|
||||||
return ERROR_OK; /* Don't abort recursion */
|
return ERROR_OK; /* Don't abort recursion */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dap_cid_ok(cid)) {
|
if (!is_dap_cid_ok(cid)) {
|
||||||
command_print(cmd->ctx, "\t\tInvalid CID 0x%08" PRIx32, cid);
|
command_print(cmd, "\t\tInvalid CID 0x%08" PRIx32, cid);
|
||||||
return ERROR_OK; /* Don't abort recursion */
|
return ERROR_OK; /* Don't abort recursion */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* component may take multiple 4K pages */
|
/* component may take multiple 4K pages */
|
||||||
uint32_t size = (pid >> 36) & 0xf;
|
uint32_t size = (pid >> 36) & 0xf;
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
command_print(cmd->ctx, "\t\tStart address 0x%08" PRIx32, (uint32_t)(base_addr - 0x1000 * size));
|
command_print(cmd, "\t\tStart address 0x%08" PRIx32, (uint32_t)(base_addr - 0x1000 * size));
|
||||||
|
|
||||||
command_print(cmd->ctx, "\t\tPeripheral ID 0x%010" PRIx64, pid);
|
command_print(cmd, "\t\tPeripheral ID 0x%010" PRIx64, pid);
|
||||||
|
|
||||||
uint8_t class = (cid >> 12) & 0xf;
|
uint8_t class = (cid >> 12) & 0xf;
|
||||||
uint16_t part_num = pid & 0xfff;
|
uint16_t part_num = pid & 0xfff;
|
||||||
|
@ -1233,12 +1233,12 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
|
|
||||||
if (designer_id & 0x80) {
|
if (designer_id & 0x80) {
|
||||||
/* JEP106 code */
|
/* JEP106 code */
|
||||||
command_print(cmd->ctx, "\t\tDesigner is 0x%03" PRIx16 ", %s",
|
command_print(cmd, "\t\tDesigner is 0x%03" PRIx16 ", %s",
|
||||||
designer_id, jep106_manufacturer(designer_id >> 8, designer_id & 0x7f));
|
designer_id, jep106_manufacturer(designer_id >> 8, designer_id & 0x7f));
|
||||||
} else {
|
} else {
|
||||||
/* Legacy ASCII ID, clear invalid bits */
|
/* Legacy ASCII ID, clear invalid bits */
|
||||||
designer_id &= 0x7f;
|
designer_id &= 0x7f;
|
||||||
command_print(cmd->ctx, "\t\tDesigner ASCII code 0x%02" PRIx16 ", %s",
|
command_print(cmd, "\t\tDesigner ASCII code 0x%02" PRIx16 ", %s",
|
||||||
designer_id, designer_id == 0x41 ? "ARM" : "<unknown>");
|
designer_id, designer_id == 0x41 ? "ARM" : "<unknown>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1260,8 +1260,8 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx, "\t\tPart is 0x%" PRIx16", %s %s", part_num, type, full);
|
command_print(cmd, "\t\tPart is 0x%" PRIx16", %s %s", part_num, type, full);
|
||||||
command_print(cmd->ctx, "\t\tComponent class is 0x%" PRIx8 ", %s", class, class_description[class]);
|
command_print(cmd, "\t\tComponent class is 0x%" PRIx8 ", %s", class, class_description[class]);
|
||||||
|
|
||||||
if (class == 1) { /* ROM Table */
|
if (class == 1) { /* ROM Table */
|
||||||
uint32_t memtype;
|
uint32_t memtype;
|
||||||
|
@ -1270,9 +1270,9 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (memtype & 0x01)
|
if (memtype & 0x01)
|
||||||
command_print(cmd->ctx, "\t\tMEMTYPE system memory present on bus");
|
command_print(cmd, "\t\tMEMTYPE system memory present on bus");
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "\t\tMEMTYPE system memory not present: dedicated debug bus");
|
command_print(cmd, "\t\tMEMTYPE system memory not present: dedicated debug bus");
|
||||||
|
|
||||||
/* Read ROM table entries from base address until we get 0x00000000 or reach the reserved area */
|
/* Read ROM table entries from base address until we get 0x00000000 or reach the reserved area */
|
||||||
for (uint16_t entry_offset = 0; entry_offset < 0xF00; entry_offset += 4) {
|
for (uint16_t entry_offset = 0; entry_offset < 0xF00; entry_offset += 4) {
|
||||||
|
@ -1280,7 +1280,7 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
retval = mem_ap_read_atomic_u32(ap, base_addr | entry_offset, &romentry);
|
retval = mem_ap_read_atomic_u32(ap, base_addr | entry_offset, &romentry);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
command_print(cmd->ctx, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "",
|
command_print(cmd, "\t%sROMTABLE[0x%x] = 0x%" PRIx32 "",
|
||||||
tabs, entry_offset, romentry);
|
tabs, entry_offset, romentry);
|
||||||
if (romentry & 0x01) {
|
if (romentry & 0x01) {
|
||||||
/* Recurse */
|
/* Recurse */
|
||||||
|
@ -1288,9 +1288,9 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
} else if (romentry != 0) {
|
} else if (romentry != 0) {
|
||||||
command_print(cmd->ctx, "\t\tComponent not present");
|
command_print(cmd, "\t\tComponent not present");
|
||||||
} else {
|
} else {
|
||||||
command_print(cmd->ctx, "\t%s\tEnd of ROM table", tabs);
|
command_print(cmd, "\t%s\tEnd of ROM table", tabs);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1435,7 +1435,7 @@ static int dap_rom_display(struct command_invocation *cmd,
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_print(cmd->ctx, "\t\tType is 0x%02" PRIx8 ", %s, %s",
|
command_print(cmd, "\t\tType is 0x%02" PRIx8 ", %s, %s",
|
||||||
(uint8_t)(devtype & 0xff),
|
(uint8_t)(devtype & 0xff),
|
||||||
major, subtype);
|
major, subtype);
|
||||||
/* REVISIT also show 0xfc8 DevId */
|
/* REVISIT also show 0xfc8 DevId */
|
||||||
|
@ -1456,27 +1456,27 @@ int dap_info_command(struct command_invocation *cmd,
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(cmd->ctx, "AP ID register 0x%8.8" PRIx32, apid);
|
command_print(cmd, "AP ID register 0x%8.8" PRIx32, apid);
|
||||||
if (apid == 0) {
|
if (apid == 0) {
|
||||||
command_print(cmd->ctx, "No AP found at this ap 0x%x", ap->ap_num);
|
command_print(cmd, "No AP found at this ap 0x%x", ap->ap_num);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (apid & (IDR_JEP106 | IDR_TYPE)) {
|
switch (apid & (IDR_JEP106 | IDR_TYPE)) {
|
||||||
case IDR_JEP106_ARM | AP_TYPE_JTAG_AP:
|
case IDR_JEP106_ARM | AP_TYPE_JTAG_AP:
|
||||||
command_print(cmd->ctx, "\tType is JTAG-AP");
|
command_print(cmd, "\tType is JTAG-AP");
|
||||||
break;
|
break;
|
||||||
case IDR_JEP106_ARM | AP_TYPE_AHB_AP:
|
case IDR_JEP106_ARM | AP_TYPE_AHB_AP:
|
||||||
command_print(cmd->ctx, "\tType is MEM-AP AHB");
|
command_print(cmd, "\tType is MEM-AP AHB");
|
||||||
break;
|
break;
|
||||||
case IDR_JEP106_ARM | AP_TYPE_APB_AP:
|
case IDR_JEP106_ARM | AP_TYPE_APB_AP:
|
||||||
command_print(cmd->ctx, "\tType is MEM-AP APB");
|
command_print(cmd, "\tType is MEM-AP APB");
|
||||||
break;
|
break;
|
||||||
case IDR_JEP106_ARM | AP_TYPE_AXI_AP:
|
case IDR_JEP106_ARM | AP_TYPE_AXI_AP:
|
||||||
command_print(cmd->ctx, "\tType is MEM-AP AXI");
|
command_print(cmd, "\tType is MEM-AP AXI");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(cmd->ctx, "\tUnknown AP type");
|
command_print(cmd, "\tUnknown AP type");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1485,15 +1485,15 @@ int dap_info_command(struct command_invocation *cmd,
|
||||||
*/
|
*/
|
||||||
mem_ap = (apid & IDR_CLASS) == AP_CLASS_MEM_AP;
|
mem_ap = (apid & IDR_CLASS) == AP_CLASS_MEM_AP;
|
||||||
if (mem_ap) {
|
if (mem_ap) {
|
||||||
command_print(cmd->ctx, "MEM-AP BASE 0x%8.8" PRIx32, dbgbase);
|
command_print(cmd, "MEM-AP BASE 0x%8.8" PRIx32, dbgbase);
|
||||||
|
|
||||||
if (dbgbase == 0xFFFFFFFF || (dbgbase & 0x3) == 0x2) {
|
if (dbgbase == 0xFFFFFFFF || (dbgbase & 0x3) == 0x2) {
|
||||||
command_print(cmd->ctx, "\tNo ROM table present");
|
command_print(cmd, "\tNo ROM table present");
|
||||||
} else {
|
} else {
|
||||||
if (dbgbase & 0x01)
|
if (dbgbase & 0x01)
|
||||||
command_print(cmd->ctx, "\tValid ROM table present");
|
command_print(cmd, "\tValid ROM table present");
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "\tROM table in legacy format");
|
command_print(cmd, "\tROM table in legacy format");
|
||||||
|
|
||||||
dap_rom_display(cmd, ap, dbgbase & 0xFFFFF000, 0);
|
dap_rom_display(cmd, ap, dbgbase & 0xFFFFF000, 0);
|
||||||
}
|
}
|
||||||
|
@ -1681,7 +1681,7 @@ COMMAND_HANDLER(dap_baseaddr_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "0x%8.8" PRIx32, baseaddr);
|
command_print(CMD, "0x%8.8" PRIx32, baseaddr);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1703,7 +1703,7 @@ COMMAND_HANDLER(dap_memaccess_command)
|
||||||
}
|
}
|
||||||
dap->ap[dap->apsel].memaccess_tck = memaccess_tck;
|
dap->ap[dap->apsel].memaccess_tck = memaccess_tck;
|
||||||
|
|
||||||
command_print(CMD_CTX, "memory bus access delay set to %" PRIi32 " tck",
|
command_print(CMD, "memory bus access delay set to %" PRIi32 " tck",
|
||||||
dap->ap[dap->apsel].memaccess_tck);
|
dap->ap[dap->apsel].memaccess_tck);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1716,7 +1716,7 @@ COMMAND_HANDLER(dap_apsel_command)
|
||||||
|
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "%" PRIi32, dap->apsel);
|
command_print(CMD, "%" PRIi32, dap->apsel);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
case 1:
|
case 1:
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], apsel);
|
||||||
|
@ -1740,7 +1740,7 @@ COMMAND_HANDLER(dap_apcsw_command)
|
||||||
|
|
||||||
switch (CMD_ARGC) {
|
switch (CMD_ARGC) {
|
||||||
case 0:
|
case 0:
|
||||||
command_print(CMD_CTX, "ap %" PRIi32 " selected, csw 0x%8.8" PRIx32,
|
command_print(CMD, "ap %" PRIi32 " selected, csw 0x%8.8" PRIx32,
|
||||||
dap->apsel, apcsw);
|
dap->apsel, apcsw);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
case 1:
|
case 1:
|
||||||
|
@ -1801,7 +1801,7 @@ COMMAND_HANDLER(dap_apid_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "0x%8.8" PRIx32, apid);
|
command_print(CMD, "0x%8.8" PRIx32, apid);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1853,7 +1853,7 @@ COMMAND_HANDLER(dap_apreg_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (CMD_ARGC == 2)
|
if (CMD_ARGC == 2)
|
||||||
command_print(CMD_CTX, "0x%08" PRIx32, value);
|
command_print(CMD, "0x%08" PRIx32, value);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1884,7 +1884,7 @@ COMMAND_HANDLER(dap_dpreg_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (CMD_ARGC == 1)
|
if (CMD_ARGC == 1)
|
||||||
command_print(CMD_CTX, "0x%08" PRIx32, value);
|
command_print(CMD, "0x%08" PRIx32, value);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -1906,7 +1906,7 @@ COMMAND_HANDLER(dap_ti_be_32_quirks_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
dap->ti_be_32_quirks = enable;
|
dap->ti_be_32_quirks = enable;
|
||||||
command_print(CMD_CTX, "TI BE-32 quirks mode %s",
|
command_print(CMD, "TI BE-32 quirks mode %s",
|
||||||
enable ? "enabled" : "disabled");
|
enable ? "enabled" : "disabled");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -252,7 +252,7 @@ COMMAND_HANDLER(handle_cti_dump)
|
||||||
return JIM_ERR;
|
return JIM_ERR;
|
||||||
|
|
||||||
for (int i = 0; i < (int)ARRAY_SIZE(cti_names); i++)
|
for (int i = 0; i < (int)ARRAY_SIZE(cti_names); i++)
|
||||||
command_print(CMD_CTX, "%8.8s (0x%04"PRIx32") 0x%08"PRIx32,
|
command_print(CMD, "%8.8s (0x%04"PRIx32") 0x%08"PRIx32,
|
||||||
cti_names[i].label, cti_names[i].offset, *cti_names[i].p_val);
|
cti_names[i].label, cti_names[i].offset, *cti_names[i].p_val);
|
||||||
|
|
||||||
return JIM_OK;
|
return JIM_OK;
|
||||||
|
@ -336,7 +336,7 @@ COMMAND_HANDLER(handle_cti_read)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "0x%08"PRIx32, value);
|
command_print(CMD, "0x%08"PRIx32, value);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -778,17 +778,17 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
|
||||||
struct reg *regs;
|
struct reg *regs;
|
||||||
|
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "error: target must be halted for register accesses");
|
command_print(CMD, "error: target must be halted for register accesses");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arm->core_type != ARM_MODE_ANY) {
|
if (arm->core_type != ARM_MODE_ANY) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"Microcontroller Profile not supported - use standard reg cmd");
|
"Microcontroller Profile not supported - use standard reg cmd");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -799,7 +799,7 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arm->full_context) {
|
if (!arm->full_context) {
|
||||||
command_print(CMD_CTX, "error: target doesn't support %s",
|
command_print(CMD, "error: target doesn't support %s",
|
||||||
CMD_NAME);
|
CMD_NAME);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -828,7 +828,7 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
|
||||||
shadow = "shadow ";
|
shadow = "shadow ";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%s%s mode %sregisters",
|
command_print(CMD, "%s%s mode %sregisters",
|
||||||
sep, name, shadow);
|
sep, name, shadow);
|
||||||
|
|
||||||
/* display N rows of up to 4 registers each */
|
/* display N rows of up to 4 registers each */
|
||||||
|
@ -855,7 +855,7 @@ COMMAND_HANDLER(handle_armv4_5_reg_command)
|
||||||
"%8s: %8.8" PRIx32 " ",
|
"%8s: %8.8" PRIx32 " ",
|
||||||
reg->name, value);
|
reg->name, value);
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%s", output);
|
command_print(CMD, "%s", output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -868,13 +868,13 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command)
|
||||||
struct arm *arm = target_to_arm(target);
|
struct arm *arm = target_to_arm(target);
|
||||||
|
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arm->core_type == ARM_MODE_THREAD) {
|
if (arm->core_type == ARM_MODE_THREAD) {
|
||||||
/* armv7m not supported */
|
/* armv7m not supported */
|
||||||
command_print(CMD_CTX, "Unsupported Command");
|
command_print(CMD, "Unsupported Command");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -885,7 +885,7 @@ COMMAND_HANDLER(handle_armv4_5_core_state_command)
|
||||||
arm->core_state = ARM_STATE_THUMB;
|
arm->core_state = ARM_STATE_THUMB;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "core state: %s", arm_state_strings[arm->core_state]);
|
command_print(CMD, "core state: %s", arm_state_strings[arm->core_state]);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -906,7 +906,7 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
|
||||||
int thumb = 0;
|
int thumb = 0;
|
||||||
|
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ COMMAND_HANDLER(handle_arm_disassemble_command)
|
||||||
COMMAND_PARSE_ADDRESS(CMD_ARGV[0], address);
|
COMMAND_PARSE_ADDRESS(CMD_ARGV[0], address);
|
||||||
if (address & 0x01) {
|
if (address & 0x01) {
|
||||||
if (!thumb) {
|
if (!thumb) {
|
||||||
command_print(CMD_CTX, "Disassemble as Thumb");
|
command_print(CMD, "Disassemble as Thumb");
|
||||||
thumb = 1;
|
thumb = 1;
|
||||||
}
|
}
|
||||||
address &= ~1;
|
address &= ~1;
|
||||||
|
@ -963,7 +963,7 @@ usage:
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "%s", cur_instruction.text);
|
command_print(CMD, "%s", cur_instruction.text);
|
||||||
address += cur_instruction.instruction_size;
|
address += cur_instruction.instruction_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -79,20 +79,20 @@ int armv4_5_identify_cache(uint32_t cache_type_reg, struct armv4_5_cache_common
|
||||||
int armv4_5_handle_cache_info_command(struct command_invocation *cmd, struct armv4_5_cache_common *armv4_5_cache)
|
int armv4_5_handle_cache_info_command(struct command_invocation *cmd, struct armv4_5_cache_common *armv4_5_cache)
|
||||||
{
|
{
|
||||||
if (armv4_5_cache->ctype == -1) {
|
if (armv4_5_cache->ctype == -1) {
|
||||||
command_print(cmd->ctx, "cache not yet identified");
|
command_print(cmd, "cache not yet identified");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx, "cache type: 0x%1.1x, %s", armv4_5_cache->ctype,
|
command_print(cmd, "cache type: 0x%1.1x, %s", armv4_5_cache->ctype,
|
||||||
(armv4_5_cache->separate) ? "separate caches" : "unified cache");
|
(armv4_5_cache->separate) ? "separate caches" : "unified cache");
|
||||||
|
|
||||||
command_print(cmd->ctx, "D-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
|
command_print(cmd, "D-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
|
||||||
armv4_5_cache->d_u_size.linelen,
|
armv4_5_cache->d_u_size.linelen,
|
||||||
armv4_5_cache->d_u_size.associativity,
|
armv4_5_cache->d_u_size.associativity,
|
||||||
armv4_5_cache->d_u_size.nsets,
|
armv4_5_cache->d_u_size.nsets,
|
||||||
armv4_5_cache->d_u_size.cachesize);
|
armv4_5_cache->d_u_size.cachesize);
|
||||||
|
|
||||||
command_print(cmd->ctx, "I-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
|
command_print(cmd, "I-Cache: linelen %i, associativity %i, nsets %i, cachesize 0x%x",
|
||||||
armv4_5_cache->i_size.linelen,
|
armv4_5_cache->i_size.linelen,
|
||||||
armv4_5_cache->i_size.associativity,
|
armv4_5_cache->i_size.associativity,
|
||||||
armv4_5_cache->i_size.nsets,
|
armv4_5_cache->i_size.nsets,
|
||||||
|
|
|
@ -229,7 +229,7 @@ COMMAND_HANDLER(handle_cache_l2x)
|
||||||
if (CMD_ARGC != 2)
|
if (CMD_ARGC != 2)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
/* command_print(CMD_CTX, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
|
/* command_print(CMD, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
|
||||||
|
|
||||||
|
@ -248,7 +248,7 @@ int armv7a_handle_cache_info_command(struct command_invocation *cmd,
|
||||||
int cl;
|
int cl;
|
||||||
|
|
||||||
if (armv7a_cache->info == -1) {
|
if (armv7a_cache->info == -1) {
|
||||||
command_print(cmd->ctx, "cache not yet identified");
|
command_print(cmd, "cache not yet identified");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -256,7 +256,7 @@ int armv7a_handle_cache_info_command(struct command_invocation *cmd,
|
||||||
struct armv7a_arch_cache *arch = &(armv7a_cache->arch[cl]);
|
struct armv7a_arch_cache *arch = &(armv7a_cache->arch[cl]);
|
||||||
|
|
||||||
if (arch->ctype & 1) {
|
if (arch->ctype & 1) {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"L%d I-Cache: linelen %" PRIi32
|
"L%d I-Cache: linelen %" PRIi32
|
||||||
", associativity %" PRIi32
|
", associativity %" PRIi32
|
||||||
", nsets %" PRIi32
|
", nsets %" PRIi32
|
||||||
|
@ -269,7 +269,7 @@ int armv7a_handle_cache_info_command(struct command_invocation *cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arch->ctype >= 2) {
|
if (arch->ctype >= 2) {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"L%d D-Cache: linelen %" PRIi32
|
"L%d D-Cache: linelen %" PRIi32
|
||||||
", associativity %" PRIi32
|
", associativity %" PRIi32
|
||||||
", nsets %" PRIi32
|
", nsets %" PRIi32
|
||||||
|
@ -283,7 +283,7 @@ int armv7a_handle_cache_info_command(struct command_invocation *cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (l2x_cache != NULL)
|
if (l2x_cache != NULL)
|
||||||
command_print(cmd->ctx, "Outer unified cache Base Address 0x%" PRIx32 ", %" PRId32 " ways",
|
command_print(cmd, "Outer unified cache Base Address 0x%" PRIx32 ", %" PRId32 " ways",
|
||||||
l2x_cache->base, l2x_cache->way);
|
l2x_cache->base, l2x_cache->way);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -513,7 +513,7 @@ COMMAND_HANDLER(arm7a_cache_disable_auto_cmd)
|
||||||
struct armv7a_common *armv7a = target_to_armv7a(target);
|
struct armv7a_common *armv7a = target_to_armv7a(target);
|
||||||
|
|
||||||
if (CMD_ARGC == 0) {
|
if (CMD_ARGC == 0) {
|
||||||
command_print(CMD_CTX, "auto cache is %s",
|
command_print(CMD, "auto cache is %s",
|
||||||
armv7a->armv7a_mmu.armv7a_cache.auto_cache_enabled ? "enabled" : "disabled");
|
armv7a->armv7a_mmu.armv7a_cache.auto_cache_enabled ? "enabled" : "disabled");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -180,11 +180,11 @@ static int arm7a_handle_l2x_cache_info_command(struct command_invocation *cmd,
|
||||||
(armv7a_cache->outer_cache);
|
(armv7a_cache->outer_cache);
|
||||||
|
|
||||||
if (armv7a_cache->info == -1) {
|
if (armv7a_cache->info == -1) {
|
||||||
command_print(cmd->ctx, "cache not yet identified");
|
command_print(cmd, "cache not yet identified");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"L2 unified cache Base Address 0x%" PRIx32 ", %" PRId32 " ways",
|
"L2 unified cache Base Address 0x%" PRIx32 ", %" PRId32 " ways",
|
||||||
l2x_cache->base, l2x_cache->way);
|
l2x_cache->base, l2x_cache->way);
|
||||||
|
|
||||||
|
@ -312,7 +312,7 @@ COMMAND_HANDLER(armv7a_l2x_cache_conf_cmd)
|
||||||
if (CMD_ARGC != 2)
|
if (CMD_ARGC != 2)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
/* command_print(CMD_CTX, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
|
/* command_print(CMD, "%s %s", CMD_ARGV[0], CMD_ARGV[1]); */
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], base);
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], way);
|
||||||
|
|
||||||
|
|
|
@ -1054,7 +1054,7 @@ COMMAND_HANDLER(armv8_handle_exception_catch_command)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "Exception Catch: Secure: %s, Non-Secure: %s", sec, nsec);
|
command_print(CMD, "Exception Catch: Secure: %s, Non-Secure: %s", sec, nsec);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1083,7 +1083,7 @@ int armv8_handle_cache_info_command(struct command_invocation *cmd,
|
||||||
struct armv8_cache_common *armv8_cache)
|
struct armv8_cache_common *armv8_cache)
|
||||||
{
|
{
|
||||||
if (armv8_cache->info == -1) {
|
if (armv8_cache->info == -1) {
|
||||||
command_print(cmd->ctx, "cache not yet identified");
|
command_print(cmd, "cache not yet identified");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -194,7 +194,7 @@ static int armv8_handle_inner_cache_info_command(struct command_invocation *cmd,
|
||||||
int cl;
|
int cl;
|
||||||
|
|
||||||
if (armv8_cache->info == -1) {
|
if (armv8_cache->info == -1) {
|
||||||
command_print(cmd->ctx, "cache not yet identified");
|
command_print(cmd, "cache not yet identified");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -202,7 +202,7 @@ static int armv8_handle_inner_cache_info_command(struct command_invocation *cmd,
|
||||||
struct armv8_arch_cache *arch = &(armv8_cache->arch[cl]);
|
struct armv8_arch_cache *arch = &(armv8_cache->arch[cl]);
|
||||||
|
|
||||||
if (arch->ctype & 1) {
|
if (arch->ctype & 1) {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"L%d I-Cache: linelen %" PRIi32
|
"L%d I-Cache: linelen %" PRIi32
|
||||||
", associativity %" PRIi32
|
", associativity %" PRIi32
|
||||||
", nsets %" PRIi32
|
", nsets %" PRIi32
|
||||||
|
@ -215,7 +215,7 @@ static int armv8_handle_inner_cache_info_command(struct command_invocation *cmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arch->ctype >= 2) {
|
if (arch->ctype >= 2) {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"L%d D-Cache: linelen %" PRIi32
|
"L%d D-Cache: linelen %" PRIi32
|
||||||
", associativity %" PRIi32
|
", associativity %" PRIi32
|
||||||
", nsets %" PRIi32
|
", nsets %" PRIi32
|
||||||
|
|
|
@ -2969,7 +2969,7 @@ COMMAND_HANDLER(handle_cortex_a_mask_interrupts_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_a->isrmasking_mode);
|
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_a->isrmasking_mode);
|
||||||
command_print(CMD_CTX, "cortex_a interrupt mask %s", n->name);
|
command_print(CMD, "cortex_a interrupt mask %s", n->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2995,7 +2995,7 @@ COMMAND_HANDLER(handle_cortex_a_dacrfixup_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = Jim_Nvp_value2name_simple(nvp_dacrfixup_modes, cortex_a->dacrfixup_mode);
|
n = Jim_Nvp_value2name_simple(nvp_dacrfixup_modes, cortex_a->dacrfixup_mode);
|
||||||
command_print(CMD_CTX, "cortex_a domain access control fixup %s", n->name);
|
command_print(CMD, "cortex_a domain access control fixup %s", n->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2370,7 +2370,7 @@ static int cortex_m_verify_pointer(struct command_invocation *cmd,
|
||||||
struct cortex_m_common *cm)
|
struct cortex_m_common *cm)
|
||||||
{
|
{
|
||||||
if (cm->common_magic != CORTEX_M_COMMON_MAGIC) {
|
if (cm->common_magic != CORTEX_M_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not a Cortex-M");
|
command_print(cmd, "target is not a Cortex-M");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -2459,7 +2459,7 @@ write:
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < ARRAY_SIZE(vec_ids); i++) {
|
for (unsigned i = 0; i < ARRAY_SIZE(vec_ids); i++) {
|
||||||
command_print(CMD_CTX, "%9s: %s", vec_ids[i].name,
|
command_print(CMD, "%9s: %s", vec_ids[i].name,
|
||||||
(demcr & vec_ids[i].mask) ? "catch" : "ignore");
|
(demcr & vec_ids[i].mask) ? "catch" : "ignore");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2487,7 +2487,7 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2500,7 +2500,7 @@ COMMAND_HANDLER(handle_cortex_m_mask_interrupts_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_m->isrmasking_mode);
|
n = Jim_Nvp_value2name_simple(nvp_maskisr_modes, cortex_m->isrmasking_mode);
|
||||||
command_print(CMD_CTX, "cortex_m interrupt mask %s", n->name);
|
command_print(CMD, "cortex_m interrupt mask %s", n->name);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2545,7 +2545,7 @@ COMMAND_HANDLER(handle_cortex_m_reset_config_command)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "cortex_m reset_config %s", reset_config);
|
command_print(CMD, "cortex_m reset_config %s", reset_config);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1930,7 +1930,7 @@ static void handle_md_output(struct command_invocation *cmd,
|
||||||
value);
|
value);
|
||||||
|
|
||||||
if ((i % line_modulo == line_modulo - 1) || (i == count - 1)) {
|
if ((i % line_modulo == line_modulo - 1) || (i == count - 1)) {
|
||||||
command_print(cmd->ctx, "%s", output);
|
command_print(cmd, "%s", output);
|
||||||
output_len = 0;
|
output_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1680,7 +1680,7 @@ COMMAND_HANDLER(handle_esirisc_cache_arch_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "esirisc cache_arch %s", esirisc_cache_arch_name(esirisc));
|
command_print(CMD, "esirisc cache_arch %s", esirisc_cache_arch_name(esirisc));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -1698,7 +1698,7 @@ COMMAND_HANDLER(handle_esirisc_flush_caches_command)
|
||||||
|
|
||||||
retval = esirisc_flush_caches(target);
|
retval = esirisc_flush_caches(target);
|
||||||
|
|
||||||
command_print(CMD_CTX, "cache flush %s",
|
command_print(CMD, "cache flush %s",
|
||||||
(retval == ERROR_OK) ? "successful" : "failed");
|
(retval == ERROR_OK) ? "successful" : "failed");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -1748,7 +1748,7 @@ COMMAND_HANDLER(handle_esirisc_hwdc_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
for (size_t i = 0; i < ARRAY_SIZE(esirisc_hwdc_masks); ++i)
|
for (size_t i = 0; i < ARRAY_SIZE(esirisc_hwdc_masks); ++i)
|
||||||
command_print(CMD_CTX, "%9s: %s", esirisc_hwdc_masks[i].name,
|
command_print(CMD, "%9s: %s", esirisc_hwdc_masks[i].name,
|
||||||
(esirisc->hwdc_save & esirisc_hwdc_masks[i].mask) ? "enabled" : "disabled");
|
(esirisc->hwdc_save & esirisc_hwdc_masks[i].mask) ? "enabled" : "disabled");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -403,7 +403,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
|
||||||
case ESIRISC_TRACE_ID_EXECUTE:
|
case ESIRISC_TRACE_ID_EXECUTE:
|
||||||
case ESIRISC_TRACE_ID_STALL:
|
case ESIRISC_TRACE_ID_STALL:
|
||||||
case ESIRISC_TRACE_ID_BRANCH:
|
case ESIRISC_TRACE_ID_BRANCH:
|
||||||
command_print(cmd->ctx, "%s", esirisc_trace_id_strings[id]);
|
command_print(cmd, "%s", esirisc_trace_id_strings[id]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESIRISC_TRACE_ID_EXTENDED: {
|
case ESIRISC_TRACE_ID_EXTENDED: {
|
||||||
|
@ -417,7 +417,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
|
||||||
case ESIRISC_TRACE_EXT_ID_STOP:
|
case ESIRISC_TRACE_EXT_ID_STOP:
|
||||||
case ESIRISC_TRACE_EXT_ID_WAIT:
|
case ESIRISC_TRACE_EXT_ID_WAIT:
|
||||||
case ESIRISC_TRACE_EXT_ID_MULTICYCLE:
|
case ESIRISC_TRACE_EXT_ID_MULTICYCLE:
|
||||||
command_print(cmd->ctx, "%s", esirisc_trace_ext_id_strings[ext_id]);
|
command_print(cmd, "%s", esirisc_trace_ext_id_strings[ext_id]);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESIRISC_TRACE_EXT_ID_ERET:
|
case ESIRISC_TRACE_EXT_ID_ERET:
|
||||||
|
@ -430,11 +430,11 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
command_print(cmd->ctx, "%s PC: 0x%" PRIx32,
|
command_print(cmd, "%s PC: 0x%" PRIx32,
|
||||||
esirisc_trace_ext_id_strings[ext_id], pc);
|
esirisc_trace_ext_id_strings[ext_id], pc);
|
||||||
|
|
||||||
if (ext_id == ESIRISC_TRACE_EXT_ID_END_PC) {
|
if (ext_id == ESIRISC_TRACE_EXT_ID_END_PC) {
|
||||||
command_print(cmd->ctx, "--- end of trace ---");
|
command_print(cmd, "--- end of trace ---");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -450,7 +450,7 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
command_print(cmd->ctx, "%s EID: 0x%" PRIx32 ", EPC: 0x%" PRIx32,
|
command_print(cmd, "%s EID: 0x%" PRIx32 ", EPC: 0x%" PRIx32,
|
||||||
esirisc_trace_ext_id_strings[ext_id], eid, epc);
|
esirisc_trace_ext_id_strings[ext_id], eid, epc);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -461,28 +461,28 @@ static int esirisc_trace_analyze_full(struct command_invocation *cmd, uint8_t *b
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
command_print(cmd->ctx, "repeats %" PRId32 " %s", count,
|
command_print(cmd, "repeats %" PRId32 " %s", count,
|
||||||
(count == 1) ? "time" : "times");
|
(count == 1) ? "time" : "times");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ESIRISC_TRACE_EXT_ID_END:
|
case ESIRISC_TRACE_EXT_ID_END:
|
||||||
command_print(cmd->ctx, "--- end of trace ---");
|
command_print(cmd, "--- end of trace ---");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
command_print(cmd->ctx, "invalid extended trace ID: %" PRId32, ext_id);
|
command_print(cmd, "invalid extended trace ID: %" PRId32, ext_id);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
command_print(cmd->ctx, "invalid trace ID: %" PRId32, id);
|
command_print(cmd, "invalid trace ID: %" PRId32, id);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
command_print(cmd->ctx, "trace buffer too small");
|
command_print(cmd, "trace buffer too small");
|
||||||
return ERROR_BUF_TOO_SMALL;
|
return ERROR_BUF_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -504,14 +504,14 @@ static int esirisc_trace_analyze_simple(struct command_invocation *cmd, uint8_t
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (pc == end_of_trace) {
|
if (pc == end_of_trace) {
|
||||||
command_print(cmd->ctx, "--- end of trace ---");
|
command_print(cmd, "--- end of trace ---");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx, "PC: 0x%" PRIx32, pc);
|
command_print(cmd, "PC: 0x%" PRIx32, pc);
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx, "trace buffer too small");
|
command_print(cmd, "trace buffer too small");
|
||||||
return ERROR_BUF_TOO_SMALL;
|
return ERROR_BUF_TOO_SMALL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -523,19 +523,19 @@ static int esirisc_trace_analyze(struct command_invocation *cmd, uint8_t *buffer
|
||||||
|
|
||||||
switch (trace_info->format) {
|
switch (trace_info->format) {
|
||||||
case ESIRISC_TRACE_FORMAT_FULL:
|
case ESIRISC_TRACE_FORMAT_FULL:
|
||||||
command_print(cmd->ctx, "--- full pipeline ---");
|
command_print(cmd, "--- full pipeline ---");
|
||||||
return esirisc_trace_analyze_full(cmd, buffer, size);
|
return esirisc_trace_analyze_full(cmd, buffer, size);
|
||||||
|
|
||||||
case ESIRISC_TRACE_FORMAT_BRANCH:
|
case ESIRISC_TRACE_FORMAT_BRANCH:
|
||||||
command_print(cmd->ctx, "--- branches taken ---");
|
command_print(cmd, "--- branches taken ---");
|
||||||
return esirisc_trace_analyze_full(cmd, buffer, size);
|
return esirisc_trace_analyze_full(cmd, buffer, size);
|
||||||
|
|
||||||
case ESIRISC_TRACE_FORMAT_ICACHE:
|
case ESIRISC_TRACE_FORMAT_ICACHE:
|
||||||
command_print(cmd->ctx, "--- icache misses ---");
|
command_print(cmd, "--- icache misses ---");
|
||||||
return esirisc_trace_analyze_simple(cmd, buffer, size);
|
return esirisc_trace_analyze_simple(cmd, buffer, size);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
command_print(cmd->ctx, "invalid trace format: %i", trace_info->format);
|
command_print(cmd, "invalid trace format: %i", trace_info->format);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -552,7 +552,7 @@ static int esirisc_trace_analyze_buffer(struct command_invocation *cmd)
|
||||||
size = esirisc_trace_buffer_size(trace_info);
|
size = esirisc_trace_buffer_size(trace_info);
|
||||||
buffer = calloc(1, size);
|
buffer = calloc(1, size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(cmd->ctx, "out of memory");
|
command_print(cmd, "out of memory");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,7 +577,7 @@ static int esirisc_trace_analyze_memory(struct command_invocation *cmd,
|
||||||
|
|
||||||
buffer = calloc(1, size);
|
buffer = calloc(1, size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(cmd->ctx, "out of memory");
|
command_print(cmd, "out of memory");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -602,15 +602,15 @@ static int esirisc_trace_dump(struct command_invocation *cmd, const char *filena
|
||||||
|
|
||||||
retval = fileio_open(&fileio, filename, FILEIO_WRITE, FILEIO_BINARY);
|
retval = fileio_open(&fileio, filename, FILEIO_WRITE, FILEIO_BINARY);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(cmd->ctx, "could not open dump file: %s", filename);
|
command_print(cmd, "could not open dump file: %s", filename);
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
retval = fileio_write(fileio, size, buffer, &size_written);
|
retval = fileio_write(fileio, size, buffer, &size_written);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(cmd->ctx, "trace data dumped to: %s", filename);
|
command_print(cmd, "trace data dumped to: %s", filename);
|
||||||
else
|
else
|
||||||
command_print(cmd->ctx, "could not write dump file: %s", filename);
|
command_print(cmd, "could not write dump file: %s", filename);
|
||||||
|
|
||||||
fileio_close(fileio);
|
fileio_close(fileio);
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ static int esirisc_trace_dump_buffer(struct command_invocation *cmd, const char
|
||||||
size = esirisc_trace_buffer_size(trace_info);
|
size = esirisc_trace_buffer_size(trace_info);
|
||||||
buffer = calloc(1, size);
|
buffer = calloc(1, size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(cmd->ctx, "out of memory");
|
command_print(cmd, "out of memory");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -654,7 +654,7 @@ static int esirisc_trace_dump_memory(struct command_invocation *cmd, const char
|
||||||
|
|
||||||
buffer = calloc(1, size);
|
buffer = calloc(1, size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(cmd->ctx, "out of memory");
|
command_print(cmd, "out of memory");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -676,13 +676,13 @@ COMMAND_HANDLER(handle_esirisc_trace_init_command)
|
||||||
struct esirisc_common *esirisc = target_to_esirisc(target);
|
struct esirisc_common *esirisc = target_to_esirisc(target);
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retval = esirisc_trace_init(target);
|
int retval = esirisc_trace_init(target);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "trace initialized");
|
command_print(CMD, "trace initialized");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -694,42 +694,42 @@ COMMAND_HANDLER(handle_esirisc_trace_info_command)
|
||||||
struct esirisc_trace *trace_info = &esirisc->trace_info;
|
struct esirisc_trace *trace_info = &esirisc->trace_info;
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (esirisc_trace_is_fifo(trace_info))
|
if (esirisc_trace_is_fifo(trace_info))
|
||||||
command_print(CMD_CTX, "trace FIFO address: 0x%" TARGET_PRIxADDR,
|
command_print(CMD, "trace FIFO address: 0x%" TARGET_PRIxADDR,
|
||||||
trace_info->buffer_start);
|
trace_info->buffer_start);
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "trace buffer start: 0x%" TARGET_PRIxADDR,
|
command_print(CMD, "trace buffer start: 0x%" TARGET_PRIxADDR,
|
||||||
trace_info->buffer_start);
|
trace_info->buffer_start);
|
||||||
command_print(CMD_CTX, "trace buffer end: 0x%" TARGET_PRIxADDR,
|
command_print(CMD, "trace buffer end: 0x%" TARGET_PRIxADDR,
|
||||||
trace_info->buffer_end);
|
trace_info->buffer_end);
|
||||||
command_print(CMD_CTX, "trace buffer will %swrap",
|
command_print(CMD, "trace buffer will %swrap",
|
||||||
trace_info->buffer_wrap ? "" : "not ");
|
trace_info->buffer_wrap ? "" : "not ");
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "flow control: %s",
|
command_print(CMD, "flow control: %s",
|
||||||
trace_info->flow_control ? "enabled" : "disabled");
|
trace_info->flow_control ? "enabled" : "disabled");
|
||||||
|
|
||||||
command_print(CMD_CTX, "trace format: %s",
|
command_print(CMD, "trace format: %s",
|
||||||
esirisc_trace_format_strings[trace_info->format]);
|
esirisc_trace_format_strings[trace_info->format]);
|
||||||
command_print(CMD_CTX, "number of PC bits: %i", trace_info->pc_bits);
|
command_print(CMD, "number of PC bits: %i", trace_info->pc_bits);
|
||||||
|
|
||||||
command_print(CMD_CTX, "start trigger: %s",
|
command_print(CMD, "start trigger: %s",
|
||||||
esirisc_trace_trigger_strings[trace_info->start_trigger]);
|
esirisc_trace_trigger_strings[trace_info->start_trigger]);
|
||||||
command_print(CMD_CTX, "start data: 0x%" PRIx32, trace_info->start_data);
|
command_print(CMD, "start data: 0x%" PRIx32, trace_info->start_data);
|
||||||
command_print(CMD_CTX, "start mask: 0x%" PRIx32, trace_info->start_mask);
|
command_print(CMD, "start mask: 0x%" PRIx32, trace_info->start_mask);
|
||||||
|
|
||||||
command_print(CMD_CTX, "stop trigger: %s",
|
command_print(CMD, "stop trigger: %s",
|
||||||
esirisc_trace_trigger_strings[trace_info->stop_trigger]);
|
esirisc_trace_trigger_strings[trace_info->stop_trigger]);
|
||||||
command_print(CMD_CTX, "stop data: 0x%" PRIx32, trace_info->stop_data);
|
command_print(CMD, "stop data: 0x%" PRIx32, trace_info->stop_data);
|
||||||
command_print(CMD_CTX, "stop mask: 0x%" PRIx32, trace_info->stop_mask);
|
command_print(CMD, "stop mask: 0x%" PRIx32, trace_info->stop_mask);
|
||||||
|
|
||||||
command_print(CMD_CTX, "trigger delay: %s",
|
command_print(CMD, "trigger delay: %s",
|
||||||
esirisc_trace_delay_strings[trace_info->delay]);
|
esirisc_trace_delay_strings[trace_info->delay]);
|
||||||
command_print(CMD_CTX, "trigger delay cycles: %i", trace_info->delay_cycles);
|
command_print(CMD, "trigger delay cycles: %i", trace_info->delay_cycles);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -741,7 +741,7 @@ COMMAND_HANDLER(handle_esirisc_trace_status_command)
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -749,7 +749,7 @@ COMMAND_HANDLER(handle_esirisc_trace_status_command)
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
command_print(CMD_CTX, "trace is %s%s%s%s",
|
command_print(CMD, "trace is %s%s%s%s",
|
||||||
(status & STATUS_T) ? "started" : "stopped",
|
(status & STATUS_T) ? "started" : "stopped",
|
||||||
(status & STATUS_TD) ? ", disabled" : "",
|
(status & STATUS_TD) ? ", disabled" : "",
|
||||||
(status & STATUS_W) ? ", wrapped" : "",
|
(status & STATUS_W) ? ", wrapped" : "",
|
||||||
|
@ -764,13 +764,13 @@ COMMAND_HANDLER(handle_esirisc_trace_start_command)
|
||||||
struct esirisc_common *esirisc = target_to_esirisc(target);
|
struct esirisc_common *esirisc = target_to_esirisc(target);
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retval = esirisc_trace_start(target);
|
int retval = esirisc_trace_start(target);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "trace started");
|
command_print(CMD, "trace started");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -781,13 +781,13 @@ COMMAND_HANDLER(handle_esirisc_trace_stop_command)
|
||||||
struct esirisc_common *esirisc = target_to_esirisc(target);
|
struct esirisc_common *esirisc = target_to_esirisc(target);
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int retval = esirisc_trace_stop(target);
|
int retval = esirisc_trace_stop(target);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "trace stopped");
|
command_print(CMD, "trace stopped");
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -801,7 +801,7 @@ COMMAND_HANDLER(handle_esirisc_trace_analyze_command)
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -817,7 +817,7 @@ COMMAND_HANDLER(handle_esirisc_trace_analyze_command)
|
||||||
* as arguments as a workaround.
|
* as arguments as a workaround.
|
||||||
*/
|
*/
|
||||||
if (esirisc_trace_is_fifo(trace_info)) {
|
if (esirisc_trace_is_fifo(trace_info)) {
|
||||||
command_print(CMD_CTX, "analyze from FIFO not supported");
|
command_print(CMD, "analyze from FIFO not supported");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ COMMAND_HANDLER(handle_esirisc_trace_dump_command)
|
||||||
uint32_t size;
|
uint32_t size;
|
||||||
|
|
||||||
if (!esirisc->has_trace) {
|
if (!esirisc->has_trace) {
|
||||||
command_print(CMD_CTX, "target does not support trace");
|
command_print(CMD, "target does not support trace");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,7 +849,7 @@ COMMAND_HANDLER(handle_esirisc_trace_dump_command)
|
||||||
if (CMD_ARGC == 1) {
|
if (CMD_ARGC == 1) {
|
||||||
/* also see: handle_esirisc_trace_analyze_command() */
|
/* also see: handle_esirisc_trace_analyze_command() */
|
||||||
if (esirisc_trace_is_fifo(trace_info)) {
|
if (esirisc_trace_is_fifo(trace_info)) {
|
||||||
command_print(CMD_CTX, "dump from FIFO not supported");
|
command_print(CMD, "dump from FIFO not supported");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -946,7 +946,7 @@ COMMAND_HANDLER(handle_esirisc_trace_format_command)
|
||||||
COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], pc_bits);
|
COMMAND_PARSE_NUMBER(int, CMD_ARGV[1], pc_bits);
|
||||||
|
|
||||||
if (pc_bits < 1 || pc_bits > 31) {
|
if (pc_bits < 1 || pc_bits > 31) {
|
||||||
command_print(CMD_CTX, "invalid pc_bits: %i; must be 1..31", pc_bits);
|
command_print(CMD, "invalid pc_bits: %i; must be 1..31", pc_bits);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -344,13 +344,13 @@ COMMAND_HANDLER(handle_etb_config_command)
|
||||||
|
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETB: '%s' isn't an ARM", CMD_ARGV[0]);
|
command_print(CMD, "ETB: '%s' isn't an ARM", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
tap = jtag_tap_by_string(CMD_ARGV[1]);
|
tap = jtag_tap_by_string(CMD_ARGV[1]);
|
||||||
if (tap == NULL) {
|
if (tap == NULL) {
|
||||||
command_print(CMD_CTX, "ETB: TAP %s does not exist", CMD_ARGV[1]);
|
command_print(CMD, "ETB: TAP %s does not exist", CMD_ARGV[1]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -382,17 +382,17 @@ COMMAND_HANDLER(handle_etb_trigger_percent_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETB: current target isn't an ARM");
|
command_print(CMD, "ETB: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm = arm->etm;
|
etm = arm->etm;
|
||||||
if (!etm) {
|
if (!etm) {
|
||||||
command_print(CMD_CTX, "ETB: target has no ETM configured");
|
command_print(CMD, "ETB: target has no ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
if (etm->capture_driver != &etb_capture_driver) {
|
if (etm->capture_driver != &etb_capture_driver) {
|
||||||
command_print(CMD_CTX, "ETB: target not using ETB");
|
command_print(CMD, "ETB: target not using ETB");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
etb = arm->etm->capture_driver_priv;
|
etb = arm->etm->capture_driver_priv;
|
||||||
|
@ -402,13 +402,13 @@ COMMAND_HANDLER(handle_etb_trigger_percent_command)
|
||||||
|
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], new_value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], new_value);
|
||||||
if ((new_value < 2) || (new_value > 100))
|
if ((new_value < 2) || (new_value > 100))
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"valid percentages are 2%% to 100%%");
|
"valid percentages are 2%% to 100%%");
|
||||||
else
|
else
|
||||||
etb->trigger_percent = (unsigned) new_value;
|
etb->trigger_percent = (unsigned) new_value;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%d percent of tracebuffer fills after trigger",
|
command_print(CMD, "%d percent of tracebuffer fills after trigger",
|
||||||
etb->trigger_percent);
|
etb->trigger_percent);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
178
src/target/etm.c
178
src/target/etm.c
|
@ -869,7 +869,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
ctx->capture_driver->read_trace(ctx);
|
ctx->capture_driver->read_trace(ctx);
|
||||||
|
|
||||||
if (ctx->trace_depth == 0) {
|
if (ctx->trace_depth == 0) {
|
||||||
command_print(cmd->ctx, "Trace is empty.");
|
command_print(cmd, "Trace is empty.");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -893,7 +893,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
int current_pc_ok = ctx->pc_ok;
|
int current_pc_ok = ctx->pc_ok;
|
||||||
|
|
||||||
if (ctx->trace_data[ctx->pipe_index].flags & ETMV1_TRIGGER_CYCLE)
|
if (ctx->trace_data[ctx->pipe_index].flags & ETMV1_TRIGGER_CYCLE)
|
||||||
command_print(cmd->ctx, "--- trigger ---");
|
command_print(cmd, "--- trigger ---");
|
||||||
|
|
||||||
/* instructions execute in IE/D or BE/D cycles */
|
/* instructions execute in IE/D or BE/D cycles */
|
||||||
if ((pipestat == STAT_IE) || (pipestat == STAT_ID))
|
if ((pipestat == STAT_IE) || (pipestat == STAT_ID))
|
||||||
|
@ -942,7 +942,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
next_pc = ctx->last_branch;
|
next_pc = ctx->last_branch;
|
||||||
break;
|
break;
|
||||||
case 0x1: /* tracing enabled */
|
case 0x1: /* tracing enabled */
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"--- tracing enabled at 0x%8.8" PRIx32 " ---",
|
"--- tracing enabled at 0x%8.8" PRIx32 " ---",
|
||||||
ctx->last_branch);
|
ctx->last_branch);
|
||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
|
@ -950,7 +950,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
case 0x2: /* trace restarted after FIFO overflow */
|
case 0x2: /* trace restarted after FIFO overflow */
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
|
"--- trace restarted after FIFO overflow at 0x%8.8" PRIx32 " ---",
|
||||||
ctx->last_branch);
|
ctx->last_branch);
|
||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
|
@ -958,7 +958,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
continue;
|
continue;
|
||||||
break;
|
break;
|
||||||
case 0x3: /* exit from debug state */
|
case 0x3: /* exit from debug state */
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
|
"--- exit from debug state at 0x%8.8" PRIx32 " ---",
|
||||||
ctx->last_branch);
|
ctx->last_branch);
|
||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
|
@ -971,7 +971,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
* we have to move on with the next trace cycle
|
* we have to move on with the next trace cycle
|
||||||
*/
|
*/
|
||||||
if (!current_pc_ok) {
|
if (!current_pc_ok) {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"--- periodic synchronization point at 0x%8.8" PRIx32 " ---",
|
"--- periodic synchronization point at 0x%8.8" PRIx32 " ---",
|
||||||
next_pc);
|
next_pc);
|
||||||
ctx->current_pc = next_pc;
|
ctx->current_pc = next_pc;
|
||||||
|
@ -998,9 +998,9 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
|| ((ctx->last_branch >= 0xffff0000) &&
|
|| ((ctx->last_branch >= 0xffff0000) &&
|
||||||
(ctx->last_branch <= 0xffff0020))) {
|
(ctx->last_branch <= 0xffff0020))) {
|
||||||
if ((ctx->last_branch & 0xff) == 0x10)
|
if ((ctx->last_branch & 0xff) == 0x10)
|
||||||
command_print(cmd->ctx, "data abort");
|
command_print(cmd, "data abort");
|
||||||
else {
|
else {
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"exception vector 0x%2.2" PRIx32 "",
|
"exception vector 0x%2.2" PRIx32 "",
|
||||||
ctx->last_branch);
|
ctx->last_branch);
|
||||||
ctx->current_pc = ctx->last_branch;
|
ctx->current_pc = ctx->last_branch;
|
||||||
|
@ -1058,7 +1058,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
ctx->ptr_ok = 1;
|
ctx->ptr_ok = 1;
|
||||||
|
|
||||||
if (ctx->ptr_ok)
|
if (ctx->ptr_ok)
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"address: 0x%8.8" PRIx32 "",
|
"address: 0x%8.8" PRIx32 "",
|
||||||
ctx->last_ptr);
|
ctx->last_ptr);
|
||||||
}
|
}
|
||||||
|
@ -1073,7 +1073,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
uint32_t data;
|
uint32_t data;
|
||||||
if (etmv1_data(ctx, 4, &data) != 0)
|
if (etmv1_data(ctx, 4, &data) != 0)
|
||||||
return ERROR_ETM_ANALYSIS_FAILED;
|
return ERROR_ETM_ANALYSIS_FAILED;
|
||||||
command_print(cmd->ctx,
|
command_print(cmd,
|
||||||
"data: 0x%8.8" PRIx32 "",
|
"data: 0x%8.8" PRIx32 "",
|
||||||
data);
|
data);
|
||||||
}
|
}
|
||||||
|
@ -1084,7 +1084,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
if (etmv1_data(ctx, arm_access_size(&instruction),
|
if (etmv1_data(ctx, arm_access_size(&instruction),
|
||||||
&data) != 0)
|
&data) != 0)
|
||||||
return ERROR_ETM_ANALYSIS_FAILED;
|
return ERROR_ETM_ANALYSIS_FAILED;
|
||||||
command_print(cmd->ctx, "data: 0x%8.8" PRIx32 "", data);
|
command_print(cmd, "data: 0x%8.8" PRIx32 "", data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1119,7 +1119,7 @@ static int etmv1_analyze_trace(struct etm_context *ctx, struct command_invocatio
|
||||||
(cycles == 1) ? "cycle" : "cycles");
|
(cycles == 1) ? "cycle" : "cycles");
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(cmd->ctx, "%s%s%s",
|
command_print(cmd, "%s%s%s",
|
||||||
instruction.text,
|
instruction.text,
|
||||||
(pipestat == STAT_IN) ? " (not executed)" : "",
|
(pipestat == STAT_IN) ? " (not executed)" : "",
|
||||||
cycles_text);
|
cycles_text);
|
||||||
|
@ -1156,7 +1156,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update,
|
||||||
else if (strcmp(CMD_ARGV[0], "all") == 0)
|
else if (strcmp(CMD_ARGV[0], "all") == 0)
|
||||||
tracemode = ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR;
|
tracemode = ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR;
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[0]);
|
command_print(CMD, "invalid option '%s'", CMD_ARGV[0]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1176,7 +1176,7 @@ static COMMAND_HELPER(handle_etm_tracemode_command_update,
|
||||||
tracemode |= ETM_CTRL_CONTEXTID_32;
|
tracemode |= ETM_CTRL_CONTEXTID_32;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX, "invalid option '%s'", CMD_ARGV[1]);
|
command_print(CMD, "invalid option '%s'", CMD_ARGV[1]);
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1207,13 +1207,13 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
|
||||||
struct etm_context *etm;
|
struct etm_context *etm;
|
||||||
|
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm = arm->etm;
|
etm = arm->etm;
|
||||||
if (!etm) {
|
if (!etm) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1235,47 +1235,47 @@ COMMAND_HANDLER(handle_etm_tracemode_command)
|
||||||
* or couldn't be written; display actual hardware state...
|
* or couldn't be written; display actual hardware state...
|
||||||
*/
|
*/
|
||||||
|
|
||||||
command_print(CMD_CTX, "current tracemode configuration:");
|
command_print(CMD, "current tracemode configuration:");
|
||||||
|
|
||||||
switch (tracemode & ETM_CTRL_TRACE_MASK) {
|
switch (tracemode & ETM_CTRL_TRACE_MASK) {
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX, "data tracing: none");
|
command_print(CMD, "data tracing: none");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_TRACE_DATA:
|
case ETM_CTRL_TRACE_DATA:
|
||||||
command_print(CMD_CTX, "data tracing: data only");
|
command_print(CMD, "data tracing: data only");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_TRACE_ADDR:
|
case ETM_CTRL_TRACE_ADDR:
|
||||||
command_print(CMD_CTX, "data tracing: address only");
|
command_print(CMD, "data tracing: address only");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR:
|
case ETM_CTRL_TRACE_DATA | ETM_CTRL_TRACE_ADDR:
|
||||||
command_print(CMD_CTX, "data tracing: address and data");
|
command_print(CMD, "data tracing: address and data");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (tracemode & ETM_CTRL_CONTEXTID_MASK) {
|
switch (tracemode & ETM_CTRL_CONTEXTID_MASK) {
|
||||||
case ETM_CTRL_CONTEXTID_NONE:
|
case ETM_CTRL_CONTEXTID_NONE:
|
||||||
command_print(CMD_CTX, "contextid tracing: none");
|
command_print(CMD, "contextid tracing: none");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_CONTEXTID_8:
|
case ETM_CTRL_CONTEXTID_8:
|
||||||
command_print(CMD_CTX, "contextid tracing: 8 bit");
|
command_print(CMD, "contextid tracing: 8 bit");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_CONTEXTID_16:
|
case ETM_CTRL_CONTEXTID_16:
|
||||||
command_print(CMD_CTX, "contextid tracing: 16 bit");
|
command_print(CMD, "contextid tracing: 16 bit");
|
||||||
break;
|
break;
|
||||||
case ETM_CTRL_CONTEXTID_32:
|
case ETM_CTRL_CONTEXTID_32:
|
||||||
command_print(CMD_CTX, "contextid tracing: 32 bit");
|
command_print(CMD, "contextid tracing: 32 bit");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tracemode & ETM_CTRL_CYCLE_ACCURATE)
|
if (tracemode & ETM_CTRL_CYCLE_ACCURATE)
|
||||||
command_print(CMD_CTX, "cycle-accurate tracing enabled");
|
command_print(CMD, "cycle-accurate tracing enabled");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "cycle-accurate tracing disabled");
|
command_print(CMD, "cycle-accurate tracing disabled");
|
||||||
|
|
||||||
if (tracemode & ETM_CTRL_BRANCH_OUTPUT)
|
if (tracemode & ETM_CTRL_BRANCH_OUTPUT)
|
||||||
command_print(CMD_CTX, "full branch address output enabled");
|
command_print(CMD, "full branch address output enabled");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "full branch address output disabled");
|
command_print(CMD, "full branch address output disabled");
|
||||||
|
|
||||||
#define TRACEMODE_MASK ( \
|
#define TRACEMODE_MASK ( \
|
||||||
ETM_CTRL_CONTEXTID_MASK \
|
ETM_CTRL_CONTEXTID_MASK \
|
||||||
|
@ -1331,7 +1331,7 @@ COMMAND_HANDLER(handle_etm_config_command)
|
||||||
|
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "target '%s' is '%s'; not an ARM",
|
command_print(CMD, "target '%s' is '%s'; not an ARM",
|
||||||
target_name(target),
|
target_name(target),
|
||||||
target_type_name(target));
|
target_type_name(target));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -1382,7 +1382,7 @@ COMMAND_HANDLER(handle_etm_config_command)
|
||||||
portmode |= ETM_PORT_2BIT;
|
portmode |= ETM_PORT_2BIT;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"unsupported ETM port width '%s'", CMD_ARGV[1]);
|
"unsupported ETM port width '%s'", CMD_ARGV[1]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1394,7 +1394,7 @@ COMMAND_HANDLER(handle_etm_config_command)
|
||||||
else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
|
else if (strcmp("demultiplexed", CMD_ARGV[2]) == 0)
|
||||||
portmode |= ETM_PORT_DEMUXED;
|
portmode |= ETM_PORT_DEMUXED;
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'",
|
"unsupported ETM port mode '%s', must be 'normal', 'multiplexed' or 'demultiplexed'",
|
||||||
CMD_ARGV[2]);
|
CMD_ARGV[2]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -1405,7 +1405,7 @@ COMMAND_HANDLER(handle_etm_config_command)
|
||||||
else if (strcmp("full", CMD_ARGV[3]) == 0)
|
else if (strcmp("full", CMD_ARGV[3]) == 0)
|
||||||
portmode |= ETM_PORT_FULL_CLOCK;
|
portmode |= ETM_PORT_FULL_CLOCK;
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"unsupported ETM port clocking '%s', must be 'full' or 'half'",
|
"unsupported ETM port clocking '%s', must be 'full' or 'half'",
|
||||||
CMD_ARGV[3]);
|
CMD_ARGV[3]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
@ -1461,44 +1461,44 @@ COMMAND_HANDLER(handle_etm_info_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm = arm->etm;
|
etm = arm->etm;
|
||||||
if (!etm) {
|
if (!etm) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "ETM v%d.%d",
|
command_print(CMD, "ETM v%d.%d",
|
||||||
etm->bcd_vers >> 4, etm->bcd_vers & 0xf);
|
etm->bcd_vers >> 4, etm->bcd_vers & 0xf);
|
||||||
command_print(CMD_CTX, "pairs of address comparators: %i",
|
command_print(CMD, "pairs of address comparators: %i",
|
||||||
(int) (etm->config >> 0) & 0x0f);
|
(int) (etm->config >> 0) & 0x0f);
|
||||||
command_print(CMD_CTX, "data comparators: %i",
|
command_print(CMD, "data comparators: %i",
|
||||||
(int) (etm->config >> 4) & 0x0f);
|
(int) (etm->config >> 4) & 0x0f);
|
||||||
command_print(CMD_CTX, "memory map decoders: %i",
|
command_print(CMD, "memory map decoders: %i",
|
||||||
(int) (etm->config >> 8) & 0x1f);
|
(int) (etm->config >> 8) & 0x1f);
|
||||||
command_print(CMD_CTX, "number of counters: %i",
|
command_print(CMD, "number of counters: %i",
|
||||||
(int) (etm->config >> 13) & 0x07);
|
(int) (etm->config >> 13) & 0x07);
|
||||||
command_print(CMD_CTX, "sequencer %spresent",
|
command_print(CMD, "sequencer %spresent",
|
||||||
(int) (etm->config & (1 << 16)) ? "" : "not ");
|
(int) (etm->config & (1 << 16)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "number of ext. inputs: %i",
|
command_print(CMD, "number of ext. inputs: %i",
|
||||||
(int) (etm->config >> 17) & 0x07);
|
(int) (etm->config >> 17) & 0x07);
|
||||||
command_print(CMD_CTX, "number of ext. outputs: %i",
|
command_print(CMD, "number of ext. outputs: %i",
|
||||||
(int) (etm->config >> 20) & 0x07);
|
(int) (etm->config >> 20) & 0x07);
|
||||||
command_print(CMD_CTX, "FIFO full %spresent",
|
command_print(CMD, "FIFO full %spresent",
|
||||||
(int) (etm->config & (1 << 23)) ? "" : "not ");
|
(int) (etm->config & (1 << 23)) ? "" : "not ");
|
||||||
if (etm->bcd_vers < 0x20)
|
if (etm->bcd_vers < 0x20)
|
||||||
command_print(CMD_CTX, "protocol version: %i",
|
command_print(CMD, "protocol version: %i",
|
||||||
(int) (etm->config >> 28) & 0x07);
|
(int) (etm->config >> 28) & 0x07);
|
||||||
else {
|
else {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"coprocessor and memory access %ssupported",
|
"coprocessor and memory access %ssupported",
|
||||||
(etm->config & (1 << 26)) ? "" : "not ");
|
(etm->config & (1 << 26)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "trace start/stop %spresent",
|
command_print(CMD, "trace start/stop %spresent",
|
||||||
(etm->config & (1 << 26)) ? "" : "not ");
|
(etm->config & (1 << 26)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "number of context comparators: %i",
|
command_print(CMD, "number of context comparators: %i",
|
||||||
(int) (etm->config >> 24) & 0x03);
|
(int) (etm->config >> 24) & 0x03);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1549,30 +1549,30 @@ COMMAND_HANDLER(handle_etm_info_command)
|
||||||
LOG_ERROR("Illegal max_port_size");
|
LOG_ERROR("Illegal max_port_size");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "max. port size: %i", max_port_size);
|
command_print(CMD, "max. port size: %i", max_port_size);
|
||||||
|
|
||||||
if (etm->bcd_vers < 0x30) {
|
if (etm->bcd_vers < 0x30) {
|
||||||
command_print(CMD_CTX, "half-rate clocking %ssupported",
|
command_print(CMD, "half-rate clocking %ssupported",
|
||||||
(config & (1 << 3)) ? "" : "not ");
|
(config & (1 << 3)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "full-rate clocking %ssupported",
|
command_print(CMD, "full-rate clocking %ssupported",
|
||||||
(config & (1 << 4)) ? "" : "not ");
|
(config & (1 << 4)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "normal trace format %ssupported",
|
command_print(CMD, "normal trace format %ssupported",
|
||||||
(config & (1 << 5)) ? "" : "not ");
|
(config & (1 << 5)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "multiplex trace format %ssupported",
|
command_print(CMD, "multiplex trace format %ssupported",
|
||||||
(config & (1 << 6)) ? "" : "not ");
|
(config & (1 << 6)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "demultiplex trace format %ssupported",
|
command_print(CMD, "demultiplex trace format %ssupported",
|
||||||
(config & (1 << 7)) ? "" : "not ");
|
(config & (1 << 7)) ? "" : "not ");
|
||||||
} else {
|
} else {
|
||||||
/* REVISIT show which size and format are selected ... */
|
/* REVISIT show which size and format are selected ... */
|
||||||
command_print(CMD_CTX, "current port size %ssupported",
|
command_print(CMD, "current port size %ssupported",
|
||||||
(config & (1 << 10)) ? "" : "not ");
|
(config & (1 << 10)) ? "" : "not ");
|
||||||
command_print(CMD_CTX, "current trace format %ssupported",
|
command_print(CMD, "current trace format %ssupported",
|
||||||
(config & (1 << 11)) ? "" : "not ");
|
(config & (1 << 11)) ? "" : "not ");
|
||||||
}
|
}
|
||||||
if (etm->bcd_vers >= 0x21)
|
if (etm->bcd_vers >= 0x21)
|
||||||
command_print(CMD_CTX, "fetch comparisons %ssupported",
|
command_print(CMD, "fetch comparisons %ssupported",
|
||||||
(config & (1 << 17)) ? "not " : "");
|
(config & (1 << 17)) ? "not " : "");
|
||||||
command_print(CMD_CTX, "FIFO full %ssupported",
|
command_print(CMD, "FIFO full %ssupported",
|
||||||
(config & (1 << 8)) ? "" : "not ");
|
(config & (1 << 8)) ? "" : "not ");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1588,13 +1588,13 @@ COMMAND_HANDLER(handle_etm_status_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm = arm->etm;
|
etm = arm->etm;
|
||||||
if (!etm) {
|
if (!etm) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1608,7 +1608,7 @@ COMMAND_HANDLER(handle_etm_status_command)
|
||||||
if (etm_get_reg(reg) == ERROR_OK) {
|
if (etm_get_reg(reg) == ERROR_OK) {
|
||||||
unsigned s = buf_get_u32(reg->value, 0, reg->size);
|
unsigned s = buf_get_u32(reg->value, 0, reg->size);
|
||||||
|
|
||||||
command_print(CMD_CTX, "etm: %s%s%s%s",
|
command_print(CMD, "etm: %s%s%s%s",
|
||||||
/* bit(1) == progbit */
|
/* bit(1) == progbit */
|
||||||
(etm->bcd_vers >= 0x12)
|
(etm->bcd_vers >= 0x12)
|
||||||
? ((s & (1 << 1))
|
? ((s & (1 << 1))
|
||||||
|
@ -1626,21 +1626,21 @@ COMMAND_HANDLER(handle_etm_status_command)
|
||||||
/* Trace Port Driver status */
|
/* Trace Port Driver status */
|
||||||
trace_status = etm->capture_driver->status(etm);
|
trace_status = etm->capture_driver->status(etm);
|
||||||
if (trace_status == TRACE_IDLE)
|
if (trace_status == TRACE_IDLE)
|
||||||
command_print(CMD_CTX, "%s: idle", etm->capture_driver->name);
|
command_print(CMD, "%s: idle", etm->capture_driver->name);
|
||||||
else {
|
else {
|
||||||
static char *completed = " completed";
|
static char *completed = " completed";
|
||||||
static char *running = " is running";
|
static char *running = " is running";
|
||||||
static char *overflowed = ", overflowed";
|
static char *overflowed = ", overflowed";
|
||||||
static char *triggered = ", triggered";
|
static char *triggered = ", triggered";
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: trace collection%s%s%s",
|
command_print(CMD, "%s: trace collection%s%s%s",
|
||||||
etm->capture_driver->name,
|
etm->capture_driver->name,
|
||||||
(trace_status & TRACE_RUNNING) ? running : completed,
|
(trace_status & TRACE_RUNNING) ? running : completed,
|
||||||
(trace_status & TRACE_OVERFLOWED) ? overflowed : "",
|
(trace_status & TRACE_OVERFLOWED) ? overflowed : "",
|
||||||
(trace_status & TRACE_TRIGGERED) ? triggered : "");
|
(trace_status & TRACE_TRIGGERED) ? triggered : "");
|
||||||
|
|
||||||
if (etm->trace_depth > 0) {
|
if (etm->trace_depth > 0) {
|
||||||
command_print(CMD_CTX, "%i frames of trace data read",
|
command_print(CMD, "%i frames of trace data read",
|
||||||
(int)(etm->trace_depth));
|
(int)(etm->trace_depth));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1660,20 +1660,20 @@ COMMAND_HANDLER(handle_etm_image_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (etm_ctx->image) {
|
if (etm_ctx->image) {
|
||||||
image_close(etm_ctx->image);
|
image_close(etm_ctx->image);
|
||||||
free(etm_ctx->image);
|
free(etm_ctx->image);
|
||||||
command_print(CMD_CTX, "previously loaded image found and closed");
|
command_print(CMD, "previously loaded image found and closed");
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx->image = malloc(sizeof(struct image));
|
etm_ctx->image = malloc(sizeof(struct image));
|
||||||
|
@ -1711,24 +1711,24 @@ COMMAND_HANDLER(handle_etm_dump_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (etm_ctx->capture_driver->status == TRACE_IDLE) {
|
if (etm_ctx->capture_driver->status == TRACE_IDLE) {
|
||||||
command_print(CMD_CTX, "trace capture wasn't enabled, no trace data captured");
|
command_print(CMD, "trace capture wasn't enabled, no trace data captured");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
|
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
|
||||||
/* TODO: if on-the-fly capture is to be supported, this needs to be changed */
|
/* TODO: if on-the-fly capture is to be supported, this needs to be changed */
|
||||||
command_print(CMD_CTX, "trace capture not completed");
|
command_print(CMD, "trace capture not completed");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1768,18 +1768,18 @@ COMMAND_HANDLER(handle_etm_load_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
|
if (etm_ctx->capture_driver->status(etm_ctx) & TRACE_RUNNING) {
|
||||||
command_print(CMD_CTX, "trace capture running, stop first");
|
command_print(CMD, "trace capture running, stop first");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1794,7 +1794,7 @@ COMMAND_HANDLER(handle_etm_load_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filesize % 4) {
|
if (filesize % 4) {
|
||||||
command_print(CMD_CTX, "size isn't a multiple of 4, no valid trace data");
|
command_print(CMD, "size isn't a multiple of 4, no valid trace data");
|
||||||
fileio_close(file);
|
fileio_close(file);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1812,7 +1812,7 @@ COMMAND_HANDLER(handle_etm_load_command)
|
||||||
}
|
}
|
||||||
etm_ctx->trace_data = malloc(sizeof(struct etmv1_trace_data) * etm_ctx->trace_depth);
|
etm_ctx->trace_data = malloc(sizeof(struct etmv1_trace_data) * etm_ctx->trace_depth);
|
||||||
if (etm_ctx->trace_data == NULL) {
|
if (etm_ctx->trace_data == NULL) {
|
||||||
command_print(CMD_CTX, "not enough memory to perform operation");
|
command_print(CMD, "not enough memory to perform operation");
|
||||||
fileio_close(file);
|
fileio_close(file);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1842,13 +1842,13 @@ COMMAND_HANDLER(handle_etm_start_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1887,13 +1887,13 @@ COMMAND_HANDLER(handle_etm_stop_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1923,14 +1923,14 @@ COMMAND_HANDLER(handle_etm_trigger_debug_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: %s isn't an ARM",
|
command_print(CMD, "ETM: %s isn't an ARM",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm = arm->etm;
|
etm = arm->etm;
|
||||||
if (!etm) {
|
if (!etm) {
|
||||||
command_print(CMD_CTX, "ETM: no ETM configured for %s",
|
command_print(CMD, "ETM: no ETM configured for %s",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -1955,7 +1955,7 @@ COMMAND_HANDLER(handle_etm_trigger_debug_command)
|
||||||
buf_set_u32(etm_ctrl_reg->value, 0, 32, etm->control);
|
buf_set_u32(etm_ctrl_reg->value, 0, 32, etm->control);
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "ETM: %s debug halt",
|
command_print(CMD, "ETM: %s debug halt",
|
||||||
(etm->control & ETM_CTRL_DBGRQ)
|
(etm->control & ETM_CTRL_DBGRQ)
|
||||||
? "triggers"
|
? "triggers"
|
||||||
: "does not trigger");
|
: "does not trigger");
|
||||||
|
@ -1972,13 +1972,13 @@ COMMAND_HANDLER(handle_etm_analyze_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "ETM: current target isn't an ARM");
|
command_print(CMD, "ETM: current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
etm_ctx = arm->etm;
|
etm_ctx = arm->etm;
|
||||||
if (!etm_ctx) {
|
if (!etm_ctx) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1987,18 +1987,18 @@ COMMAND_HANDLER(handle_etm_analyze_command)
|
||||||
/* FIX! error should be reported inside etmv1_analyze_trace() */
|
/* FIX! error should be reported inside etmv1_analyze_trace() */
|
||||||
switch (retval) {
|
switch (retval) {
|
||||||
case ERROR_ETM_ANALYSIS_FAILED:
|
case ERROR_ETM_ANALYSIS_FAILED:
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"further analysis failed (corrupted trace data or just end of data");
|
"further analysis failed (corrupted trace data or just end of data");
|
||||||
break;
|
break;
|
||||||
case ERROR_TRACE_INSTRUCTION_UNAVAILABLE:
|
case ERROR_TRACE_INSTRUCTION_UNAVAILABLE:
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"no instruction for current address available, analysis aborted");
|
"no instruction for current address available, analysis aborted");
|
||||||
break;
|
break;
|
||||||
case ERROR_TRACE_IMAGE_UNAVAILABLE:
|
case ERROR_TRACE_IMAGE_UNAVAILABLE:
|
||||||
command_print(CMD_CTX, "no image available for trace analysis");
|
command_print(CMD, "no image available for trace analysis");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
command_print(CMD_CTX, "unknown error");
|
command_print(CMD, "unknown error");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ COMMAND_HANDLER(handle_etm_dummy_config_command)
|
||||||
|
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "target '%s' isn't an ARM", CMD_ARGV[0]);
|
command_print(CMD, "target '%s' isn't an ARM", CMD_ARGV[0]);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -909,7 +909,7 @@ static int mips32_verify_pointer(struct command_invocation *cmd,
|
||||||
struct mips32_common *mips32)
|
struct mips32_common *mips32)
|
||||||
{
|
{
|
||||||
if (mips32->common_magic != MIPS32_COMMON_MAGIC) {
|
if (mips32->common_magic != MIPS32_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not an MIPS32");
|
command_print(cmd, "target is not an MIPS32");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -932,7 +932,7 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,12 +949,12 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
|
||||||
|
|
||||||
retval = mips32_cp0_read(ejtag_info, &value, cp0_reg, cp0_sel);
|
retval = mips32_cp0_read(ejtag_info, &value, cp0_reg, cp0_sel);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %" PRIi32,
|
"couldn't access reg %" PRIi32,
|
||||||
cp0_reg);
|
cp0_reg);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
||||||
cp0_reg, cp0_sel, value);
|
cp0_reg, cp0_sel, value);
|
||||||
|
|
||||||
} else if (CMD_ARGC == 3) {
|
} else if (CMD_ARGC == 3) {
|
||||||
|
@ -962,12 +962,12 @@ COMMAND_HANDLER(mips32_handle_cp0_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
|
||||||
retval = mips32_cp0_write(ejtag_info, value, cp0_reg, cp0_sel);
|
retval = mips32_cp0_write(ejtag_info, value, cp0_reg, cp0_sel);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access cp0 reg %" PRIi32 ", select %" PRIi32,
|
"couldn't access cp0 reg %" PRIi32 ", select %" PRIi32,
|
||||||
cp0_reg, cp0_sel);
|
cp0_reg, cp0_sel);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
||||||
cp0_reg, cp0_sel, value);
|
cp0_reg, cp0_sel, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -986,13 +986,13 @@ COMMAND_HANDLER(mips32_handle_scan_delay_command)
|
||||||
else if (CMD_ARGC > 1)
|
else if (CMD_ARGC > 1)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX, "scan delay: %d nsec", ejtag_info->scan_delay);
|
command_print(CMD, "scan delay: %d nsec", ejtag_info->scan_delay);
|
||||||
if (ejtag_info->scan_delay >= MIPS32_SCAN_DELAY_LEGACY_MODE) {
|
if (ejtag_info->scan_delay >= MIPS32_SCAN_DELAY_LEGACY_MODE) {
|
||||||
ejtag_info->mode = 0;
|
ejtag_info->mode = 0;
|
||||||
command_print(CMD_CTX, "running in legacy mode");
|
command_print(CMD, "running in legacy mode");
|
||||||
} else {
|
} else {
|
||||||
ejtag_info->mode = 1;
|
ejtag_info->mode = 1;
|
||||||
command_print(CMD_CTX, "running in fast queued mode");
|
command_print(CMD, "running in fast queued mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1274,7 +1274,7 @@ static int mips_m4k_verify_pointer(struct command_invocation *cmd,
|
||||||
struct mips_m4k_common *mips_m4k)
|
struct mips_m4k_common *mips_m4k)
|
||||||
{
|
{
|
||||||
if (mips_m4k->common_magic != MIPSM4K_COMMON_MAGIC) {
|
if (mips_m4k->common_magic != MIPSM4K_COMMON_MAGIC) {
|
||||||
command_print(cmd->ctx, "target is not an MIPS_M4K");
|
command_print(cmd, "target is not an MIPS_M4K");
|
||||||
return ERROR_TARGET_INVALID;
|
return ERROR_TARGET_INVALID;
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1292,7 +1292,7 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
|
||||||
return retval;
|
return retval;
|
||||||
|
|
||||||
if (target->state != TARGET_HALTED) {
|
if (target->state != TARGET_HALTED) {
|
||||||
command_print(CMD_CTX, "target must be stopped for \"%s\" command", CMD_NAME);
|
command_print(CMD, "target must be stopped for \"%s\" command", CMD_NAME);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1308,12 +1308,12 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
retval = mips32_cp0_read(ejtag_info, &value, cp0_reg, cp0_sel);
|
retval = mips32_cp0_read(ejtag_info, &value, cp0_reg, cp0_sel);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access reg %" PRIi32,
|
"couldn't access reg %" PRIi32,
|
||||||
cp0_reg);
|
cp0_reg);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
||||||
cp0_reg, cp0_sel, value);
|
cp0_reg, cp0_sel, value);
|
||||||
|
|
||||||
} else if (CMD_ARGC == 3) {
|
} else if (CMD_ARGC == 3) {
|
||||||
|
@ -1321,12 +1321,12 @@ COMMAND_HANDLER(mips_m4k_handle_cp0_command)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], value);
|
||||||
retval = mips32_cp0_write(ejtag_info, value, cp0_reg, cp0_sel);
|
retval = mips32_cp0_write(ejtag_info, value, cp0_reg, cp0_sel);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"couldn't access cp0 reg %" PRIi32 ", select %" PRIi32,
|
"couldn't access cp0 reg %" PRIi32 ", select %" PRIi32,
|
||||||
cp0_reg, cp0_sel);
|
cp0_reg, cp0_sel);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
command_print(CMD, "cp0 reg %" PRIi32 ", select %" PRIi32 ": %8.8" PRIx32,
|
||||||
cp0_reg, cp0_sel, value);
|
cp0_reg, cp0_sel, value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1345,13 +1345,13 @@ COMMAND_HANDLER(mips_m4k_handle_scan_delay_command)
|
||||||
else if (CMD_ARGC > 1)
|
else if (CMD_ARGC > 1)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
command_print(CMD_CTX, "scan delay: %d nsec", ejtag_info->scan_delay);
|
command_print(CMD, "scan delay: %d nsec", ejtag_info->scan_delay);
|
||||||
if (ejtag_info->scan_delay >= MIPS32_SCAN_DELAY_LEGACY_MODE) {
|
if (ejtag_info->scan_delay >= MIPS32_SCAN_DELAY_LEGACY_MODE) {
|
||||||
ejtag_info->mode = 0;
|
ejtag_info->mode = 0;
|
||||||
command_print(CMD_CTX, "running in legacy mode");
|
command_print(CMD, "running in legacy mode");
|
||||||
} else {
|
} else {
|
||||||
ejtag_info->mode = 1;
|
ejtag_info->mode = 1;
|
||||||
command_print(CMD_CTX, "running in fast queued mode");
|
command_print(CMD, "running in fast queued mode");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -46,7 +46,7 @@ COMMAND_HANDLER(handle_nds32_dssim_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,7 +57,7 @@ COMMAND_HANDLER(handle_nds32_dssim_command)
|
||||||
nds32->step_isr_enable = false;
|
nds32->step_isr_enable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: $INT_MASK.DSSIM: %d", target_name(target),
|
command_print(CMD, "%s: $INT_MASK.DSSIM: %d", target_name(target),
|
||||||
nds32->step_isr_enable);
|
nds32->step_isr_enable);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -71,7 +71,7 @@ COMMAND_HANDLER(handle_nds32_memory_access_command)
|
||||||
struct nds32_memory *memory = &(nds32->memory);
|
struct nds32_memory *memory = &(nds32->memory);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ COMMAND_HANDLER(handle_nds32_memory_access_command)
|
||||||
|
|
||||||
aice_memory_access(aice, memory->access_channel);
|
aice_memory_access(aice, memory->access_channel);
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "%s: memory access channel: %s",
|
command_print(CMD, "%s: memory access channel: %s",
|
||||||
target_name(target),
|
target_name(target),
|
||||||
NDS_MEMORY_ACCESS_NAME[memory->access_channel]);
|
NDS_MEMORY_ACCESS_NAME[memory->access_channel]);
|
||||||
}
|
}
|
||||||
|
@ -103,18 +103,18 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
|
||||||
struct aice_port_s *aice = target_to_aice(target);
|
struct aice_port_s *aice = target_to_aice(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0) {
|
if (CMD_ARGC > 0) {
|
||||||
|
|
||||||
if (nds32->edm.access_control == false) {
|
if (nds32->edm.access_control == false) {
|
||||||
command_print(CMD_CTX, "%s does not support ACC_CTL. "
|
command_print(CMD, "%s does not support ACC_CTL. "
|
||||||
"Set memory mode to MEMORY", target_name(target));
|
"Set memory mode to MEMORY", target_name(target));
|
||||||
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
||||||
} else if (nds32->edm.direct_access_local_memory == false) {
|
} else if (nds32->edm.direct_access_local_memory == false) {
|
||||||
command_print(CMD_CTX, "%s does not support direct access "
|
command_print(CMD, "%s does not support direct access "
|
||||||
"local memory. Set memory mode to MEMORY",
|
"local memory. Set memory mode to MEMORY",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
||||||
|
@ -128,13 +128,13 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
|
||||||
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
nds32->memory.mode = NDS_MEMORY_SELECT_MEM;
|
||||||
} else if (strcmp(CMD_ARGV[0], "ilm") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "ilm") == 0) {
|
||||||
if (nds32->memory.ilm_base == 0)
|
if (nds32->memory.ilm_base == 0)
|
||||||
command_print(CMD_CTX, "%s does not support ILM",
|
command_print(CMD, "%s does not support ILM",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
else
|
else
|
||||||
nds32->memory.mode = NDS_MEMORY_SELECT_ILM;
|
nds32->memory.mode = NDS_MEMORY_SELECT_ILM;
|
||||||
} else if (strcmp(CMD_ARGV[0], "dlm") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "dlm") == 0) {
|
||||||
if (nds32->memory.dlm_base == 0)
|
if (nds32->memory.dlm_base == 0)
|
||||||
command_print(CMD_CTX, "%s does not support DLM",
|
command_print(CMD, "%s does not support DLM",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
else
|
else
|
||||||
nds32->memory.mode = NDS_MEMORY_SELECT_DLM;
|
nds32->memory.mode = NDS_MEMORY_SELECT_DLM;
|
||||||
|
@ -145,7 +145,7 @@ COMMAND_HANDLER(handle_nds32_memory_mode_command)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: memory mode: %s",
|
command_print(CMD, "%s: memory mode: %s",
|
||||||
target_name(target),
|
target_name(target),
|
||||||
NDS_MEMORY_SELECT_NAME[nds32->memory.mode]);
|
NDS_MEMORY_SELECT_NAME[nds32->memory.mode]);
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ COMMAND_HANDLER(handle_nds32_cache_command)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,30 +173,30 @@ COMMAND_HANDLER(handle_nds32_cache_command)
|
||||||
/* D$ write back */
|
/* D$ write back */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Write back data cache...failed",
|
command_print(CMD, "%s: Write back data cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Write back data cache...done",
|
command_print(CMD, "%s: Write back data cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
|
|
||||||
/* D$ invalidate */
|
/* D$ invalidate */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Invalidate data cache...failed",
|
command_print(CMD, "%s: Invalidate data cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Invalidate data cache...done",
|
command_print(CMD, "%s: Invalidate data cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
} else {
|
} else {
|
||||||
if (dcache->line_size == 0)
|
if (dcache->line_size == 0)
|
||||||
command_print(CMD_CTX, "%s: No data cache",
|
command_print(CMD, "%s: No data cache",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s: Data cache disabled",
|
command_print(CMD, "%s: Data cache disabled",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,23 +204,23 @@ COMMAND_HANDLER(handle_nds32_cache_command)
|
||||||
/* I$ invalidate */
|
/* I$ invalidate */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Invalidate instruction cache...failed",
|
command_print(CMD, "%s: Invalidate instruction cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Invalidate instruction cache...done",
|
command_print(CMD, "%s: Invalidate instruction cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
} else {
|
} else {
|
||||||
if (icache->line_size == 0)
|
if (icache->line_size == 0)
|
||||||
command_print(CMD_CTX, "%s: No instruction cache",
|
command_print(CMD, "%s: No instruction cache",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s: Instruction cache disabled",
|
command_print(CMD, "%s: Instruction cache disabled",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
command_print(CMD_CTX, "No valid parameter");
|
command_print(CMD, "No valid parameter");
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -235,14 +235,14 @@ COMMAND_HANDLER(handle_nds32_icache_command)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0) {
|
if (CMD_ARGC > 0) {
|
||||||
|
|
||||||
if (icache->line_size == 0) {
|
if (icache->line_size == 0) {
|
||||||
command_print(CMD_CTX, "%s: No instruction cache",
|
command_print(CMD, "%s: No instruction cache",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -252,15 +252,15 @@ COMMAND_HANDLER(handle_nds32_icache_command)
|
||||||
/* I$ invalidate */
|
/* I$ invalidate */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1I_INVALALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Invalidate instruction cache...failed",
|
command_print(CMD, "%s: Invalidate instruction cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Invalidate instruction cache...done",
|
command_print(CMD, "%s: Invalidate instruction cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "%s: Instruction cache disabled",
|
command_print(CMD, "%s: Instruction cache disabled",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
}
|
}
|
||||||
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
|
||||||
|
@ -274,7 +274,7 @@ COMMAND_HANDLER(handle_nds32_icache_command)
|
||||||
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
|
||||||
/* TODO: dump cache content */
|
/* TODO: dump cache content */
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "%s: No valid parameter", target_name(target));
|
command_print(CMD, "%s: No valid parameter", target_name(target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -290,14 +290,14 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0) {
|
if (CMD_ARGC > 0) {
|
||||||
|
|
||||||
if (dcache->line_size == 0) {
|
if (dcache->line_size == 0) {
|
||||||
command_print(CMD_CTX, "%s: No data cache", target_name(target));
|
command_print(CMD, "%s: No data cache", target_name(target));
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,26 +306,26 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
|
||||||
/* D$ write back */
|
/* D$ write back */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_WBALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Write back data cache...failed",
|
command_print(CMD, "%s: Write back data cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Write back data cache...done",
|
command_print(CMD, "%s: Write back data cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
|
|
||||||
/* D$ invalidate */
|
/* D$ invalidate */
|
||||||
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
|
result = aice_cache_ctl(aice, AICE_CACHE_CTL_L1D_INVALALL, 0);
|
||||||
if (result != ERROR_OK) {
|
if (result != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "%s: Invalidate data cache...failed",
|
command_print(CMD, "%s: Invalidate data cache...failed",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s: Invalidate data cache...done",
|
command_print(CMD, "%s: Invalidate data cache...done",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "%s: Data cache disabled",
|
command_print(CMD, "%s: Data cache disabled",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
}
|
}
|
||||||
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "enable") == 0) {
|
||||||
|
@ -339,7 +339,7 @@ COMMAND_HANDLER(handle_nds32_dcache_command)
|
||||||
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
|
} else if (strcmp(CMD_ARGV[0], "dump") == 0) {
|
||||||
/* TODO: dump cache content */
|
/* TODO: dump cache content */
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "%s: No valid parameter", target_name(target));
|
command_print(CMD, "%s: No valid parameter", target_name(target));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -352,7 +352,7 @@ COMMAND_HANDLER(handle_nds32_auto_break_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -364,10 +364,10 @@ COMMAND_HANDLER(handle_nds32_auto_break_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nds32->auto_convert_hw_bp)
|
if (nds32->auto_convert_hw_bp)
|
||||||
command_print(CMD_CTX, "%s: convert sw break to hw break on ROM: on",
|
command_print(CMD, "%s: convert sw break to hw break on ROM: on",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s: convert sw break to hw break on ROM: off",
|
command_print(CMD, "%s: convert sw break to hw break on ROM: off",
|
||||||
target_name(target));
|
target_name(target));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -379,7 +379,7 @@ COMMAND_HANDLER(handle_nds32_virtual_hosting_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,9 +391,9 @@ COMMAND_HANDLER(handle_nds32_virtual_hosting_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nds32->virtual_hosting)
|
if (nds32->virtual_hosting)
|
||||||
command_print(CMD_CTX, "%s: virtual hosting: on", target_name(target));
|
command_print(CMD, "%s: virtual hosting: on", target_name(target));
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s: virtual hosting: off", target_name(target));
|
command_print(CMD, "%s: virtual hosting: off", target_name(target));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -404,7 +404,7 @@ COMMAND_HANDLER(handle_nds32_global_stop_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -429,7 +429,7 @@ COMMAND_HANDLER(handle_nds32_soft_reset_halt_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -454,7 +454,7 @@ COMMAND_HANDLER(handle_nds32_boot_time_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ COMMAND_HANDLER(handle_nds32_login_edm_passcode_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -485,7 +485,7 @@ COMMAND_HANDLER(handle_nds32_login_edm_operation_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -516,7 +516,7 @@ COMMAND_HANDLER(handle_nds32_reset_halt_as_init_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +536,7 @@ COMMAND_HANDLER(handle_nds32_keep_target_edm_ctl_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -556,7 +556,7 @@ COMMAND_HANDLER(handle_nds32_decode_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -581,7 +581,7 @@ COMMAND_HANDLER(handle_nds32_decode_command)
|
||||||
read_addr, &instruction))
|
read_addr, &instruction))
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s", instruction.text);
|
command_print(CMD, "%s", instruction.text);
|
||||||
|
|
||||||
read_addr += instruction.instruction_size;
|
read_addr += instruction.instruction_size;
|
||||||
i++;
|
i++;
|
||||||
|
@ -599,7 +599,7 @@ COMMAND_HANDLER(handle_nds32_decode_command)
|
||||||
if (ERROR_OK != nds32_evaluate_opcode(nds32, opcode, addr, &instruction))
|
if (ERROR_OK != nds32_evaluate_opcode(nds32, opcode, addr, &instruction))
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
command_print(CMD_CTX, "%s", instruction.text);
|
command_print(CMD, "%s", instruction.text);
|
||||||
} else
|
} else
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
|
@ -612,7 +612,7 @@ COMMAND_HANDLER(handle_nds32_word_access_mem_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,11 +632,11 @@ COMMAND_HANDLER(handle_nds32_query_target_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "OCD");
|
command_print(CMD, "OCD");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -647,7 +647,7 @@ COMMAND_HANDLER(handle_nds32_query_endian_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -655,9 +655,9 @@ COMMAND_HANDLER(handle_nds32_query_endian_command)
|
||||||
nds32_get_mapped_reg(nds32, IR0, &value_psw);
|
nds32_get_mapped_reg(nds32, IR0, &value_psw);
|
||||||
|
|
||||||
if (value_psw & 0x20)
|
if (value_psw & 0x20)
|
||||||
command_print(CMD_CTX, "%s: BE", target_name(target));
|
command_print(CMD, "%s: BE", target_name(target));
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "%s: LE", target_name(target));
|
command_print(CMD, "%s: LE", target_name(target));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -668,11 +668,11 @@ COMMAND_HANDLER(handle_nds32_query_cpuid_command)
|
||||||
struct nds32 *nds32 = target_to_nds32(target);
|
struct nds32 *nds32 = target_to_nds32(target);
|
||||||
|
|
||||||
if (!is_nds32(nds32)) {
|
if (!is_nds32(nds32)) {
|
||||||
command_print(CMD_CTX, "current target isn't an Andes core");
|
command_print(CMD, "current target isn't an Andes core");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "CPUID: %s", target_name(target));
|
command_print(CMD, "CPUID: %s", target_name(target));
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -277,7 +277,7 @@ COMMAND_HANDLER(handle_oocd_trace_config_command)
|
||||||
target = get_current_target(CMD_CTX);
|
target = get_current_target(CMD_CTX);
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,17 +306,17 @@ COMMAND_HANDLER(handle_oocd_trace_status_command)
|
||||||
|
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arm->etm) {
|
if (!arm->etm) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) {
|
if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) {
|
||||||
command_print(CMD_CTX, "current target's ETM capture driver isn't 'oocd_trace'");
|
command_print(CMD, "current target's ETM capture driver isn't 'oocd_trace'");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -325,9 +325,9 @@ COMMAND_HANDLER(handle_oocd_trace_status_command)
|
||||||
oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status);
|
oocd_trace_read_reg(oocd_trace, OOCD_TRACE_STATUS, &status);
|
||||||
|
|
||||||
if (status & 0x8)
|
if (status & 0x8)
|
||||||
command_print(CMD_CTX, "trace clock locked");
|
command_print(CMD, "trace clock locked");
|
||||||
else
|
else
|
||||||
command_print(CMD_CTX, "no trace clock");
|
command_print(CMD, "no trace clock");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -344,17 +344,17 @@ COMMAND_HANDLER(handle_oocd_trace_resync_command)
|
||||||
|
|
||||||
arm = target_to_arm(target);
|
arm = target_to_arm(target);
|
||||||
if (!is_arm(arm)) {
|
if (!is_arm(arm)) {
|
||||||
command_print(CMD_CTX, "current target isn't an ARM");
|
command_print(CMD, "current target isn't an ARM");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!arm->etm) {
|
if (!arm->etm) {
|
||||||
command_print(CMD_CTX, "current target doesn't have an ETM configured");
|
command_print(CMD, "current target doesn't have an ETM configured");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) {
|
if (strcmp(arm->etm->capture_driver->name, "oocd_trace") != 0) {
|
||||||
command_print(CMD_CTX, "current target's ETM capture driver isn't 'oocd_trace'");
|
command_print(CMD, "current target's ETM capture driver isn't 'oocd_trace'");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -366,7 +366,7 @@ COMMAND_HANDLER(handle_oocd_trace_resync_command)
|
||||||
if (bytes_written < 1)
|
if (bytes_written < 1)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
|
|
||||||
command_print(CMD_CTX, "requesting traceclock resync");
|
command_print(CMD, "requesting traceclock resync");
|
||||||
LOG_DEBUG("resyncing traceclk pll");
|
LOG_DEBUG("resyncing traceclk pll");
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1291,7 +1291,7 @@ COMMAND_HANDLER(or1k_tap_list_command_handler)
|
||||||
|
|
||||||
list_for_each_entry(or1k_tap, &tap_list, list) {
|
list_for_each_entry(or1k_tap, &tap_list, list) {
|
||||||
if (or1k_tap->name)
|
if (or1k_tap->name)
|
||||||
command_print(CMD_CTX, "%s", or1k_tap->name);
|
command_print(CMD, "%s", or1k_tap->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1339,7 +1339,7 @@ COMMAND_HANDLER(or1k_du_list_command_handler)
|
||||||
|
|
||||||
list_for_each_entry(or1k_du, &du_list, list) {
|
list_for_each_entry(or1k_du, &du_list, list) {
|
||||||
if (or1k_du->name)
|
if (or1k_du->name)
|
||||||
command_print(CMD_CTX, "%s", or1k_du->name);
|
command_print(CMD, "%s", or1k_du->name);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -1623,7 +1623,7 @@ COMMAND_HANDLER(riscv_authdata_read)
|
||||||
uint32_t value;
|
uint32_t value;
|
||||||
if (r->authdata_read(target, &value) != ERROR_OK)
|
if (r->authdata_read(target, &value) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
command_print(CMD_CTX, "0x%" PRIx32, value);
|
command_print(CMD, "0x%" PRIx32, value);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("authdata_read is not implemented for this target.");
|
LOG_ERROR("authdata_read is not implemented for this target.");
|
||||||
|
@ -1676,7 +1676,7 @@ COMMAND_HANDLER(riscv_dmi_read)
|
||||||
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
|
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[0], address);
|
||||||
if (r->dmi_read(target, &value, address) != ERROR_OK)
|
if (r->dmi_read(target, &value, address) != ERROR_OK)
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
command_print(CMD_CTX, "0x%" PRIx32, value);
|
command_print(CMD, "0x%" PRIx32, value);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
} else {
|
} else {
|
||||||
LOG_ERROR("dmi_read is not implemented for this target.");
|
LOG_ERROR("dmi_read is not implemented for this target.");
|
||||||
|
|
|
@ -1470,7 +1470,7 @@ __COMMAND_HANDLER(handle_common_semihosting_command)
|
||||||
|
|
||||||
struct semihosting *semihosting = target->semihosting;
|
struct semihosting *semihosting = target->semihosting;
|
||||||
if (!semihosting) {
|
if (!semihosting) {
|
||||||
command_print(CMD_CTX, "semihosting not supported for current target");
|
command_print(CMD, "semihosting not supported for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1493,7 +1493,7 @@ __COMMAND_HANDLER(handle_common_semihosting_command)
|
||||||
semihosting->is_active = is_active;
|
semihosting->is_active = is_active;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "semihosting is %s",
|
command_print(CMD, "semihosting is %s",
|
||||||
semihosting->is_active
|
semihosting->is_active
|
||||||
? "enabled" : "disabled");
|
? "enabled" : "disabled");
|
||||||
|
|
||||||
|
@ -1512,19 +1512,19 @@ __COMMAND_HANDLER(handle_common_semihosting_fileio_command)
|
||||||
|
|
||||||
struct semihosting *semihosting = target->semihosting;
|
struct semihosting *semihosting = target->semihosting;
|
||||||
if (!semihosting) {
|
if (!semihosting) {
|
||||||
command_print(CMD_CTX, "semihosting not supported for current target");
|
command_print(CMD, "semihosting not supported for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!semihosting->is_active) {
|
if (!semihosting->is_active) {
|
||||||
command_print(CMD_CTX, "semihosting not yet enabled for current target");
|
command_print(CMD, "semihosting not yet enabled for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0)
|
if (CMD_ARGC > 0)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting->is_fileio);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting->is_fileio);
|
||||||
|
|
||||||
command_print(CMD_CTX, "semihosting fileio is %s",
|
command_print(CMD, "semihosting fileio is %s",
|
||||||
semihosting->is_fileio
|
semihosting->is_fileio
|
||||||
? "enabled" : "disabled");
|
? "enabled" : "disabled");
|
||||||
|
|
||||||
|
@ -1543,7 +1543,7 @@ __COMMAND_HANDLER(handle_common_semihosting_cmdline)
|
||||||
|
|
||||||
struct semihosting *semihosting = target->semihosting;
|
struct semihosting *semihosting = target->semihosting;
|
||||||
if (!semihosting) {
|
if (!semihosting) {
|
||||||
command_print(CMD_CTX, "semihosting not supported for current target");
|
command_print(CMD, "semihosting not supported for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1558,7 +1558,7 @@ __COMMAND_HANDLER(handle_common_semihosting_cmdline)
|
||||||
semihosting->cmdline = cmdline;
|
semihosting->cmdline = cmdline;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "semihosting command line is [%s]",
|
command_print(CMD, "semihosting command line is [%s]",
|
||||||
semihosting->cmdline);
|
semihosting->cmdline);
|
||||||
|
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
@ -1575,19 +1575,19 @@ __COMMAND_HANDLER(handle_common_semihosting_resumable_exit_command)
|
||||||
|
|
||||||
struct semihosting *semihosting = target->semihosting;
|
struct semihosting *semihosting = target->semihosting;
|
||||||
if (!semihosting) {
|
if (!semihosting) {
|
||||||
command_print(CMD_CTX, "semihosting not supported for current target");
|
command_print(CMD, "semihosting not supported for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!semihosting->is_active) {
|
if (!semihosting->is_active) {
|
||||||
command_print(CMD_CTX, "semihosting not yet enabled for current target");
|
command_print(CMD, "semihosting not yet enabled for current target");
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CMD_ARGC > 0)
|
if (CMD_ARGC > 0)
|
||||||
COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting->has_resumable_exit);
|
COMMAND_PARSE_ENABLE(CMD_ARGV[0], semihosting->has_resumable_exit);
|
||||||
|
|
||||||
command_print(CMD_CTX, "semihosting resumable exit is %s",
|
command_print(CMD, "semihosting resumable exit is %s",
|
||||||
semihosting->has_resumable_exit
|
semihosting->has_resumable_exit
|
||||||
? "enabled" : "disabled");
|
? "enabled" : "disabled");
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@ COMMAND_HANDLER(default_handle_smp_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
if (!CMD_ARGC) {
|
if (!CMD_ARGC) {
|
||||||
command_print(CMD_CTX, "%s", target->smp ? "on" : "off");
|
command_print(CMD, "%s", target->smp ? "on" : "off");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +166,7 @@ COMMAND_HANDLER(handle_smp_gdb_command)
|
||||||
target->gdb_service->core[1] = coreid;
|
target->gdb_service->core[1] = coreid;
|
||||||
|
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "gdb coreid %" PRId32 " -> %" PRId32, target->gdb_service->core[0]
|
command_print(CMD, "gdb coreid %" PRId32 " -> %" PRId32, target->gdb_service->core[0]
|
||||||
, target->gdb_service->core[1]);
|
, target->gdb_service->core[1]);
|
||||||
}
|
}
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
|
|
|
@ -2147,7 +2147,7 @@ COMMAND_HANDLER(stm8_handle_enable_step_irq_command)
|
||||||
stm8->enable_step_irq = enable;
|
stm8->enable_step_irq = enable;
|
||||||
}
|
}
|
||||||
msg = stm8->enable_step_irq ? "enabled" : "disabled";
|
msg = stm8->enable_step_irq ? "enabled" : "disabled";
|
||||||
command_print(CMD_CTX, "enable_step_irq = %s", msg);
|
command_print(CMD, "enable_step_irq = %s", msg);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2163,7 +2163,7 @@ COMMAND_HANDLER(stm8_handle_enable_stm8l_command)
|
||||||
stm8->enable_stm8l = enable;
|
stm8->enable_stm8l = enable;
|
||||||
}
|
}
|
||||||
msg = stm8->enable_stm8l ? "enabled" : "disabled";
|
msg = stm8->enable_stm8l ? "enabled" : "disabled";
|
||||||
command_print(CMD_CTX, "enable_stm8l = %s", msg);
|
command_print(CMD, "enable_stm8l = %s", msg);
|
||||||
stm8_init_flash_regs(stm8->enable_stm8l, stm8);
|
stm8_init_flash_regs(stm8->enable_stm8l, stm8);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -670,7 +670,7 @@ static int target_process_reset(struct command_invocation *cmd, enum target_rese
|
||||||
|
|
||||||
if (retval != JIM_OK) {
|
if (retval != JIM_OK) {
|
||||||
Jim_MakeErrorMessage(cmd->ctx->interp);
|
Jim_MakeErrorMessage(cmd->ctx->interp);
|
||||||
command_print(cmd->ctx, "%s", Jim_GetString(Jim_GetResult(cmd->ctx->interp), NULL));
|
command_print(cmd, "%s", Jim_GetString(Jim_GetResult(cmd->ctx->interp), NULL));
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2612,8 +2612,8 @@ COMMAND_HANDLER(handle_targets_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
struct target *target = all_targets;
|
struct target *target = all_targets;
|
||||||
command_print(CMD_CTX, " TargetName Type Endian TapName State ");
|
command_print(CMD, " TargetName Type Endian TapName State ");
|
||||||
command_print(CMD_CTX, "-- ------------------ ---------- ------ ------------------ ------------");
|
command_print(CMD, "-- ------------------ ---------- ------ ------------------ ------------");
|
||||||
while (target) {
|
while (target) {
|
||||||
const char *state;
|
const char *state;
|
||||||
char marker = ' ';
|
char marker = ' ';
|
||||||
|
@ -2627,7 +2627,7 @@ COMMAND_HANDLER(handle_targets_command)
|
||||||
marker = '*';
|
marker = '*';
|
||||||
|
|
||||||
/* keep columns lined up to match the headers above */
|
/* keep columns lined up to match the headers above */
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"%2d%c %-18s %-10s %-6s %-18s %s",
|
"%2d%c %-18s %-10s %-6s %-18s %s",
|
||||||
target->target_number,
|
target->target_number,
|
||||||
marker,
|
marker,
|
||||||
|
@ -2837,7 +2837,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
while (cache) {
|
while (cache) {
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
command_print(CMD_CTX, "===== %s", cache->name);
|
command_print(CMD, "===== %s", cache->name);
|
||||||
|
|
||||||
for (i = 0, reg = cache->reg_list;
|
for (i = 0, reg = cache->reg_list;
|
||||||
i < cache->num_regs;
|
i < cache->num_regs;
|
||||||
|
@ -2848,7 +2848,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
if (reg->valid) {
|
if (reg->valid) {
|
||||||
value = buf_to_str(reg->value,
|
value = buf_to_str(reg->value,
|
||||||
reg->size, 16);
|
reg->size, 16);
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"(%i) %s (/%" PRIu32 "): 0x%s%s",
|
"(%i) %s (/%" PRIu32 "): 0x%s%s",
|
||||||
count, reg->name,
|
count, reg->name,
|
||||||
reg->size, value,
|
reg->size, value,
|
||||||
|
@ -2857,7 +2857,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
: "");
|
: "");
|
||||||
free(value);
|
free(value);
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "(%i) %s (/%" PRIu32 ")",
|
command_print(CMD, "(%i) %s (/%" PRIu32 ")",
|
||||||
count, reg->name,
|
count, reg->name,
|
||||||
reg->size) ;
|
reg->size) ;
|
||||||
}
|
}
|
||||||
|
@ -2889,7 +2889,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!reg) {
|
if (!reg) {
|
||||||
command_print(CMD_CTX, "%i is out of bounds, the current target "
|
command_print(CMD, "%i is out of bounds, the current target "
|
||||||
"has only %i registers (0 - %i)", num, count, count - 1);
|
"has only %i registers (0 - %i)", num, count, count - 1);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2915,7 +2915,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
if (reg->valid == 0)
|
if (reg->valid == 0)
|
||||||
reg->type->get(reg);
|
reg->type->get(reg);
|
||||||
value = buf_to_str(reg->value, reg->size, 16);
|
value = buf_to_str(reg->value, reg->size, 16);
|
||||||
command_print(CMD_CTX, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);
|
command_print(CMD, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);
|
||||||
free(value);
|
free(value);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
@ -2930,7 +2930,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
reg->type->set(reg, buf);
|
reg->type->set(reg, buf);
|
||||||
|
|
||||||
value = buf_to_str(reg->value, reg->size, 16);
|
value = buf_to_str(reg->value, reg->size, 16);
|
||||||
command_print(CMD_CTX, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);
|
command_print(CMD, "%s (/%i): 0x%s", reg->name, (int)(reg->size), value);
|
||||||
free(value);
|
free(value);
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
@ -2941,7 +2941,7 @@ COMMAND_HANDLER(handle_reg_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
|
|
||||||
not_found:
|
not_found:
|
||||||
command_print(CMD_CTX, "register %s not found in current target", CMD_ARGV[0]);
|
command_print(CMD, "register %s not found in current target", CMD_ARGV[0]);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2951,9 +2951,9 @@ COMMAND_HANDLER(handle_poll_command)
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
|
|
||||||
if (CMD_ARGC == 0) {
|
if (CMD_ARGC == 0) {
|
||||||
command_print(CMD_CTX, "background polling: %s",
|
command_print(CMD, "background polling: %s",
|
||||||
jtag_poll_get_enabled() ? "on" : "off");
|
jtag_poll_get_enabled() ? "on" : "off");
|
||||||
command_print(CMD_CTX, "TAP: %s (%s)",
|
command_print(CMD, "TAP: %s (%s)",
|
||||||
target->tap->dotted_name,
|
target->tap->dotted_name,
|
||||||
target->tap->enabled ? "enabled" : "disabled");
|
target->tap->enabled ? "enabled" : "disabled");
|
||||||
if (!target->tap->enabled)
|
if (!target->tap->enabled)
|
||||||
|
@ -3183,7 +3183,7 @@ static void handle_md_output(struct command_invocation *cmd,
|
||||||
value_fmt, value);
|
value_fmt, value);
|
||||||
|
|
||||||
if ((i % line_modulo == line_modulo - 1) || (i == count - 1)) {
|
if ((i % line_modulo == line_modulo - 1) || (i == count - 1)) {
|
||||||
command_print(cmd->ctx, "%s", output);
|
command_print(cmd, "%s", output);
|
||||||
output_len = 0;
|
output_len = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3413,7 +3413,7 @@ COMMAND_HANDLER(handle_load_image_command)
|
||||||
for (i = 0; i < image.num_sections; i++) {
|
for (i = 0; i < image.num_sections; i++) {
|
||||||
buffer = malloc(image.sections[i].size);
|
buffer = malloc(image.sections[i].size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"error allocating buffer for section (%d bytes)",
|
"error allocating buffer for section (%d bytes)",
|
||||||
(int)(image.sections[i].size));
|
(int)(image.sections[i].size));
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
|
@ -3450,7 +3450,7 @@ COMMAND_HANDLER(handle_load_image_command)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
image_size += length;
|
image_size += length;
|
||||||
command_print(CMD_CTX, "%u bytes written at address " TARGET_ADDR_FMT "",
|
command_print(CMD, "%u bytes written at address " TARGET_ADDR_FMT "",
|
||||||
(unsigned int)length,
|
(unsigned int)length,
|
||||||
image.sections[i].base_address + offset);
|
image.sections[i].base_address + offset);
|
||||||
}
|
}
|
||||||
|
@ -3459,7 +3459,7 @@ COMMAND_HANDLER(handle_load_image_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "downloaded %" PRIu32 " bytes "
|
command_print(CMD, "downloaded %" PRIu32 " bytes "
|
||||||
"in %fs (%0.3f KiB/s)", image_size,
|
"in %fs (%0.3f KiB/s)", image_size,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
||||||
}
|
}
|
||||||
|
@ -3520,7 +3520,7 @@ COMMAND_HANDLER(handle_dump_image_command)
|
||||||
retval = fileio_size(fileio, &filesize);
|
retval = fileio_size(fileio, &filesize);
|
||||||
if (retval != ERROR_OK)
|
if (retval != ERROR_OK)
|
||||||
return retval;
|
return retval;
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"dumped %zu bytes in %fs (%0.3f KiB/s)", filesize,
|
"dumped %zu bytes in %fs (%0.3f KiB/s)", filesize,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
duration_elapsed(&bench), duration_kbps(&bench, filesize));
|
||||||
}
|
}
|
||||||
|
@ -3585,7 +3585,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
|
||||||
for (i = 0; i < image.num_sections; i++) {
|
for (i = 0; i < image.num_sections; i++) {
|
||||||
buffer = malloc(image.sections[i].size);
|
buffer = malloc(image.sections[i].size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"error allocating buffer for section (%d bytes)",
|
"error allocating buffer for section (%d bytes)",
|
||||||
(int)(image.sections[i].size));
|
(int)(image.sections[i].size));
|
||||||
break;
|
break;
|
||||||
|
@ -3636,14 +3636,14 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
|
||||||
uint32_t t;
|
uint32_t t;
|
||||||
for (t = 0; t < buf_cnt; t++) {
|
for (t = 0; t < buf_cnt; t++) {
|
||||||
if (data[t] != buffer[t]) {
|
if (data[t] != buffer[t]) {
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
|
"diff %d address 0x%08x. Was 0x%02x instead of 0x%02x",
|
||||||
diffs,
|
diffs,
|
||||||
(unsigned)(t + image.sections[i].base_address),
|
(unsigned)(t + image.sections[i].base_address),
|
||||||
data[t],
|
data[t],
|
||||||
buffer[t]);
|
buffer[t]);
|
||||||
if (diffs++ >= 127) {
|
if (diffs++ >= 127) {
|
||||||
command_print(CMD_CTX, "More than 128 errors, the rest are not printed.");
|
command_print(CMD, "More than 128 errors, the rest are not printed.");
|
||||||
free(data);
|
free(data);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
goto done;
|
goto done;
|
||||||
|
@ -3655,7 +3655,7 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
|
||||||
free(data);
|
free(data);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "address " TARGET_ADDR_FMT " length 0x%08zx",
|
command_print(CMD, "address " TARGET_ADDR_FMT " length 0x%08zx",
|
||||||
image.sections[i].base_address,
|
image.sections[i].base_address,
|
||||||
buf_cnt);
|
buf_cnt);
|
||||||
}
|
}
|
||||||
|
@ -3664,12 +3664,12 @@ static COMMAND_HELPER(handle_verify_image_command_internal, enum verify_mode ver
|
||||||
image_size += buf_cnt;
|
image_size += buf_cnt;
|
||||||
}
|
}
|
||||||
if (diffs > 0)
|
if (diffs > 0)
|
||||||
command_print(CMD_CTX, "No more differences found.");
|
command_print(CMD, "No more differences found.");
|
||||||
done:
|
done:
|
||||||
if (diffs > 0)
|
if (diffs > 0)
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "verified %" PRIu32 " bytes "
|
command_print(CMD, "verified %" PRIu32 " bytes "
|
||||||
"in %fs (%0.3f KiB/s)", image_size,
|
"in %fs (%0.3f KiB/s)", image_size,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
||||||
}
|
}
|
||||||
|
@ -3702,24 +3702,24 @@ static int handle_bp_command_list(struct command_invocation *cmd)
|
||||||
if (breakpoint->type == BKPT_SOFT) {
|
if (breakpoint->type == BKPT_SOFT) {
|
||||||
char *buf = buf_to_str(breakpoint->orig_instr,
|
char *buf = buf_to_str(breakpoint->orig_instr,
|
||||||
breakpoint->length, 16);
|
breakpoint->length, 16);
|
||||||
command_print(cmd->ctx, "IVA breakpoint: " TARGET_ADDR_FMT ", 0x%x, %i, 0x%s",
|
command_print(cmd, "IVA breakpoint: " TARGET_ADDR_FMT ", 0x%x, %i, 0x%s",
|
||||||
breakpoint->address,
|
breakpoint->address,
|
||||||
breakpoint->length,
|
breakpoint->length,
|
||||||
breakpoint->set, buf);
|
breakpoint->set, buf);
|
||||||
free(buf);
|
free(buf);
|
||||||
} else {
|
} else {
|
||||||
if ((breakpoint->address == 0) && (breakpoint->asid != 0))
|
if ((breakpoint->address == 0) && (breakpoint->asid != 0))
|
||||||
command_print(cmd->ctx, "Context breakpoint: 0x%8.8" PRIx32 ", 0x%x, %i",
|
command_print(cmd, "Context breakpoint: 0x%8.8" PRIx32 ", 0x%x, %i",
|
||||||
breakpoint->asid,
|
breakpoint->asid,
|
||||||
breakpoint->length, breakpoint->set);
|
breakpoint->length, breakpoint->set);
|
||||||
else if ((breakpoint->address != 0) && (breakpoint->asid != 0)) {
|
else if ((breakpoint->address != 0) && (breakpoint->asid != 0)) {
|
||||||
command_print(cmd->ctx, "Hybrid breakpoint(IVA): " TARGET_ADDR_FMT ", 0x%x, %i",
|
command_print(cmd, "Hybrid breakpoint(IVA): " TARGET_ADDR_FMT ", 0x%x, %i",
|
||||||
breakpoint->address,
|
breakpoint->address,
|
||||||
breakpoint->length, breakpoint->set);
|
breakpoint->length, breakpoint->set);
|
||||||
command_print(cmd->ctx, "\t|--->linked with ContextID: 0x%8.8" PRIx32,
|
command_print(cmd, "\t|--->linked with ContextID: 0x%8.8" PRIx32,
|
||||||
breakpoint->asid);
|
breakpoint->asid);
|
||||||
} else
|
} else
|
||||||
command_print(cmd->ctx, "Breakpoint(IVA): " TARGET_ADDR_FMT ", 0x%x, %i",
|
command_print(cmd, "Breakpoint(IVA): " TARGET_ADDR_FMT ", 0x%x, %i",
|
||||||
breakpoint->address,
|
breakpoint->address,
|
||||||
breakpoint->length, breakpoint->set);
|
breakpoint->length, breakpoint->set);
|
||||||
}
|
}
|
||||||
|
@ -3739,7 +3739,7 @@ static int handle_bp_command_set(struct command_invocation *cmd,
|
||||||
retval = breakpoint_add(target, addr, length, hw);
|
retval = breakpoint_add(target, addr, length, hw);
|
||||||
/* error is always logged in breakpoint_add(), do not print it again */
|
/* error is always logged in breakpoint_add(), do not print it again */
|
||||||
if (ERROR_OK == retval)
|
if (ERROR_OK == retval)
|
||||||
command_print(cmd->ctx, "breakpoint set at " TARGET_ADDR_FMT "", addr);
|
command_print(cmd, "breakpoint set at " TARGET_ADDR_FMT "", addr);
|
||||||
|
|
||||||
} else if (addr == 0) {
|
} else if (addr == 0) {
|
||||||
if (target->type->add_context_breakpoint == NULL) {
|
if (target->type->add_context_breakpoint == NULL) {
|
||||||
|
@ -3749,7 +3749,7 @@ static int handle_bp_command_set(struct command_invocation *cmd,
|
||||||
retval = context_breakpoint_add(target, asid, length, hw);
|
retval = context_breakpoint_add(target, asid, length, hw);
|
||||||
/* error is always logged in context_breakpoint_add(), do not print it again */
|
/* error is always logged in context_breakpoint_add(), do not print it again */
|
||||||
if (ERROR_OK == retval)
|
if (ERROR_OK == retval)
|
||||||
command_print(cmd->ctx, "Context breakpoint set at 0x%8.8" PRIx32 "", asid);
|
command_print(cmd, "Context breakpoint set at 0x%8.8" PRIx32 "", asid);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
if (target->type->add_hybrid_breakpoint == NULL) {
|
if (target->type->add_hybrid_breakpoint == NULL) {
|
||||||
|
@ -3759,7 +3759,7 @@ static int handle_bp_command_set(struct command_invocation *cmd,
|
||||||
retval = hybrid_breakpoint_add(target, addr, asid, length, hw);
|
retval = hybrid_breakpoint_add(target, addr, asid, length, hw);
|
||||||
/* error is always logged in hybrid_breakpoint_add(), do not print it again */
|
/* error is always logged in hybrid_breakpoint_add(), do not print it again */
|
||||||
if (ERROR_OK == retval)
|
if (ERROR_OK == retval)
|
||||||
command_print(cmd->ctx, "Hybrid breakpoint set at 0x%8.8" PRIx32 "", asid);
|
command_print(cmd, "Hybrid breakpoint set at 0x%8.8" PRIx32 "", asid);
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -3830,7 +3830,7 @@ COMMAND_HANDLER(handle_wp_command)
|
||||||
struct watchpoint *watchpoint = target->watchpoints;
|
struct watchpoint *watchpoint = target->watchpoints;
|
||||||
|
|
||||||
while (watchpoint) {
|
while (watchpoint) {
|
||||||
command_print(CMD_CTX, "address: " TARGET_ADDR_FMT
|
command_print(CMD, "address: " TARGET_ADDR_FMT
|
||||||
", len: 0x%8.8" PRIx32
|
", len: 0x%8.8" PRIx32
|
||||||
", r/w/a: %i, value: 0x%8.8" PRIx32
|
", r/w/a: %i, value: 0x%8.8" PRIx32
|
||||||
", mask: 0x%8.8" PRIx32,
|
", mask: 0x%8.8" PRIx32,
|
||||||
|
@ -3922,7 +3922,7 @@ COMMAND_HANDLER(handle_virt2phys_command)
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
int retval = target->type->virt2phys(target, va, &pa);
|
int retval = target->type->virt2phys(target, va, &pa);
|
||||||
if (retval == ERROR_OK)
|
if (retval == ERROR_OK)
|
||||||
command_print(CMD_CTX, "Physical address " TARGET_ADDR_FMT "", pa);
|
command_print(CMD, "Physical address " TARGET_ADDR_FMT "", pa);
|
||||||
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -4115,7 +4115,7 @@ COMMAND_HANDLER(handle_profile_command)
|
||||||
|
|
||||||
write_gmon(samples, num_of_samples, CMD_ARGV[1],
|
write_gmon(samples, num_of_samples, CMD_ARGV[1],
|
||||||
with_range, start_address, end_address, target, duration_ms);
|
with_range, start_address, end_address, target, duration_ms);
|
||||||
command_print(CMD_CTX, "Wrote %s", CMD_ARGV[1]);
|
command_print(CMD, "Wrote %s", CMD_ARGV[1]);
|
||||||
|
|
||||||
free(samples);
|
free(samples);
|
||||||
return retval;
|
return retval;
|
||||||
|
@ -5152,19 +5152,19 @@ COMMAND_HANDLER(handle_target_event_list)
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
struct target_event_action *teap = target->event_action;
|
struct target_event_action *teap = target->event_action;
|
||||||
|
|
||||||
command_print(CMD_CTX, "Event actions for target (%d) %s\n",
|
command_print(CMD, "Event actions for target (%d) %s\n",
|
||||||
target->target_number,
|
target->target_number,
|
||||||
target_name(target));
|
target_name(target));
|
||||||
command_print(CMD_CTX, "%-25s | Body", "Event");
|
command_print(CMD, "%-25s | Body", "Event");
|
||||||
command_print(CMD_CTX, "------------------------- | "
|
command_print(CMD, "------------------------- | "
|
||||||
"----------------------------------------");
|
"----------------------------------------");
|
||||||
while (teap) {
|
while (teap) {
|
||||||
Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_target_event, teap->event);
|
Jim_Nvp *opt = Jim_Nvp_value2name_simple(nvp_target_event, teap->event);
|
||||||
command_print(CMD_CTX, "%-25s | %s",
|
command_print(CMD, "%-25s | %s",
|
||||||
opt->name, Jim_GetString(teap->body, NULL));
|
opt->name, Jim_GetString(teap->body, NULL));
|
||||||
teap = teap->next;
|
teap = teap->next;
|
||||||
}
|
}
|
||||||
command_print(CMD_CTX, "***END***");
|
command_print(CMD, "***END***");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
static int jim_target_current_state(Jim_Interp *interp, int argc, Jim_Obj *const *argv)
|
||||||
|
@ -5776,7 +5776,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
||||||
fastload_num = image.num_sections;
|
fastload_num = image.num_sections;
|
||||||
fastload = malloc(sizeof(struct FastLoad)*image.num_sections);
|
fastload = malloc(sizeof(struct FastLoad)*image.num_sections);
|
||||||
if (fastload == NULL) {
|
if (fastload == NULL) {
|
||||||
command_print(CMD_CTX, "out of memory");
|
command_print(CMD, "out of memory");
|
||||||
image_close(&image);
|
image_close(&image);
|
||||||
return ERROR_FAIL;
|
return ERROR_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -5784,7 +5784,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
||||||
for (i = 0; i < image.num_sections; i++) {
|
for (i = 0; i < image.num_sections; i++) {
|
||||||
buffer = malloc(image.sections[i].size);
|
buffer = malloc(image.sections[i].size);
|
||||||
if (buffer == NULL) {
|
if (buffer == NULL) {
|
||||||
command_print(CMD_CTX, "error allocating buffer for section (%d bytes)",
|
command_print(CMD, "error allocating buffer for section (%d bytes)",
|
||||||
(int)(image.sections[i].size));
|
(int)(image.sections[i].size));
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
|
@ -5816,7 +5816,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
||||||
fastload[i].data = malloc(length);
|
fastload[i].data = malloc(length);
|
||||||
if (fastload[i].data == NULL) {
|
if (fastload[i].data == NULL) {
|
||||||
free(buffer);
|
free(buffer);
|
||||||
command_print(CMD_CTX, "error allocating buffer for section (%" PRIu32 " bytes)",
|
command_print(CMD, "error allocating buffer for section (%" PRIu32 " bytes)",
|
||||||
length);
|
length);
|
||||||
retval = ERROR_FAIL;
|
retval = ERROR_FAIL;
|
||||||
break;
|
break;
|
||||||
|
@ -5825,7 +5825,7 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
||||||
fastload[i].length = length;
|
fastload[i].length = length;
|
||||||
|
|
||||||
image_size += length;
|
image_size += length;
|
||||||
command_print(CMD_CTX, "%u bytes written at address 0x%8.8x",
|
command_print(CMD, "%u bytes written at address 0x%8.8x",
|
||||||
(unsigned int)length,
|
(unsigned int)length,
|
||||||
((unsigned int)(image.sections[i].base_address + offset)));
|
((unsigned int)(image.sections[i].base_address + offset)));
|
||||||
}
|
}
|
||||||
|
@ -5834,11 +5834,11 @@ COMMAND_HANDLER(handle_fast_load_image_command)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK)) {
|
||||||
command_print(CMD_CTX, "Loaded %" PRIu32 " bytes "
|
command_print(CMD, "Loaded %" PRIu32 " bytes "
|
||||||
"in %fs (%0.3f KiB/s)", image_size,
|
"in %fs (%0.3f KiB/s)", image_size,
|
||||||
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
duration_elapsed(&bench), duration_kbps(&bench, image_size));
|
||||||
|
|
||||||
command_print(CMD_CTX,
|
command_print(CMD,
|
||||||
"WARNING: image has not been loaded to target!"
|
"WARNING: image has not been loaded to target!"
|
||||||
"You can issue a 'fast_load' to finish loading.");
|
"You can issue a 'fast_load' to finish loading.");
|
||||||
}
|
}
|
||||||
|
@ -5865,7 +5865,7 @@ COMMAND_HANDLER(handle_fast_load_command)
|
||||||
int retval = ERROR_OK;
|
int retval = ERROR_OK;
|
||||||
for (i = 0; i < fastload_num; i++) {
|
for (i = 0; i < fastload_num; i++) {
|
||||||
struct target *target = get_current_target(CMD_CTX);
|
struct target *target = get_current_target(CMD_CTX);
|
||||||
command_print(CMD_CTX, "Write to 0x%08x, length 0x%08x",
|
command_print(CMD, "Write to 0x%08x, length 0x%08x",
|
||||||
(unsigned int)(fastload[i].address),
|
(unsigned int)(fastload[i].address),
|
||||||
(unsigned int)(fastload[i].length));
|
(unsigned int)(fastload[i].length));
|
||||||
retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data);
|
retval = target_write_buffer(target, fastload[i].address, fastload[i].length, fastload[i].data);
|
||||||
|
@ -5875,7 +5875,7 @@ COMMAND_HANDLER(handle_fast_load_command)
|
||||||
}
|
}
|
||||||
if (retval == ERROR_OK) {
|
if (retval == ERROR_OK) {
|
||||||
int64_t after = timeval_ms();
|
int64_t after = timeval_ms();
|
||||||
command_print(CMD_CTX, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));
|
command_print(CMD, "Loaded image %f kBytes/s", (float)(size/1024.0)/((float)(after-ms)/1000.0));
|
||||||
}
|
}
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
@ -5930,7 +5930,7 @@ COMMAND_HANDLER(handle_ps_command)
|
||||||
if ((target->rtos) && (target->rtos->type)
|
if ((target->rtos) && (target->rtos->type)
|
||||||
&& (target->rtos->type->ps_command)) {
|
&& (target->rtos->type->ps_command)) {
|
||||||
display = target->rtos->type->ps_command(target);
|
display = target->rtos->type->ps_command(target);
|
||||||
command_print(CMD_CTX, "%s", display);
|
command_print(CMD, "%s", display);
|
||||||
free(display);
|
free(display);
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
} else {
|
} else {
|
||||||
|
@ -5942,10 +5942,10 @@ COMMAND_HANDLER(handle_ps_command)
|
||||||
static void binprint(struct command_invocation *cmd, const char *text, const uint8_t *buf, int size)
|
static void binprint(struct command_invocation *cmd, const char *text, const uint8_t *buf, int size)
|
||||||
{
|
{
|
||||||
if (text != NULL)
|
if (text != NULL)
|
||||||
command_print_sameline(cmd->ctx, "%s", text);
|
command_print_sameline(cmd, "%s", text);
|
||||||
for (int i = 0; i < size; i++)
|
for (int i = 0; i < size; i++)
|
||||||
command_print_sameline(cmd->ctx, " %02x", buf[i]);
|
command_print_sameline(cmd, " %02x", buf[i]);
|
||||||
command_print(cmd->ctx, " ");
|
command_print(cmd, " ");
|
||||||
}
|
}
|
||||||
|
|
||||||
COMMAND_HANDLER(handle_test_mem_access_command)
|
COMMAND_HANDLER(handle_test_mem_access_command)
|
||||||
|
@ -5997,7 +5997,7 @@ COMMAND_HANDLER(handle_test_mem_access_command)
|
||||||
read_ref[i] = rand();
|
read_ref[i] = rand();
|
||||||
read_buf[i] = read_ref[i];
|
read_buf[i] = read_ref[i];
|
||||||
}
|
}
|
||||||
command_print_sameline(CMD_CTX,
|
command_print_sameline(CMD,
|
||||||
"Test read %" PRIu32 " x %d @ %d to %saligned buffer: ", count,
|
"Test read %" PRIu32 " x %d @ %d to %saligned buffer: ", count,
|
||||||
size, offset, host_offset ? "un" : "");
|
size, offset, host_offset ? "un" : "");
|
||||||
|
|
||||||
|
@ -6010,10 +6010,10 @@ COMMAND_HANDLER(handle_test_mem_access_command)
|
||||||
duration_measure(&bench);
|
duration_measure(&bench);
|
||||||
|
|
||||||
if (retval == ERROR_TARGET_UNALIGNED_ACCESS) {
|
if (retval == ERROR_TARGET_UNALIGNED_ACCESS) {
|
||||||
command_print(CMD_CTX, "Unsupported alignment");
|
command_print(CMD, "Unsupported alignment");
|
||||||
goto next;
|
goto next;
|
||||||
} else if (retval != ERROR_OK) {
|
} else if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "Memory read failed");
|
command_print(CMD, "Memory read failed");
|
||||||
goto next;
|
goto next;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6023,11 +6023,11 @@ COMMAND_HANDLER(handle_test_mem_access_command)
|
||||||
/* check result */
|
/* check result */
|
||||||
int result = memcmp(read_ref, read_buf, host_bufsiz);
|
int result = memcmp(read_ref, read_buf, host_bufsiz);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
command_print(CMD_CTX, "Pass in %fs (%0.3f KiB/s)",
|
command_print(CMD, "Pass in %fs (%0.3f KiB/s)",
|
||||||
duration_elapsed(&bench),
|
duration_elapsed(&bench),
|
||||||
duration_kbps(&bench, count * size));
|
duration_kbps(&bench, count * size));
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Compare failed");
|
command_print(CMD, "Compare failed");
|
||||||
binprint(CMD, "ref:", read_ref, host_bufsiz);
|
binprint(CMD, "ref:", read_ref, host_bufsiz);
|
||||||
binprint(CMD, "buf:", read_buf, host_bufsiz);
|
binprint(CMD, "buf:", read_buf, host_bufsiz);
|
||||||
}
|
}
|
||||||
|
@ -6069,13 +6069,13 @@ out:
|
||||||
|
|
||||||
for (size_t i = 0; i < host_bufsiz; i++)
|
for (size_t i = 0; i < host_bufsiz; i++)
|
||||||
write_buf[i] = rand();
|
write_buf[i] = rand();
|
||||||
command_print_sameline(CMD_CTX,
|
command_print_sameline(CMD,
|
||||||
"Test write %" PRIu32 " x %d @ %d from %saligned buffer: ", count,
|
"Test write %" PRIu32 " x %d @ %d from %saligned buffer: ", count,
|
||||||
size, offset, host_offset ? "un" : "");
|
size, offset, host_offset ? "un" : "");
|
||||||
|
|
||||||
retval = target_write_memory(target, wa->address, 1, num_bytes, test_pattern);
|
retval = target_write_memory(target, wa->address, 1, num_bytes, test_pattern);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "Test pattern write failed");
|
command_print(CMD, "Test pattern write failed");
|
||||||
goto nextw;
|
goto nextw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6092,28 +6092,28 @@ out:
|
||||||
duration_measure(&bench);
|
duration_measure(&bench);
|
||||||
|
|
||||||
if (retval == ERROR_TARGET_UNALIGNED_ACCESS) {
|
if (retval == ERROR_TARGET_UNALIGNED_ACCESS) {
|
||||||
command_print(CMD_CTX, "Unsupported alignment");
|
command_print(CMD, "Unsupported alignment");
|
||||||
goto nextw;
|
goto nextw;
|
||||||
} else if (retval != ERROR_OK) {
|
} else if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "Memory write failed");
|
command_print(CMD, "Memory write failed");
|
||||||
goto nextw;
|
goto nextw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* read back */
|
/* read back */
|
||||||
retval = target_read_memory(target, wa->address, 1, num_bytes, read_buf);
|
retval = target_read_memory(target, wa->address, 1, num_bytes, read_buf);
|
||||||
if (retval != ERROR_OK) {
|
if (retval != ERROR_OK) {
|
||||||
command_print(CMD_CTX, "Test pattern write failed");
|
command_print(CMD, "Test pattern write failed");
|
||||||
goto nextw;
|
goto nextw;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* check result */
|
/* check result */
|
||||||
int result = memcmp(read_ref, read_buf, num_bytes);
|
int result = memcmp(read_ref, read_buf, num_bytes);
|
||||||
if (result == 0) {
|
if (result == 0) {
|
||||||
command_print(CMD_CTX, "Pass in %fs (%0.3f KiB/s)",
|
command_print(CMD, "Pass in %fs (%0.3f KiB/s)",
|
||||||
duration_elapsed(&bench),
|
duration_elapsed(&bench),
|
||||||
duration_kbps(&bench, count * size));
|
duration_kbps(&bench, count * size));
|
||||||
} else {
|
} else {
|
||||||
command_print(CMD_CTX, "Compare failed");
|
command_print(CMD, "Compare failed");
|
||||||
binprint(CMD, "ref:", read_ref, num_bytes);
|
binprint(CMD, "ref:", read_ref, num_bytes);
|
||||||
binprint(CMD, "buf:", read_buf, num_bytes);
|
binprint(CMD, "buf:", read_buf, num_bytes);
|
||||||
}
|
}
|
||||||
|
|
|
@ -283,7 +283,7 @@ COMMAND_HANDLER(handle_target_request_debugmsgs_command)
|
||||||
return ERROR_COMMAND_SYNTAX_ERROR;
|
return ERROR_COMMAND_SYNTAX_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
command_print(CMD_CTX, "receiving debug messages from current target %s",
|
command_print(CMD, "receiving debug messages from current target %s",
|
||||||
(receiving) ? (charmsg_mode ? "charmsg" : "enabled") : "disabled");
|
(receiving) ? (charmsg_mode ? "charmsg" : "enabled") : "disabled");
|
||||||
return ERROR_OK;
|
return ERROR_OK;
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue