Line 149... |
Line 149... |
name = name_not_found;
|
name = name_not_found;
|
} else {
|
} else {
|
name = name_not_found;
|
name = name_not_found;
|
irlen = -1;
|
irlen = -1;
|
}
|
}
|
printf("%d: \t%s \t0x%08lX \t%d\n", i, name, idcodes[i], irlen);
|
printf("%d: \t%s \t0x%08X \t%d\n", i, name, idcodes[i], irlen);
|
}
|
}
|
printf("\n");
|
printf("\n");
|
|
|
|
#ifdef __LEGACY__
|
|
// The legacy debug interface cannot support multi-device chains. If there is more than
|
|
// one device on this chain, pull the cord.
|
|
if(num_devices > 1) {
|
|
fprintf(stderr, "\n*** ERROR: The legacy debug hardware cannot support JTAG chains with\n");
|
|
fprintf(stderr, "*** more than one device. Reconnect the JTAG cable to ONLY the legacy\n");
|
|
fprintf(stderr, "*** debug unit, or change your SoC to use the Advanced Debug Unit.\n");
|
|
exit(0);
|
|
}
|
|
#endif
|
|
|
|
|
if(target_dev_pos >= num_devices) {
|
if(target_dev_pos >= num_devices) {
|
printf("ERROR: Requested target device (%i) beyond highest device index (%i).\n", target_dev_pos, num_devices-1);
|
printf("ERROR: Requested target device (%i) beyond highest device index (%i).\n", target_dev_pos, num_devices-1);
|
exit(1);
|
exit(1);
|
} else {
|
} else {
|
printf("Target device %i, JTAG ID = 0x%08lx\n", target_dev_pos, idcodes[target_dev_pos]);
|
printf("Target device %i, JTAG ID = 0x%08x\n", target_dev_pos, idcodes[target_dev_pos]);
|
}
|
}
|
|
|
manuf_id = (idcodes[target_dev_pos] >> 1) & 0x7FF;
|
manuf_id = (idcodes[target_dev_pos] >> 1) & 0x7FF;
|
|
|
// Use BSDL files to determine prefix bits, postfix bits, debug command, IR length
|
// Use BSDL files to determine prefix bits, postfix bits, debug command, IR length
|
Line 232... |
Line 244... |
}
|
}
|
|
|
if(id_read == idcodes[target_dev_pos]) {
|
if(id_read == idcodes[target_dev_pos]) {
|
printf("IDCODE sanity test passed, chain OK!\n");
|
printf("IDCODE sanity test passed, chain OK!\n");
|
} else {
|
} else {
|
printf("Warning: IDCODE sanity test failed. Read IDCODE 0x%08lX, expected 0x%08lX\n", id_read, idcodes[target_dev_pos]);
|
printf("Warning: IDCODE sanity test failed. Read IDCODE 0x%08X, expected 0x%08X\n", id_read, idcodes[target_dev_pos]);
|
}
|
}
|
}
|
}
|
|
|
if(err |= tap_enable_debug_module()) { // Select the debug unit in the TAP.
|
if(err |= tap_enable_debug_module()) { // Select the debug unit in the TAP.
|
printf("Error %s enabling debug module, aborting.\n", get_err_string(err));
|
printf("Error %s enabling debug module, aborting.\n", get_err_string(err));
|
Line 245... |
Line 257... |
}
|
}
|
|
|
|
|
void print_usage(char *func)
|
void print_usage(char *func)
|
{
|
{
|
printf("JTAG connection between GDB and the Advanced Debug Interface.\n");
|
printf("JTAG connection between GDB and the SoC debug interface.\n");
|
|
#ifdef __LEGACY__
|
|
printf("Compiled with support for the Legacy debug unit (debug_if).\n");
|
|
#else
|
|
printf("Compiled with support for the Advanced Debug Interface (adv_dbg_if).\n");
|
|
#endif
|
printf("Copyright (C) 2008 Nathan Yawn, nathan.yawn@opencores.org\n\n");
|
printf("Copyright (C) 2008 Nathan Yawn, nathan.yawn@opencores.org\n\n");
|
printf("Usage: %s (options) [cable] (cable options)\n", func);
|
printf("Usage: %s (options) [cable] (cable options)\n", func);
|
printf("Options:\n");
|
printf("Options:\n");
|
printf("\t-g [port] : port number for GDB (default: 9999)\n");
|
printf("\t-g [port] : port number for GDB (default: 9999)\n");
|
printf("\t-x [index] : Position of the target device in the scan chain\n");
|
printf("\t-x [index] : Position of the target device in the scan chain\n");
|
Line 483... |
Line 500... |
}
|
}
|
retval = cmd_line_cmd_debug;
|
retval = cmd_line_cmd_debug;
|
}
|
}
|
|
|
if(retval == TAP_CMD_INVALID) {
|
if(retval == TAP_CMD_INVALID) {
|
printf("ERROR! Unable to find DEBUG command for device index %i, device ID 0x%0lX\n", devidx, idcodes[devidx]);
|
printf("ERROR! Unable to find DEBUG command for device index %i, device ID 0x%0X\n", devidx, idcodes[devidx]);
|
}
|
}
|
|
|
return retval;
|
return retval;
|
}
|
}
|
|
|