Embedded Systems and Embedded Linux Contents 1 INTRODUCTION 2 EMBEDDED LINUX 3 CONCLUSION Embedded Systems & Embedded Linux 1. INTRODUCTION 1.3 Examples 1.2 Characteristics Of ES 1. INTRODUCITON 1.1 What & Why Embedded Systems? 1.4 Embedded OS and Why Linux? 1.5 History of Linux and Embedded Linux Embedded Systems & Embedded Linux 1.1 What & Why Embedded Systems? 1st: Information processing systems embedded into enclosing products [1] 2nd: A special-purpose computer system designed to perform one or a few dedicated functions, often with real-time computing constraints [wiki] 3rd: System that consists of input/output (I/O) and control logic stored in system firmware [2] Embedded Systems & Embedded Linux 1.1 What & Why Embedded Systems? The 1st recognizably modern embedded system: The Apollo Guidance Computer (AGC) – 1960s DSKY user interface DSKY mounted on control panel Embedded Systems & Embedded Linux 1.1 What & Why Embedded Systems? WHY? To make hardware devices more flexible: + Cost + Connectivity + Pervasive Computing + Hardware Combination We are in the post-PC era. (2000 - 2020) Embedded Systems & Embedded Linux 1.2 CHARACTERISTICS OF EMBEDDED SYSTEMS Real-time: + hard real-time (time critical constraints) + soft real-time (time sensitive constraints) x86, Power PC, ARM, MIPS, 8051…hard-core or soft-core? Dedicated to specific tasks Power constraints Wide range of Hardware and Processors Operating under extreme environmental conditions Software failure severity Real-time constraints Fewer system resources than Desktop systems Specialized tools and Design methods Using real-time Operating systems (RTOS) Dedicated debugging circuitry Cost sensitive etc… Embedded Systems ≠ Desktop Systems Embedded Systems & Embedded Linux 1.3 EXAMPLES TELECOMMUNICATIONS MEDICAL USERS’ DESIGNS CONSUMER ELECTRONICS Embedded Systems AUTOMOTIVE INDUSTRY Embedded Systems & Embedded Linux 1.4 WHY USING AN OPERATING SYSTEM? WHY USING EMBEDDED LINUX? 1 Providing an abstraction layer for software on top of the OS to be less dependent on hardware → Easier for middleware and applications designers Why Embedded OSes ? 2 Managing various system hardware and software resources → Provide more features Embedded Systems & Embedded Linux 1.4 WHY USING AN OPERATING SYSTEM? WHY USING EMBEDDED LINUX? Low Cost Varied Hardware Support (scalable & flexible) - Single to Multiprocessors - Simple to Complex Systems - Fully customizable in all its components (thanks to GPL, General Public License) Powerful High-performance (Short Time to Market) - Fast, High Efficiency - Stable, low failure rate - Rich set of toolsets and utilities - Networking capabilities - Development Cost -Training and Hiring Costs - Royalty free - Low system maintenance time OPEN SOURCE Why Embedded Linux? - Vendor Independence - Thousands of developers provide & enhance Linux kernel and other applications - Global support POSIX® Standards (IEEE) Compliance (Portable Operating System Interface) Increasing of supported hardware & software Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX - Linux / ’lɪnʊks / (original) or /’lɪnəks/ (English): A “Unix-like” operating system. UNIX??? Unix-like UNIX 1969, AT&T (Bell LABs) UnixWare Solaris FreeBSD … OpenBSD MINIX IRIX LINUX Mac OS X AIX Timeline of Unix variants Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX • / ’lɪnʊks / (original) or /’lɪnəks/ (English) Linux (or • A “Unix-like” operating system. GNU/Linux) • Linux = Linux kernel 1.0 + GNU Project Linus Torvalds (created Linux Kernel in 1991) Richard Matthew Stallman founder of The GNU project (from 1984) Embedded Systems & Embedded Linux 1.5 GNU HISTORY OF LINUX & EMBEDDED LINUX • A “Unix-like” operating system • Created with free software • Recursive acronym for “GNU's Not Unix” (contain no UNIX code) • GNU General Public License (GPL) GNU Lesser General Public License (LGPL ) GNU Free Documentation License (FDL) • GNU Compiler Collection (gcc) GNU C Library (glibc) Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX Linux Distributions (Distros) kernel + tools + window managers + many other applications SUSE Ubuntu Debian Red Hat / Fedora Mandriva SUSE (GNU/Linux) Ret Hat Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX EMBEDDED LINUX (FIRST AGE) 1996 1997 Hard real-time No MMU 1999 Support BlueCat LynuxWorks 2000 New wave BusyBox 0.43 Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX Embedded Linux vs Other Embedded OSes Linux AMIRIX, Coollogic: Coollinux, Coventive: Xlinux, Klinux, Esfia: RedBlue Linux, KYZO: PizzaBox Linux, Lineo: Embedix, LynuxWorks: BlueCat, Neoware: NeoLinux, TimeSys: Linux GPL, MontaVista Linux NonLinux eCos , VxWorks, Win CE, Lynyos, BSD, Green Hills, QNX DOS … Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX Linux kernel versions Newest: 2.6.27.9-rc2 Embedded Systems & Embedded Linux 1.5 HISTORY OF LINUX & EMBEDDED LINUX Embedded Linux: Real-time or not? General-purposes OS: NO REAL-TIME AT ALL! (Differences in deterministic timing behavior of all the OS services) Past 1st Dual-kernel (Co-kernel) approach : hard real-time 2nd Fully Preemptive Kernel Approach: Patches supported to make soft real-time Linux NOW Full real-time Linux Embedded Systems & Embedded Linux 2. EMBEDDED LINUX 1 INTRODUCTION 2 EMBEDDED LINUX 3 CONCLUSION Embedded Systems & Embedded Linux 2. EMBEDDED LINUX 2.3 Prospects 2.2 Implementation 2. EMBEDDED LINUX 2.1 Design life circle 2.4 Examples for FUTURE 2.5 Challenges Embedded Systems & Embedded Linux 2.1 DESIGN LIFE CYCLE Embedded Systems & Embedded Linux 2.1 DESIGN LIFE CYCLE TRADITIONAL WORK-FLOW vs MODEL-BASED DESIGNED WORK-FLOW PAST NOW Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Examine . . . HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Simplified work-flow (suitable for individuals) System Specifications Overall Architecture / Models Hardware & software configurations Applications design Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Examine . . . HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 1: Product specifications / System requirements -Build a Linux-based platform on a specific hardware - Which hardware to choose (to order)? + Which development board? Compatible with Linux or not? + Which processor? - Which Linux distro? (that supports the chosen hardware) - Which software and toolchain(s) to design? Eclipse-based IDE(Integrated Development Environment) - Which software application(s) to run? Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Examine . . . HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 2: Overall Architecture / Models - Understand hardware’s architecture Basic concepts - Understand the Linux kernel - Choosing hardware components - Design block diagrams (at high level) + hardware connecting and behavior + application(s) - Understand the cross-platform concept Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Examine . . . HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? EXAMPLE: + Board + CPU Step 2: Overall Architecture / Models - Understand hardware’s architecture - Understand the Linux kernel - Choosing hardware components - Design block diagrams (at high level) + hardware connecting and behavior + application(s) - Understand the cross-platform concept Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 2: Overall Architecture / Models - Understand hardware’s architecture + Bus architecture Ex: IBM CoreConnect™ for Xilinx Avalon Switch Fabric for Altera Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 2: Overall Architecture / Models - Understand the Linux kernel (overall) The hardware abstraction layer (HAL) HAL = BSPs + processor-specific software Memory manager Scheduler File system I/O subsystem Networking subsystem IPC (Inter-process communication) Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 2: Overall Architecture / Models - Understand hardware’s architecture - Understand the Linux kernel - Choosing hardware components - Design block diagrams (at high level) + hardware connecting and behavior + application(s) - Understand the cross-platform concept Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 2: Overall Architecture / Models - Understand the cross-platform concept Host Desktop (Linux-x86) Cross-Compiler C libraries Target’s hardware drivers Linux kernel Configure & CrossCompile Target ARM, PPC, MIPS, NIOS… Boot loader Kernel’s image Root filesystem Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Examine . . . HOW TO BUILD A PARTICULAR EMBEDDED LINUX SYSTEM? Step 3: Hardware and Software configurations HARDWARE: (Work becomes more easier with powerful tools) - Configure the CPU parameters + processor clock frequency, bus clock frequency + Cache/ debug mode/ On-chip memory? - Configure the peripherals + Using own designs (verilog .v or .vhdl files) + Using supported / licensed IP cores (Intellectual Properties) + Enabled / Disabled – interrupt or not? Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 3: Hardware and Software configurations HARDWARE: (Work becomes more easier with powerful tools) - Configure Software setting + Give more detailed information to the System Wizard + Choose the embedded OS + Connected peripherals - Build and generate file Netlist + bitstream (will be uploaded to the FPGA ) - Generate software Libraries and BSP (Board Support Packages) BSP includes: + drivers + header files + device ID number +system address map will be used in the kernel compilation process Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 3: Hardware and Software configurations SOFTWARE: (need to deal a lot with the Linux command console) -Preparations for cross-compilation of the kernel Create a cross-compiler environment (to compile CPU kernel and Linux root file system) Crosstool: reliable & easy-to-use toolchain generator (by Dan Kegel) • Linux kernel headers • C libraries Crosstool Proper toolchain (suitable versions (GCC – GNU Compiler Collection ) (scripts) for target hardware) (glibc) • Binutils(manipulate binary object files) •… - Build the Linux kernel • Download the Linux kernel (with the distro supporting the hardware) • Insert the BSP files + make some necessary modifications (Created before) Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 3: Hardware and Software configurations SOFTWARE: (need to deal a lot with the Linux command console) - Build the Linux kernel (cont) • Compile the kernel → make kernel’s image (.elf – executable and linking format) • Test the kernel without Root file system (optional) - Build Root filesystem (RFS) • Using BusyBox Run a script file to: + Create root directories + Copy Glibc into RFS folder + Install BusyBox into RFS + Modifies permissions and ownerships of RFS • Re-configure the kernel • Re-make the final image (.ace file - to load into the flash-card) Top-level directories Directory Contents bin Binary executables, usable by all users on the system dev Device nodes etc Local system-configuration files lib System libraries, such as the standard C library and many others sbin Binary executables usually reserved for superuser accounts on the system usr A secondary file system hierarchy for application programs, usually read-only var Contains variable files, such as system logs and temporary configuration files tmp Temporary files Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 3: Hardware and Software configurations SOFTWARE: (need to deal a lot with the Linux command console) - Port kernel image into hardware • Format CF card (flash card): Partition 1: Type = FAT16 (6) (contains created .ace file) Partition 2: Type = Linux Swap (82) Size = 1 ~ 1.5 main memory Partition 3: Type = Linux (83), Size = Remainder disk space (contains NFS files) • Copy .ace file → partition 1 NFS files → partition 3 PORT LINUX KERNEL FINISH!!! Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION Step 4: Applications design - Similar to programming applications in desktop + Assembly, Pascal, C, C++, Java… + Block diagram + Coding (on host PC) +… + Cross-compile → executable files in target device - Copy into /bin on root file system of target. SYSTEM COMPLETED!!! Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION SOME REAL EMBEDDED LINUX SYSTEMS TODAY LINUX KERNEL PORTED TO IPHONE (iPhone-Dev.org) - Hardware: Iphone (fixed) 1st & 2nd generation + Touch Processor: ARM - Bootloader: OpeniBoot - Linux kernel: 2.6 Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION SOME REAL EMBEDDED LINUX SYSTEMS TODAY www.mtemag.com Hardware: Airbus380 25 PowerPC processors OS: LynxOS (Linux-based real-time OS) Embedded Systems & Embedded Linux 2.2 IMPLEMENTATION SOME REAL EMBEDDED LINUX SYSTEMS TODAY ANDROID – FUTURE’S HAND HELD OS android.com - Developers: Open Handset Alliance (Google, Intel, Motorola, T-mobile… ) on November 2007 - Hardware: mobile devices - OS: Android (Linux kernel (monolithic)) - Software development kit: Android SDK T-mobile G1: 1st mobile device using Android 1.0 OS Embedded Systems & Embedded Linux 2.3 PROSPECTS - 3rd wave of innovation in ICT (Post-PC era) 99% of global processors are placed in Embedded Systems. -Combine advantages of many industries together (ITC, Mechanics, Biology, Chemistry… ) - With an eOS + a powerful design toolchain, Embedded Systems can approach any kind of user and are much easier to build your own system. (flexibility) + Xilinx ISE development suites + Altera Stratix II Development Kit + Embedded MATLAB:using Model-Based Design +… Embedded Systems & Embedded Linux 2.4 FUTURE’S EXAMPLES - SoC evolutions → NoC (Network on Chip) Spidergon Topology + IPU (Interconnect Processing Unit) → Spidergon STNoC: an innovative technology Embedded Systems & Embedded Linux 2.4 FUTURE’S EXAMPLES NoC Using GALS (Globally Asynch. Locally Sync.) Embedded Systems & Embedded Linux 2.4 FUTURE’S EXAMPLES Ambient Intelligence: Many networked devices are integrated into the environment. Embedded Systems & Embedded Linux 2.5 CHALLENGES & LIMITATIONS - Difficulties in HW/SW co-design. - Multi-careers co-ordination - Linux: + Open source + Unfamiliar with Windows users Viet Nam’s reality: - Hardware’s un-afordable (software only) Embedded Systems & Embedded Linux REFERENCE [1] Arnold S. Berger - Embedded Systems Design- An Introduction to Processes, Tools and Techniques (CMP Books - 2002) [2] Craig Hollabaugh - Embedded Linux- Hardware, Software and Interfacing (Addison Wesley) – 2002 [3] Auerbach - Embedded Linux System Design and Development (2006) [4] Newnes - Embedded Software - Know it all - Sep 2007 [5] Karim Yaghmour Building Embedded Linux Systems - 2nd edition - Aug.2008 (OReilly) [6] O'Reilly - Understanding The Linux Kernel (2000) [7] Prentice Hall - Embedded Linux Primer - a Practical RealWorld Approach 2006 [8] Prentice Hall- The Linux Kernel Primer A Top Down Approach for x86 and PowerPC Architectures – 2005 [9] PETER MARWEDEL - Embedded System Design - Peter Marwedel -2006 (Springer) [10] Embedded System WEEK08_tutorial Slides [11] J. W. Donaldson - Porting MontaVista Linux to the XUP Virtex-II Pro development board - 2006 Embedded Systems & Embedded Linux