Last month I covered the details of using ARM Compiler 6 to compile bare metal software included in Carbon Performance Analysis Kits (CPAKs) for ARMv8 processors such as the Cortex-A53. This time I will outline the flow used to connect ARM DS-5 version 5.19 to debug software. DS-5 is a full set of tools for end-to-end software development for ARM processors and includes the ability to connect to cycle accurate models running in SoC Designer and debug software.
Overview of DS-5 to SoC Designer Connection
Setting up SoC Designer for use with DS-5 involves the following steps:
- Use a DS-5 supplied program called cdbimporter to create a DS-5 configuration database.
- Add the configuration database to the list of systems to which DS-5 can connect.
- Create a DS-5 Debug Configuration which specifies the system to connect to and the software to debug.
- Connect to a SoC Designer simulation using the Debug Configuration to perform software debugging tasks.
This article presents a summary of the flow. The last two steps are common to debugging with eclipse, but the first two steps may be new to eclipse users. There is an application note in the SoC Designer release which provides additional information about cdbimporter. SoC Designer users can look at the file $MAXSIM_HOME/doc/DS5_App_Note.pdf
Generating a DS-5 Configuration Database
The database is created with a DS-5 utility called cdbimporter, which provides a number of useful features to help automate the process such as:
- Query the host machine for running CADI servers
- Identify the simulation of interest
- Identify the cores included in the simulation
- Generate the configuration database
I will use a Cortex-A53 Baremetal CPAK with SoC Designer 7.14.6 for reference.
To set up the DS-5 configuration database start the simulation as specified in the CPAK README file and load the software. Do not start running the simulation.
Run the simulation:
$ sdsim -b A53-cpak.conf -b $MAXSIM_PROTOCOLS/etc/Protocols.conf Systems/A53v8-MP1-CCI400.mxp
Then load the sorts_v8.axf file from the Applications/ directory and go to the shell prompt to run cdbimporter.
Setup the DS-5 shell environment using the path to your DS-5 installation:
$ /o/tools/linux/ARM/DS5_5.19/64bit/bin/suite_exec_ac6 bash
Now cdbimporter should be in the PATH and ready to run.
The output from cdbimporter is a directory containing the DS-5 configuration database which will be used in the next step.
Add the Configuration Database to DS-5
The next step is to make DS-5 aware of the new configuration database. Start by launching eclipse and set the workspace directory.
Import the database generated by cdbimporter as follows:
Open the Preferences page from the menu: Windows -> Preferences.
From the Preferences popup, select DS-5-> Configuration Database -> Add. The Add configuration database location dialog opens:
Use the Browse button to navigate to the directory which contains the configuration database created in the first step.
Use the Name field to name this database for later identification in the Preferences (it can also be left blank).
Click OK to close the Add configuration database location dialog.
Click OK again to close the Preference window. You will see a dialog box indicating it is adding the new database.
The configuration database is now included in the DS-5 list of target systems.
Create a DS-5 Debug Configuration
The next step is to create a DS-5 Debug Configuration that creates the connection to the system to be debugged.
Start the DS-5 debug perspective as follows:
From the top menu, select Windows -> open perspective -> DS5 Debug.
From the top menu, select Run > Debug Configurations… (or right-click from the upper left “Debug Control” view and select debug configurations -> DS-5 Debugger).
From the “Debug Configurations” pop up, right-click on DS5-Debugger and select New.
On the Connection tab, close default groups, then scroll down and select the imported system; e.g., Carbon > A53-MP1-CCI400.mxp > Bare Metal Debug > Debug Cortex-A53_0
On the Files tab select the .axf file of the application, in this case sorts_v8.axf.
Load symbols from file assumes you already loaded the application to debug from SoC Designer. To load the application from DS-5 instead, enter the name in the Application on host to download box and the application will be written to memory when the debugger connects.
On the Debugger tab, in the Run Control panel, select "Connect only."
Connect DS-5 to a SoC Designer Simulation and Debug Software
The final step is to launch the Debugger Configuration and connect to the SoC Designer simulation. You can do this immediately using the Debug button on the lower right of the Debug Configurations dialog.
You can also use the Debug Control tab by right-clicking on the connection and selecting “Connect to Target” from the context menu (shown below).
After the debugger is connected the status is shown as “connected”:
After connection, DS-5 can be used to debug the software running on the SoC Designer simulation.
Simulation on Another Machine or Port
If multiple simulations are starting and stopping there is a chance the port number the simulator is using is different than it was when the configuration database was created. The first simulation is normally port 7000, then the next is 7001. The numbers will recycle as simulations start and stop. It’s not necessary to start from scratch and create a new configuration database. There is an environment variable that is the easiest way to adjust to a new port number:
For bash I use:
$ export CADI_TARGET_MACHINE=localhost:7001
This environment variable can also be used to connect to a simulator on another machine by using the name or IP address of the machine which has the running simulation.
This summary covered the steps to connect DS-5 to SoC Designer. DS-5 is the best debugger to handle bare metal software for the AARCH64 state compiled with ARM Compiler 6 and DWARF4 debug information. Make sure to review the application note provided with each SoC Designer release for the latest information.