15.9.2 Overriding device reset behavior

For a DSTREAM class device, the default operation for a System Reset request is to drive nSRST on the JTAG connector. On some platforms, this pin is not present on the JTAG connector. So, some other method must be used to perform the reset.

Sometimes, the reset is performed by writing to another system component, such as a System Reset Controller device. If this is not available, another approach is to cause a system watchdog timeout, which in turn causes a system reset. Whichever approach is taken, the default reset behavior must be modified. To override the default reset behavior, the resetTarget method can be overridden to perform the necessary actions.

The following code sequence is an example of this:

1. from com.arm.debug.dtsl.components import ConnectableDevice
2. [snip]
3. 
4.  class DtslScript(DTSLv1):
5.     '''A top-level configuration class which supports debug and trace'''
6. 
7.   [snip]    
8. 
9.      def setupPinMUXForTrace(self):
10.         '''Sets up the IO Pin MUX to select 4 bit TPIU trace'''
11.         addrDBGMCU_CR = 0xE0042004
12.         value = self.readMem(addrDBGMCU_CR)
13.         value |=  0xE0 # TRACE_MODE=11 (4 bit port), TRACE_IOEN=1
14.         self.writeMem(addrDBGMCU_CR, value)
15.
16.     def enableSystemTrace(self):
17.         '''Sets up the system to enable trace
18.            For a Cortex-M3 system we must make sure that the
19.            TRCENA bit (24) in the DEMCR registers is set.
20.            NOTE: This bit is normally set by the DSTREAM Cortex-M3
21.                  template - but we set it ourselves here in case
22.                  no one connects to the Cortex-M3 device.
23.         '''
24.         addrDEMCR = 0xE000EDFC
25.         bitTRCENA = 0x01000000
26.         value = self.readMem(addrDEMCR)
27.         value |= bitTRCENA
28.         self.writeMem(addrDEMCR, value)
29.
30.     def postReset(self):
31.         '''Makes sure the debug configuration is re-instated
32.            following a reset event
33.         '''
34.         if self.getOptionValue("options.traceBuffer.traceCaptureDevice") == "DSTREAM":
35.             self.setupPinMUXForTrace()
36.         self.enableSystemTrace()
37. 
38.     def resetTarget(self, resetType, targetDevice):
39.         # perform the reset
40.         DTSLv1.resetTarget(self, resetType, targetDevice)
41.         # perform the post-reset actions
42.         Self.postReset()

Line 38 declares the resetTarget method. This calls the normal reset method to perform the reset and then calls the custom postReset method to perform the actions required after a reset.

The implementation of resetTarget in DTSLv1 is to call the systemReset method of the targetDevice.

Non-ConfidentialPDF file icon PDF versionARM DUI0446Z
Copyright © 2010-2016 ARM Limited or its affiliates. All rights reserved.