The PandaBoard is a compact mobile platform built around the Texas Instruments OMAP 4430 processor. With a dual-core Cortex-A9 processor at its heart, it is ideal for running ARM-Linux, and has good connectivity.
In this article we will go through the steps required to setup Linux on the PandaBoard using files supplied from Linaro and also the further steps required to setup Linux for use with Development Studio 5 (DS-5) and the Streamline Profiler. This article has been written with PandaBoard as an example but the configuration steps detailed here for DS-5 can be used for any platforms supported by Linaro releases. Linaro images are also pre configured for profiling and tracing in general, so the additional kernel configuration steps can be skipped for Linaro images. Following the Linux setup, we will demonstrate how to debug and profile applications running on ARM Linux using DS-5.
1. Setting up Linux
The task of reliably setting up a complete Linux system from scratch can sometimes be a frustrating one. Linaro provides Linux images for several popular development boards based on the ARM architecture, including the PandaBoard. The following sections describe how to use a minimal (called “nano”) build from the 11.05 Linaro release (most recent at the time of writing) to setup ARM Linux on the PandaBoard. The image and hardware pack used below are examples and shall be replaced with images and hardware packs appropriate for your target. Hardware packs are the Linaro way of distributing the hardware-specific packages needed to make an image (such as the nano or ALIP image) work on a particular board without including them in the image itself
What You Will Need
To setup Linux on the PandaBoard using the process described here you will need:
- A host computer running Ubuntu 11.04 or above with sudo rights.
- An SD card of at least 2GB, for the Linaro nano filesystem (though you will want at least 4GB for larger filesystems (like Ubuntu LEB) and a card reader that can be connected to your host computer
- An installation of DS-5 and a PandaBoard! DS-5 is supported on a wide range of x86 platforms running Windows or Linux.
Prepare Your SD card
Firstly, insert the SD card into your card reader. Then you will need to determine the device node name – most likely it will be /dev/mmcblk0 or /dev/sdb. To find out, you can issue the following commands:
Host $ mount | grep /media $ sudo fdisk -l
Re-trying the above commands with and without the SD card inserted will indicate its device node.
Once you have determined the device node of your SD card you will then need to unmount the device. To do this, enter the following command:
Host $ sudo umount /media/*
From here on the device node for the SD card will be assumed to be /dev/sdx – please replace this with the device node for your own card.
Before we write any images, we’ll need the Linaro image tools. We can use apt-get to get these.
Host $ sudo add-apt-repository ppa:linaro-maintainers/tools $ sudo apt-get install linaro-image-tools
The latest Linaro nano ARM Linux images are stored at http://releases.lina...o-n/nano/latest
Next, pull the latest image and hardware pack from this location using wget below.
Host $ wget http://releases.linaro.org/platform/linaro-n/nano/latest/nano-n-tar-20110628-1.tar.gz $ wget http://releases.linaro.org/platform/linaro-n/nano/latest/hwpack_linaro-panda_20110629-1_armel_supported.tar.gz
If you want to use the Ubuntu image, then you can get it from: http://releases.lina...-desktop/final/
After we have downloaded the image and hardware pack, enter the line below to extract the image to the SD card. You will need to execute this as a sudo user. Also, remember to replace sdx with the name of your SD card node.
Host $ sudo linaro-media-create --rootfs ext3 --mmc/dev/sdx --binary nano-n-tar-20110628-1.tar.gz --hwpack hwpack_linaro-panda_20110629-1_armel_supported.tar.gz --dev panda
This will take some time so it might be time for a well earned break and go and make your preferred beverage at this point!
After this step is complete your SD card will contain 2 partitions. The first partition contains a FAT32 boot partition containing the boot loader and kernel. The second is an ext3 partition containing the extracted file system.
You are now ready to boot up the board.
Power off the PandaBoard, place the SD card into its SD card slot and connect the Ethernet port to a DHCP enabled network. So that you can see the board booting and access the console you will also need to setup a serial port connection from your host to the target. The port parameters are 115200bps, 8 Data bits, 1 stop bit, with no parity or flow control.
Switch the board on and after booting you should be greeted with a Linux shell prompt!
Setting up the Target for DS-5 Debug and Profiling.
To enable DS-5 debug support and streamline profiling we will need to install a few things onto the target, including:
- gdbserver: required to allow DS-5 to connect to target for remote application debug.
- openssh-server: We’ll use this to allow easy file transfer between host and target later.
- gator.ko: This module is required for Streamline profiling
- gatord: This is the gator-daemon. Again, required for Streamline profiling.
All of these can be obtained using apt-get. Before doing this, we’ll need to add the following line to the end of the /etc/apt/sources.list file.
deb http://ppa.launchpad.../arm-ds5/ubuntu natty main
Following this, to get all the required packages on the target, enter the following using your serial console connection to the PandaBoard. Please observe the reserve apostrophes in the command line below.
Target # apt-get update # apt-get install openssh-server gdbserver gator-module-`uname –r` gator-daemon
To confirm correct installation, re-boot the target and then enter ‘lsmod’ at the command prompt. The gator module should be automatically inserted at boot time.
Target # lsmod
This command will output a list of currently inserted modules, one of which should now be gator.ko.
Now that we have sshd installed, we can ssh into the target rather than using the serial connection, which will provide a better command line experience. Firstly, using the serial port set a password for the root user, this must not be blank!
Target # passwd root
Then, find out the IP address of your target by typing:
Target # ifconfig
Following this, confirm you can connect using ssh from your host.
Host # ssh root@<IP_ADDRESS>
Congratulations - the target is now setup for Linux application debugging and profiling with DS-5!
2. Debugging Linux Applications Using Development Studio 5
To demonstrate Linux application debugging, we will make use of the “Hello World” example that comes as part of the DS-5 examples. The process is pretty much the same for any Linux executable you need to debug – with the exception that you may also need to pull shared libraries across to the target in where you need to debug shared libraries loaded by the applications.
To debug this example follow the steps below. Please refer to the DS-5 user guide if you require more detail.
- Select import from the Eclipse File menu.
- To import the “hello” example, select “Existing projects into workspace” from the general folder in the import screen. Import is available from the file menu.
- Select “Next”, select the “Select archive file” radio button and browse to the Linux examples archive, which will be in <installation_dir>/DS-5/examples/Linux_examples.zip
- Select the “Deselect all” button and select “hello” from the list of examples. Then select ”Finish”.
- We need to get the stripped “hello” image onto the target. DS-5 provides a convenient way to send files to your target via Remote System Explorer (RSE). To setup RSE, open the “Remote Systems” view from the Window -> Show View -> Other... -> Remote Systems -> Remote Systems item. Once you’ve done this you’ll get a Remote Systems tab in Eclipse, as in the figure.
- Select “new connection” from the menu buttons in the “Remote Systems” window and enter the connection details for your target, as prompted. Full details of using RSE can be found in the RSE user guide.
- You can now drag and drop the stripped “hello” image from the “hello” project we imported to the file system onto your PandaBoard.
- On the target, set execute permission on the hello executable: chmod +x hello
- Now switch to the DS-5 Debug perspective in Eclipse and create a new debug configuration.
- In the connection tab (see image) use the following settings:
Platform: – pandaboard.org – OMAP 4430
Project type: - Linux Application Debug
Debug operation: - Start gdbserver and debug target resident application
- Use the RSE connection you have already setup for the connection as shown in the screenshot below.
- In the Files tab, enter the absolute path to the hello executable on the target and also add the unstripped hello executable from your workplace. This is required so that debugger can load symbolic information for the target binary.
- Finally, in the Debugger tab, select "Debug from main".
- Select "Apply" and "Debug" to start a debug session and connect to your target.
- You can now debug and step through your application code, set break points, all in a nicely contained fully featured debug user interface.
3. Profiling ARM Linux Applications using Streamline
We will now show how to profile a Linux application running on the PandaBoard. As a simple example, we will profile the “threads” example application supplied with DS-5. To do this, follow the steps below.
- Select Import from the File menu.
- To import the threads example, select “Existing projects into workspace” from the general folder in the import screen
- Select Next, select the “Select archive file” radio button and browse to the Linux examples archive, which will be in DS-5/examples/Linux_examples.zip
- Select the “Deselect all” button and select “threads” from the list of examples. Then select Finish.
- We need to get the stripped threads image onto the target. DS-5 provides a convenient way to send files to your target using Remote System Explorer.
- Open the “Remote Systems” view from the Window -> Show View menu -> other item. Once you’ve done this you’ll get a Remote Systems tab in Eclipse.
- Select a new connection from the menu in this new window and enter the connection details for your target, as prompted. Full details of using RSE are given in the RSE user guide.
- You can now drag and drop the stripped threads image from the threads project we imported to the file system on your PandaBoard, using the target filesystem explorer provided by RSE.
- You’ll need to enable execute permissions on the threads executable on the target using chmod +x threads. Another useful feature in Remote Systems Explorer is the ability to launch an ssh terminal from within DS-5. You can do this from the Remote Systems tab, and right clicking on Ssh Terminals -> Launch Terminal
- If not already open, open the ARM Streamline data view from the Window -> Show View menu.
- Now we can create a new Streamline connection to the target. Click on the “Change capture options” button in the ARM Streamline data view and enter the IP of your target into the address text box. Also in this view, use the “Add elf image from workspace button” to add the un-stripped version of the threads app from the threads project. Then select “Save”.
- Click on the “Start Capture” icon in the ARM Streamline data view to start a Streamline capture session. Streamline now starts collecting performance counter and trace points data from the target.
- Start the threads application on your target.
- After a short period, when your application has finished, stop the capture by clicking the stop button that appears in the ARM Streamline data view.
- The Streamline analysis phase begins and the profiling results are displayed once the analysis is completed.
- You can now see where the threads example is being executed on the timeline. In the screenshot above, it’s to the right hand side of the timeline where there is clear cpu activity.
You can now browse through the various views to investigate functions, callpaths and areas of the code that are of interest in more detail.
In summary, we have seen how to setup a Linaro ARM Linux image on the PandaBoard using tools from Linaro that make the setup process relatively straightforward and hassle free. Following this we configured the Linaro image on PandaBoard for use with DS-5 using simple apt-get commands that installs the DS-5 dependencies on target and used DS-5 for debugging and profiling Linux applications running on PandaBoard.
In a future article, we shall be discussing Linux Kernel debug using DS-5 on a Linaro image.
Until then, happy debugging and profiling!
David Stubbs, Senior Validation Engineer at ARM, has been part of the DS-5 Validation team for several years and is involved with testing DS-5, ARM Streamline and the ARM Compiler tool chain. He also develops and maintains the DS-5 test infrastructure.
1 Comments On This Entry
Please log in above to add a comment or register for an account
Search My Blog
on May 08 2013 06:15 PM
New Platform Bring-Up with ARM® Development Studio 5 (DS-5™)
on Apr 30 2013 09:55 AM
如何利用全志安卓4.0 HDMI Dongle进行ARM DS-5 Streamline性能分析
on Apr 26 2013 10:50 AM
DS-5 Streamline Performance Analyzer on Allwinner Android 4.0 HDMI Dongle
on Apr 25 2013 04:58 PM
Spotlight on the Linux Software Ecosystem - openSUSE
on Apr 22 2013 08:10 PM