Arm Community
Arm Community
  • Site
  • User
  • Site
  • Search
  • User
  • Groups
    • Research Collaboration and Enablement
    • DesignStart
    • Education Hub
    • Innovation
    • Open Source Software and Platforms
  • Forums
    • AI and ML forum
    • Architectures and Processors forum
    • Arm Development Platforms forum
    • Arm Development Studio forum
    • Arm Virtual Hardware forum
    • Automotive forum
    • Compilers and Libraries forum
    • Graphics, Gaming, and VR forum
    • High Performance Computing (HPC) forum
    • Infrastructure Solutions forum
    • Internet of Things (IoT) forum
    • Keil forum
    • Morello Forum
    • Operating Systems forum
    • SoC Design and Simulation forum
    • 中文社区论区
  • Blogs
    • AI and ML blog
    • Announcements
    • Architectures and Processors blog
    • Automotive blog
    • Graphics, Gaming, and VR blog
    • High Performance Computing (HPC) blog
    • Infrastructure Solutions blog
    • Innovation blog
    • Internet of Things (IoT) blog
    • Operating Systems blog
    • Research Articles
    • SoC Design and Simulation blog
    • Tools, Software and IDEs blog
    • 中文社区博客
  • Support
    • Arm Support Services
    • Documentation
    • Downloads
    • Training
    • Arm Approved program
    • Arm Design Reviews
  • Community Help
  • More
  • Cancel
Arm Community blogs
Arm Community blogs
Tools, Software and IDEs blog Playing with DS-5 CE and BeagleBone Black
  • Blogs
  • Mentions
  • Sub-Groups
  • Tags
  • Jump...
  • Cancel
More blogs in Arm Community blogs
  • AI and ML blog

  • Announcements

  • Architectures and Processors blog

  • Automotive blog

  • Embedded blog

  • Graphics, Gaming, and VR blog

  • High Performance Computing (HPC) blog

  • Infrastructure Solutions blog

  • Internet of Things (IoT) blog

  • Operating Systems blog

  • SoC Design and Simulation blog

  • Tools, Software and IDEs blog

Tags
  • Tool
  • texas_instruments
  • development_tool_software
  • ds-5
  • Trace
  • Cortex-A
  • Cortex-A8
  • debug
  • Linux
Actions
  • RSS
  • More
  • Cancel
Related blog posts
Related forum threads

Playing with DS-5 CE and BeagleBone Black

Stephen Theobald
Stephen Theobald
September 11, 2013
7 minute read time.

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.

  
DS-5 Community Edition running on Apple MacBook, connected to BeagleBone Black



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.


BeagleBone Black, close-up


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.

Setting Up

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.

Debugging the Linux Application

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:

4-ConnectTab_updated.png

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:

5-FilesTab_updated.png

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.

6-Debug.png
(click to enlarge)


  
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:

Profiling the Linux Application

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:

10-Timeline.png
(click to enlarge)

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...

Anonymous
  • Stephen Theobald
    Offline Stephen Theobald over 9 years ago

    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: 

    • Launch Eclipse for DS-5
    • Close the Welcome screen, if it appears
    • Go to 'Project' menu and ensure that 'Build automatically' is NOT ticked.
    • Go to 'File' menu and select 'Import...'. The Import wizard opens.
    • Open the 'General' folder
    • Select 'Existing Projects into Workspace'
    • Press 'Next'
    • Select 'Select archive file', then press 'Browse...' next to it. A file dialog opens.
    • Navigate to the directory where the example zips are located.
      For a default install on Windows, this is C:\Program Files\DS-5\examples
    • Select Linux_examples.zip, then press 'OK'
      The 'Projects:' field populates with all of the projects found in that folder.
    • Press 'Finish'. The 'Project' view populates with all of the projects.


    Hope this helps your deployment of DS-5!

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Joseph Gorse
    Offline Joseph Gorse over 9 years ago
    Stephen,

    Thanks for all the help so far. My hello worlds and the xaos apps compile fine, now it's time to lock down the development environments and platform for the team.

    I saw that you mentioned OS X is now supported for DS-5. I downloaded the latest Eclipse CDT, installed the DS-5 plugin via the ARM url, but cannot compile anything. I have looked around a little bit, but it appears that the plugin does not install any sort of Linaro GCC (specifically, arm-linux-gnueabihf). I assume this means I have to source my own arm-linux-gnueabihf-gcc and get it into the Eclipse path for things to work, right? #1

    Also, is there any good documentation about getting that DS-5 Eclipse plugin bootstrapped to the point of compiling code (such as importing the Linux examples without cheat sheets, how to extract the cheat sheets from the DS-5 full installers, compiler setup)?

    EDIT: #1 I found an older Linaro for OS X here which seems to get the DS-5 plugin to the next step:
    http://trismer.com/downloads/arm-linux-gnueabihf-osx-2012-08-28.tar.gz

    Cheers,
    Joe
    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Stephen Theobald
    Offline Stephen Theobald over 9 years ago
    Hi again Joe,

    Hope you are still having fun playing with DS-5 CE and BeagleBone Black.


        >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?

        Building Xaos does not depend on the kernel sources, but does depend on the filesystem. 

        Taking a look inside the makefile, you'll see we've configured this Xaos build to use the GTK driver, so the GTK-related graphics libraries such as gtk-x11-2.0, gio-2.0, gdk-x11-2.0, cairo, ... need to be present on your host machine and in the target's filesystem, and the corresponding header (include) files need to be present on the host.  Alternatively, you could experiment with building using one of the other graphics drivers supported by Xaos. 

        In addition, Xaos can be built as hard-float ABI or full software floating point ABI (see the FLOAT switch in the makefile), to match your BBB filesystem.

        Hope this helps you to make some further progress.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Joseph Gorse
    Offline Joseph Gorse over 9 years ago

    Stephen,

    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. =)

    Cheers,

    Joe

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
  • Stephen Theobald
    Offline Stephen Theobald over 9 years ago

    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.

    • Cancel
    • Up 0 Down
    • Reply
    • More
    • Cancel
>
Tools, Software and IDEs blog
  • Product update: Arm Development Studio 2022.2 now available

    Ronan Synnott
    Ronan Synnott
    Arm Development Studio 2022.2 is now available, providing support for PSA-ADAC authenticated debug.
    • December 7, 2022
  • Product update: Arm Development Studio 2022.1 now available

    Ronan Synnott
    Ronan Synnott
    Arm Development Studio 2022.1 (and 2022.b) is now available.
    • July 25, 2022
  • Arm Compiler for Linux: what is new in the 22.0 release?

    Ashok Bhat
    Ashok Bhat
    Arm Compiler for Linux 22.0 is now available with performance improvements and support for new hardware like AWS Graviton 3.
    • May 27, 2022