Tracing using DS-5 Debugger from the Command Line
Sometimes it's useful to be able to drive DS-5 Debugger from the command line. If you are automating tests or carrying out repetitive tasks, this can help to save significant time. In this tutorial we're going to show you how to capture trace in this way.
Trace Configuration in DS-5
The first thing you need to do is make sure that you can capture trace using the graphical debugger. Open up Arm DS-5 Development Studio, switch to the DS-5 Debug perspective and open up the Debug Configuration for the device you are going to capture trace from.
Choose a connection type that enables trace. Some connections provide DTSL options to configure the trace capture. If this is the case with your connection, you should review them by clicking Edit...
Take a note of the specified class, in this case Cortex_R5_0_ETB. This is a clue to where the DTSL file is located, which you'll need later on.
What is DTSL?
DS-5 abstracts away a lot of the low-level complexity of connecting to a target by using Debug and Trace Services Layer (DTSL) scripts. For most off-the-shelf devices, you don't need to make any changes to these scripts. If you're developing a custom SoC, you can edit the DTSL script to match the configuration of the trace elements in your design.
DS-5 Command Prompt
Connecting to your Device
The component features of DS-5 can be run from the DS-5 Command Prompt. Open it up and then type debugger without any arguments to launch the help menu.
Specify a connection using
--cdb-entry, followed by the details of the connection, which will take the format of "manufacturer::board::project type::debug operation::debug of specific core::debug hardware".
If you're unsure about this, just type
--cdb-entry with no options, which will display the list of devices in the database.
Once you have connected successfully, the debugger command prompt will appear. Type quit to exit.
Adding DTSL Options
The DTSL options which are needed to configure trace are stored in a file with a .dtslprops extension. In our case, that file is located at: C:\Documents\DS-5 Workspace\.metadata\.plugins\com.arm.ds\DTSL\ARM+Development+Boards+-+Versatile+Express+R5x2\Cortex-R5\Cortex_R5_0_ETB\default.dtslprops.
Copy the path and then pass it to the debugger:
--cdb-entry-param="dtsl_options_file=C:\Documents\DS-5 Workspace\.metadata\.plugins\com.arm.ds\DTSL\ARM+Development+Boards+-+Versatile+Express+R5x2\Cortex-R5\Cortex_R5_0_ETB\default.dtslprops", replacing the file location with your own.
To specify which DSTREAM to connect to, enter:
--cdb-entry-param "Connection=x" where x takes host name of the DSTREAM.
Here is a full command line showing connection to a target, confirming that the DTSL options are set:
Scripting the Debugger
To automate the debugger in order to capture trace, you need to write a script for it to follow. The easiest way to do this is to start a debug session in the graphical debugger and carry out all the actions that you want to automate. These can then be exported directly from the Commands view.
Note that you will need to manually add the
trace start and
trace stop commands as DS-5 Debugger doesn't automatically echo them to the Commands view.
Here's an example of a debugger script, which loads an image, enables trace, runs to a symbol called "end", stops trace and then dumps the decoded trace to a text file:
show dtsl-options loadfile image.axf start wait trace start advance end wait trace stop trace report FILE=report.txt quit
For more information on the
trace report and
trace dump commands, read the DS-5 documentation.
This should be everything you need to start capturing trace from the command line in DS-5. You can now automate your testing!