ANDROID 开发资料
- 格式:pdf
- 大小:876.03 KB
- 文档页数:28
Android for Industrial ApplicationsMarcel Ziswiler Noser Engineering AGContents ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, 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 InformationIntroducing AndroidWhat is Android?How about its architecture? What are the system requirements? What kernel extensions are required?Open-source mobile phone platform initiated by Google Building a better phone for consumers 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. … Noser Engineering AG is a founding member of the OHA and workson core functionality (core libraries, certification framework)ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationAndroid Architecture ContentsIntroducing AndroidWhy Android for industrialApplicationsIntroducing the HardwareNotes about PortingEmbedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, WiredCommunicationRecent 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 Requirements ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationAshmem 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 Extensions ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationLogger 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.)ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationPower 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.)ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationAndroid Kernel Configuration ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the Hardware Notes about Porting Embedded Linux/Android Real-Time ExtensionIOs, Field Busses, Wired CommunicationRequires one to enable previously discussed features Standard Android kernel configuration (emulator)arch/arm/configs/goldfish_defconfigSpecial Considerations ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationFrame 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.cTouch Screen Calibration ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationNo 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/pointercalWhy Android for Industrial Applications?What is already there?What is missing to make it a suitable framework forindustrial applications?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?ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationHard 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?ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationFramework 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?ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationIntroducing the HardwareWhat are the key components? Toradex Colibri XScale PXA320 Toradex Limestone PDA Design KitMost 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?ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationColibri XScale PXA320SoC: Marvell XScale PXA320 at 806 MHzMemoriesVolatile: 128 MB Hynix, Micron or Qimonda Mobile DDR RAM on 32 bit (2 x 16 bit chip) EMPI SDCS0Non-volatile: 1 GB Hynix or Samsung NAND Flash on 8 bitND_CS0Ethernet: Asix AX88796BLF on 16 bit SRAM CS2, FIFO on ADDR11, address shifted by 1, interrupt GPIO36Audio 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 bppMarvell XScale PXA320 at 806 MHzMemories 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_CS0Unfortunately no EthernetAudio codec/touch: Wolfson WM9713L on AC97, interrupt GPIO36Power management: Maxim MAX8660 on power I2C addr 0x34Fuel gauge: Ti Bq27210 on I2C addr 0x55 Display/touch: Hitachi TX09D40VM3CAA, 240 x 320, 16 bppLimestone PDA Design KitNotes 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 frameworkand its applications?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 Linux ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationPorting Android Kernel Extensions ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, 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 kernelPorting the File System with the Android Framework and its ApplicationsContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired Communication Initial RAM file system to boot-strap AndroidRegular gziped cpio archive as initramfsContains just Android proprietary init process3 different flash partitionsEach 64 MB in sizeYAFFS2 NAND flash file systemSystem partition required to be pre-loadedUser data partitionCache partitionImage File MTD Partition Mount Pointramdisk.img N/A/system.img/dev/mtdblock0/systemuserdata.img/dev/mtdblock1/dataN/A/dev/mtdblock2/cacheReal-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 - Xenomai ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationIOs, 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 ContentsIntroducing AndroidWhy Android for industrial ApplicationsIntroducing the HardwareNotes about Porting Embedded Linux/AndroidReal-Time ExtensionIOs, Field Busses, Wired CommunicationContinuing InformationVisit us at our booth at theEmbedded Computing Conference 2009Attend one of our next trainingsEmbedded Linux Seminar - June 18 & 19, 2009 Visit our website/linuxOr contact us for more informationlinux@。