The ARM® Development Studio 5 (DS-5™) Community Edition (CE) has been extended to support the community of ARM Embedded Linux users, and it now works on Apple Mac hosts too! DS-5 Community Edition is available as a free download from ARM, and enables you to create, compile, debug and profile Linux applications quickly and easily, whilst retaining its debug and profiling capabilities for Android™ native application developers too.
In this blog, I'll show how to debug and profile the Open Source "Xaos" fractal rendering application running under Linux on the new BeagleBone Black using DS-5 Debugger, and how to profile the system using the ARM Streamline™ performance analyzer. BeagleBone Black is based on an ARM Cortex®-A8 Sitara AM3359 processor running at 1GHz, with 512MB DDR3 RAM.
Of course, DS-5 Debugger and Streamline can also be used to debug and profile your own Linux or Android applications on other ARM processor-based platforms in a similar way. This blog is not intended to be a detailed tutorial, but just an overview of the main steps needed to debug a Linux application.
To get started, first download DS-5 Community Edition from ARM and install it on your host machine (Windows PC, Linux box, or Apple Mac). On start-up, enter the Activation Code to license DS-5 CE - this will give you access to all the DS-5 CE components. Alternatively, if you already have Eclipse installed, you can download and install the DS-5 Debugger and Streamline plug-ins from the Eclipse Update Site, and on start-up, you'll be prompted to install a DS-5 CE license. In either case, if you want, you can purchase a license upgrade later that enables even more features.
Next, prepare your ARM processor-based Linux target platform. Consult the Getting Started instructions for BeagleBone Black. Other detailed instructions are available elsewhere on how to build a kernel and setup a filesystem for BeagleBone Black "" we chose Ubuntu 12.10. To allow Linux application debug, you'll need to ensure gdbserver is present on the Linux target (apt-get install gdbserver). DS-5 CE comes with Remote System Explorer that allows you to easily copy files between your host PC and the Linux target. To use RSE, the ssh daemon (sshd) must be running on the Linux target. For file transfer, RSE makes use of sftp-server, so that must be present on the Linux target too. To profile your application with Streamline, you must build gatord and gator.ko alongside the kernel in the usual way. To run a graphics-intensive application like Xaos, you may also need to apt-get some graphics libraries such as gtk, cairo, pango, glib.
Next build your application. We used the Open Source "Xaos" fractal rendering application. This is provided within the Examples supplied with DS-5 or can alternatively the sources can be downloaded from SourceForge. For best performance on BeagleBone Black, we built Xaos for hardware floating-point, to match the Ubuntu 12.10 hardware floating-point file system. We also built Xaos multi-threaded, to demonstrate DS-5's support for debug and analysis of multi-threaded apps.
We'll be debugging this Linux application via gdbserver. The simplest way to establish an application debug connection to the BeagleBone Black is to set up a Linux/SSH connection with "Remote System Explorer" (RSE), then create a debug launch configuration that uses that RSE connection.
In the Remote Systems tab, create a New connection. Select "Linux" [Next], enter the IP Address, and name it (e.g. "My BeagleBone Black") [Next], select "ssh.files" [Finish]. When you first try to connect to the target, RSE will ask you to enter the User ID and Password. The Properties for the connection will end-up looking something like:
Following a successful RSE connection, you can drill down into the remote target's file system in Eclipse, and drag'n'drop any needed files from host to target:
To create a debug launch configuration that uses that RSE connection, select Run -> Debug Configurations..., then create a New configuration named, for example, "xaos-gdbserver-example".
In the Connection tab's target tree view, select Linux Application Debug -> Application Debug -> Download and debug application. It will automatically use the RSE connection made earlier by default:
In the Files tab, enter the stripped executable to download, and the location of the unstripped executable containing the debug information to allow debug at source level:
Finally, click on Debug. DS-5 Debugger will download the stripped executable onto the target via RSE, start gdbserver on the target, read the debug information from the unstripped executable, and run to a breakpoint at main(). You can then view the source, run, stop, single-step, set breakpoints, set watchpoints, view registers, view variables, view disassembly, view memory, view symbols, view the stack backtrace for each thread, and so on.
To view the graphical output from Xaos, we didn't have an LCD screen connected to the BeagleBone Black, but could redirect the graphical screen output to the XQuartz X server instead, by setting e.g. "export DISPLAY=[host IP address]:0.0" in the Environment tab of the Debug Configurations dialog:
Streamline is ARM's performance analyzer, for profiling the behaviour of individual applications within whole Linux and Android systems. To analyse the performance of the Xaos application, we simply need to start the application running, then point Streamline at it, to capture analysis data.
In the Streamline tab, first enter the IP address of the target:
Then click on the Capture & Analysis Options button, and add the location of the unstripped executable from which to read debug information, then press Save.
It is also possible here to select the use of ARM's low-cost Energy Probe that can be used to correlate target activity with energy usage on up to three power rails simultaneously.
Then click on the Counter Configurations button, and select the target's hardware counters and kernel's events that you want to track, then press Save.
The list of available counters and events is dependent on the target ARM processor, the kernel in use, and the DS-5 licence in use.
Finally, start the application running and click on the Capture button to start capturing. Streamline's Live View (new in DS-5 v5.14) immediately shows you the data coming from the BeagleBone Black in real time. Once you have captured activity over a sufficient length of time, stop the capture, and Streamline will generate an analysis report, starting with the Timeline:
Here, we can see the workload of each thread within Xaos, together with their interaction with the Linux scheduler and other parts of the system, augmented by Streamline's textual and visual annotation feature. In this example, Streamline is showing an intense period of activity by all five Xaos threads (bottom centre of this view), where the first set of calculations are made before the first Mandelbrot graphics frame is displayed, followed by regular bursts before each subsequent frame.
Clicking on the Functions tab then reveals the contribution of individual functions. Here we can see that calculate() is the function within Xaos that consumes most time:
In the full-featured version with the upgraded license, we could see more detail, for example, which lines in the source code / assembler were taking the most execution time.
To summarize, we have seen how the features of DS-5 Debugger and Streamline make it easy to debug and profile Linux-based systems, and how these can be deployed successfully on latest low-cost development boards such as the BeagleBone Black.
Below is a video that introduces the new features in the ARM DS-5 toolchain version 5.14 including ARM big.LITTLE™ Processing support, improved compiler, multi-core debugger and trace synchronization, power and temperature monitoring and much more...
I didn't happen to see an option for OSX. Assuming you have to add the plugin to an existing Eclipse install for OSX?
Hi Joe, Thanks for trying out DS-5 - I'm glad to hear you were able to build Xaos at least natively on your target.
>When installing the Eclipse plugin instead of the standalone DS-5, I do not see that it includes the Xaos demo.
As shown at http://ds.arm.com/ds-5-community-edition, the DS-5 Examples are not provided as part of the DS-5 plugins from the Eclipse update site (red box on the right), but they are provided as part of the full DS-5 CE installation (green box on the left). So suggest you install the full DS-5 CE version, if only to get hold of the DS-5 Examples. You can even uninstall it afterwards if you don't want to use it. You can find the DS-5 Examples for Linux in ...\DS-5\examples\Linux_examples.zip.
>How can I cross compile the Xaos project on the host before deploying to the BBB?
The DS-5 Linux Examples include Xaos and Gnometris, and a hand-crafted set of makefiles that make use of the Linaro cross-compiler (arm-linux-gnueabihf-gcc) as supplied with DS-5. The makefiles also need access to some Linux headers and libraries, that you can either copy from your target to the host, or download from the DS-5 Downloads page of ARM Development Studio 5 (DS-5) Web Site
>Xming is denying the remote connections.
Try selecting “No access control”. Start the XLaunch wizard from All Programs > Xming > XLaunch. Choose Multiple Windows, "Next >", Start no client, "Next >", check No Access Control, "Next >" and click the Finish button. Use of No Access Control is simple, but insecure. Any machine connected to the same network as your host will be able to open windows on the host.
Hope this helps with your investigations.
Thank your for the prompt reply.
In an attempt to have a more "native" experience with development, I have installed Linux (Mint/Ubuntu) onto my development machine and have started with a "fresh" DS-5 Community Edition full install plus Linux Distribution optional download (DS500-BN-00009-r5p0-15rel1.zip). Things are definitely smoother, so far.
As per the README, I used the Help->Cheat Sheets... trick to import the locally installed examples to my workspace as well as the optional Linux distribution package. A potential gotcha is that you must click the "Click to Perform" or "Click to Begin" link within the "Introduction" section first. Then you must skip the Baremetal things in order to get to the Linux imports. There are two Linux imports, one for the builtin examples and one for the optional distribution package, which you need if you care about things like building the builtin linux examples.
If one wanted to use the default Angstrom distribution of the BBB, it is not immediately clear which "distribution" files you might use in order to successfully compile xaos. Perhaps it would be enough to change the "kernel" folder to the Angstrom distro's kernel source?
In any case, with the default settings and the optional distribution package installed, the first build failed. The Eclipse PATH to /usr/local/DS-5/bin had not been set. We do this via the menu: Window->Preferences->C/C++>Build->Build Variables->Show system variables->PATH. Add /usr/local/DS-5/bin to the top of the list. Apply. OK. Now it builds.
Like a typical embedded engineer, the successful build is my success for today. Tomorrow I shall actually test the build by deploying it. Wish me luck. =)
Hi again Joe,
Glad to hear you're planning to roll-out DS-5 to your team.
You are correct that the Linaro GCC toolchain is not provided as part of the DS-5 plugin from the Eclipse update site, though is provided as part of the full DS-5 CE installation. The DS-5 plugin is intended for folk who want to augment an existing working development environment with DS-5 Debugger and the ARM Streamline performance analyser. It does not include any compiler as it is assumed that you already have one. By contrast, the full DS-5 CE install includes everything you need to get started, including a recent Linaro GCC (v4.7.3 2013.03). Are you able to install that instead?
If not, then you'll need to source your own arm-linux-gnueabihf-gcc and add it into the Eclipse environment. There is a Knowledge Article that describes how to do this:How do I use a custom gcc toolchain with Eclipse?
To import the Linux examples without using the cheat sheets, perform the following steps:
Hope this helps your deployment of DS-5!