Real-time Embedded System Programming g Course Teacher: D. M. Akbar Hussain DE5-2010 Lessen # 1 1 Course Book is Required? Course: The course material is prepared from the following books & Internet Resources : 1. Embedded Systems: Architecture, Programming, and Design by Raj Kamal 2. Embedded Systems, A Contemporary Design Tool by James K. Peckol 3. Real Time Systems and Software by Alan C. Shaw 4. Software Engineering by Ian Sommerville 2 Programming 1
What is the common thing in these 3 Embedded Systems in Cars GPS Braking System Air Bags Car Seat Smart Keys Blind Angle Alert System 4 Programming 2
Smart Vehicle Systems 5 Embedded Systems in these Vehicles Arm Control Navigation in Forest Recording of Trees Typically use 16 bit (for example TMS320C167) Processor in a CAN Network, meaning without a host computer. Environment is quite tough, -40 degree to 100 temperature. 6 Programming 3
Huge Embedded System/Vehicles Radar/Sonar Weapons Navigation Command & Control Over 1000 Processors. 7 Embedded System What is it? 8 Programming 4
Definitions: An Embedded System is a computer based system for an application(s) or product with dedicated software embedded in it. It may be an independent system or part of large system. 9 It is any device that includes a programmable computer but is not itself intended to be a general purpose computer. Wayne Wolf 10 Programming 5
Embedded Systems are the electronic systems that contain a microprocessor or a microcontroller, but we do not think of them as computers- the computer is hidden or embedded in the system. Todd D. Morton 11 Three Classes of the Embedded Systems 12 Programming 6
1. Small Scale System Single 8or 16 bit microcontroller, little hardware and software complexities, C or Java as development platform, 13 2. Medium Scale System - Single or few 16 or 32 bit microcontrollers or DSPs or RISCs, may also employ the readily available ASSPs and IPs in the hardware, use complex software design tools: C, Source code engineering tool, RTOS, IDE (Integrated Development Environment) as the development platform, 14 Programming 7
3. Sophisticated System Enormous hardware and software complexities, may also employ scalable or configurable processors and FPGAs, needs hardware and software co-design and integration in the final system, used for the cutting edge applications, for example, an ipod or Smart mobile phone 15 Design Skills Requirement Embedded System development is a team work of software and hardware engineers of various skills. Exemplary skills required are C/C++/Java/J2ME/Visual C++/.NET programming, RTOS programming, APIs, programming for device drivers, IOs, APIs and network interfaces Program and Design Modeling Uses of Inter-Process Communication Use of ICE, Lab Programming, Assemblers, Simulators, IDE, Debugging and Source code Engineering tools Project Management, System Integration,. 16 Programming 8
Look at this sunflower, a nature s gift How does the nature embed its software? 17 What is Technology A manner of accomplishing a task, especially using technical processes, methods, or knowledge. 18 Programming 9
Constructing an Embedded Systems Three kinds of computing Engines are used. 19 Micro-Processor Microprocessor only contains a CPU (the kind used in a PC). Micro-Controller A microcontroller (also MCU or μc) is a functional computer system-on-a-chip. It contains a processor core, memory, and programmable input/output peripherals. Micro-Computer A microcomputer is a computer with a microprocessor as its central processing unit 20 Programming 10
21 Processors Types of Processors which can be customized for the problem at hand: 1. General Purpose Processor 2. Programable Digital Single Processor 3. Application Specific Processor (ASIC) 4. Field Programable Gate Arrays (FPGA) 22 Programming 11
System Designer Must Know 1. Instruction Set. 2. Maximum bits in an operand within a single arithmetic or logical operation. 3. Clock Frequency. 4. Processing Speed (MIPS). 23 General purpose microprocessor Examples - ARM, Intel 80x86, MIPS, SHARC, PowerPC, Intel i860 family, Sparc, Motorola 68HCxxx 24 Programming 12
Microcontrollers Intel : 8051, 80196,... ARM STR 72x,... Motorola : - 68HC11, 68HC12, 68HC16, or MCORE M2001 25 DSP Examples -A Texas Instruments- C28x Series, C54xx or C64xx or OPMAP 5910 DSP or Analog Devices SHARC or TigerSharc, or Motorola 5600xx 26 Programming 13
Media Processor TI DSP TMS320DM310 or Trimedia Phillips Media Processor 1x00 series for Processing Streaming and Data Networks and Image, Video and Speech: PNX1300 and PNX 1500 (2002) 27 Application Specific Instruction Processor (ASIP) Examples - A processor for speech processing, adaptive filtering, encrypting and decrypting or communication protocol stack processor. 28 Programming 14
Multiprocessor System using GPPs Example - A video-conference system, router, high-end cell phone, mobile TV (March 2006) 29 SYSTEM-ON-CHIP Embedding: Multiple processors, memories, multiple standard source solutions (IP Cores), Logic and analog units. 30 Programming 15
FPGAs Cum Processor Cores FPGA 125136: Logic Cells along with the Four IBM PowerPC processors. [Exemplary Application: System with a Data Encryption Engine at 1.5 Gbps]. Xilinx Spartan-3 90 nm based FPGAs with Power PCs (released on April 14, 2003 ) 31 Network Processors Intel INXP4xx builds Embedded Systems for Instrumentation with SOHO and SME communication applications such as residential broadband gateways, enterprise wireless access points and integrated access of the devices quickly and efficiently. 32 Programming 16
Mobile System Processor Centrino, Intel's new mobile technology includes anew mobile processor, related chipsets and 802.11 wireless network functions and wireless Internet Connectivity. it 33 Embedded Processor? Fast Context Switching resulting lower latencies. Atomic ALU operations (no sharing of data), typically occurs for non atomic ALU as for larger operands 2or 4 registers are used. RISC core for fast and precise calculations. 34 Programming 17
Embedded Processor Small Scale Embedded System Microcontroller 68HCD5 68HCD8 PIC 18F8X Medium Scale Embedded System Microcontroller 8051 8051 80251 80x86 68HC11xx 68HC12xx BD196 Large Embedded System Microcontroller INTEL 80960CA POWERPC MPC 604 35 ROM Image Final stage software is also called ROM image. Why? Just as an image is a unique sequence and arrangement of pixels, embedded software is also a unique placement and arrangement of bytes for instructions and data. 36 Programming 18
Distinct ROM Image in a Distinct Embedded System Hardware elements between the distinct systems can be identical but it is the software that makes asystem unique and distinct from the other. Therefore, arom image is also distinct for adistinct embedded system product 37 Compressing the Codes and Data ROM image may alternatively have the software (for example, the zip format) and data (for example, the pictures in jpg or gif format) along with the required software for decompression at run-time. 38 Programming 19
Assembly Language Codes Needed for Invoking Processor Specific Instructions. For configuring some specific physical device or subsystem like transceiver, the machine codes can be straightaway used. For physical device driver codes or codes that utilize the processor-specificspecific features-invoking codes, 'processor-specific' specific' assembly language is used. A file is then created in three steps using 'Assembler', 'Linker' and 'Locator' before finally burned at the ROM 39 Assembly to ROM-Image Conversion Assembly Program Assembler Machine Codes Library Function Binary Linker Linked Program System specific Address Locator ROM Image Device (ROM) Programmer Device Hex-Codes 40 Programming 20
High Level Languages For most systems, software codes are developed in C. Cprogram has various layers; processor commands, main function, task functions and library functions, interrupt service routines and kernel (scheduler). The compiler generates an object file. Using linker and locator, the file for ROM image is created for the targeted hardware. C++ and Java are object oriented languages and they are used for coding in a similar fashion. 41 Real Time Operating System (RTOS) Embedded software is most often designed for performing multiple actions and controlling multiple devices and their ISRs. Multitasking software is therefore essential. For scheduling multiple tasks, popular, readily available RTOS kernel with functions (like device-drivers) drivers) are most often used. 42 Programming 21
Definition of Real Time System A System that is composed of two or more concurrent processes that execute with stringent timing requirements and cooperate with each other to accomplish a common goal. 43 Important RTOSs μcos-ii VxWorks QNX RTLinux Windows CE 44 Programming 22
Devices in a System In an embedded d system, there are number of physical devices. Exemplary Physical Devices - Mobile Device has keypad, LCD display unit, Modem radio interface, port and network drivers. 45 Driver Controls 3 Functions 1. Placing appropriate bits at the control register or word. 2. Calling an ISR on interrupt (event) or on setting a status flag in the status register, and run (drive) the ISR (also called Interrupt Handler Routine). 3. Resetting the status flag after interrupt service. 46 Programming 23
Device Functions Manager Device Management software (usually apart of the OS) provide codes for detecting the presence of devices, for initializing these, memory buffers allocation, and testing the active devices. 47 Development Tools 1. Editor, 2. Interpreter, 3. Compiler, 4. Assembler and Cross Assembler, IDE, 5. Prototyper 48 Programming 24
Source Code Engineering Tools Simulator: To simulate the target processor and hardware elements on a host PC and to run and test the executable module. Debugging and Testing Tools: Including tools for Navigation, Profiler, Stethoscope, Trace Scope and others. 49 Programming 25