• ARM DS-5 Tutorial For Android

    by  • December 1, 2011 • AppDev • 11 Comments

    Prerequisite

    Must have Java 1.6+ installed on your local machine

    DS-5 Installation Steps

    1. Download Eclipse making sure it’s Eclipse Indigo

    2. Download Android SDK

    3. Click on the link to download, in my case I downloaded the .zip file (android-sdk_r15-windows.zip)

    4. Download the Android NDK (Native Development Kit) from http://developer.android.com/sdk/ndk

    5. Unzip both the NDK and SDK .zip files to a directory

    6. Unzip Eclipse .zip to a directory

    7. Launch Eclipse and specify the workspace

    8. Select Install New Software… from the Help menu

    9. Enter the repository information in the Name and Location field

    10. Select the ARM DS-5 Community Edition by clicking on the tickbox

    11. You should see the Eclipse plug-ins for DS-5 Community Edition with all the necessary components shown.

    12. Select the radio button for I accept the terms of the license agreements and click on Finish button

    13. You will see the progress of the components being installed . Depending on your internet connection it will take few minutes to 15-20min to complete the downloading and installing of the components.

    14. Click on Restart Now

    15. When Eclipse has started select the Install Community Edition license and click Continue button

    Android SDK Configuration

    1. Install ADT (Android Development Toolkit) plugin

    2. Select the Developer Tools check box to select the components that need to be installed

    3. Check to make sure all the necessary components have been selected.

    4. Select I accept the terms of the license agreements

    5. The installation process will start and wait until it’s completed

    6. You will get a Warning message to tell you that the software content is not signed, for this just click Ok button

    7. Click on Restart Now

    8. Select Window –> Preferences

    9. Select Android from the Preferences window and click on Browse… button to select the SDK location

    10. You will get Android SDK Verification message box, click on Ok button

    11. Exit Eclipse

    12. Run SDK Manager.exe

    13. Make sure the following are selected

    • Android SDK Platform-tools
    • Documentation for Android SDK
    • SDK Platform
    • Samples for SDK
    • ARM EABI v7a System Image
    • Google APIs by Google Inc.

    14. Select Accept All and click Install button

    15. Wait until the downloading complete. The download process will take sometime as it’s downloading quite a number of files for the SDK.

    16. Click on Yes once you are done

    17. Open the AVD Manager by selecting Windows –> AVD Manager

    18. Click on New… button

    19. Enter the information for creating a new AVD (Android Virtual Device) and click on Create AVD

    20. Click on the Start… button to bring up the Launch Options dialog box. Click on Launch button.

    21. If everything goes well you should be able to see the following Ice Cream Sandwich (Android 4.0) startup screen.

    Once you are able to see the Android home screen your setup is complete

    How To Run NDK Sample Application

    1. Change to your NDK directory and execute the command ndk-build -C samples/hello-neon in your command prompt as shown below

    2. Open up Eclipse and select File –> New –> Project and select Android Project

    3. Type in the name of the project and for the Location field select the sample hello-neon and click on Finish button

    4. Once the project has been imported double-click on AndroidManifest.xml and select the Application tab. Once it’s opened click on the Application Attributes heading, you will see the Debuggable option and select true . Save the file before moving on to the next steps.

    5. Run the application by right clicking on the hello-neon project and select Run As and select Android Application

    6. You will see on the Console tab the following messages

    7. You will see the application run in the emulator as follows

    How To Setup Debugging

    1. Open the debug perspective by select Window –> Open Perspective –> Debug

    2. Open the debug perspective by select Window –> Open Perspective –> DS-5 Debug.You will see screen similar to the following screen shot

    3. Open up the debug configuration by selecting Run –> Debug Configurations

    4. Create a new configuration by clicking on the New launch configuration button. Untick the Connect as root and check make sure that your physical device (mobile phone/tablet) is connected properly to the USB and the ID is shown in the Connections drop down box.

    If any of the above information are not done properly the tab will have an error on it like so

    5. Fill in the following under the Files and click on the Workspace… button to browse for the project and select the hello-neon project. Do the same step for both the Project directory and APK file.

    6. Fill in the following under Debugger tab

    Using Debugger

    1. Switch to DS-5 Debug mode

    2. Open up the helloneon.c file and put a break point on line 109 and 113. Double click on the blue line of the left side of the screen to put the breakpoint in (a small blue color circle)

    3. To start debugging click on the DS-5 debug icon or go to Run –> Debug Configurations and select the helloNeon under the DS-5 Debugger section. Click on the Debug button on Debug Configurations box.

    4. Once the application is running on your device you can see the breakpoint will be hit at the line that you setup from the previous step

    5. To connect or disconnect the debugging session use the connect and disconnect button in the Debug Control

    Problem and Fixes

    1. If your ARM menus from the Help menu does not show up it’s because it cannot find the license key. What you must do is make sure you have the proper location of your eclipse directory in your PATH folder

    2. If you are getting the following error meaning that you have not compiled the program to generate the .so file. Follow step 1 from the How To Run NDK Sample Application section.

    3. If you are getting the following error this means that the .apk has not been generated

    the easiest way to resolve this is to run the application by right clicking on the hello-neon project and select Run As and select Android Application. Once the application has been exported to your phone do the debugging steps again.

    4. If your breakpoint is not triggered when the app hit that line that means that most probably the gdbserver that Eclipse is using is not from DS-5 version. This is what you have to do. Go to Help –> ARM Extras

    It will open up a folder that contains the gator and gdbserver directories.

    Go to the gdbserver/android directory and copy the gdbserver-stat-7.1 file into your project folder, in my case it’s copied into the C:\DS-5\android-ndk-r7-windows\samples\hello-neon\libs\armeabi and C:\DS-5\android-ndk-r7-windows\samples\hello-neon\libs\armeabi-v7a directory. Once copied delete the old gdbserver and rename the copied file from gdbserver-stat-7.1 to gdbserver

    Once this step is done you should be able to see your breakpoint hit.

     

     

    Update 2/March/2012: Added the following video uploaded by ARM

    http://www.youtube.com/watch?feature=player_detailpage&v=xfoezJgw7wA

    11 Responses to ARM DS-5 Tutorial For Android

    1. December 5, 2011 at 3:20 pm

      That’s a very nice post.
      I have 2 questions !

      1 – Actually I develop under Android but do not use DS5 !
      Can I install DS5 after having installed the NDK ?

      2 – Is it possible to debug a application running on the device and not the emulator ?

      Thank’s for your work !

    2. December 5, 2011 at 10:42 pm

      Hi Etienne,

      1. Yes, you can install DS5 after installing the NDK. DS5 is just plugins inside Eclipse so once you installed Eclipse you can do the normal setup for the plugins like any other Eclipse plugins

      2. Yes, you can debug on the device straight away that’s what I do normally. The main thing on the device you enable the USB Debugging settings. Normally it’s in he Setttings –> Application –> Development and then tick the USB debugging option

    3. Krystian
      December 10, 2011 at 7:57 pm

      I’ve followed your tutorial very closely, but I’m having a trouble to get debugging works (on Samsung Galaxy S2). More details here:
      http://forums.arm.com/index.php?/topic/15575-arm-ds-5-tutorial-for-android/
      Did I do something wrong?

    4. Stone
      December 20, 2011 at 3:45 am

      My “connection” tab in “New configuration” dialog doesn’t have “Kill existing process”…

    5. Nick
      January 23, 2012 at 3:11 pm

      I’m having problems installing the package into Eclipse
      I select the “ARM DS-5 Community Edition ” option on the install screen, click next and get the following error.
      “Cannot complete the install because some dependencies are not satisfiable
      com.arm.ds.community.feature.feature.group [5.8.0.20111129_133554] cannot be installed in this environment because its filter is not applicable.”

      Any clues?

    6. Iosif Hamlatzis
      March 17, 2012 at 8:25 am

      I’ve followed to the letter the tutorial but when trying to debug my game first of all the eclipse IDE returns to the original Debug perspective and not the DS-5 Debug one, even though I’ve replaced the gdbserver on my project folder.

      I’ve placed a break point in the first line of my: void android_main(android_app* pApplication) function in order to verify the debugger but it stops before reaching my code.

      http://dl.dropbox.com/u/45547852/Android/debug_capture.png

      I’ve noticed that eclipse IDE recompiled my game when I hit the debug button on the toolbar and inspecting my projects folder (C:\Android\Workspace\Games\libs\armeabi) I’ve noticed it has replaced the gdbserver files from DS-5 back to the original

    7. April 18, 2012 at 1:03 am

      hi, I followed your step, and I encountered such error:
      >>>>
      failed gdbserver configuration
      Timeout, PID not found!
      >>>
      Do you have any idea on what happened to me?

    8. will
      May 9, 2012 at 8:46 am

      Hi Nick,

      I am trying to use DS-5 CE to debug native code on panda board

      I just try to use android sample code (HelloNeon) for testing.

      Environment:
      Android : 2.3.3
      DS-5 CE :9.5
      Android NDK : r8
      Use miniUsb to connect panda board

      all of configuation on Eclipse just like tutorial.

      But It always failed to connect gdbserver:

      Failed gdbserver configuration:
      Error configuration debug port: error: cannot bind socket

      Do I miss any configration ?

    9. Guy
      June 4, 2012 at 10:15 am

      Hi,
      When I try to set the debbuger data, in connections I get no devide found, but adb devices does show my device.

      I’m working on HTC one S.

      any ideas?

      I can’t debug the native code even with the ndk command ndk-gdb.
      Any idea how to debug native code would be appriciated.

      Thanks in advance,
      Guy.

    10. November 9, 2012 at 2:30 pm

      Two brief notes for Guy:

      - to see your device in connections in Windows you have to add \android-sdk\platform-tools
      (e.g. c:\android-sdk\platform-tools) to your PATH system variable

      - DS-5 community edition works only with jdk 32 bit and eclipse 32 bit versions
      (i checked it out with eclipse juno and jdk 1.7)
      hope it helps

    Leave a Reply

    Your email address will not be published. Required fields are marked *


    − 8 = one