Hello,
this patch fix the broken dap component base from the debug logic/processor on
the tms570 cpu.
There are some more components but i dont know if they are all wrong or only
this one. I have append
the dap info output.
There is also a new CoreSight component with id 0x930. This is still missing in
the
"dap_info_command" function.
Anyway, i was able to connect to the cortex-r4 (tms570) with a cortex_a8
configuration. I can read
the registers, halt, step and resume seems to work.
Regards,
Mathias
---
> dap info 1
AP ID register 0x04770002
Type is MEM-AP APB
AP BASE 0x80000000
ROM table in legacy format
MEMTYPE System memory not present. Dedicated debug bus.
ROMTABLE[0x0] = 0x1003
Component base address 0x80001000, start address 0x80001000
Component class is 0x9, CoreSight component
Type is 0x15, Debug Logic, Processor
Peripheral ID[4..0] = hex 04 00 6b bc 14
Part is -*- unrecognized -*-
ROMTABLE[0x4] = 0x2003
Component base address 0x80002000, start address 0x80002000
Component class is 0x9, CoreSight component
Type is 0x13, Trace Source, Processor
Peripheral ID[4..0] = hex 04 00 0b b9 30
Part is -*- unrecognized -*-
ROMTABLE[0x8] = 0x3003
Component base address 0x80003000, start address 0x80003000
Component class is 0x9, CoreSight component
Type is 0x11, Trace Sink, Port
Peripheral ID[4..0] = hex 04 00 1b b9 12
Part is Coresight TPIU (Trace Port Interface Unit)
ROMTABLE[0xc] = 0x4003
Component base address 0x80004000, start address 0x80004000
Component class is 0x9, CoreSight component
Type is 0x04, Debug Control, other
Peripheral ID[4..0] = hex 00 00 09 70 00
Part is Cortex-M3 NVIC (Interrupt Controller)
ROMTABLE[0x10] = 0x0
End of ROM table
>From 6ad5ffe1b89054177a2eb3f9f5d4918d75ca64f7 Mon Sep 17 00:00:00 2001
From: Mathias K. <[email protected]>
Date: Wed, 26 Jan 2011 16:25:13 +0100
Subject: [PATCH 1/1] - fix the broken dap component base from the debug logic
on the tms570 cpu
---
src/target/arm_adi_v5.c | 49 ++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 48 insertions(+), 1 deletions(-)
diff --git a/src/target/arm_adi_v5.c b/src/target/arm_adi_v5.c
index 7b801b9..561823e 100644
--- a/src/target/arm_adi_v5.c
+++ b/src/target/arm_adi_v5.c
@@ -1079,19 +1079,49 @@ int dap_get_debugbase(struct adiv5_dap *dap, int apsel,
return ERROR_OK;
}
+struct broken_romtable {
+ uint32_t dbgbase;
+ uint32_t component_base;
+ uint32_t apid;
+ uint32_t idcode;
+ uint32_t correct_component_base;
+ char *model;
+} broken_romtable[] = {
+ { 0x80000000, 0x80001000, 0x04770002, 0x1b7b302f, 0x08001000,
"TMS570/Debug Logic, Processor" },
+};
+
int dap_lookup_cs_component(struct adiv5_dap *dap, int apsel,
uint32_t dbgbase, uint8_t type, uint32_t *addr)
{
- uint32_t apselold;
+ unsigned int i;
+ uint32_t apselold, apid, idcode;
uint32_t romentry, entry_offset = 0, component_base, devtype;
int retval = ERROR_FAIL;
if (apsel >= 256)
return ERROR_INVALID_ARGUMENTS;
+ /* Excavate the device ID code */
+ struct jtag_tap *tap = dap->jtag_info->tap;
+ while (tap != NULL) {
+ if (tap->hasidcode) {
+ idcode = tap->idcode;
+ break;
+ }
+ tap = tap->next_tap;
+ }
+ if (tap == NULL || !tap->hasidcode)
+ return ERROR_OK;
+
apselold = dap->apsel;
dap_ap_select(dap, apsel);
+ retval = dap_queue_ap_read(dap, AP_REG_IDR, &apid);
+ if (retval != ERROR_OK)
+ return retval;
+
+ retval = ERROR_FAIL;
+
do
{
retval = mem_ap_read_atomic_u32(dap, (dbgbase&0xFFFFF000) |
@@ -1117,6 +1147,23 @@ int dap_lookup_cs_component(struct adiv5_dap *dap, int
apsel,
dap_ap_select(dap, apselold);
+ if ( retval != ERROR_OK )
+ return retval;
+
+ /* Some ROM-Tables are messed up, so fixup if needed. */
+ for (i = 0; i < sizeof(broken_romtable)/sizeof(struct broken_romtable);
i++)
+ if (broken_romtable[i].dbgbase == dbgbase &&
+ broken_romtable[i].component_base == component_base &&
+ broken_romtable[i].apid == apid &&
+ broken_romtable[i].idcode == idcode) {
+ LOG_WARNING("Found broken ROM-Table (%s), trying to
fixup "
+ "Component Base location from 0x%08x to 0x%08x",
+ broken_romtable[i].model, component_base,
+ broken_romtable[i].correct_component_base);
+ *addr = broken_romtable[i].correct_component_base;
+ break;
+ }
+
return retval;
}
--
1.7.3.4
_______________________________________________
Openocd-development mailing list
[email protected]
https://lists.berlios.de/mailman/listinfo/openocd-development