Introduction to embedded systems

50,853 views

Published on

Published in: Technology, Business
21 Comments
107 Likes
Statistics
Notes
No Downloads
Views
Total views
50,853
On SlideShare
0
From Embeds
0
Number of Embeds
23,407
Actions
Shares
0
Downloads
0
Comments
21
Likes
107
Embeds 0
No embeds

No notes for slide
  • * 07/16/96 * ##
  • * 07/16/96 * ##
  • Introduction to embedded systems

    1. 1. Introduction to Embedded Systems
    2. 2. Copyright <ul><li>Copyright © 2011 to author(s). All rights reserved </li></ul><ul><ul><li>All content in this presentation, including charts, data, artwork and logos (from here on, &quot;the Content&quot;), is the property of Amr Ali or the corresponding owners, depending on the circumstances of publication, and is protected by national and international copyright laws. </li></ul></ul><ul><ul><li>Authors are not personally liable for your usage of the Content that entailed casual or indirect destruction of anything or actions entailed to information profit loss or other losses. </li></ul></ul><ul><ul><li>Users are granted to access, display, download and print portions of this presentation, solely for their own personal non-commercial use, provided that all proprietary notices are kept intact. </li></ul></ul><ul><ul><li>Product names and trademarks mentioned in this presentation belong to their respective owners. </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    3. 3. Course Objective <ul><li>After completing this course, you will answer: </li></ul><ul><ul><li>What is an embedded systems? </li></ul></ul><ul><ul><li>What is an embedded hardware? </li></ul></ul><ul><ul><li>What is embedded software? </li></ul></ul><ul><ul><li>What are the embedded systems development tools? </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    4. 4. Course Notes <ul><li>Set your cell phone to vibrate. </li></ul><ul><li>I assume you know computer architecture. </li></ul><ul><li>Ask any time. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    5. 5. Course References <ul><li>Embedded Systems Architecture 2 nd Edition, Tammy Noergaard </li></ul><ul><li>Introduction to Real-Time Operating Systems, by David Kalinsky </li></ul><ul><li>http://en.wikipedia.org/ </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    6. 6. Course Outline <ul><li>Introduction </li></ul><ul><li>Embedded Hardware </li></ul><ul><li>Embedded Software </li></ul><ul><li>Embedded Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    7. 7. Course Outline <ul><li>Introduction </li></ul><ul><li>Embedded Hardware </li></ul><ul><li>Embedded Software </li></ul><ul><li>Embedded Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    8. 8. What is a Computer System? <ul><li>A programmable machine that executes a sequence of operations to perform certain functions. </li></ul><ul><li>A computer system consists of: </li></ul><ul><ul><li>Hardware </li></ul></ul><ul><ul><li>Software </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>Servers </li></ul></ul><ul><ul><li>PCs </li></ul></ul><ul><ul><li>Embedded systems </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Software Hardware
    9. 9. Hardware <ul><li>The physical component of a computer system. </li></ul><ul><li>HW is: </li></ul><ul><ul><li>Harder to develop </li></ul></ul><ul><ul><li>Customized to a specific application </li></ul></ul><ul><ul><li>Of better performance in high-speed systems </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>Processor </li></ul></ul><ul><ul><li>Memories </li></ul></ul><ul><ul><li>IOs </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    10. 10. Software <ul><li>The non-physical part of a computer system. </li></ul><ul><li>SW is: </li></ul><ul><ul><li>Highly configurable </li></ul></ul><ul><ul><li>Faster to develop </li></ul></ul><ul><ul><li>Easier to update </li></ul></ul><ul><ul><li>Cheaper to develop </li></ul></ul><ul><ul><li>Of limited performance by the HW it runs on </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>Applications </li></ul></ul><ul><ul><li>Operating systems </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    11. 11. What is a General Purpose System? <ul><li>A computer system that can do many functionalities depending on: </li></ul><ul><ul><li>Available hardware </li></ul></ul><ul><ul><li>Installed programs </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>PCs </li></ul></ul><ul><ul><li>Servers </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    12. 12. What is an Embedded System? <ul><li>A special purpose computer system that can perform a single or few functionalities. </li></ul><ul><li>Functionalities are done by dedicated HW and SW with limited resources. </li></ul><ul><li>On average, a person interacts with 100s of embedded systems on daily basis. </li></ul><ul><li>Embedded systems are of high diversity. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    13. 13. Embedded Systems Examples Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    14. 14. Characteristics of Embedded Systems - Dependability <ul><li>Reliability </li></ul><ul><li>Maintainability </li></ul><ul><li>Availability </li></ul><ul><li>Safety </li></ul><ul><li>Security </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    15. 15. Characteristics of Embedded Systems - Efficiency <ul><li>Energy </li></ul><ul><li>Code size </li></ul><ul><li>Run-time </li></ul><ul><li>Weight </li></ul><ul><li>Cost </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    16. 16. Characteristics of Embedded Systems - Dedication <ul><li>Dedicated user interface </li></ul><ul><ul><li>No mouse, no screen, no keyboard… </li></ul></ul><ul><li>Dedicated towards an application </li></ul><ul><ul><li>Knowledge at design time can be used to minimize resources and maximize robustness </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    17. 17. Characteristics of Embedded Systems – Meeting Real-Time Constraints <ul><li>React to stimuli within a time interval dictated by the system specs </li></ul><ul><ul><li>Right answers arriving too early or too late are wrong. </li></ul></ul><ul><li>An embedded system can be a: </li></ul><ul><ul><li>Hard real-time system </li></ul></ul><ul><ul><li>Firm real-time system </li></ul></ul><ul><ul><li>Soft real-time system </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    18. 18. Characteristics of Embedded Systems – Connection to a Physical Environment <ul><li>Through sensors and actuators </li></ul><ul><li>Hybrid systems </li></ul><ul><ul><li>Analog, digital, mechanical… </li></ul></ul><ul><li>Typically, embedded systems are reactive. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    19. 19. Embedded Versus General Purpose Systems <ul><li>Embedded </li></ul><ul><li>Few applications </li></ul><ul><li>A part of a bigger system </li></ul><ul><li>Not programmed by end users </li></ul><ul><li>Harder to develop </li></ul><ul><li>General Purpose </li></ul><ul><li>Board class of application </li></ul><ul><li>Standalone or integrated in parallel with other systems </li></ul><ul><li>End users programmable </li></ul><ul><li>Easier to develop </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    20. 20. Embedded Systems Architecture Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Device Drivers Operating Systems Middleware Application SoC Memories Peripherals
    21. 21. Exercise 1: Characterize an Embedded System <ul><li>Goal: Identify embedded systems characteristics </li></ul><ul><li>Each group of 2 persons should: </li></ul><ul><ul><li>Pick an embedded system </li></ul></ul><ul><ul><li>Identify its characteristics </li></ul></ul><ul><li>Time: 15 minutes </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    22. 22. Course Outline <ul><li>Introduction </li></ul><ul><li>Embedded Hardware </li></ul><ul><li>Embedded Software </li></ul><ul><li>Embedded Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    23. 23. CPU, Processor, and SoC Amr Ali Abdel-Naby@2011 Introduction to STM32 STM32 SoC
    24. 24. Central Processing Unit <ul><li>AKA CPU </li></ul><ul><li>Core of most of digital systems </li></ul><ul><li>Performs arithmetic, control, data, and IO operations </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    25. 25. CPU Structure <ul><li>Registers </li></ul><ul><li>Internal bus </li></ul><ul><ul><li>Address </li></ul></ul><ul><ul><li>Data </li></ul></ul><ul><ul><li>Control </li></ul></ul><ul><li>CU: Control Unit </li></ul><ul><li>ALU: Arithmetic and Logic Unit </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems CU Registers ALU Internal Bus
    26. 26. Registers <ul><li>Temporal storage inside the CPU </li></ul><ul><ul><li>Flip-flops and latches </li></ul></ul><ul><li>A register can be: </li></ul><ul><ul><li>A general purpose register </li></ul></ul><ul><ul><ul><li>Carry out program or data processing </li></ul></ul></ul><ul><ul><li>A control register </li></ul></ul><ul><ul><ul><li>Controls the program or the CPU </li></ul></ul></ul><ul><ul><li>A status/flag register </li></ul></ul><ul><ul><ul><li>Shows the current state of the CPU </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    27. 27. ALU <ul><li>Carries on: </li></ul><ul><ul><li>Arithmetic operations </li></ul></ul><ul><ul><ul><li>+, -, … </li></ul></ul></ul><ul><ul><li>Logic operations </li></ul></ul><ul><ul><ul><li>AND, OR, SHIFT… </li></ul></ul></ul><ul><li>Operates and stores results in general registers </li></ul><ul><li>Stores operation status in flag/status registers </li></ul><ul><ul><li>Carry occurrence, overflow occurrence… </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    28. 28. CU <ul><li>Controls the internal flow to fetch, decode, and execute an instruction </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Instruction Program Counter Memory Device Instruction Register Instruction Decoder Control Signal Generator
    29. 29. Pipelining <ul><li>Continuous and parallel streaming of instruction to the CPU </li></ul><ul><li>A method of achieving higher execution speed at same clock speed </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems With pipelining, same number of instructions executes in less time. F D E F D E F D E F D E F D E F D E
    30. 30. Types of CPUs <ul><li>CISC </li></ul><ul><li>Complex Instruction Set </li></ul><ul><li>Introduced in 1960s </li></ul><ul><li>Memory referencing operations </li></ul><ul><li>100s of assembly instructions </li></ul><ul><li>Complex in design </li></ul><ul><li>Simple compilers </li></ul><ul><li>Targets code size </li></ul><ul><li>RISC </li></ul><ul><li>Reduced Instruction Set </li></ul><ul><li>Introduced in 1950s </li></ul><ul><li>Load/store architecture </li></ul><ul><li>Around 40 assembly instructions per CPU </li></ul><ul><li>Simple in design </li></ul><ul><li>Complex compilers </li></ul><ul><li>Targets performance </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    31. 31. Processor <ul><li>In addition to the CPU, it may have: </li></ul><ul><ul><li>Cache memories </li></ul></ul><ul><ul><li>Memory management unit </li></ul></ul><ul><ul><li>Memory protection unit </li></ul></ul><ul><ul><li>System Bus </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    32. 32. Cache Memories <ul><li>System performance is lowered </li></ul><ul><li>due to slow bus and memory </li></ul><ul><li>regardless of the CPU speed. </li></ul><ul><li>Improved performance by using </li></ul><ul><li>a high speed memory to store </li></ul><ul><li>frequently accessed </li></ul><ul><li>instructions/data. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Bus (66 MHz) Bus (66 MHz) CPU (400 MHz) Memory Device (10 MHz) CPU + Cache (400 MHz) Memory Device (10 MHz)
    33. 33. Read Operation with a Cache <ul><li>Cache hit </li></ul><ul><ul><li>A requested instruction/data is in cache </li></ul></ul><ul><ul><li>Cache performance is high when cache hit rate is high </li></ul></ul><ul><li>Cache miss </li></ul><ul><ul><li>A requested instruction/data is not in cache </li></ul></ul><ul><ul><li>Cache performance is low when cache miss rate is high </li></ul></ul><ul><li>Line fill </li></ul><ul><ul><li>Retrieving instruction/data from external memory to cache incase of cache miss </li></ul></ul><ul><ul><li>Cache retrieves a group of instructions/data </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    34. 34. Write Operation with a Cache <ul><li>Write through </li></ul><ul><ul><li>A CPU writing to a certain address writes to both external memory and caches. </li></ul></ul><ul><li>Write back </li></ul><ul><ul><li>A CPU writing to a certain address writes to caches only and postpones writing to external memories to a later time. </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    35. 35. Memory Management Unit <ul><li>AKA MMU </li></ul><ul><li>It is used for address translation from virtual address to physical address. </li></ul><ul><li>It provides memory protection functions as well. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems VA PA CPU Memory Device MMU
    36. 36. System Bus <ul><li>Connects the processor to the external memories. </li></ul><ul><li>There are 2 famous bus architectures: </li></ul><ul><ul><li>Von-Neumann </li></ul></ul><ul><ul><li>Harvard </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems CPU Instruction/Data Memories CPU Instruction Memory Data Memory
    37. 37. System on Chip <ul><li>Due to advancements in silicon technologies, it is possible to add more functionalities to the processor on chip. </li></ul><ul><ul><li>A processor tends to be a complete system on chip. </li></ul></ul><ul><li>In addition to the processor, it may have: </li></ul><ul><ul><li>Co-processors </li></ul></ul><ul><ul><li>Memories </li></ul></ul><ul><ul><li>Direct Memory Access </li></ul></ul><ul><ul><li>Internal IO devices </li></ul></ul><ul><ul><li>IO controllers </li></ul></ul><ul><ul><li>Interrupt controller </li></ul></ul><ul><ul><li>Peripherals Bus </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    38. 38. Co-Processor <ul><li>A processor that supplements the functions of the primary processor. </li></ul><ul><li>Extensions include: </li></ul><ul><ul><li>Floating point operations </li></ul></ul><ul><ul><li>Graphics </li></ul></ul><ul><ul><li>Digital signal processors </li></ul></ul><ul><ul><li>Encryption processors </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    39. 39. Memories <ul><li>They are used to store instructions and data. </li></ul><ul><li>They can be divided into: </li></ul><ul><ul><li>Volatile memory </li></ul></ul><ul><ul><ul><li>When power is off, contents are lost. </li></ul></ul></ul><ul><ul><li>Non-volatile memory </li></ul></ul><ul><ul><ul><li>When power is off, consents are preserved. </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    40. 40. Volatile Memories Versus Non-Volatile Memories Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    41. 41. Direct Memory Access <ul><li>A coprocessor that allows data transfers without the interference of the processor. </li></ul><ul><ul><li>A key player in for HW concurrency. </li></ul></ul><ul><li>It can move data between: </li></ul><ul><ul><li>Memories </li></ul></ul><ul><ul><li>A memory and IO device </li></ul></ul><ul><li>The speed is limited by the speed of the slowest device in the transfer. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems CPU DMA Memory IO Device
    42. 42. IO Devices <ul><li>They exchange information with the processor. </li></ul><ul><li>They include digital and non-digital signals. </li></ul><ul><li>Only digital signals are interfaced directly to the CPU. </li></ul><ul><li>Not all IO devices can be integrated on the chip. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    43. 43. Internal IO Devices <ul><li>They can be integrated on chip because they </li></ul><ul><ul><li>Are physically silicon devices </li></ul></ul><ul><ul><li>Have small size </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>Memories </li></ul></ul><ul><ul><li>ADCs </li></ul></ul><ul><ul><li>RTCs </li></ul></ul><ul><ul><li>IO controllers </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    44. 44. External IO Devices <ul><li>Devices can’t be integrated on chip because they: </li></ul><ul><ul><li>Are physically non silicon devices </li></ul></ul><ul><ul><li>Have large size that is not easily integrated on chip </li></ul></ul><ul><ul><li>Have a bus interface that is different from that is used internally </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>LCD </li></ul></ul><ul><ul><li>Keypad </li></ul></ul><ul><ul><li>Speakers </li></ul></ul><ul><ul><li>Mic </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    45. 45. IO Controllers <ul><li>They are used to interface the off-chip IO devices to the chip. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems CPU Signals Device Signals CPU IO Device IO Control
    46. 46. IO Address Allocation <ul><li>This is necessary to control the IO devices. </li></ul><ul><li>There are 2 types: </li></ul><ul><ul><li>IO mapped IO </li></ul></ul><ul><ul><ul><li>Exclusive address space for the IO devices </li></ul></ul></ul><ul><ul><ul><li>Widely used in PC world </li></ul></ul></ul><ul><ul><li>Memory mapped IO </li></ul></ul><ul><ul><ul><li>IO devices and memories share same address space </li></ul></ul></ul><ul><ul><ul><li>Widely used in embedded systems </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    47. 47. Memory Mapped IOs versus IO Mapped IOs <ul><li>IO Mapped </li></ul><ul><li>x86… </li></ul><ul><li>Exclusive IO region </li></ul><ul><li>Different instructions to access IO </li></ul><ul><li>Processor has a single pin that separates the IO from memory. </li></ul><ul><li>Memory Mapped </li></ul><ul><li>ARM, PPC, MIPS, x86.. </li></ul><ul><li>A memory region </li></ul><ul><li>Same instruction to access memory and IO </li></ul><ul><li>External address decoder decodes the address and decides whether to select a memory or a device. </li></ul><ul><li>IO region must be non-cacheable and all IO variables must be declared as volatile. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    48. 48. IO Management <ul><li>Polling </li></ul><ul><ul><li>A program continuously checks the IO device </li></ul></ul><ul><li>Interrupt </li></ul><ul><ul><li>If an IO device needs processor attention, it interrupts the processor. </li></ul></ul><ul><ul><li>A key player for multi-tasking and real-time </li></ul></ul><ul><li>DMA </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    49. 49. Interrupt Controller <ul><li>Extends interrupt signals of the processors </li></ul><ul><li>Offloads the CPU by doing some of interrupt processing </li></ul><ul><li>Extra level of interrupt control </li></ul><ul><li>Maps the interrupt signal to the processor interrupt signal </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems CPU IO Device Interrupt Control
    50. 50. Interrupt Processing Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Interrupt Control
    51. 51. On Chip Bus <ul><li>Connects the components of the SoC </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    52. 52. Types of the SoC <ul><li>Application specific integrated circuit (ASIC) </li></ul><ul><li>Programmable HW </li></ul><ul><ul><li>FGPAs </li></ul></ul><ul><ul><li>CPLDs </li></ul></ul><ul><li>Application specific instruction set processors (ASIPs) </li></ul><ul><ul><li>DSPs </li></ul></ul><ul><ul><li>Media processors </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    53. 53. Implementation Tradeoff Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    54. 54. Embedded Boards <ul><li>PCBs that can be used to run an embedded SW on top of it. </li></ul><ul><li>It has: </li></ul><ul><ul><li>SoC’s </li></ul></ul><ul><ul><li>Memories </li></ul></ul><ul><ul><li>IOs </li></ul></ul><ul><li>A development board can be an evaluation board or a solution board. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    55. 55. Embedded Boards cont’d <ul><li>Evaluation boards </li></ul><ul><ul><li>Boards that has a controller and all possible IOs that the controller can connect to. </li></ul></ul><ul><ul><li>Used by controller manufacturers to test their own chip. </li></ul></ul><ul><ul><li>Design houses use them to develop their products’ prototypes. </li></ul></ul><ul><li>Solutions boards </li></ul><ul><ul><li>Used in actual product </li></ul></ul><ul><ul><li>Subset or a tuned version of the evaluation board </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    56. 56. Exercise 2: Identify Your Embedded System Hardware <ul><li>Goal: Identify embedded systems hardware </li></ul><ul><li>Each group of 2 persons should: </li></ul><ul><ul><li>Identify the embedded hardware for the example in exercise 1 </li></ul></ul><ul><li>Time: 15 minutes </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    57. 57. Course Outline <ul><li>Introduction </li></ul><ul><li>Embedded Hardware </li></ul><ul><li>Embedded Software </li></ul><ul><li>Embedded Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    58. 58. Program <ul><li>A SW that the hardware understands and runs to achieve a specific result. </li></ul><ul><li>A program is written in 1 or more programming languages. </li></ul><ul><li>A program may compose or can be a mix of: </li></ul><ul><ul><li>Application </li></ul></ul><ul><ul><li>Middleware </li></ul></ul><ul><ul><li>Operating system </li></ul></ul><ul><ul><li>Device Driver </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems Device Drivers Operating Systems Middleware Application
    59. 59. Programming Languages in Embedded Systems <ul><li>They can be: </li></ul><ul><ul><li>Low level </li></ul></ul><ul><ul><ul><li>Assembly </li></ul></ul></ul><ul><ul><ul><li>Machine code </li></ul></ul></ul><ul><ul><li>High level </li></ul></ul><ul><ul><ul><li>C/C++ </li></ul></ul></ul><ul><ul><ul><li>Java </li></ul></ul></ul><ul><ul><ul><li>Ada </li></ul></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    60. 60. Machine Code and Assembly Programming <ul><li>Machine code is </li></ul><ul><ul><li>1’s and 0’s only </li></ul></ul><ul><ul><li>Understood by processor only </li></ul></ul><ul><ul><li>Inconvenient to write a program with </li></ul></ul><ul><li>Mnemonic code </li></ul><ul><ul><li>Machine code converted to symbols understood by programmers </li></ul></ul><ul><li>Assembly language mnemonic code + pseudo instructions to improve programs readability </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    61. 61. Assembly Instructions <ul><li>Instruction consists of mnemonic (opcode) and operands </li></ul><ul><ul><li>Opcode is an action taken by a processor </li></ul></ul><ul><ul><li>Operands is the target the opcode should take an action for/on </li></ul></ul><ul><li>ADD A, B, C </li></ul><ul><ul><li>Opcode: ADD </li></ul></ul><ul><ul><li>Operands: A, B, and C </li></ul></ul><ul><ul><li>Symantec: register A = register B + register C </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    62. 62. Pros and Cons of Assembly Language <ul><li>Pros </li></ul><ul><ul><li>Readable and understandable compared to machine code </li></ul></ul><ul><ul><li>Easier to debug and maintain compared to machine code </li></ul></ul><ul><li>Cons </li></ul><ul><ul><li>Knowledge of HW and processor internals is necessary </li></ul></ul><ul><ul><li>Processor specific </li></ul></ul><ul><ul><li>Limited capabilities </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    63. 63. C/C++ Programming <ul><li>Processor independent </li></ul><ul><li>Flexible </li></ul><ul><li>Easier to write </li></ul><ul><li>Assembly can be inlined in C/C++ </li></ul><ul><li>Greater productivity </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    64. 64. Bootloader <ul><li>The first program that should run when the system starts. </li></ul><ul><li>Initial code written in assembly and then switches to C/C++. </li></ul><ul><li>Initializes the HW for proper SW operation and jumps to the first program to run on the system. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    65. 65. Device Drivers <ul><li>Pieces of SW that interface directly to/abstracts the HW devices. </li></ul><ul><li>A device driver is divided into 2 layers: </li></ul><ul><ul><li>Low level: HW dependent </li></ul></ul><ul><ul><li>High level: OS dependent </li></ul></ul><ul><li>Device drivers are installed during bootloading or when a device is used for the 1 st time in the system or whenever the device is plugged. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems HLD Operating Systems Middleware Application LLD
    66. 66. Operating System <ul><li>A SW that manages HW and SW system resources. </li></ul><ul><li>It provide HW abstraction as well. </li></ul><ul><li>Windows and Unix can be used in embedded systems. </li></ul><ul><li>Another class of OSs called RTOS fits more in embedded systems. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    67. 67. Middleware <ul><li>AKA libraries </li></ul><ul><li>Pieces of SW that solve a generic problem are gathered to form a middleware. </li></ul><ul><li>Examples: </li></ul><ul><ul><li>GUI libraries </li></ul></ul><ul><ul><li>Video/Audio Decoders </li></ul></ul><ul><ul><li>USB stack </li></ul></ul><ul><ul><li>TCP/IP stacks </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    68. 68. Application <ul><li>Pieces of SW that: </li></ul><ul><ul><li>Interface to the user </li></ul></ul><ul><ul><li>Tunes the middleware </li></ul></ul><ul><ul><li>Uses the OS and device drivers </li></ul></ul><ul><ul><li>To solve a specific problem </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    69. 69. Embedded SW Application Form <ul><li>There are several different types of SW architecture in use: </li></ul><ul><ul><li>Endless loop </li></ul></ul><ul><ul><li>Cyclic execution </li></ul></ul><ul><ul><li>Interrupt controlled system </li></ul></ul><ul><ul><li>Cooperative multi-tasking </li></ul></ul><ul><ul><li>Preemptive multitasking </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    70. 70. The Endless Loop <ul><li>No tasks </li></ul><ul><li>Polled device I/O only </li></ul><ul><li>Often, performance too slow </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems DO FOREVER Request Input Device make a Measurement Wait for the Measurement to be ready Fetch the Value of the Measurement Process the Value of the Measurement IF Value is Reasonable THEN Prepare new Result using Value ELSE Result will be an Error Report Request Output Device deliver the Result Wait for the Result to be output Confirm that output is OK END DO
    71. 71. Basic Cyclic Executive <ul><li>Endless loop of tasks </li></ul><ul><ul><li>Tasks as independent as possible </li></ul></ul><ul><ul><ul><li>Separate application issues. </li></ul></ul></ul><ul><ul><ul><li>Little interaction </li></ul></ul></ul><ul><li>Tasks share information easily. </li></ul><ul><ul><li>Write/Read shared data </li></ul></ul><ul><li>Polled device I/O only </li></ul><ul><li>Time of complete loop determines real-time. </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    72. 72. Time-Driven Cyclic Executive <ul><li>More precise timing </li></ul><ul><li>Timer interrupt determines real-time. </li></ul><ul><li>Sharing data OK </li></ul><ul><li>Polled device I/O only (except timer) </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    73. 73. Multi-Rate Cyclic Executive <ul><li>Some tasks need higher rate. </li></ul><ul><ul><li>Integer multiple of base rate </li></ul></ul><ul><ul><li>Major cycle/Minor cycle(s) </li></ul></ul><ul><li>Sharing data OK </li></ul><ul><li>Polled device I/O only (except timer) </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    74. 74. Limitation of Cyclic Executives <ul><li>Polled device I/O only </li></ul><ul><ul><li>Too low rate: Miss transient occurrences </li></ul></ul><ul><ul><li>Too high rate: Waste CPU power </li></ul></ul><ul><ul><li>Prefer interrupt-driven I/O </li></ul></ul><ul><li>Timing of task executions imprecise </li></ul><ul><ul><li>Data-dependent loops </li></ul></ul><ul><ul><li>SW maintenance nightmare </li></ul></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    75. 75. Caution Adding Interrupts <ul><li>Interrupt service routine (ISR) </li></ul><ul><ul><li>May need to pass data to task it is interrupting </li></ul></ul><ul><ul><li>Possible result: Inconsistent data </li></ul></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems HW I/P Device ISR Shared Data Area SW using Data from ISR Old New
    76. 76. Multi-Rate Executive with Interrupts <ul><li>ISRs write to one set of buffers. </li></ul><ul><li>Tasks use data from another set of buffers. </li></ul><ul><li>At each clock tick, data are copied. </li></ul><ul><li>Not a weekend “Garage” project </li></ul><ul><li>Sharing data among tasks, OK </li></ul><ul><li>Polled and interrupt-driven device I/O </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems HW I/P Device ISR Shared Data Area Task Data Buffers DI Copy data from ISR buffers to task buffers EI
    77. 77. Faster Response: Preemptive Scheduling <ul><li>All previous schedulers: Non-Preemptive </li></ul><ul><li>Preemptive Scheduling == Task switches can take place at any point/time </li></ul><ul><ul><li>Tasks can be switched in mid-execution. </li></ul></ul><ul><li>Preemptive scheduler is very complex. </li></ul><ul><li>Polled and interrupt-driven device I/O are OK. </li></ul><ul><li>ISR data not delayed by a tick  Task can respond at once </li></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems Task 1 Task 2 Task 3 HW I/P Device ISR Task 3
    78. 78. Preemptive Scheduling Issues <ul><li>Which task can preempt which task? </li></ul><ul><ul><li>Answer is in priority. </li></ul></ul><ul><li>Sharing data, Not OK </li></ul><ul><ul><li>OS provide safe mechanism for passing data between ISRs/Tasks. </li></ul></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems Shared Data Area Task 1 Task 1 cont’d Task 2 with higher priority
    79. 79. An Intertask Communication Catalog <ul><li>Data Transfer: Destructive reading, non-destructive writing </li></ul><ul><ul><li>Message queues </li></ul></ul><ul><ul><ul><li>Direct message passing </li></ul></ul></ul><ul><ul><ul><li>Indirect message passing </li></ul></ul></ul><ul><ul><li>Mailboxes </li></ul></ul><ul><ul><li>Pipes </li></ul></ul><ul><li>Data Transfer: Destructive writing, non-destructive reading </li></ul><ul><ul><li>RTOS-protected globals: notepad registers, environment variables, … </li></ul></ul><ul><ul><li>Shared data area protected by a mutual exclusion mechanism. </li></ul></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    80. 80. An Intertask Communication Catalog cont’d <ul><li>-ve synchronization == mutual exclusion </li></ul><ul><ul><li>Semaphores </li></ul></ul><ul><ul><li>Mutexes </li></ul></ul><ul><li>+ve synchronization </li></ul><ul><ul><li>Event flags </li></ul></ul><ul><ul><li>Condition variables </li></ul></ul><ul><ul><li>Signals </li></ul></ul>Amr Ali Abdel-Naby@ 2009 Real-Time Operating Systems
    81. 81. Exercise 3: Identify Your Embedded System Software <ul><li>Goal: Identify embedded systems hardware </li></ul><ul><li>Each group of 2 persons should: </li></ul><ul><ul><li>Identify the embedded software for the example in exercise 1 </li></ul></ul><ul><li>Time: 15 minutes </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    82. 82. Course Outline <ul><li>Introduction </li></ul><ul><li>Embedded Hardware </li></ul><ul><li>Embedded Software </li></ul><ul><li>Embedded Development Tools </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    83. 83. Embedded Development Tools <ul><li>Depending on your business, you may need different set of tools. </li></ul><ul><ul><li>Integrated Device Manufacturer (IDM) </li></ul></ul><ul><ul><li>Original Equipment Manufacturer (OEM) </li></ul></ul><ul><ul><li>Embedded SW design house </li></ul></ul><ul><li>I will try to focus on the most commonly used tools. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    84. 84. Assembler <ul><li>A SW program that converts source code written in assembly language into machine language. </li></ul><ul><li>Examples include: </li></ul><ul><ul><li>GNU assembler </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    85. 85. Compiler <ul><li>A SW program that converts source code written in a high level programming language into another programming language. </li></ul><ul><ul><li>C/C++  Assembly or Machine language </li></ul></ul><ul><li>Compilation can be: </li></ul><ul><ul><li>Native: Compiler and generated executables run on the same processor. </li></ul></ul><ul><ul><li>Cross: Compiler runs on a processor and the generated executables runs on a different processor. </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>ARMCC </li></ul></ul><ul><ul><li>GCC </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    86. 86. Linker and Locator <ul><li>A linker is a SW program that links the compilation and assemble operations’ outputs into a single executable. </li></ul><ul><li>A locator is a SW program that can change the memory map of the linker output. </li></ul><ul><li>It is common these days to see a combined linker-locator tool. </li></ul><ul><li>Examples include: </li></ul><ul><ul><li>GCC </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    87. 87. Simulator <ul><li>A SW program that imitates a real thing, state of affairs, or processes. </li></ul><ul><li>Simulation is an approximation of the real time system. </li></ul><ul><li>A simulator is used when: </li></ul><ul><ul><li>The real platform is not available. </li></ul></ul><ul><ul><li>It is dangerous to test on real system directly. </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>Proteus </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    88. 88. Debugger <ul><li>A SW program + HW device that interfaces my PC to my embedded HW. </li></ul><ul><li>It can be used to: </li></ul><ul><ul><li>Set breakpoints </li></ul></ul><ul><ul><li>Dump memories </li></ul></ul><ul><ul><li>Trace execution </li></ul></ul><ul><ul><li>Watch variables </li></ul></ul><ul><li>The HW can be </li></ul><ul><ul><li>In circuit debugger </li></ul></ul><ul><ul><li>Debug agent SW on bard </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    89. 89. Flash Loader <ul><li>A SW program + HW device that interfaces my PC to my embedded HW. </li></ul><ul><li>It can be used to: </li></ul><ul><ul><li>Erase ROM/Flash </li></ul></ul><ul><ul><li>Read ROM/Flash </li></ul></ul><ul><ul><li>Program ROM/Flash </li></ul></ul><ul><ul><li>Watch variables </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    90. 90. Profiler <ul><li>A SW program that gathers information about a program during execution. </li></ul><ul><li>Profiler is used to know which areas of code to optimize speed and memory. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    91. 91. Integrated Development Environment <ul><li>A SW program that provides a comprehensive facilities for programmers. </li></ul><ul><li>It includes: </li></ul><ul><ul><li>Assemblers </li></ul></ul><ul><ul><li>Compilers </li></ul></ul><ul><ul><li>Linkers </li></ul></ul><ul><ul><li>Debuggers </li></ul></ul><ul><ul><li>Simulators </li></ul></ul><ul><ul><li>Profilers </li></ul></ul><ul><ul><li>Text editors </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    92. 92. Schematic Capture/Circuit Design Tool <ul><li>A SW program that allows the circuit designer to enter his circuit design into CAD tools. </li></ul><ul><li>It is used for: </li></ul><ul><ul><li>Design simulation </li></ul></ul><ul><ul><li>Design sketching </li></ul></ul><ul><li>Examples include: </li></ul><ul><ul><li>OrCAD </li></ul></ul><ul><ul><li>KiCAD </li></ul></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    93. 93. PCB Layout Design Tool <ul><li>A SW program that allows the transformation of the circuit schematic capture into PCB layout that cab printed on a circuit board. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    94. 94. Oscilloscope <ul><li>A HW Device that allows observation of constantly varying voltages. </li></ul><ul><li>It observes the exact wave shape across time. </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems
    95. 95. Exercise 4: Identify Your Embedded System Development Tools <ul><li>Goal: Identify embedded systems development tools </li></ul><ul><li>Each group of 2 persons should: </li></ul><ul><ul><li>Identify the embedded system development tools for the example in exercise 1 </li></ul></ul><ul><li>Time: 15 minutes </li></ul>Amr Ali Abdel-Naby@2011 Introduction to Embedded Systems

    ×