15.9.1 Performing custom actions on connect

On some platforms, it might be necessary to configure the system to enable access by a debugger. For example, some platforms have a scan chain controller that controls which devices are visible on the JTAG scan chain.

On other platforms, it might be necessary to power up subsystems by writing control registers. The DTSL configuration provides several hooks that can be overridden to perform such actions.

Each DTSL configuration class is derived from a parent class, usually DTSLv1. The derived class gets all the methods the parent class implements and can replace the methods of the parent class to modify the behavior. When replacing a method, the original implementation can be called by DTSLv1.<method_name>().

postRDDIConnect
This is called immediately after the RDDI interface has been opened. At this point, the RDDI interface has been opened, but no connection to the debug server has been made. This method should be implemented to perform low-level configuration, for example, using the JTAG interface to configure a TAP controller to make debug devices visible on the JTAG scan chain.
1.  class DtslScript(DTSLv1):
2.     '''A top-level configuration class which supports debug and trace'''
3. 
4.   [snip]    
5. 
6.     def postRDDIConnect(self):
7.         DTSLv1.postRDDIConnect(self)
8.         self.jtag_config()
9.
10.    def jtag_config(self):
11.        jtag = self.getJTAG()
12.        pVer = zeros(1, 'i')
13.        jtag.connect(pVer)
14.        try:
15.            jtag.setUseRTCLK(0)
16.            jtag.setJTAGClock(1000000)
17.            # perform target configuration JTAG scans here
18.        finally:
19.            jtag.disconnect()
postDebugConnect
This is called after the RDDI debug interface has been opened. At this point, the RDDI debug interface has been opened, but no connection to any device has been made. This method should be implemented to perform any configuration required to access devices. For example, writes using a DAP to power on other components could be performed here.
1.  class DtslScript(DTSLv1):
2.     '''A top-level configuration class which supports debug and trace'''
3. 
4.   [snip]    
5. 
6.     def postDebugConnect(self):
7.         DTSLv1.postDebugConnect(self)
8.         self.power_config()
9.
10.    def power_config(self):
11.        self.ahb.connect()
12.        # power up cores 
13.        self.ahb.writeMem(0xA0001000, 1) 
14.        self.ahb.disconnect()
postConnect
This is called after the connection and all devices in the managed device list have been opened. This method should be implemented to perform any other configuration that isn't required to be done at an earlier stage, for example, trace pin muxing.
1.  class DtslScript(DTSLv1):
2.     '''A top-level configuration class which supports debug and trace'''
3. 
4.   [snip]    
5. 
6.     def postConnect(self):
7.         DTSLv1.postConnect(self)
8.         self.tpiu_config()
9.
10.    def tpiu_config(self):
11.        # select trace pins
12.        self.ahb.writeMem(0xB0001100, 0xAA)
Non-ConfidentialPDF file icon PDF versionARM DUI0446Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.