Using ARM DS-5 with custom Fast Model systems

ARM DS-5 Development Studio is a suite of tools for editing, compiling, analyzing, and debugging embedded C/C++ software for the ARM architecture. The DS-5 Debugger can be used with virtual prototypes, hardware emulators, FPGA prototypes, and many different ARM boards using a variety of connection methods. DS-5 connects and communicates with models using the Component Architecture Debug Interface (CADI). DS-5 can connect to any model which supports CADI. As an interface, CADI has a few interesting aspects:

  • CADI is a self-describing API for debugging
  • Architecture independent, it's not ARM specific
  • Attached debuggers do not need any pre-defined information about the target
  • CADI uses synchronous function calls when target stopped
  • CADI also uses asynchronous function calls from models for run control

One of the benefits of using CADI with models is non-intrusive debugging. With simulated hardware it's easy to read and write register and memory content without any simulation. This ensures that the interactive debugging results are the same as running software with no debugger connected. For more information refer to the CADI Developer Guide.

DS-5 comes with a variety of fixed virtual platforms (FVPs) which utilize CADI to debug software. These models are included in DS-5 and their system descriptions are included in the DS-5 configuration database. There is an existing article describing how to import these models into DS-5, but this article expands on how to import new, custom systems and debug software.

ARM silicon partners are constantly working to create unique systems and software using ARM IP. For engineers working on these projects, creating a unique virtual platform based on ARM Fast Models and starting software development as soon as possible is critical.

Fast Models are great for early software development and can get new projects up and running quickly. Fast Models excel at tasks such as:

  • Functional software debugging
  • System configuration and programming
  • Software profiling
  • Architecture compliance
  • Software optimization

DS-5 with custom Fast Model systems

Compared to the FVPs included in DS-5, importing custom Fast Model systems into DS-5 is slightly more work to setup, but once the initial configuration is done DS-5 is very easy to connect and use. This article outlines the process and provides some tips to help import custom Fast Model systems into DS-5 and start running and debugging as quickly as possible.

To demonstrate the process, a system with heterogeneous ARM CPUs running different software will be used. The system has a single Cortex-A53 and a quad-core Cortex-R8. Each has different software and a different memory map.

The diagram from the Fast Models System Canvas is shown below. Each CPU has memory and a PL011 UART attached to it for input and output.

The goal is to import the system into DS-5, create debug configurations, and connect and debug the software. It is possible to focus on only one CPU core, one CPU cluster, or debug all of the CPUs at the same time.

The initial setup is a one-time task per system and consists of four steps:

  • Create a new configuration database
  • Create a new model configuration
  • Import the system description into the configuration database
  • Setup debug configurations for specific connections

New configuration database

The first step in importing a Fast Model system is to create a new DS-5 configuration database. Most users will be starting from the C/C++ perspective. If this is the case, use:

File -> New -> Other and then select Configuration Database under DS-5 Configuration Database.

Another way is to change to the DS-5 Configuration perspective.

Once this perspective is open the menus change context to make it easier so use:

File -> New -> Configuration Database

Enter a database name and click Finish.

Both methods result in a new configuration database used to hold the new system descriptions.

New model configuration

The next step is to create a model configuration for the system. There are a couple of ways to do this.

One is to use File -> New -> Other and then select Model Configuration under DS-5 Configuration Database.

It can also be done by right clicking on the Configuration Database in the Project Explorer and selecting New -> Model Configuration

This invokes the wizard to import the new system.

First, choose the database created in the previous step and click Next.

There are two options to choose from:

The first option, Launch, tells DS-5 to take care of starting the simulation and connect to the simulation when it starts. DS-5 will also take care of terminating the simulator when instructed to disconnect from the target. Everything can be done from within DS-5 when using this option. To make the connection DS-5 passes two arguments to the simulation: --cadi-server and --print-port-number and expects to be able to use the output from the printed port number to make the CADI connection. The specific model can be an executable or a script, but make sure it gets the arguments passed by DS-5.

The second option, Browse, tells DS-5 to look for an already running simulation and just connect. It also means that simulation must be started manually before DS-5 can connect and when DS-5 disconnects the simulator will not be terminated.

Select the method that best fits the desired use case.

For launching a model browse to the executable or script used to start the simulation. If a script is used make sure to pass the command line arguments sent by DS-5. For example, using bash to do some environment setup and run a simulation called system_sim should add $* to the command name.

#!/bin/bash

<do some environment setup>

./system_sim $*

 

  

To use the browse method to connect to a running simulation use the Browse button, select the running simulation and it will appear in the Model field.

When starting simulations manually make sure to use the –S or –cadi-server because Fast Model simulations don’t enable CADI automatically.

Importing the system

Once the system is identified, DS-5 will query the CADI targets in the system and create a new system description in the form of a model.mdf file.

  

The Manufacturer Name will be “Imported” unless it is changed before pushing the Import button. This is helpful to remember as there are hundreds of systems which are sorted by Manufacturer. The Manufacturer can be changed as desired.

Normally, there is nothing to change in the model.mdf file. The other tabs have additional customization such as changing how the simulation is launched or logging CADI communication to a file.

Click the Import button and new system will be added to the database of known systems.

Creating a debug configuration

DS-5 uses debug configurations to manage connections to target systems. The fastest way to get going is to click Debug after the system is imported. This will create a debug configuration with the imported system. There are a number of options. For this example, the first configuration is for bare metal debugging of the quad core Cortex-R8 cluster. Select ARM_Cortex-R8x4 SMP Cluster 1.

  

The Files tab can be used to specify the software to load. It can be from the file system or from a C/C++ project workspace. If the image has already been loaded by the virtual platform, the Load Symbols from file is a good option since there is no need to write the image to target memory.

The Debugger tab can be used to either debug from the image entry point or debug from a symbol such as main. Usually the “Debug from entry point” is the best option for bare metal software development.

Use Apply to save at any time and the Debug button to connect to the target.

If it’s only necessary to debug one core or one cluster DS-5 is now connected and ready to use.

Right click to disconnect as connect as needed keeping in mind the previously described choices of launching the simulation or connecting to an already running simulation.

When DS-5 is restarted all that is needed is to open the Debug perspective and right click the connection and connect.

Multiple connections

Since the example system also includes a Cortex-A53 CPU another debug configuration can be created to connect to it. This time select the Cortex-A53 from the imported system. This enables the ability to set a different software image on the Cortex-A53.

Another tip is to copy the first debug configuration and just change the software image and the CPU to connect to. To copy a debug configuration use Run -> Debug Configurations to open the debug configurations and right click the existing configuration and select “Duplicate”. This will guarantee that everything else is the same.

Now DS-5 can connect to the Cortex-R8 cluster, the Cortex-A53, or both. Of course, if only one of the debug configurations is connected it means the other may not get any software loaded.

The DS-5 debug perspective will show both connections and all DS-5 windows will be linked to the selected CPU context.

Conclusion

DS-5 is an excellent debugger for ARM software development. Because it is capable of connecting to many different target types, it takes a little more setup to import and connect to a custom ARM Fast Model system simulation. Hopefully, this article provided some additional insight about how to quickly import a new system description and get connected. Once the system import has been completed the connection process is a simple two clicks.

The primary benefit of DS-5 is a single, synchronized view of all cores in the system. This makes understanding multi-core systems much more manageable compared to connecting a debugger to each core and trying to manage multiple debug windows. DS-5 also offers powerful scripting, familiar command line prompt, OS and RTOS awareness, and understands exceptions levels and complex breakpoints. If you are debugging software on Fast Models and need more insight into what is happening give DS-5 a try.