TI-Android-GingerBread-2.3.4-DevKit-2.1.1 DeveloperGuide

From Texas Instruments Embedded Processors Wiki

Jump to: navigation, search
Translate this page to   

TIBanner.png

Contents

TI Android GingerBread 2.3.4 DevKit 2.1.1 Developer Guide

Developer Guide - December 09, 2011

About this manual

The objective of this document is to guide Android developers to get access to Android GingerBread DevKit release sources for TI AM335x platforms, setting up host environment for compilation and enabling debug environment to ease the app development, debugging and deployment.

This document contains instructions to:

Hardware Requirements

This release of TI Android GingerBread 2.3.4 DevKit 2.1.1 is evaluated on the below given list of platforms. This package should be easily portable on other platforms on similar TI devices.

TI Device Platform Supported Version Other Accessories
AM335x



AM335x EVM Rev 1.1B USB HUB, USB Keyboard, USB Mouse, Ethernet, USB Micro-B Cable, UART Cable, Audio Speakers, MMC/SD Card (2GB min)

BeagleBone Rev A3 USB HUB, USB Keyboard, USB Mouse, Ethernet, USB Mini-B Cable, Micro MMC/SD Card (2GB min)


Host (PC) setup requirements

If you are an Android application developer or would like to use Android SDK Tools then refer to Android SDK Requirements for Host PC requirements.

The host development environment for Android is based on Ubuntu, please install Ubuntu version 10.04 or later http://www.ubuntu.com/desktop/get-ubuntu/download.

We recommend you to have a Linux "Ubuntu 10.04 or above" Host machine, See Ubuntu Linux installation notes

The host installation would need few more Android specific dependencies, these can be installed dynamically over network using below commands.

For Ubuntu on 32-bit machines

  $ sudo add-apt-repository "deb http://archive.canonical.com/ lucid partner"
  $ sudo add-apt-repository "deb-src http://archive.canonical.com/ubuntu lucid partner"
  $ sudo apt-get update
  $ sudo apt-get install git-core gnupg sun-java6-jdk flex bison gperf libsdl-dev libesd0-dev libwxgtk2.6-dev build-essential zip curl libncurses5-dev zlib1g-dev minicom tftpd uboot-mkimage expect
  $ sudo update-java-alternatives -s java-6-sun

NOTE:

  1. Android Gingerbread (2.3.4) needs Java 6 on ubuntu, whereas the previous version FroYo (2.2) was using Java 5.
  2. The Hard Disk should have at least 15 GigaBytes of free space to complete the building of sources.
  3. Please refer to the AOSP for latest information http://source.android.com/source/initializing.html

Getting Source & Toolchain

TI provides Android sources for all the supported devices in multiple locations, developers can download the sources from the rowboat repository or use the pre-packaged sources in the DevKit.

Using Rowboat Gitorious

A tool called Repo helps to fetch the android sources from gitorious.org/rowboat. Repo is a tool that makes it easier to work with Git in the context of Android.
For more information about Repo, see Android Version Control.
To install, initialize, and configure Repo, follow these steps:

Make sure you have a bin/ directory in your home directory, and that it is included in your path:

  $ mkdir ~/bin
  $ PATH=~/bin:$PATH

Download the Repo script and ensure it is executable:

  $ curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
  $ chmod a+x ~/bin/repo
  

The following commands help developers to clone sources from rowboat repository

  $ mkdir $HOME/rowboat-android
  $ cd $HOME/rowboat-android
  $ repo init -u git://gitorious.org/rowboat/manifest.git -m rowboat-gingerbread-am335x.xml
  $ repo sync

Using Pre-Packaged Sources

The above method is ideal but it is time consuming, so developers can use the pre-packaged Android sources in DevKit package.

Download the pre-packaged DevKit sources from here.
Run following commands to extract the pre-packaged source:

  $ mkdir $HOME/rowboat-android
  $ cd $HOME/rowboat-android
  $ tar -xvzf 	TI_Android_GingerBread_2_3_4_AM335x_Sources.tar.gz

Checkout the sources from pre-packaged source:

  $ cd TI_Android_GingerBread_2_3_4_AM335x_Sources
  $ ./.repo/repo/repo sync --local-only

This will generate the sources for

This will generate the pre-built of

NOTE: Once the sources are generated developers can do a “repo sync” to pull latest updates (if any) from rowboat

Toolchain setup

  $ export PATH=$HOME/rowboat-android/prebuilt/linux-x86/toolchain/arm-eabi-4.4.3/bin:$PATH

Build Procedure

To Build Bootloader

  $ cd u-boot
  $ make CROSS_COMPILE=arm-eabi- distclean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- am335x_evm_config
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- 

To Build Android Linux Kernel

  $ cd kernel
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- am335x_evm_android_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- distclean
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- beaglebone_android_defconfig
  $ make ARCH=arm CROSS_COMPILE=arm-eabi- uImage

To Build Android Filesystem

Filesystem with SGX

  $ make TARGET_PRODUCT=<product-name> OMAPES=4.x -j<N>

NOTE:

  1. product-name can be "beaglebone" for BeagleBone or "am335xevm" for AM335x EVM
  2. <N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4

Filesystem without SGX

  $ make TARGET_PRODUCT= <product-name> clean
  $ make TARGET_PRODUCT=am335xevm droid build_kernel wl12xx_compat am335xevm_modules -j<N> 
  $ make TARGET_PRODUCT=beaglebone droid build_kernel beaglebone_modules -j<N> 

NOTE:

  1. <N> should be twice the number of processors on your host machine. For example, a dual core machine would use -j4
  2. droid will build basic Android filesystem
  3. build_kernel will build the kernel
  4. wl12xx_compat will build WLAN drivers and load WLAN and BT firmwares into Android filesystem (for am335xevm only)
  5. <product-name>_modules will build USB modules and load into Android filesystem

NOTE: BeagleBone doesn't have WLAN support.

Create root filesystem tarball

  $ cd out/target/product/<product-name>
  $ mkdir android_rootfs
  $ cp -r root/* android_rootfs
  $ cp -r system android_rootfs
  $ sudo ../../../../build/tools/mktarball.sh ../../../host/linux-x86/bin/fs_get_stats android_rootfs . rootfs rootfs_<product-name>.tar.bz2

NOTE: product-name can be "beaglebone" for BeagleBone or "am335xevm" for AM335x EVM.

RowboPERF Integration

   $ git clone git://gitorious.org/rowboat/rowboperf.git
   $ cd rowboperf

To generate SD/MMC card to boot Android

These compiled Images can be copied to a SD/MMC card to boot Android on AM335x EVM or BeagleBone. The boot script (uEnv.txt) helps the board to boot automatically (Provided the NAND environment is empty).

  bootargs=console=ttyO0,115200n8 androidboot.console=ttyO0 mem=256M root=/dev/mmcblk0p2 rw rootfstype=ext3 rootwait rootdelay=1 init=/init ip=off
  bootcmd=mmc rescan ; fatload mmc 0 82000000 uImage ; bootm 82000000
  uenvcmd=boot

NOTE: You can edit uEnv.txt to update bootargs and bootcmd.

  $ mkdir image_folder
  $ cp uEnv.txt image_folder
  $ cp kernel/arch/arm/boot/uImage image_folder
  $ cp u-boot/u-boot.img image_folder
  $ cp u-boot/MLO image_folder
  $ cp out/target/product/<product-name>/rootfs.tar.bz2 image_folder
  $ cp Media_Clips image_folder
  $ cp <android-devkit>/Debug_and_Development_Tools/TI_Android_Utilities/mk-mmc/mkmmc-android.sh image_folder
  $ cd image_folder
  $ sudo ./mkmmc-android.sh /dev/sd<mount-point> MLO u-boot.img uImage uEnv.txt rootfs.tar.bz2 Media_Clips

NOTE:

  1. mkmmc-android.sh is provided in Devkit.
  2. All the Images, Audio and Video can be put into Media_Clips directory and can be provided as an argument to the above script.

Booting the Platform

Here are the instructions to boot the prepared SD card on the two platforms:

AM335x EVM

AM335x EVM SD boot mode setting

Switch
1
2
3
4
5
6
7
8
State
OFF
OFF
OFF
ON
OFF
ON
ON
ON

BeagleBone


To exercise various Android DevKit features refer to:

  1. TI-Android-GingerBread-2.3.4-DevKit-2.1.1 UserGuide
  2. RowboPERF User Guide

Boot Logs

Application Development and Debugging

Using TI's Code Composer Studio V5 (Eclipse based)

Code Composer Studio (CCS) is the integrated development environment for TI's DSPs, microcontrollers and application processors based on the Eclipse open source software framework which includes a suite of tools used to develop and debug embedded applications. Since CCS is based on Eclipse, it is possible to integrate the Android Development Tools (ADT) like Android Debug Bridge (ADB), Dalvik Debug Monitoring System (DDMS) and ndk-gdb in CCS to enable the debugging of Android Applications directly on Android Device (i.e TI EVM) along with the inherent CCS capability of Linux Aware Debug and DSP Debugging.

This wiki walks you through installation of Android Debugging Tools in CCS, connecting CCS with Android Device and illustrates a debugging session of an HelloWorld Application based on android NDK having a mix of Java and Native C Code.

Preparing CCS for Android Development

The steps below are condensed version of steps mentioned on http://developer.android.com/sdk/installing.html

Refer http://developer.android.com/sdk/eclipse-adt.html#installing

  1. On Windows, double-click the SDK Manager.exe file at the root of the Android SDK directory
  2. On Linux, run '<SDK>tools/android'
  3. Proxy Settings (If needed): Go to Settings and set the Proxy to work with your network
  4. To download components, use the graphical UI of the Android SDK and AVD Manager, shown in Figure below, to browse the SDK repository and select new or updated components. The Android SDK and AVD Manager will install the selected components in your SDK environment. Refer the list of Recommended Components: http://developer.android.com/sdk/installing.html#which

Android-sdk-manager.png

  1. To Install the Terminal (similar to Teraterm) in CCS, please follow the steps mentioned in the wiki: http://processors.wiki.ti.com/index.php/How_to_install_the_terminal_plugin_in_CCSv5
  2. For more information regarding CCSv5 and ADT plugin setup please refer CCSv5SetupGuide

Debugging Android with CCS

Hello World Application on Android Virtual Device (AVD)

  1. Hello World Using CCSv5
  2. Android Hello World

Hello-jni of Android NDK on Android Device

  1. Click File > New Android Project...
  2. Select the Create project from existing source radio button.
  3. Select any API level above Android 1.5.
  4. In the Location field, click Browse... and select the <ndk-root>/samples/hello-jni directory.
  5. Click Finish.
  6. Go to C/C++ Perspective. Click File->New->Convert to C/C++ Project
  cd <ndk-root>/samples/hello-jni
  <ndk_root>/ndk-build
  # $GDBCLIENT -x $GDBSETUP -e $APP_PROCESS
  ndk-gdb –adb=<PATH_TO_android-sdk-windows/platform_tools/adb.exe>
sample command: $ ndk-gdb --adb=/cygdrive/c/PROGRA~1/Android/android-sdk-windows/platform-tools/adb.exe

Using ADB Android Debugger, Downloader

Android Debug Bridge (adb) is a versatile tool lets you manage the state of the Android-powered device. For more information about what is possible with adb, see Android Debug Bridge page at http://developer.android.com/guide/developing/tools/adb.html. The ADB tool can be used to

Downloading "ADB" & Host setup

The adb tool is a part of Android SDK package located at http://developer.android.com/sdk/index.html. For an overview of how to install and set up the Android SDK, follow download & setup instructions from http://developer.android.com/sdk/index.html. Once you install Android SDK, the directory contents look like this.

  .
  |-- SDK Readme.txt
  |-- add-ons
  |-- google-market_licensing
  |-- platform-tools
  |   |-- NOTICE.txt
  |   |-- aapt
  |   |-- adb
  |   |-- aidl
  |   |-- dexdump
  |   |-- dx
  |   |-- lib
  |   `-- source.properties
  |-- platforms
  |-- temp
  `-- tools
      |-- NOTICE.txt
      |-- adb_has_moved.txt
      |-- android
      |-- ant
      |-- apkbuilder
      |-- ddms
      |-- dmtracedump
      |-- draw9patch
      |-- emulator
      |-- etc1tool
      |-- hierarchyviewer
      |-- hprof-conv
      |-- layoutopt
      |-- lib
      |-- mksdcard
      |-- monkeyrunner
      |-- proguard
      |-- source.properties
      |-- sqlite3
      |-- traceview
      `-- zipalign

The adb tool is located in paltform-tools/ directory under the Android SDK installation. Export the platform-tools and tools directory path as shown below.

  $ export PATH=<android_sdk_path>/platform-tools/:<android_sdk_path>/tools/:$PATH

Connecting Host machine to board through adb

This release of DevKit has been tested for three different methods of connecting a given board with host machine

The below sections describe each of these methods and provides necessary instructions for the same.

adb over USB

    For Gusty/Hardy, edit the file to read:
    SUBSYSTEM=="usb", SYSFS{idVendor}=="18d1", MODE="0666"
    For Dapper, edit the file to read:
    SUBSYSTEM=="usb_device", SYSFS{idVendor}=="18d1", MODE="0666"
  • Execute the following to change the user mode for the rules file.
    $ chmod a+r /etc/udev/rules.d/51-android.rules
  • Verify the adb connectivity between host and target board
    $ adb devices 

If device is connected, then output on screen should list the device, example:

       List of devices attached
       0123456789ABCDEF    device

adb over USB Ethernet (Ethernet over USB)

IMPORTANT NOTE: Inventra configuration must occur in two places as shown below.

    $ make ARCH=arm CROSS_COMPILE=arm-eabi- menuconfig
  ...
  Power management options --->
  [*] Networking support --->
  Device Drivers --->
  File systems --->
  Kernel hacking --->
  ...
  ...
  <*> Sound card support --->
  [*] HID Devices --->
  [*] USB support --->
  <*> MMC/SD/SDIO card support --->
  ...
  ...
  < >   R8A66597 HCD support
  < >   Host Wire Adapter (HWA) driver (EXPERIMENTAL)
  <*>   Inventra Highspeed Dual Role Controller (TI, ADI, ...)
          *** Platform Glue Layer ***
  < >     TUSB6010
  ...
  ...
  < >   iSight firmware loading support
  < >   USB YUREX driver support
  <*>   USB Gadget Support  --->
        *** OTG and related infrastructure ***
  [ ]   Hold a wakelock when USB connected
  ...
  ...
  <*>   USB Peripheral Controller (Inventra HDRC USB Peripheral (TI, ADI, ...))  --->
  < >   Select one gadget as builtin for one port
  <*>   USB Gadget Drivers (Ethernet Gadget (with CDC Ethernet support))  --->
          Ethernet Gadget (with CDC Ethernet support)
  [*]       RNDIS support (NEW)
  [ ]       Ethernet Emulation Model (EEM) support (NEW)

The USB network gadget g_ether is named usb0 (instead of eth0 or other network interface names). The normal set of Ethernet configuration tools should work, such as ifconfig, netstat, and route.

For example, the following commands will assign the network address 192.168.194.2 to the target. Run this on the target:

  $ ifconfig usb0 192.168.194.2 netmask 255.255.255.224 up

On Host machine, run the following commands to establish the connection to the target:

  $ sudo ifconfig usb0 192.168.194.1 netmask 255.255.255.224 up
  $ sudo route add 192.168.194.2 dev usb0

The target and the host machine should be connected, run ping command to test the same:

  $ ping -c 3 192.168.194.2
  PING 192.168.194.2 (192.168.194.2) 56(84) bytes of data.
  64 bytes from 192.168.194.2: icmp_seq=1 ttl=64 time=6.08 ms
  64 bytes from 192.168.194.2: icmp_seq=2 ttl=64 time=0.511 ms
  64 bytes from 192.168.194.2: icmp_seq=3 ttl=64 time=0.485 ms
  --- 192.168.194.2 ping statistics ---
  3 packets transmitted, 3 received, 0% packet loss, time 2000ms
  rtt min/avg/max/mdev = 0.485/2.361/6.089/2.636 ms

On the host machine execute following commands to establish adb connection

  $ export ADBHOST=<target's ip address>
  $ adb kill-server
  $ adb start-server
  $ adb connect <target_ip_address>:5555

Verify the connection by executing

  $ adb devices 

If connected, device name should be listed as a "emulator"

  $ adb devices
   List of devices attached
   emulator-5554    device
  $ adb shell

adb over Ethernet

  # netcfg                                                                        
  lo       UP    127.0.0.1       255.0.0.0       0x00000049                       
  eth0     UP    172.24.190.59   255.255.252.0   0x00001043                       
  # netcfg eth0 dhcp
  # setprop service.adb.tcp.port 5555
  # stop adbd
  # start adbd
  $ export ADBHOST=<target's ip address>
  $ adb kill-server
  $ adb start-server
  $ adb connect <target_ip_address>:5555
  $ adb devices
    List of devices attached
    emulator-5554    device
  $ adb shell 

For more information about adb commands, see Android Debug Bridge page at http://developer.android.com/guide/developing/tools/adb.html

adb over USB on Windows Machine

Follow the below instructions to get ADB over USB work on a Windows PC

(http://developer.android.com/sdk/index.html) and uncompress it in a local folder (i.e. c:\android_sdk).

(https://dl-ssl.google.com/android/repository/usb_driver_r03-windows.zip) and uncompress it in a local folder (i.e. c:\android_sdk\usb_driver)

"%USERPROFILE%\.android\adb_usb.ini":

  > echo 0x18D1 > "%USERPROFILE%\.android\adb_usb.ini"

Under [Google.NTx86] section add:

  ;TI EVM
  %SingleAdbInterface%        = USB_Install, USB\VID_18D1&PID_9018
  %CompositeAdbInterface%     = USB_Install, USB\VID_18D1&PID_9018&MI_01

NOTE: Be careful to add it under Google.NTx86 and not under Google.NTamd64 unless your machine is AMD 64 bits. If you skip this step you won't be able to later install the driver as windows will reject it.

Answer "No, not this time" to the question about running Windows Update to search for software.

  > adb kill-server
  > adb start-server

Operations over ADB

The Root File System provided in this DevKit release contain only standard Android components and applications.

To install and run Android application follow steps mentioned below:

Installing (.apk files) application on Target Platform

  $ adb install <package>.apk. 

NOTE: Use -s option with the adb tool, to install the package on external storage.

On successful installation adb tool will report SUCCESS on host terminal, and the application would be listed on the android main menu.

Un-installing applications (.apk) using adb

  $ adb shell pm list packages
  $ adb uninstall <package name>
  • Method 2: On target:

Main menu -> Menu -> Settings -> Applications -> Manage applications -> Find the package Tap on it -> Uninstall -> OK -> OK

  • On successful removal, the application would have been removed from the android main menu. All the short-cuts to the application also removed.
  $ adb shell
  # rm /system/app/app.apk

On successful removal, the application would have been removed from the android main menu.

Copy any files to and from the board over ADB

  $ adb pull <remote> <local>
  $ adb push <local> <remote>

In the commands, <local> and <remote> refer to the paths to the file or directory on your development host (local) and on the target instance (remote).

  Here's an example: 
  $ adb push foo.txt /sdcard/foo.txt

Setup ADB for application Debugging

ADB and Eclipse, with ADT( Android Development Tools plug-in) allow users to create and debug Android applications. Follow Developing In Eclipse, with ADT at http://developer.android.com/guide/developing/eclipse-adt.html

Steps to connect Eclipse to the board.

    Verify the connectivity by executing 
    $ adb devices

For more detailed and complete information on the above follow Developing In Eclipse, with ADT at http://developer.android.com/guide/developing/eclipse-adt.html

    Window -> Open Perspective -> Other -> DDMS; 
    Click on OK

Others

How to set media volume?

Main Menu->Settings->Sound->Volume

How to show fps in logcat messages?

To print the FPS in logcat dump, type this command on the console before starting playback:
#setprop debug.video.showfps 1

To disable the prints, type:
#setprop debug.video.showfps 0

How to set longer screen timeout ?

Main Menu->Settings->Display->Screen timeout->30 minutes

Acronyms

Quick References

Content Link Ref#
User Guide http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1.1_UserGuide
Release Notes http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1.1_ReleaseNotes
Porting Guides http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1.1_PortingGuides
Downloads http://focus.ti.com/docs/toolsw/folders/print/androidsdk-sitara.html

Support

For further information or to report any problems, contact http://e2e.ti.com/android or http://support.ti.com.
For community support join http://groups.google.com/group/rowboat
For IRC #rowboat on irc.freenode.net

E2e.jpg For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article TI-Android-GingerBread-2.3.4-DevKit-2.1.1 DeveloperGuide here.
Hyperlink blue.png Links
ARM Microcontroller MCU ARM Processor Digital Media Processor Digital Signal Processing Microcontroller MCU Multi Core Processor
Ultra Low Power DSP 8 bit Microcontroller MCU 16 bit Microcontroller MCU 32 bit Microcontroller MCU

Leave a Comment
Personal tools
Namespaces
Variants
Actions
Navigation
Print/export
Toolbox