28
1 1 Android for Industrial Applications Marcel Ziswiler Noser Engineering AG

Embedded LInux in a Nutshell

Embed Size (px)

Citation preview

Page 1: Embedded LInux in a Nutshell

1 1

Android for Industrial Applications

Marcel ZiswilerNoser Engineering AG

Page 2: Embedded LInux in a Nutshell

2 2

ContentsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Introducing Android Why Android for Industrial Applications Introducing the Hardware Notes about Porting Embedded Linux/Android Real-Time Extension – Xenomai IOs, Field Busses, Wired Communication Continuing Information

Page 3: Embedded LInux in a Nutshell

3

Introducing Android

What is Android?How about its architecture?

What are the system requirements?What kernel extensions are required?

Page 4: Embedded LInux in a Nutshell

4

Open-source mobile phone platform initiated by Google Building a better phone for consumers source.android.com

Open handset alliance Several companies innovate in the open …Increased openness will enable everyone in our industry to innovate

more rapidly and respond better to consumer's demands. … openhandsetalliance.com

Noser Engineering AG is a founding member of the OHA and works

on core functionality (core libraries, certification framework)

Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 5: Embedded LInux in a Nutshell

5

Android ArchitectureContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 6: Embedded LInux in a Nutshell

6

Recent Linux kernel running on your target HW

ARM based SoC Low-level assembly optimisation Code generation in graphics subsystem

128 MB SDRAM

256 MB flash favourably of the NAND kind

Optimised for 16 bpp QVGA LCD with capacitive touch screen

At least 5 button navigation keypad

System RequirementsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 7: Embedded LInux in a Nutshell

7

Ashmem mm/ashmem.c Anonymous shared memory subsystem Allow processes to share named blocks of memory Kernel may reclaim them if not in use

Binder IPC drivers/android/binder.c System oriented component architecture Providing object-oriented operating system environment Inter-process communication (IPC) between processes and

thread pools Memory management and clean-up functionality

Android Kernel ExtensionsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 8: Embedded LInux in a Nutshell

8

Logger drivers/android/ram_console.c

Store kernel log messages in RAM buffer drivers/android/logger.c

Logging mechanism for user processes to read and write system log messages

Low Memory Killer drivers/misc/lowmemorykiller.c Scans list of running processes and kills one Optional component not required for basic bring-up

Android Kernel Extensions (cont.)Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 9: Embedded LInux in a Nutshell

9

Power management drivers/android/power.c At its core uses regular Linux power management subsystem Does not poll for power related changes Uses iNotify interface via fs/inotify_user.c Subscribe to power related updates

YAFFS2 Yet another flash file system 2nd edition fs/yaffs2/* Primary file system for low-cost high density NAND flash based

storage Not part of any mainline kernel yet

Android Kernel Extensions (cont.)Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 10: Embedded LInux in a Nutshell

10

Android Kernel ConfigurationContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Requires one to enable previously discussed features

Standard Android kernel configuration (emulator)

arch/arm/configs/goldfish_defconfig

Page 11: Embedded LInux in a Nutshell

11

Special ConsiderationsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Frame buffer Requires double buffering aka panning functionality Allocate twice the memory required for actual frame size Pan function selects which part is actually output to screen

Touch screen Android uses standard Linux input subsystem Driver that not only reports pressure but button touch as well

BTN_TOUCH upon detecting pen down event Many mainline touch drivers do not implement it that way

drivers/input/touchscreen/ucb1400_ts.c drivers/input/touchscreen/wm97xx-core.c

Page 12: Embedded LInux in a Nutshell

12

Touch Screen CalibrationContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

No support for calibration as required by resistive touch screens

Only capacitive touch screens not requiring any calibration

Traditionally touch screen calibration handled by tslib Special ts_calibrate application Generates /etc/pointercal file containing calibration constants

Integrated calibration calculation into Android Did not bother to port actual calibration application to Android Just integrate correct calibration file into Android file system

/system/etc/pointercal

Page 13: Embedded LInux in a Nutshell

13

Why Android for Industrial Applications?

What is already there?What is missing to make it a suitable framework for

industrial applications?

Page 14: Embedded LInux in a Nutshell

14

Robust embedded Linux kernel

Most widely used native open-source libraries/components

Well thought out partitioning between native and managed code

Optimised virtual execution environment: Dalvik VM

Flexible application framework

Well defined Java API for custom applications

User-friendly human machine interface (HMI)

Complete development environment with Eclipse and QEMU

What is already there?Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 15: Embedded LInux in a Nutshell

15

Hard real-time kernel: support for real-time code

Safety critical aspects

Support for industrial interfaces Analog and digital IOs Field busses Wired communication

What is still missing?Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 16: Embedded LInux in a Nutshell

16

Framework extensions for typical industrial use-cases– Intelligent control systems– Instrumentation, control and automation– Communication with (distributed) sensors and actuators– Monitoring, processing and production– Signal analysis– Process control

Standard applications suitable for industrial use-cases

What is still missing?Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 17: Embedded LInux in a Nutshell

17

Introducing the Hardware

What are the key components?Toradex Colibri XScale PXA320

Toradex Limestone PDA Design Kit

Page 18: Embedded LInux in a Nutshell

18

Most embedded HW centred around System On Chip (SoC)

Important to understand bus/chip mapping What chips hooked up to what buses:

AC97, I2C, PCI, peripheral, SDRAM controller, SPI, USB bus Bus width vs. chip width Address pin used for command/data FIFO switching Bus timing: SRAM vs. VLIO modes Specialities like address offsets (shifts) or latches/multiplexing

GPIO/interrupt routing Most SoCs have at least partially re-configurable pins Usually completely board specific

Displays: number of colour data lines vs. bits per pixel (bpp)

What are the Key Components?Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 19: Embedded LInux in a Nutshell

19

SoC: Marvell XScale PXA320 at 806 MHz Memories

Volatile: 128 MB Hynix, Micron or Qimonda Mobile DDR RAM on 32 bit (2 x 16 bit chip) EMPI SDCS0

Non-volatile: 1 GB Hynix or Samsung NAND Flash on 8 bit ND_CS0

Ethernet: Asix AX88796BLF on 16 bit SRAM CS2, FIFO on ADDR11, address shifted by 1, interrupt GPIO36

Audio codec/touch: NXP UCB1400E on AC97, interrupt GPIO4_2 Power management: Maxim MAX8660 on power I2C addr 0x34 Display/touch:

Sharp LQ043T3DX02 4.3” WQVGA, 480 x 272, 16 or 18 bpp

Colibri XScale PXA320

Page 20: Embedded LInux in a Nutshell

20

Marvell XScale PXA320 at 806 MHz Memories

Volatile: 128 MB Hynix, Micron or Qimonda Mobile DDR RAM on 32 bit (2 x 16 bit chip) EMPI SDCS0

Non-volatile: 1 GB Hynix or Samsung NAND Flash on 8 bit ND_CS0

Unfortunately no Ethernet Audio codec/touch: Wolfson WM9713L on AC97, interrupt

GPIO36 Power management: Maxim MAX8660 on power I2C addr 0x34 Fuel gauge: Ti Bq27210 on I2C addr 0x55 Display/touch: Hitachi TX09D40VM3CAA, 240 x 320, 16 bpp

Limestone PDA Design Kit

Page 21: Embedded LInux in a Nutshell

21

Notes about Porting Embedded Linux/Android

How to port embedded Linux to your HW?How to port the Android kernel extensions?

How to port the file system with the Android framework and its applications?

Page 22: Embedded LInux in a Nutshell

22

First check what is supported by open-source– Chip vendors development board as base line

Step-by-step board bring up– Serial debug console a must– Ethernet/USB convenient for image loading (kernel RAM

disk) or root file system mounting

Boot concept needs to be understood

Low-level vs. high-level initialisation

SoC specific vs. generic code

Having the right tools at your finger tips– Low-level hardware JTAG debugger

Porting Embedded LinuxContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 23: Embedded LInux in a Nutshell

23

Porting Android Kernel ExtensionsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

● What we got so far● Android 1.5 kernel based on vanilla Linux 2.6.27● Colibri BSP kernel based on vanilla Linux 2.6.28

● Two possibilities● Port Android modifications into our BSP kernel● Or vice versa

● Depending on who did your BSP that code might be better

understood by you speaking for second approach

● Android modifications rather well integrated/understood

● Analyse Android kernel modifications and integrate them into our

BSP kernel

Page 24: Embedded LInux in a Nutshell

24

Porting the File System with the

Android Framework and its ApplicationsContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Initial RAM file system to boot-strap Android Regular gziped cpio archive as initramfs Contains just Android proprietary init process

3 different flash partitions Each 64 MB in size YAFFS2 NAND flash file system System partition required to be pre-loaded User data partition Cache partition Image File MTD Partition Mount Point

ramdisk.img N/A /

system.img /dev/mtdblock0 /system

userdata.img /dev/mtdblock1 /data

N/A /dev/mtdblock2 /cache

Page 25: Embedded LInux in a Nutshell

25

Real-time emulation framework

Supports traditional RTOS APIs as skins

Merged with RTAI project in 2003

Common features and behaviour of traditional RTOS’ Thread scheduling Synchronisation

Co-kernel approach Control HW interrupt management

Real-Time Extension - XenomaiContents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 26: Embedded LInux in a Nutshell

26

IOs, Field Busses and Wired Comm.

Linux kernel's GPIOlib

CAN/CANOpen: SocketCAN, CanFestival

Open-source industrial Ethernet stacks

Regular Ethernet interfaces

Requires integration into Android– Settings– Events (Link up/lost)– Customised routing

Contents

Introducing Android

Why Android for industrial Applications

Introducing the Hardware

Notes about Porting Embedded Linux/Android

Real-Time Extension

IOs, Field Busses, Wired Communication

Page 27: Embedded LInux in a Nutshell

27

Page 28: Embedded LInux in a Nutshell

28

Continuing Information

Visit us at our booth at the

Embedded Computing Conference 2009

Attend one of our next trainings

Embedded Linux Seminar - June 18 & 19, 2009

Visit our website

www.noser.com/linux

Or contact us for more information

[email protected]