In this patch, I introduce the use of -variant parameter, so I can adjust the
debug_base accordingly.

So far, only the OMAP3530 and AM/DM37x CPUs, which utilize the Cortex A8 core
are supported by OpenOCD and both of these use the same Cortex A8 Debug Access
Port address (0x54011000).

There are other CPU manufacturers, who use different address for the Cortex A8
Debug Access Port though. As I was unable to figure out a way to detect the
address of DAP, this should at least work around the problem until there is a
proper solution.

Signed-off-by: Marek Vasut <marek.va...@gmail.com>
---
 src/target/cortex_a8.c  |   11 ++++++++++-
 tcl/target/amdm37x.cfg  |    3 ++-
 tcl/target/omap3530.cfg |    3 ++-
 3 files changed, 14 insertions(+), 3 deletions(-)

diff --git a/src/target/cortex_a8.c b/src/target/cortex_a8.c
index 8b4ced5..64b78bd 100644
--- a/src/target/cortex_a8.c
+++ b/src/target/cortex_a8.c
@@ -1719,7 +1719,16 @@ static int cortex_a8_examine_first(struct target *target)
        LOG_DEBUG("TODO - autoconfigure");
 
        /* Here we shall insert a proper ROM Table scan */
-       armv7a->debug_base = OMAP3530_DEBUG_BASE;
+       if (strcmp(target->variant, "amdm37x") == 0)
+               armv7a->debug_base = OMAP3530_DEBUG_BASE;
+       else if (strcmp(target->variant, "omap3530") == 0)
+               armv7a->debug_base = OMAP3530_DEBUG_BASE;
+       else {
+               LOG_DEBUG("Unknown CPU variant");
+               return ERROR_FAIL;
+       }
+
+       LOG_DEBUG("Using Cortex A8, %s variant", target->variant);
 
        /* We do one extra read to ensure DAP is configured,
         * we call ahbap_debugport_init(swjdp) instead
diff --git a/tcl/target/amdm37x.cfg b/tcl/target/amdm37x.cfg
index ab18681..3776435 100644
--- a/tcl/target/amdm37x.cfg
+++ b/tcl/target/amdm37x.cfg
@@ -142,7 +142,8 @@ jtag configure $_CHIPNAME.jrc -event setup "jtag tapenable 
$_CHIPNAME.dap"
 
 # Create the CPU target to be used with GDB:  Cortex-A8, using DAP
 set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap
+target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap \
+       -variant amdm37x
 
 # The DM37x has 64K of SRAM starting at address 0x4020_0000.  Allow the first
 # 16K to be used as a scratchpad for OpenOCD.
diff --git a/tcl/target/omap3530.cfg b/tcl/target/omap3530.cfg
index ba130a9..e7b598f 100644
--- a/tcl/target/omap3530.cfg
+++ b/tcl/target/omap3530.cfg
@@ -36,7 +36,8 @@ jtag newtap $_CHIPNAME jrc -irlen 6 -ircapture 0x1 -irmask 
0x3f \
 
 # GDB target:  Cortex-A8, using DAP
 set _TARGETNAME $_CHIPNAME.cpu
-target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap
+target create $_TARGETNAME cortex_a8 -chain-position $_CHIPNAME.dap \
+       -variant omap3530
 
 # SRAM: 64K at 0x4020.0000; use the first 16K
 $_TARGETNAME configure -work-area-phys 0x40200000 -work-area-size 0x4000
-- 
1.7.1

_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to