Getting Started with Android Development for Embedded Systems
Colin Walls
[email protected]
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
2 www.mentor.com/embedded
What is Android?
An operating system for smart phones?
yes and no
An integrated software platform for building smart phones?
almost
An integrated software platform for building connected devices
application framework on top of Linux open source not GPL
3 www.mentor.com/embedded
What is Android?
Application
Application
Application Framework
Windows
DOS
DOS
4 www.mentor.com/embedded
What is Android?
Application
Application
Open Source or Proprietary Middleware glibc or uClibc
Android
Linux
Linux
5 www.mentor.com/embedded
Android History
2005 2007 2008 2008 2009 Google acquires Android Inc. Open Handset Alliance announces Android First Android based handset launched Android source code released Mentor Graphics acquires Embedded Alley
6 www.mentor.com/embedded
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
7 www.mentor.com/embedded
Android Architecture
Linux
2.6.3x
115 patches required
provides:
process management memory management security networking drivers:
display, keypad, camera, WiFi, flash, audio, IPC, power
Linux
8 www.mentor.com/embedded
Android Architecture
Libraries
e.g.:
libc - bionic media libraries graphics SQLite
Libraries
Linux
9 www.mentor.com/embedded
Android Architecture
Android runtime
Dalvik VM Not a Java VM
register based
one instance per application memory optimized uses Linux to manage memory and multithreading
Libraries Android runtime
Linux
10 www.mentor.com/embedded
Android Architecture
Application framework
services and systems:
views content providers resource manager notification manager activity manager
Libraries Android runtime Application framework
all Java classes any application can publish its capabilities
Linux
11 www.mentor.com/embedded
Android Architecture
Applications
programs provided:
email SMS calendar Web browser contacts
Applications Application framework
Libraries
all applications have the same status Java programs
Uses standard Java tools Converted to Dalvik bytecode
Android runtime
Linux
12 www.mentor.com/embedded
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
13 www.mentor.com/embedded
Development Environment
Eclipse based
Android Development Tools (ADT) plug-in Create an Android Virtual Device (AVD) Android Emulator
or
Target device
T-Mobile G1 Android Dev Phone 1 USB connection
Only ARM devices
14 www.mentor.com/embedded
Programming Model
All the resources for an application are bundled into an archive Android package Programs written in Java
run using Dalvik VM use non-standard, memory efficient bytecodes each program has its own Linux process data protected, but sharing possible
15 www.mentor.com/embedded
Programming Model
No single entry point main()
components instantiated and run as required types of components:
activities services broadcast receivers content providers
16 www.mentor.com/embedded
Programming Model
Activities
executable unit that performs specific function has UI application may have numerous activities one activity nominated as default [entry point]
Broadcast receivers
respond to broadcast messages
Content providers
makes applications data available to others can be: file system SQLite other
Services
similar to activity no UI runs in the background
targeted by
ContentResolver
17 www.mentor.com/embedded
Programming Model
Manifest file
describes components of an application structured XML file
called AndroidManifest.xml
<?xml version="1.0" encoding="utf-8"?> <manifest . . . > <application . . . > <activity android:name="com.example.project.MyActivity . . . > </activity> . . . </application> </manifest>
18 www.mentor.com/embedded
Programming Model
Intents
asynchronous messages activate activities, services, and broadcast receivers for activities and services, specifies action and location of data applications have intent filters
19 www.mentor.com/embedded
Programming Model
Intent filters
describe what intent the components of an application can handle in manifest file
<application . . . > <activity android:name="com.example.project.MyActivity . . . > <intent-filter . . . > <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> . . . </application>
20 www.mentor.com/embedded
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
21 www.mentor.com/embedded
Android is Designed for Mobile Phones
22 www.mentor.com/embedded
Android Experience on Any Platform?
Consumer
Telcom
Automotive
Medical
Home
White Goods
Not so easy
23 www.mentor.com/embedded
Meaningful Telecom Connections
Consumer Medical Automotive Home White Goods
Medical
Automotive
White Goods
Telecom
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
26 www.mentor.com/embedded
The Embedded Alley approach Offer software and tools that precisely fit the customers product platform Maximize Open Source leverage for customers
Collaborate closely throughout the customer product life cycle
27 www.mentor.com/embedded
Bridging the Smartphone Gap
Today Android strongly tied to 3G mobile devices
Chipsets, development tools, ecosystem (ARM, Qualcomm) Platform developer community anchored in Open Handset Alliance
Needs investment to enable wider market
Embedded CPUs, device drivers, board support Broader open source community
Embedded Alley is bridging that gap
Enabling popular embedded CPUs and chipsets Extending reach of Android Runtime porting/optimizations, development tools
28 www.mentor.com/embedded
Embedded Alley and Android
Dramatically expands Android application space
Handheld multimedia Digital video Automotive Medical devices Home automation and SOHO networking Instrumentation and industrial control
29 www.mentor.com/embedded
Android Deployment
Enable Customers to build product specific applications, UI Produce product specific SDK and emulator Extending beyond handset assumptions Enable developing product and industry specific classes
Applications Application framework
Porting/optimizing for instruction sets Integrating with hardware acceleration Extending beyond handset assumptions Enable product and industry specific middleware
Libraries
Android runtime
Porting and optimizing Android Dalvik VM for CPU cores and SoCs
Linux
Providing Androidready Linux kernel Integrating and testing board support and industry-specific device drivers 30 www.mentor.com/embedded
Development System for Android
Provides the latest stable Android runtime (Cupcake, 1.5)
Includes optimized Libraries for Architecture and CPU core Includes optimized Dalvik VM for the Architecture and the CPU core
Platform Libraries, Kernel
Developing and adding board ports and custom drivers Developing and adding product specific C/C++ Libraries (more than NDK) Enables customizing HAL for hardware specific needs
Runtime Dalvik, Java Native Interface
Developing and adding product specific JNI
Application Framework
Developing and adding product specific classes Enables customizing the UI, theme, and icons
Application SDK and Emulator (modified ADT, JDT Eclipse plug in)
Create product specific Application SDK Enables customizing the emulator to match the product (hardware, behavior and skins)
31 www.mentor.com/embedded
Embedded Alley Development System
Eclipse IDE for application development, tools and debug
Latest stable gcc, binutils and gdb/gdbserver (CDT) Dnload app, console window, automatic debug connection (DSDP)
Match Customer requirements and workflow
Integration and build tool to create product specific runtime Build both proprietary code and open source components Control build type and flags - debug, code coverage, optimization levels, CPU flags Integrate with customer workflow and source control
Best practices and real world workflow
Reproducible builds Software BoM, Source package, License Auditing and Traceability Multiple build targets - development, test, production, manufacturing
User documentation
32 www.mentor.com/embedded
Android Services
Custom board ports kernel and Android Extend Android I/O support with JNI and Class support Integrate product/industry specific middleware Turnkey solutions Application development Integration and Support services
33 www.mentor.com/embedded
Agenda
Introduction Android architecture Application development Android deployment Mentor Graphics support for Android Conclusions
34 www.mentor.com/embedded
Conclusions
Android is a disruptive technology
introduced for mobile phones much wider potential
Many challenges in wider Android deployment Mentor Graphics is committed to supporting developers who choose Android/Linux
35 www.mentor.com/embedded
Questions?
Colin Walls
[email protected]
blogs.mentor.com/colinwalls