Fix debug prints when loading to flash
While loading to flash with debug level at least 3, OpenOCD tries to print the whole loaded bitstream. This will be very-very-slow due to implementation of conversion from buffer to string. * fix condition on selected debug level in jtag/core.c * replace slow buf_to_str function from helper/binarybuffer.c with faster but_to_hex_str function Change-Id: I3dc01d5846941ca80736f2ed12e3a54114d2b6dd Signed-off-by: Samuel Obuch <sobuch@codasip.com> Reviewed-on: http://openocd.zylin.com/5800 Tested-by: jenkins Reviewed-by: Jan Matyas <matyas@codasip.com> Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com>
This commit is contained in:
committed by
Antonio Borneo
parent
764b25c814
commit
3ac010bb9f
@@ -214,10 +214,10 @@ int jtag_build_buffer(const struct scan_command *cmd, uint8_t **buffer)
|
||||
for (i = 0; i < cmd->num_fields; i++) {
|
||||
if (cmd->fields[i].out_value) {
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_str(cmd->fields[i].out_value,
|
||||
char *char_buf = buf_to_hex_str(cmd->fields[i].out_value,
|
||||
(cmd->fields[i].num_bits > DEBUG_JTAG_IOZ)
|
||||
? DEBUG_JTAG_IOZ
|
||||
: cmd->fields[i].num_bits, 16);
|
||||
: cmd->fields[i].num_bits);
|
||||
|
||||
LOG_DEBUG("fields[%i].out_value[%i]: 0x%s", i,
|
||||
cmd->fields[i].num_bits, char_buf);
|
||||
@@ -257,10 +257,10 @@ int jtag_read_buffer(uint8_t *buffer, const struct scan_command *cmd)
|
||||
malloc(DIV_ROUND_UP(num_bits, 8)), 0, num_bits);
|
||||
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_str(captured,
|
||||
char *char_buf = buf_to_hex_str(captured,
|
||||
(num_bits > DEBUG_JTAG_IOZ)
|
||||
? DEBUG_JTAG_IOZ
|
||||
: num_bits, 16);
|
||||
: num_bits);
|
||||
|
||||
LOG_DEBUG("fields[%i].in_value[%i]: 0x%s",
|
||||
i, num_bits, char_buf);
|
||||
|
||||
@@ -891,8 +891,8 @@ static int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value,
|
||||
|
||||
/* NOTE: we've lost diagnostic context here -- 'which tap' */
|
||||
|
||||
captured_str = buf_to_str(captured, bits, 16);
|
||||
in_check_value_str = buf_to_str(in_check_value, bits, 16);
|
||||
captured_str = buf_to_hex_str(captured, bits);
|
||||
in_check_value_str = buf_to_hex_str(in_check_value, bits);
|
||||
|
||||
LOG_WARNING("Bad value '%s' captured during DR or IR scan:",
|
||||
captured_str);
|
||||
@@ -904,7 +904,7 @@ static int jtag_check_value_inner(uint8_t *captured, uint8_t *in_check_value,
|
||||
if (in_check_mask) {
|
||||
char *in_check_mask_str;
|
||||
|
||||
in_check_mask_str = buf_to_str(in_check_mask, bits, 16);
|
||||
in_check_mask_str = buf_to_hex_str(in_check_mask, bits);
|
||||
LOG_WARNING(" check_mask: 0x%s", in_check_mask_str);
|
||||
free(in_check_mask_str);
|
||||
}
|
||||
@@ -960,7 +960,7 @@ int default_interface_jtag_execute_queue(void)
|
||||
* jtag/Makefile.am if MINIDRIVER_DUMMY || !MINIDRIVER, but those variables
|
||||
* aren't accessible here. */
|
||||
struct jtag_command *cmd = jtag_command_queue;
|
||||
while (debug_level >= LOG_LVL_DEBUG && cmd) {
|
||||
while (debug_level >= LOG_LVL_DEBUG_IO && cmd) {
|
||||
switch (cmd->type) {
|
||||
case JTAG_SCAN:
|
||||
LOG_DEBUG_IO("JTAG %s SCAN to %s",
|
||||
@@ -969,12 +969,12 @@ int default_interface_jtag_execute_queue(void)
|
||||
for (int i = 0; i < cmd->cmd.scan->num_fields; i++) {
|
||||
struct scan_field *field = cmd->cmd.scan->fields + i;
|
||||
if (field->out_value) {
|
||||
char *str = buf_to_str(field->out_value, field->num_bits, 16);
|
||||
char *str = buf_to_hex_str(field->out_value, field->num_bits);
|
||||
LOG_DEBUG_IO(" %db out: %s", field->num_bits, str);
|
||||
free(str);
|
||||
}
|
||||
if (field->in_value) {
|
||||
char *str = buf_to_str(field->in_value, field->num_bits, 16);
|
||||
char *str = buf_to_hex_str(field->in_value, field->num_bits);
|
||||
LOG_DEBUG_IO(" %db in: %s", field->num_bits, str);
|
||||
free(str);
|
||||
}
|
||||
@@ -1436,7 +1436,7 @@ static int jtag_validate_ircapture(void)
|
||||
/* verify the '11' sentinel we wrote is returned at the end */
|
||||
val = buf_get_u64(ir_test, chain_pos, 2);
|
||||
if (val != 0x3) {
|
||||
char *cbuf = buf_to_str(ir_test, total_ir_length, 16);
|
||||
char *cbuf = buf_to_hex_str(ir_test, total_ir_length);
|
||||
|
||||
LOG_ERROR("IR capture error at bit %d, saw 0x%s not 0x...3",
|
||||
chain_pos, cbuf);
|
||||
|
||||
@@ -103,11 +103,10 @@ static int jtag_vpi_send_cmd(struct vpi_cmd *vpi)
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
if (vpi->nb_bits > 0) {
|
||||
/* command with a non-empty data payload */
|
||||
char *char_buf = buf_to_str(vpi->buffer_out,
|
||||
char *char_buf = buf_to_hex_str(vpi->buffer_out,
|
||||
(vpi->nb_bits > DEBUG_JTAG_IOZ)
|
||||
? DEBUG_JTAG_IOZ
|
||||
: vpi->nb_bits,
|
||||
16);
|
||||
: vpi->nb_bits);
|
||||
LOG_DEBUG_IO("sending JTAG VPI cmd: cmd=%s, "
|
||||
"length=%" PRIu32 ", "
|
||||
"nb_bits=%" PRIu32 ", "
|
||||
@@ -328,9 +327,8 @@ static int jtag_vpi_queue_tdi_xfer(uint8_t *bits, int nb_bits, int tap_shift)
|
||||
|
||||
/* Optional low-level JTAG debug */
|
||||
if (LOG_LEVEL_IS(LOG_LVL_DEBUG_IO)) {
|
||||
char *char_buf = buf_to_str(vpi.buffer_in,
|
||||
(nb_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : nb_bits,
|
||||
16);
|
||||
char *char_buf = buf_to_hex_str(vpi.buffer_in,
|
||||
(nb_bits > DEBUG_JTAG_IOZ) ? DEBUG_JTAG_IOZ : nb_bits);
|
||||
LOG_DEBUG_IO("recvd JTAG VPI data: nb_bits=%d, buf_in=0x%s%s",
|
||||
nb_bits, char_buf, (nb_bits > DEBUG_JTAG_IOZ) ? "(...)" : "");
|
||||
free(char_buf);
|
||||
|
||||
@@ -204,7 +204,7 @@ static int Jim_Command_drscan(Jim_Interp *interp, int argc, Jim_Obj *const *args
|
||||
char *str;
|
||||
|
||||
Jim_GetLong(interp, args[i], &bits);
|
||||
str = buf_to_str(fields[field_count].in_value, bits, 16);
|
||||
str = buf_to_hex_str(fields[field_count].in_value, bits);
|
||||
free(fields[field_count].in_value);
|
||||
|
||||
Jim_ListAppendElement(interp, list, Jim_NewStringObj(interp, str, strlen(str)));
|
||||
|
||||
Reference in New Issue
Block a user