Dynamically choose between DAP_M3 and DAP_DebugSS
authorBrad Griffis <bgriffis@ti.com>
Thu, 14 Mar 2019 20:08:56 +0000 (15:08 -0500)
committerBrad Griffis <bgriffis@ti.com>
Thu, 14 Mar 2019 20:08:56 +0000 (15:08 -0500)
am335x-ctt.dss

index 89d3794a1aca8ffb51841f340caaf995252a4846..33b75b629644e346eb7d6e8116c3f0e1602fe6ec 100644 (file)
@@ -229,9 +229,21 @@ var ctt_registers = [
        0x44e01204,
        0x44e10040];
 
+// Try CS_DAP_M3 first
 debugSessionDAP = ds.openSession("*","CS_DAP_M3");
 debugSessionDAP.target.connect();
 
+// Do a test read of Device_ID register at 0x44e10600
+value = debugSessionDAP.memory.readWord(0,0x44e10600,false);
+
+// If it is zero, switch to CS_DAP_DebugSS
+if (value == 0)
+{
+       debugSessionDAP.target.disconnect();
+       debugSessionDAP = ds.openSession("*","CS_DAP_DebugSS");
+       debugSessionDAP.target.connect();
+}
+
 //Build a filename that includes date/time
 var today = new Date();
 var year4digit = today.getFullYear();