Upload
lelien
View
233
Download
0
Embed Size (px)
Citation preview
External Use
TM
Develop Software for Android™
on i.MX Applications Processors
FTF-SDS-F0169
A P R . 2 0 1 4
Guoyin Chen | Team Leader for i.MX Applications Processors and Android
TM
External Use 1
Session Introduction
• Introduction of Android BSP for i.MX 6 series
processors
• Walk-through Android SDK and ADB
• Step-by-step tutorial for developing a simple
Android application
• Miscellaneous tools for debugging in Android BSP
TM
External Use 2
Session Objectives
• After completing the session you will be able to understand:
− What Freescale provides in the Android BSP for i.MX 6 series
processors for your product
− How to deploy and customize the Android BSP for i.MX 6 series
processors for your product
− How to create an Android application and install it into i.MX 6 series
processors
− Ways to help debug issues in Android BSP
TM
External Use 3
Agenda
• Android BSP for i.MX 6 series processors
− Overview of Android BSP release packages
− Deploy Android BSP release package
− Customize Android BSP release package
• Android SDK
• Simple Android application
• Misc tools for debugging in Android BSP
TM
External Use 4
History of Android BSP Releases Android Google Release First Freescale Release
Cupcake
Android 1.0 (September 2008)
Android 1.1 (February 9, 2009)
Android 1.5 (April 2009)
R3 (June 2009)
Donut Android 1.6 (September 2009) R5 (September 2009)
Eclair
Android 2.0 (October 2009)
Android 2.0.1 (December 2009)
Android 2.1 (January 2010)
R7 (January 2010)
Froyo
Android 2.2 (May 2010)
Android 2.2.1 (January 2011)
Android 2.2.2 (January 2011)
Android 2.2.3 (November 2011)
R9 (August 2010)
Gingerbread
Android 2.3 (December 2010)
Android 2.3.3 (February 2011)
Android 2.3.4 (April 2011)
Android 2.3.5 (July 2011)
Android 2.3.6 (September 2011)
Android 2.3.7 (September 2011)
R10 (January 2011)
Honeycomb
Android 3.2 (July 2011)
Android 3.2.1 (September 2011)
Android 3.2.2 (August 2011)
Android 3.2.4 (December 2011)
Android 3.2.6 (February 2012)
R11 (September 2011 – i.MX53)
R12 (September 2011 – i.MX 6D/Q)
Ice Cream Sandwich
Android 4.0.1 (October 2011)
Android 4.0.2 (November 2011)
Android 4.0.3 (December 2011)
Android 4.0.4 (March 2012)
R13 (December 2011)
R13.1 (January 2012)
R13.3 (June 2012)
R13.4 GA (September 2012)
*to align to 6Series launch
JellyBean
Android 4.1 (September 2012)
Android 4.2 (December 2012)
Android 4.3 (July 2013)
JB 4.1 GA candidate – Dec 2012
JB 4.2 Beta Feb 2012
JB 4.2 GA – April 2012
JB 4.3 GA – November 2013
Kit Kat
Android 4.4 (November 2013) KK 4.4.2 Alpha – Jan 2014
KK 4.4.2 Beta - May 2014
KK 4.4.2 GA – June 2014
TM
External Use 5
i.MX6Q/i.MX6D SabreSDB/SDP, SabreAI
i.MX6DL/i.MX6S SabreSDP, SabreAI
i.MX6SL EVK
Android BSP Recent Releases
Android
Releases
Long-term
Release
(Planning)
Releases
O N D J F M A M J J A S O N D J F M A M J J A S O N D
4Q 1Q 2Q 3Q 4Q 1Q 2Q 3Q 4Q
2012 2013 2014
“L” Android Release
Jellybean
4.2
Kit Kat
4.4
“L” Android
(Est.)
Jellybean
4.3
JB4.1.2_1.0.0-beta
JB4.2.1_1.0.0-alpha
JB4.2.2_1.1.0
L3.0.35 Kernel
KK4.4_1.0.0-alpha
L3.0.35 Kernel
KK4.4_1.0.0
L3.0.35 Kernel
KK4.4_1.0.0-beta
L3.0.35 Kernel
JB4.2.2_1.0.0
JB4.3_1.0.0-beta
L3.0.35 Kernel
JB4.3_1.1.0
L3.0.35 Kernel
JB4.3_1.0.0
L3.0.35 Kernel
TM
External Use 6
Android JB4.3_1.0.0 Release
• Available at https://community.freescale.com/docs/DOC-98524
Name Description
android_jb4.3_1.0.0-ga_docs.tar.gz Quick Start: A manual explains how to run android on i.MX board by
using prebuilt images.
User Guide: A detailed manual for this release package.
FAQ: A document lists “Frequently Asked Questions”.
Release Note: A document to introduce the key updates and known
issues in this release.
android_jb4.3_1.0.0-ga_source.tar.gz All Freescale i.MX processor specific patches (apply to Google
Android repo)
android_jb4.3_1.0.0-ga_image_6qsabresd.gz Prebuilt images for the SABRE-SD board
android_jb4.3_1.0.0-ga_image_6qsabreauto.gz Prebuilt images for the SABRE-AI board
android_jb4.3_1.0.0-ga_image_6slevk.gz Prebuilt images for the 6SL EVK board
android_jb4.3_1.0.0-ga_tools.tar.gz Manufacture tools for i.MX applications processors
TM
External Use 7
Deploy Android JB4.3_1.0.0 BSP
1. Fetch the code base android-4.3_r2.1 from Google’s AOSP Repository
2. Fetch the code base form Freescale public gits at git.freescale.com
3. Apply Source code patches in android_jb4.3_1.0.0-ga_source.tar.gz
Freescale Android Source Code Repository
bionic.git framework
/native.git
device/fsl.
git
hardware/i
mx.git AOSP gits
uboot-
imx.git
Kernel-
imx.git
Freescale
patches
Freescale
patches
From Google’s AOSP Repository android-4.3_r2.1
From android_jb4.3_1.0.0-ga_source.tar.gz
From Freescale public gits at git.freescale.com
TM
External Use 8
Customize Android for Your Boards - uBoot
• Configs for uboot
− include/configs/mx6x_xxx_android.h
• Default boot command
− board/freescale/mx6x_xxx/mx6x_xxx.c
• Ways to android recovery mode
− board/freescale/mx6x_xxx/mx6x_xxx.c
TM
External Use 9
Customize Android for Your Boards – Linux Kernel
• Configurations for Linux kernel
− i.MX6DQ/DL/Solo: arch/arm/configs/imx6_android_defconfig
− i.MX6SL:arch/arm/configs/imx6s_android_defconfig
− Reference the link http://source.android.com/devices/tech/kernel.html
TM
External Use 10
Customize Android for Your Boards – Linux Kernel
• Memory reserved adjustment
− i.MX6DQ/DL/Solo:
mx6q_sabresd_reserve() &
fixup_mxc_board() in arch/arm/mach-
mx6/board-mx6q_sabresd.c
mx6q_reserve() & fixup_mxc_board()
arch/arm/mach-mx6/board-
mx6q_sabreauto.c
− i.MX6SL:
mx6_evk_reserve() in arch/arm/mach-
mx6/board-mx6sl_evk.c
TM
External Use 11
Customize Android for Your Boards – Linux Kernel
Power key: Its irq should be
set as wakeup source IRQ
Volume-Up key
Volume-Down key
• GPIO/Keypad definitions
− i.MX6DQ/DL/Solo:
arch/arm/mach-mx6/board-mx6q_sabresd.c
arch/arm/mach-mx6/board-mx6q_sabreauto.c
− i.MX6SL:
arch/arm/mach-mx6/board-mx6sl_evk.c
• Register early suspend handler for specific drivers
− register_early_suspend() as in drivers/input/touchscreen/egalaxy_ts.c
Running
Early
Suspend
Suspend
Late
Resume
TM
External Use 12
Customize Android for Your Boards – Android rootfs
• myandroid/device/fsl
− Bootloader config to be build in android build system should be set in TARGET_BOOTLOADER_CONFIG
− Kernel config to be build in android build system should be set in TARGET_KERNEL_DEFCONF
− Default bootargs stored in boot.img should be set in BOARD_KERNEL_CMDLINE
− Files to be copied in android’s rootfs should be updated into PRODUCT_COPY_FILES
− APK, library, execute binary to be included in Android’s rootfs should be updated into PRODUCT_PACKAGES
− Remove or Add android features in requried_hardware.xml
− Storage block devices and partitions to be mounted should be updated in fstab.freescale
TM
External Use 13
Customize Android for Your Boards – Android rootfs
Partition Type/Index Name Start Offset Size File System Content
N/A BOOT Loader 512 1 MB N/A u-boot.bin
Primary 1 Boot 8 MB 8 MB boot.img format – zImage +
ramdisk boot.img
Primary 2 Recovery After end of Boot 8MB boot.img format – zImage +
ramdisk recovery.img
Logic 5
(Extended 3) SYSTEM
After end of
Recovery 512 MB
EXT4 – mount as /system system.img
Logic 6
(Extended 3) CACHE
After end of
SYSTEM 512 MB
EXT4 – mount as /cache Android cache for OTA
image store
Logic 7
(Extended 3) Device
After end of
CACHE 8MB
EXT4 – mount as /device For Store MAC
address files.
Logic 8
(Extended 3) Misc
After end of
Device 4 MB
N/A Recovery store,
bootloader message
Primary 4 DATA After end of Misc Up to remaining
sectors
N/A Application data storage for system application. And for
internal media partition, in
/mnt/sdcard/ dir.
TM
External Use 14
Customize Android for Your Boards – Android rootfs
myandroid/device/fsl$ cat sabresd_6dq/fstab.freescale
# Android fstab file.
#<src> <mnt_point> <type> <mnt_flags and options> <fs_mgr_flags>
# The filesystem that contains the filesystem checker binary (typically /system) cannot
# specify MF_CHECK, and must come before any filesystems that do specify MF_CHECK
/devices/platform/sdhci-esdhc-imx.2/mmc_host/mmc1 /mnt/extsd vfat defaults voldmanaged=sdcard:auto
/devices/platform/fsl-ehci /mnt/udisk vfat defaults voldmanaged=sdcard:auto
/dev/block/mmcblk0p5 /system ext4 ro wait
/dev/block/mmcblk0p4 /data ext4 nosuid wait
/dev/block/mmcblk0p6 /cache ext4 nosuid, wait
/dev/block/mmcblk0p7 /device ext4 ro,nosuid,nodev wait
/dev/block/mmcblk0p1 /boot emmc defaults defaults
/dev/block/mmcblk0p2 /recovery emmc defaults defaults
/dev/block/mmcblk0p8 /misc emmc defaults defaults
TM
External Use 15
Android SDK&Tools
• API Reference
− http://developer.android.com/reference/packages.html
• Android Plugin (ADT) & Eclipse
− http://developer.android.com/sdk/index.html
− Development environment for building Android apps. It's a full
Java IDE with advanced features to help you build, test, debug,
and package your Android apps
• Android SDK
− http://developer.android.com/sdk/index.html
− Install everything except Additional SDK Platforms
TM
External Use 16
Android SDK&Tools
• Android SDK Manager
− To download SDK Platform, SDK tool, and Google USB driver
− Start as SDK/tools/android.bat
TM
External Use 17
Android SDK&Tools
• SDK Platform
− One SDK platform per each
Android version, corresponding
with an API version.
− Includes an Android library and
system image, as well as a set
of emulator skins
TM
External Use 18
Android SDK&Tools
• Emulator
− a virtual mobile device that runs
on your computer. The emulator
lets you develop and test
Android applications without
using a physical device.
TM
External Use 19
Android SDK&Tools
• Android Debug Bridge (adb) A client, which runs on your development machine. You can invoke a client from a shell by
issuing an adb command. Other Android tools such as the ADT plugin and DDMS also
create adb clients.
A server, which runs as a background process on your development machine. The server
manages communication between the client and the adb daemon running on an emulator
or device.
A daemon, which runs as a background process on each emulator or device instance.
ADB
Client 0
ADB
Client 0
ADB
Client 0
ADB
daemon ADB
server
Host PC
Android device
TM
External Use 20
Android Demo Application Compilation and Deployment
1. In Eclipse, select File > New > Android Application Project
2. Fill in the Project Name: with HelloAndroid leave the rest of the parameter with the default and click on Next >
TM
External Use 21
Android Demo Application Compilation and Deployment
3. On the new screen leave the defaults click Next>
TM
External Use 22
Android Demo Application Compilation and Deployment
4. On the new screen leave the defaults click Next>
TM
External Use 23
Android Demo Application Compilation and Deployment
5. On the new screen leave the defaults click Next>
TM
External Use 24
Android Demo Application Compilation and Deployment
6. On the last screen leave the defaults click Finish>
TM
External Use 25
Android Demo Application Compilation and Deployment
7. Your Android project is now ready. Close the Android IDE tab and the new
project should be visible in the Package Explorer on the left. Open the
MainActivity.java file, located inside HelloAndroid > src >
com.example.helloandroid. It should look like this:
TM
External Use 26
Android Demo Application Compilation and Deployment
8. Now we need to connect SABRE Board for Smart Devices Based
on i.MX 6 series as an Android device to eclipse. Power on the
BSD.
9. Connect the USB OTG to the computer.
10. Open the Run Configurations… windows located in Run-> Run
Configurations…
11. Double click on the Android Application tab
TM
External Use 27
Android Demo Application Compilation and Deployment
13. Fill the Name: and Project: sections with the next information,
click on Apply and then on Run
TM
External Use 28
Android Demo Application Compilation and Deployment
14. On the i.MX 6 series board click on the Always allow from this computer option and then click Ok
15. In the Android Device Chooser windows, select the freescale-sabresd device and click on OK.
16. The application will be launched on the i.MX 6 board.
TM
External Use 29
Misc Tools for Debugging in Android BSP - Traceview
• A graphical viewer for execution logs saved by your application
• Help you debug your application and profile its performance.
TM
External Use 30
Misc Tools for Debugging in Android BSP - Traceview
• Start the DDMS in SDK folder
• Select a application
• Click the button “Start Method Profiling”
TM
External Use 31
Misc Tools for Debugging in Android BSP - Traceview
• Click the button “Stop Method Profiling”
TM
External Use 32
Misc Tools for Debugging in Android BSP - Traceview
• Incl CPU time is the inclusive cpu time. It is the sum of the time spent in the function itself, as well as the sum of the times of all functions that it calls.
• Excl CPU time is the exclusive cpu time. It is only the time spent in the function itself. You'll notice that it is always the same as the "incl time" of the "self" child.
• The CPU time is the time that the function is actually running (this would not include waiting on IO)
• The real time is the wall clock time (which would include time spent doing IO).
TM
External Use 33
Misc Tools for Debugging in Android BSP - dumpstate
"usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-
s]\n“
" -o: write to file (instead of stdout)\n“
" -d: append date to filename (requires -o)\n“
" -z: gzip output (requires -o)\n“
" -p: capture screenshot to filename.png (requires -o)\n“
" -s: write output to control socket (for init)\n“
" -b: play sound file instead of vibrate, at beginning of job\n“
" -e: play sound file instead of vibrate, at end of job\n"
TM
External Use 34
Misc Tools for Debugging in Android BSP - dumpsys
• root@android:/ #service list
• root@android:/ # dumpsys SurfaceFlinger
TM
External Use 35
Misc Tools for Debugging in Android BSP - screencap
usage: screencap [-hp] [FILENAME]
-h: this message
-p: save the file as a png.
If FILENAME ends with .png it will be saved as a png.
If FILENAME is not given, the results will be printed to stdout.
root@android:/ # screencap -p /sdcard/screencap.png
Note:
You need to restart the board to view the png file in
Android’s Gallery application
TM
External Use 36
Misc Tools for Debugging in Android BSP - powerdebug
Usage: powerdebug [OPTIONS]
powerdebug -d [ -r ] [ -s ] [ -c [ -p <clock-name> ] ] [ -v ]
powerdebug [ -r | -s | -c ]
-r, --regulator Show regulator information
-g, --gpio Show gpio information
-s, --sensor Show sensor information
-c, --clock Show clock information
-p, --findparents Show all parents for a particular clock
-t, --time Set ticktime in seconds (eg. 10.0)
-d, --dump Dump information once (no refresh)
-v, --verbose Verbose mode (use with -r and/or -s)
-V, --version Show Version
-h, --help Help
TM
© 2014 Freescale Semiconductor, Inc. | External Use
www.Freescale.com