Android Development Environment (DACU)

From DAVE Developer's Wiki
Jump to: navigation, search
Info Box
Android-logo.jpg Applies to Android
Dacu-top-view.png Applies to Dacu

Introduction[edit | edit source]

When we talk generically about Android, we mean we deal with an embedded system running a Linux-based operating system. As the reader probably already knows, Linux was first developed on the PC platform, based on the famous x86 architecture. Typical embedded systems using an operating system (O.S. for short), today are running Linux. This choice has several benefits:

  • The developer can count on a reliable, efficient and robust software, developed and maintained by a large community all over the world
  • The software is open-source, so developers have access to the whole source code
  • Since the Linux kernel runs on many different platforms (x86, PowerPC, ARM, SuperH, MIPS etc.), applications are portable by definition
  • There are a lot of open-source applications running on top of Linux that can be easily integrated in the embedded system

The typical Android/Linux Embedded system is composed by:

  1. the bootloader – this software is run by the processor after coming out of reset. It performs basic hardware initialization, retrieves the Android kernel image (for example from a remote server via the TFTP protocol) and launch it by passing the proper arguments (command line and tags)
  2. the Android/Linux kernel
  3. the Android root file system – this file system is mounted (that is, made available, attached) by the kernel during the boot process on the root directory (“/”).


Android porting on Dacu/Lizard[edit | edit source]

Android relies on the Linux kernel version 2.6.x, so, like many other linux systems, booting it is straightforward once a working Linux kernel image and a pre-built root file system are available. A big help in getting these software components come from the Texas Instruments Android Development Kit for Sitara Devices (http://software-dl.ti.com/dsps/dsps_public_sw/sdo_tii/TI_Android_DevKit/TI_Android_GingerBread_2_3_4_DevKit_2_1/index_FDS.html), which provides, among other things, the Linux kernel source code and a Android 2.3.4 "Gingerbread" pre-packaged root file system source code.

The porting on Dacu/Lizard consisted in:

  • patching the TI Android kernel source tree with the Dacu carrier board/Lizard SOM modifications
  • adding kernel support for the capacitive touchscreen controller and buttons
  • rebuilding the root file system, adding some demo and benchmark applications


Android "Gingerbread" desktop
Multitouch demo application

Running Android: videos[edit | edit source]

Please watch the following videos:

Android Multitouch demo on Dacu/Lizard

Running "Hello, world!" app on DACU/Lizard

Booting Android[edit | edit source]

Default IP address[edit | edit source]

200px-Emblem-important.svg.png

The default IP address is 192.168.0.122

From internal flash: standard operation[edit | edit source]

The Dacu system is provided with a pre-programmed Android environment. When started (please refer to Dacu Quick Start), the bootloader loads the Android kernel and mounts the default root file system retrieving these components from the flash. For further information on the boot process, please refer to Android Booting.

From the network: full control on boot process[edit | edit source]

In some cases (in particular during the development phase) it's required to boot the system loading different kernel images or root file systems. You can do this by setting up Dacu to load the kernel and root file sustem from the network, using tftp and nfs protocols. Please refer to Setting_up_tftp_and_nfs for instruction on how to install a tftp and nfs servers on the host environment. When the TFTP and NFS services are properly configured, copy the kernel image to the tftp directory (es: /tftpboot/dacu/android/uImage) and export via NFS the directory where the root file system archive has been previously uncompressed.

The software package provided with Dacu includes the kernel binary image and a compressed archive containing the root file system, so you can use these default components to set up the host machine.

A few more steps are required before launching Android: from the U-Boot console, you need to stop the default boot procedure and configure some environment variables, as described in this section: Configuration net_nfs.

Once U-Boot is configured, you can launch the following command:

run net_andr_nfs


The console should report the following boot messages:

=> run net_andr_nfs                                                                                                
Using DaVinci EMAC device                                                                                          
TFTP from server 192.168.0.23; our IP address is 192.168.0.122                                                     
Filename 'lizard/dacu/uImage-android-cap-gpio'.                                                                    
Load address: 0x81000000                                                                                           
Loading: #################################################################                                         
         #################################################################                                         
         #################################################################                                         
         #################################################################                                         
         #################################################################                                         
         #################################################################                                         
         #################################################################                                         
         #####################################################                                                     
done                                                                                                               
Bytes transferred = 2597660 (27a31c hex)                                                                           
## Booting kernel from Legacy Image at 81000000 ...                                                                
   Image Name:   Linux-2.6.32-dacu-0.9.0-ge750727                                                                  
   Image Type:   ARM Linux Kernel Image (uncompressed)                                                             
   Data Size:    2597596 Bytes =  2.5 MB                                                                           
   Load Address: 80008000                                                                                          
   Entry Point:  80008000                                                                                          
   Verifying Checksum ... OK                                                                                       
   Loading Kernel Image ... OK                                                                                     
OK                                                                                                                 
                                                                                                                   
Starting kernel ...                                                                                                
                                                                                                                   
Uncompressing Linux................................................................................................
[    0.000000] Linux version 2.6.32-dacu-0.9.0-ge750727-dirty (piero@beleriand) (gcc version 4.4.3 (GCC) ) #9 Tue 2
[    0.000000] CPU: ARMv7 Processor [411fc087] revision 7 (ARMv7), cr=10c53c7f                                     
[    0.000000] CPU: VIPT nonaliasing data cache, VIPT nonaliasing instruction cache                                
[    0.000000] Machine: DAVE Lizard CPU module                                                                     
[    0.000000] Memory policy: ECC disabled, Data cache writeback                                                   
[    0.000000] AM3517 ES3.1 (l2cache iva sgx neon isp )                                                            
[    0.000000] SRAM: Mapped pa 0x40200000 to va 0xfe400000 size: 0x100000                                          
[    0.000000] Reserving 33554432 bytes SDRAM for VRAM                                                             
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 65024                          
[    0.000000] Kernel command line: init=/init rw root=/dev/nfs nfsroot=192.168.0.119:/home/piero/work/rfs/gingerb8
[    0.000000] PID hash table entries: 1024 (order: 0, 4096 bytes)                                                 
[    0.000000] Dentry cache hash table entries: 32768 (order: 5, 131072 bytes)                                     
[    0.000000] Inode-cache hash table entries: 16384 (order: 4, 65536 bytes)                                       
[    0.000000] Memory: 256MB = 256MB total                                                                         
[    0.000000] Memory: 221312KB available (4480K code, 814K data, 172K init, 0K highmem)                           
[    0.000000] Hierarchical RCU implementation.                                                                    
[    0.000000] NR_IRQS:368                                                                                         
[    0.000000] Clocking rate (Crystal/Core/MPU): 26.0/332/500 MHz                                                  
[    0.000000] GPMC revision 5.0                                                                                   
[    0.000000] IRQ: Found an INTC at 0xfa200000 (revision 4.0) with 96 interrupts                                  
[    0.000000] Total of 96 interrupts on 1 active controller                                                       
[    0.000000] OMAP GPIO hardware version 2.5                                                                      
[    0.000000] OMAP clockevent source: GPTIMER1 at 32768 Hz                                                        
[    0.000000] Console: colour dummy device 80x30                                                                  
[    0.000000] Calibrating delay loop... 499.92 BogoMIPS (lpj=1949696)                                             
[    0.000000] Mount-cache hash table entries: 512                                                                 
[    0.000000] CPU: Testing write buffer coherency: ok                                                             
[    0.000000] regulator: core version 0.5                                                                         
[    0.000000] NET: Registered protocol family 16                                                                  
[    0.000000] mux: Could not set signal i2c2_scl                                                                  
[    0.000000] mux: Could not set signal i2c2_sda                                                                  
[    0.000000] mux: Could not set signal i2c3_scl                                                                  
[    0.000000] mux: Could not set signal i2c3_sda                                                                  
[    0.000000] mux: Could not set signal sdmmc1_clk                                                                
[    0.000000] mux: Could not set signal sdmmc1_cmd                                                                
[    0.000000] mux: Could not set signal sdmmc1_dat0                                                               
[    0.000000] mux: Could not set signal sdmmc1_dat1                                                               
[    0.000000] mux: Could not set signal sdmmc1_dat2                                                               
[    0.000000] mux: Could not set signal sdmmc1_dat3                                                               
[    0.000000] mux: Could not set signal sdmmc2_clk                                                                
[    0.000000] mux: Could not set signal sdmmc2_cmd                                                                
[    0.000000] mux: Could not set signal sdmmc2_dat0                                                               
[    0.000000] mux: Could not set signal sdmmc2_dat1                                                               
[    0.000000] mux: Could not set signal sdmmc2_dat2                                                               
[    0.000000] mux: Could not set signal sdmmc2_dat3                                                               
[ 3942.236114] OMAP DMA hardware revision 4.0                                                                      
[ 3942.269958] bio: create slab <bio-0> at 0                                                                       
[ 3942.272613] SCSI subsystem initialized                                                                          
[ 3942.277099] usbcore: registered new interface driver usbfs                                                      
[ 3942.277587] usbcore: registered new interface driver hub                                                        
[ 3942.277893] usbcore: registered new device driver usb                                                           
[ 3942.278808] i2c_omap i2c_omap.1: bus 1 rev3.12 at 100 kHz                                                       
[ 3942.279266] i2c_omap i2c_omap.2: bus 2 rev3.12 at 100 kHz                                                       
[ 3942.291351] pca953x 2-0027: failed reading register                                                             
[ 3942.291412] pca953x: probe of 2-0027 failed with error -5                                                       
[ 3942.307006] i2c_omap i2c_omap.3: bus 3 rev3.12 at 100 kHz                                                       
[ 3942.309539] Switching to clocksource 32k_counter                                                                
[ 3942.312103] musb_hdrc: version 6.0, cppi4.1-dma, otg (peripheral+host), debug=0                                 
[ 3942.333557] AM3517 OTG revision 4ea41001, PHY f0036e2, control 00                                               
[ 3942.334075] musb_hdrc: USB OTG mode controller at d0810000 using DMA, IRQ 71                                    
[ 3942.334869] NET: Registered protocol family 2                                                                   
[ 3942.335113] IP route cache hash table entries: 2048 (order: 1, 8192 bytes)                                      
[ 3942.335662] TCP established hash table entries: 8192 (order: 4, 65536 bytes)                                    
[ 3942.335906] TCP bind hash table entries: 8192 (order: 3, 32768 bytes)                                           
[ 3942.336029] TCP: Hash tables configured (established 8192 bind 8192)                                            
[ 3942.336059] TCP reno registered                                                                                 
[ 3942.336059] UDP hash table entries: 256 (order: 0, 4096 bytes)                                                  
[ 3942.336120] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)                                             
[ 3942.336364] NET: Registered protocol family 1                                                                   
[ 3942.336791] RPC: Registered udp transport module.                                                               
[ 3942.336791] RPC: Registered tcp transport module.                                                               
[ 3942.336822] RPC: Registered tcp NFSv4.1 backchannel transport module.                                           
[ 3942.337707] AM3517  Linux PSP version 03.00.01.06-lizard (Lizard)                                               
[ 3942.337738] NetWinder Floating Point Emulator V0.97 (double precision)                                          
[ 3942.348266] ashmem: initialized                                                                                 
[ 3942.349060] VFS: Disk quotas dquot_6.5.2                                                                        
[ 3942.349182] Dquot-cache hash table entries: 1024 (order 0, 4096 bytes)                                          
[ 3942.350433] JFFS2 version 2.2. (NAND) �© 2001-2006 Red Hat, Inc.                                                
[ 3942.351074] msgmni has been set to 432                                                                          
[ 3942.354736] alg: No test for stdrng (krng)                                                                      
[ 3942.354858] io scheduler noop registered                                                                        
[ 3942.354858] io scheduler deadline registered                                                                    
[ 3942.355072] io scheduler cfq registered (default)                                                               
[ 3942.411499] OMAP DSS rev 2.0                                                                                    
[ 3942.411560] OMAP DISPC rev 3.0                                                                                  
[ 3942.597473] Serial: 8250/16550 driver, 4 ports, IRQ sharing enabled                                             
[ 3942.620117] serial8250.0: ttyS0 at MMIO 0x4806a000 (irq = 72) is a ST16654                                      
[ 3942.641174] serial8250.1: ttyS1 at MMIO 0x4806c000 (irq = 73) is a ST16654                                      
[ 3942.662048] serial8250.2: ttyS2 at MMIO 0x49020000 (irq = 74) is a ST16654                                      
[ 3943.155517] console [ttyS2] enabled                                                                             
[ 3943.172424] brd: module loaded                                                                                  
[ 3943.182556] loop: module loaded                                                                                 
[ 3943.186218] at24 2-0053: 4096 byte 24c32 EEPROM (writable)                                                      
[ 3943.193298] [lizard_nor_probe] flash width = 2                                                                  
[ 3943.197784] [lizard_nor_probe] ioremapping 0x08000000 bytes @ 0x08000000 -> 0xD1000000                          
[ 3943.209869] lizard_nor_flash.0: Found 1 x16 devices at 0x0 in 16-bit bank                                       
[ 3943.217010]  Amd/Fujitsu Extended Query Table at 0x0040                                                         
[ 3943.222290] lizard_nor_flash.0: CFI does not contain boot bank location. Assuming top.                          
[ 3943.230285] number of CFI chips: 1                                                                              
[ 3943.233734] cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.                            
[ 3943.241851] U-Boot partition parsing not available                                                              
[ 3943.246917] U-Boot env #1 partition parsing not available                                                       
[ 3943.252624] U-Boot env #2 partition parsing not available                                                       
[ 3943.258300] kernel partition parsing not available                                                              
[ 3943.263366] spare1 partition parsing not available                                                              
[ 3943.268402] spare2 partition parsing not available                                                              
[ 3943.273284] Creating 6 MTD partitions on "lizard_nor_flash.0":                                                  
[ 3943.279174] 0x000000000000-0x000000040000 : "U-Boot"                                                            
[ 3943.285919] 0x000000040000-0x000000060000 : "U-Boot env #1"                                                     
[ 3943.292907] 0x000000060000-0x000000080000 : "U-Boot env #2"                                                     
[ 3943.299835] 0x000000080000-0x000000300000 : "kernel"                                                            
[ 3943.306121] 0x000000300000-0x000000800000 : "spare1"                                                            
[ 3943.312438] 0x000000800000-0x000008000000 : "spare2"                                                            
[ 3943.317443] mtd: partition "spare2" extends beyond the end of device "lizard_nor_flash.0" -- size truncated to 0
[ 3943.329925] omap2-nand driver initializing                                                                      
[ 3943.334228] omap2-nand waitfunc poll on NAND STATUS                                                             
[ 3943.339324] NAND device: Manufacturer ID: 0xec, Chip ID: 0xd3 (Samsung NAND 1GiB 3,3V 8-bit)                    
[ 3943.347869] Creating 5 MTD partitions on "omap2-nand.0":                                                        
[ 3943.353271] 0x000000000000-0x000000080000 : "xloader-nand"                                                      
[ 3943.360412] 0x000000080000-0x000000240000 : "uboot-nand"                                                        
[ 3943.367889] 0x000000240000-0x000000280000 : "params-nand"                                                       
[ 3943.374786] 0x000000280000-0x000000780000 : "linux-nand"                                                        
[ 3943.383544] 0x000000780000-0x000040000000 : "jffs2-nand"                                                        
[ 3943.814910] CAN device driver interface                                                                         
[ 3943.818878] TI High End CAN Controller Driver 0.7                                                               
[ 3943.824615] ti_hecc ti_hecc.1: device registered (reg_base=d08c8000, irq=24)                                    
[ 3943.832214] ehci_hcd: USB 2.0 'Enhanced' Host Controller (EHCI) Driver                                          
[ 3943.839172] Initializing USB Mass Storage driver...                                                             
[ 3943.844451] usbcore: registered new interface driver usb-storage                                                
[ 3943.850524] USB Mass Storage support registered.                                                                
[ 3943.855438] usbcore: registered new interface driver usbtest                                                    
[ 3943.861175] android init                                                                                        
[ 3943.863952] f_adb init                                                                                          
[ 3943.866394] android_register_function adb                                                                       
[ 3943.870422] f_mass_storage init                                                                                 
[ 3943.873596] android_register_function usb_mass_storage                                                          
[ 3943.879669] input: gpio-keys as /devices/platform/gpio-keys/input/input0                                        
[ 3943.887908] input: lizard-keypad as /devices/platform/lizard-keypad/input/input1                                
[ 3943.898925] using rtc device, ds1374, for alarms                                                                
[ 3943.903503] rtc-ds1374 2-0068: rtc core: registered ds1374 as rtc0                                              
[ 3943.910156] i2c /dev entries driver                                                                             
[ 3943.915222] Linux video capture interface: v2.00                                                                
[ 3943.921051] usbcore: registered new interface driver uvcvideo                                                   
[ 3943.926818] USB Video Class driver (v0.1.0)                                                                     
[ 3943.931121] vpfe_init                                                                                           
[ 3943.933929] Driver for 1-wire Dallas network protocol.                                                          
[ 3943.941925] OMAP Watchdog Timer Rev 0x31: initial timeout 60 sec                                                
[ 3943.948730] sdhci: Secure Digital Host Controller Interface driver                                              
[ 3943.955047] sdhci: Copyright(c) Pierre Ossman                                                                   
[ 3943.977081] usbcore: registered new interface driver usbhid                                                     
[ 3943.982757] usbhid: USB HID core driver                                                                         
[ 3943.987518] logger: created 64K log 'log_main'                                                                  
[ 3943.992462] logger: created 256K log 'log_events'                                                               
[ 3943.997558] logger: created 64K log 'log_radio'                                                                 
[ 3944.002410] logger: created 64K log 'log_system'                                                                
[ 3944.007904] Advanced Linux Sound Architecture Driver Version 1.0.21.                                            
[ 3944.015136] usbcore: registered new interface driver snd-usb-audio                                              
[ 3944.021728] ALSA device list:                                                                                   
[ 3944.024719]   No soundcards found.                                                                              
[ 3944.028411] TCP cubic registered                                                                                
[ 3944.031738] NET: Registered protocol family 17                                                                  
[ 3944.036254] NET: Registered protocol family 15                                                                  
[ 3944.040802] can: controller area network core (rev 20090105 abi 8)                                              
[ 3944.047180] NET: Registered protocol family 29                                                                  
[ 3944.051696] can: raw protocol (rev 20090105)                                                                    
[ 3944.056121] Power Management for TI OMAP3.                                                                      
[ 3944.068298] VFP support v0.3: implementor 41 architecture 3 part 30 variant c rev 1                             
[ 3944.240112] omapdss DPI: Could not find exact pixel clock. Requested 33260 kHz, got 33230 kHz                   
[ 3944.320251] emac-mii: probed                                                                                    
[ 3944.326995] input: ClickTouch Touchscreen as /devices/platform/i2c_omap.2/i2c-2/2-001f/input/input2             
[ 3944.337615] rtc-ds1374 2-0068: setting system clock to 1970-01-10 06:47:08 UTC (802028)                         
[ 3944.345855] omap_vout omap_vout: probed for an unknown device                                                   
[ 3944.858764] eth0: attached PHY driver [SMSC LAN8700] (mii_bus:phy_addr=1:11, id=7c0c4)                          
[ 3945.872467] IP-Config: Complete:                                                                                
[ 3945.875518]      device=eth0, addr=192.168.0.122, mask=255.255.255.0, gw=255.255.255.255,                       
[ 3945.883758]      host=lizard, domain=, nis-domain=(none),                                                       
[ 3945.889221]      bootserver=192.168.0.23, rootserver=192.168.0.119, rootpath=                                   
[ 3945.896820] Looking up port of RPC 100003/2 on 192.168.0.119                                                    
[ 3947.857208] PHY: 1:11 - Link is Up - 100/Full                                                                   
[ 3947.917236] Looking up port of RPC 100005/1 on 192.168.0.119                                                    
[ 3948.029998] VFS: Mounted root (nfs filesystem) on device 0:12.                                                  
[ 3948.035919] Freeing init memory: 172K                                                                           
[ 3948.055450] Warning: unable to open an initial console.                                                         
[ 3948.857513] init: cannot find '/system/etc/install-recovery.sh', disabling 'flash_recovery'                     
# 


Android quick start[edit | edit source]

This section describes how to quick start Android operating system on Dacu.

"Full control" mode[edit | edit source]

  1. connect the serial cable, provided with the board, to J25 pin-strip connector
  2. connect this cable to PC COM port through a NULL-modem cable (not provided)
  3. start your favourite terminal software on PC; communication parameters are:
    • baud rate: 115200 Bps
    • data bits: 8
    • stop bits: 1
    • parity: none
  4. connect the system to Ethernet LAN (RJ45 connector, J6)
  5. connect a 12Vcc power supply to to the power jack (JP2)

Once power has been applied, U-Boot bootloader will be executed and the following messages will be printed on serial console:

U-Boot 2009.11-00074-g34e0d5b-dirty (Jul 17 2012 - 11:00:55) [dacu-android-0.9.2]

AM35xx-GP ES2.0, L3-165MHz
DAVE Lizard board + LPDDR/NAND
I2C:   ready
DRAM:  256 MB
Flash: 32 MB
NAND:  1024 MiB
In:    serial
Out:   serial
Err:   serial
Die ID #7cf60001000000000160ae2d0b01e00a
Net:   davinci_emac_initialize
Ethernet PHY: GENERIC @ 0x11
DaVinci EMAC                                                                                                       
Hit any key to stop autoboot:  0                                                                                   
=>

Once the boot process has completed, you'll get the default Android "desktop":

Android default lock screen

Moreover, you'll have immediate access to the Android shell, so you can use the shell commands to interact with the system and see the output messages on the console. Using the serial console doesn't prevent you from using also the adb tool to access the system.

"Normal" mode[edit | edit source]

  1. connect the system to Ethernet LAN (RJ45 connector, J6)
  2. connect a 12Vcc power supply to to the power jack (JP2)

Once power has been applied, the system will boot loading the software components from the internal flash. Once the boot process has completed, you'll get the default Android "desktop":

You can now access the system using adb.


Default IP address[edit | edit source]

200px-Emblem-important.svg.png

The default IP address is 192.168.0.122


Running the Android Debug Bridge (ADB)[edit | edit source]

ADB is a fundamental development tool and enables remote access to the Android device. ADB is provided with the Android SDK, so before using it you must install the SDK.

To establish the ADB connection, on a Linux host machine open a shell and launch the following commands:

$ export PATH=${PATH}:<your_sdk_dir>/platform-tools
$ export ADBHOST=<target's ip address>
$ adb kill-server
$ adb start-server

On a Windows host machine, open a shell and launch the following commands:

adb tcpip 5555
adb connect <target's ip address>:5555
adb kill-server
adb start-server


To check the connection, please launch

$ adb devices 

If everything is working properly, you should see the following messages:

$ adb devices
List of devices attached
emulator-5554    device

You can open a remote shell using the following command:

$ adb shell

To install an application (in .apk format), you can use the following commmand:

$ adb install <path to apk>


Useful Links[edit | edit source]

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_ReleaseNotes

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_PortingGuides

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_DeveloperGuide

http://processors.wiki.ti.com/index.php/TI-Android-GingerBread-2.3.4-DevKit-2.1_UserGuide