How do I add pre-connect JTAG scans to enable target connection?
Information in this article applies to:
DS-5 Development Studio
How do I add custom pre-connect JTAG scans to a target to let DS-5 to connect to it?
When using auto-detect in the Platform Configuration Editor (PCE), Arm devices are not found. The PCE reports UNKNOWN devices because the JTAG scan chain needs to have custom pre-connect JTAG scans added.
DS-5 allows pre-connect JTAG scans to be sent from the DSTREAM debug and trace unit to the target. These JTAG scans are specified under the Python script tab in the PCE.
To allow DS-5 to see the complete topology, send the correct JTAG sequence to the device to unlock the UNKNOWN component. To access the system, you need information such as the target topology and the JTAG sequence that unlocks the debug scan chain.
Add a Debug Access Port (DAP) by working through the steps in the following order:
In the PCE, right-click on "Devices" and then right-click on the "Toggle Devices Panel". Another window opens that lets you drag and drop components into the platform configuration.
Find an ARMCS-DP (a CoreSight Debug Access Port, DAP) under DebugPort and drag it across to the platform. In the same window, recreate what the platform will look like when it is detected correctly. So, if UNKNOWN_6 is detected on the target, but the correctly detected platform has an UNKNOWN_6 followed by a DAP, the initial scan will look as follows:
Add the unlocking script under the Python script tab. The unlocking script needs to be written in Python and the script is executed on the DSTREAM debug and trace unit. Here is an example script:
from LDDI import * from rvi import * myTapConfigured = False MYTAP_IDCODE = [ 0x06 ] MYTAP_CFG_CONNECT = [ 0x3E ] CFG_DATA = [ -49 ] def HandleOpenConn(DevID,type,state): if type==1: unlockMYTAP() return handleOpenConn(DevID,type,state) def unlockMYTAP(): global myTapConfigured if myTapConfigured: return JTAG_Connect() JTAG_nTRST(1) sleep(100) JTAG_nTRST(0) JTAG_ConfigScanChain(0, 0, 0, 0) MYTAP_IDCODE = [ 0x06 ] MYTAP_CFG_CONNECT = [ 0x3E ] CFG_DATA = [ 0xCF ] JTAG_ScanIO(RDDI_JTAGS_IR, 6, MYTAP_IDCODE, None, RDDI_JTAGS_PIR, 1) rData = [ 0x00 ] JTAG_ScanIO(RDDI_JTAGS_DR, 32, None, rData, RDDI_JTAGS_RTI, 1) JTAG_ScanIO(RDDI_JTAGS_IR, 6, MYTAP_CFG_CONNECT, None, RDDI_JTAGS_PIR, 1) JTAG_ScanIO(RDDI_JTAGS_DR, 8, CFG_DATA, None, RDDI_JTAGS_RTI, 1) JTAG_Disconnect() myTapConfigured = True
The function HandleOpenConn() is the default function that is called when DS-5 tries to connect to the target. A version of this function needs to be included in the script, so that the script gets called. See the preceding example script.
The function JTAG_ScanIO() is defined in <path_to_ds5_install>\sw\debugger\RDDI\include\rddi_jtag.h. The JTAG_ScanIO() function allows combined instruction register (IR) operations and data register (DR) operations. The IR is used to add instructions to perform an operation and the DR is used to exchange data with the device. The header file, rddi_jtag.h, defines other JTAG operations that are available, including just IR or just DR scans.
The Python script is added to the Python script tab. The script is included in the sdf file that is created at the end of the process. As a result, the script is available outside DS-5, for example, using a Remote Debug Device Interface (RDDI) connection. In order to debug the Python script, you can include "print" statements within the Python code and these statements will be output to the logging server within the DSTREAM debug and trace unit. To view these logs you can use the "dbghw_log_client" tool as described here.
The following example uses the print function to read and print the IDCODEs:
def readIDCODE(IRData, IRLen, DRLen): JTAG_ScanIO(RDDI_JTAGS_IR, IRLen, IRData, None, RDDI_JTAGS_PIR, 1)
rData = [ 0x00 ]
JTAG_ScanIO(RDDI_JTAGS_DR, DRLen, None, rData, RDDI_JTAGS_PDR, 1)
print "Read value: %d" % (rData)
Because we have added the print statement, the code in the preceding example generates the following output in the dbghw_log_client:
serverd info (05:23:09.982): Handle RV MSG open conn dev 2
serverd info (05:23:09.985): Handle RV MSG open conn PRE dev 2
serverd info (05:23:10.106): Read value: 0
serverd info (05:23:10.109): Handle RV MSG open conn dev 2
Under the Probe Configuration tab, set AllowICETAPReset, and TResetOnInitConnect to 0-False.
Select the probe address. This is the address for the probe which is used under the Autodetect tab. Now you have set up the system.
In the left-hand window, right-click on the component "ARMCS-DP" and select Enumerate APs. if this is successful, the Access Ports appear under the DAP. Now, right-click on "ARMCS-DP" again and select "Read CoreSight ROM tables" to fill in all the remaining components.
You can make more edits to the configuration from the Platform Configuration Editor (PCE) . Links that have not been detected by autodetect can be added in the Component Connections tab . When you have made all the edits, you can build the configuration. Under the Project Explorer tab, right-click on the sdf file and click "build". Save the sdf file. There will now be a new configuration available in Debug Configurations.