androit real-time for the rest of...
TRANSCRIPT
Corporate Technology
AndroitReal-time for the rest of us
Android Builders Summit 2012
Wolfgang Mauerer
Siemens AG, Corporate Competence Centre Embedded LinuxCorporate Research and Technologies, Open Source Platforms
Copyright © 2012, Siemens AG. All rights reserved.
Page 1 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Corporate Technology
AndroitReal-time for the rest of us
Android Builders Summit 2012
Wolfgang Mauerer, Jan Sawallisch, Gernot Hillier
Siemens AG, Corporate Competence Centre Embedded LinuxCorporate Research and Technologies, Open Source Platforms
S. Honick, S. Oberthur, University Paderborn
Copyright © 2012, Siemens AG. All rights reserved.
Page 1 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Overview
1 Introduction & Rationale
2 PREEMPT RT
3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements
4 Building Your Own
Page 2 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Outline
1 Introduction & Rationale
2 PREEMPT RT
3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements
4 Building Your Own
Page 3 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android & Industrial Control I
Page 4 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android & Industrial Control II
Page 5 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android & Industrial Control II
Page 5 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
From Android™ to Androit
From Android to Androit
Android and real-time
A bon droit – the right choice!
Business
Machine consolidation
Multi-Coreproliferation
Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
From Android™ to Androit
From Android to Androit
Android and real-time
A bon droit – the right choice!
Business
Machine consolidation
Multi-Coreproliferation
Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
From Android™ to Androit
From Android to Androit
Android and real-time
A bon droit – the right choice!
Business
Developer availability
Attractivity sells
Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
From Android™ to Androit
From Android to Androit
Android and real-time
A bon droit – the right choice!
Business
Developer availability
Attractivity sells
Technical
Reduced HMI complexity
Opportunity: RT/non-RTseparation
App model
Licensing
Page 6 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android 6= Embedded Linux
Architecture: (Embedded) LinuxApplications
Framework Applications
POSIX libc
Linux + BSP
C/C++
C
Syscall
IPC
C
Key Concepts
Movecomplexityupwards
Lingua Franca:Java
Consistency
On Philosophy
The whole is greater than the sum of its parts!
Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android 6= Embedded Linux
Architecture: (Embedded) Android
App
App Framework
CoreLibsDalvik
Bionic
Java
JNI
Binder, JavaApp
Binder
Linux + BSP+ Android Patches
Syscalls
Zygote
Key Concepts
Movecomplexityupwards
Lingua Franca:Java
Consistency
On Philosophy
The whole is greater than the sum of its parts!
Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android 6= Embedded Linux
Architecture: (Embedded) Android
App
App Framework
CoreLibsDalvik
Bionic
Java
JNI
Binder, JavaApp
Binder
Linux + BSP+ Android Patches
Syscalls
Zygote
Key Concepts
Movecomplexityupwards
Lingua Franca:Java
Consistency
On Philosophy
The whole is greater than the sum of its parts!
Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Android 6= Embedded Linux
Architecture: (Embedded) Android
App
App Framework
CoreLibsDalvik
Bionic
Java
JNI
Binder, JavaApp
Binder
Linux + BSP+ Android Patches
Syscalls
Zygote
Key Concepts
Consistency forusers anddevelopers
Convenientand saferlanguages
On Philosophy
The whole is greater than the sum of its parts!
Page 7 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit: Use Cases
Consumer
In-car entertainment
Home control
Industrial
Small PLCs
Transportation and medicalsystems (Safety?Certification?)
Page 8 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Outline
1 Introduction & Rationale
2 PREEMPT RT
3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements
4 Building Your Own
Page 9 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
PREEMPT RT: Overview
Goal
Transform Linux into hard RTkernel
Merge Strategy
Merge upstream, by end of year
Roadmap Architecture
Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
PREEMPT RT: Overview
Goal
Transform Linux into hard RTkernel
Merge Strategy
Predictions: Learn from cold fusion
Roadmap Architecture
Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
PREEMPT RT: Overview
Goal
Transform Linux into hard RTkernel
Merge Strategy
Predictions: Learn from cold fusion
Roadmap Architecture
Page 10 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
PREEMPT RT: State of Affairs
Mainline
High-res timers
PI Mutexes
Kernel preemption/Threadedinterrupts
Spinlock annotations
Out of Tree
Lock transformation
Unconditional threadedinterrupts
Latency optimisation, bugfixes
Illustration
Spinlock IRQ Sleeping lock IRQ
Z Z Z
R R R
Page 11 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Outline
1 Introduction & Rationale
2 PREEMPT RT
3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements
4 Building Your Own
Page 12 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit Architecture: Challenges
Challenges
Android, preempt rt and BSP integration
Propagating real-time “upwards”
Consolidate RT and application model
Asymmetry: HMI vs. RT
Page 13 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit Architecture: Challenges
Challenges
Android, preempt rt and BSP integration
Propagating real-time “upwards”
Consolidate RT and application model
Asymmetry: HMI vs. RT
Page 13 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit: Software Architecture I
Architecture Variants
IntegrateRT-JVM
Extend DVM Hybrid Approach
Application Framework
LibsAndroid Runtime
Applications
Linux Real-Time
Core Libs
Dalvik VM RT-JVM
Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit: Software Architecture I
Architecture Variants
IntegrateRT-JVM
Extend DVM Hybrid Approach
Application Framework
LibsAndroid Runtime
Applications
Linux Real-Time
Core LibsDalvik VMWith RT
Extensions
Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit: Software Architecture I
Architecture Variants
IntegrateRT-JVM
Extend DVM Hybrid Approach
Application Framework
Libs Android Runtime
Applications
Linux Real-Time
Core Libs
Dalvik VM
Real-TimeApplications
CommunicationChannel
Page 14 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit: Software Architecture II
Architecture
Application Framework
Libs Android Runtime
Applications
Linux Real-Time
Core Libs
Dalvik VM
Real-TimeApplications
CommunicationChannel
Design decisions
Decouple RT and non-RT(Middleware?)
Java coupling: RCU,transactions
Introduce glibc
Page 15 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Demonstration: Measurement Setup
Output Signal
HDMI-Output-Pin:„5V enable“
HDMI-Input-Pin:„hot plug detect“
Input Signal
Interrupt Latency
Signal Generator Oscilloscope
Timer Latency
Android Device„Motorola Xoom“
HDMI cable
Page 16 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Demonstration
Page 17 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Performance Measurements I
Observed Timer Delay [µs]
# s
ampl
es [a
.u.]
1
10
100
1000
1
10
100
1000
CPU 0
100 200 300 400 500
CPU 1
100 200 300 400 500
RT
Non−
RT
Page 18 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Performance Measurements I
Getclock results available
Handler scheduled in
HRT finished
HRT processing
Timer
fires
Timer
expected
3µs 5µs 7µs 30µs 20µs
t
Delay [µs]
# S
ampl
es [a
.u.]
1
10
100
1000
10000
1
10
100
1000
10000
Expiration delay
0 50 100
150
200
250
HRT handler delay
0 50 100
150
200
250
HRT duration
0 50 100
150
200
250
Schedule In
0 50 100
150
200
250
Getclock
0 50 100
150
200
250
RT
Non−
RT
Page 18 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Outline
1 Introduction & Rationale
2 PREEMPT RT
3 Androit ArchitectureSoftware ArchitectureDemonstrationPerformance Measurements
4 Building Your Own
Page 19 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Good, Bad, Ugly
IssuesDevice Access
Sources/BSP
Interfaces
Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia
Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Good, Bad, Ugly
BSP Theorem
RBSP(n) ∝ 1
n
Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia
Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Good, Bad, Ugly
Corollary
limn→∞
RBSP(n) = 0
Image Sources: Motorola, gizmodo.de, Freescale, ww1.prweb.com, Wikipedia
Page 20 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit HOWTO
Fo
rwa r
d
BS
P
An
dro
id
Pre
emp
t R
T
Van
ill a
Van
ill a
Van
ill a
Base System Tasks
preempt rt-capable base kernel(BSP!)
Android patches
preempt rt patches
Latency tuning (device drivers!)
Userland Tasks
Android component adaption
RT control integration
Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit HOWTO
# of
Pat
ches
0
50
100
150
200
250
Andro
id Fixe
sBSP
Andro
id
BSP Fixe
s
Gener
ic
Late
ncy
Preem
pt_R
T
Preem
pt_R
T Fixe
s
Base System Tasks
preempt rt-capable base kernel(BSP!)
Android patches
preempt rt patches
Latency tuning (device drivers!)
Userland Tasks
Android component adaption
RT control integration
Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Androit HOWTO#
of P
atch
es
0
10
20
30
40
50
60
Andro
id Fixe
sBSP
Andro
id
BSP Fixe
s
Gener
ic
Late
ncy
Preem
pt_R
T
Preem
pt_R
T Fixe
s
Base System Tasks
preempt rt-capable base kernel(BSP!)
Android patches
preempt rt patches
Latency tuning (device drivers!)
Userland Tasks
Android component adaption
RT control integration
Page 21 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4
Thanks for your interest!
Page 22 February 14, 2012 Dr. W. Mauerer Corporate Technology T DE TC 4