Embedded Systems Programming Prof. Dr. Hassan Alansary Lecture 1 1.1 WHAT IS AN EMBEDDED SYSTEM? Embedded systems are electronic devices that incorporate microprocessors within their implementations. The main purposes of the microprocessor are to simplify system design and to provide flexibility. Having a microprocessor in the device means that removing bugs, making modifications, or adding new features are only matters of rewriting the software that controls the device. Unlike PCs, however, embedded systems may not have a disk drive and so the software is often stored in a read-only memory (ROM) chip; this means that modifying the software requires either replacing or “reprogramming” the ROM. Telematics System for Automobiles Hand-held GPS Units Embedded System Block Diagram Types of Embedded Processors • Microprocessors for PCs • Embedded processors or Microcontrollers for embedded systems ▫ Often with lower clock speeds ▫ Integrated with memory and ▫ I/O devices e.g. A/D D/A PWM ▫ Higher environmental specs • Computational micros (32- or 64-bit datapaths) ▫ CPU of workstations, PCs, or high-end portable devices (PDAs) ▫ x86, PA-RISC, PowerPC, SPARC, etc. • Embedded general purpose micros (32-bit datapaths) ▫ Designed for a wide range of embedded applications ▫ Often scaled-down version of computational micros ▫ ARM, PowerPC, MIPS, x86, 68K, etc. • Microcontrollers (4-, 8-, or 16-bit datapaths) ▫ Integrate processing unit, memory, I/O buses, and peripherals ▫ Often low-cost, high-volume devices • Domain-specific processors (datapath size varies greatly) ▫ Designed for a particular application domain ▫ Digital signal processors, multimedia processors, graphics processors, network processors, security processors, etc. 1.2 WHAT IS UNIQUE ABOUT THE DESIGN GOALS FOR EMBEDDED SOFTWARE? Characteristics of Embedded Systems Application-specific functionality – specialized for one class of applications. Deadline constrained operation – system may have to perform its function(s) within specific time periods to achieve successful results. Resource challenged – systems typically are configured with a modest set of resources to meet the performance objectives Power efficient – many systems are battery-powered and must conserve power to maximize the usable life of the system.. Form factor – many systems are light weight and low volume to be used as components in host systems. Manufacturable – usually small and inexpensive to manufacture based on the size and low complexity of the hardware. Design Challenges • Does it really work? ▫ Is the specification correct? ▫ Does the implementation meet the spec? ▫ How do we test for real-time characteristics? ▫ How do we test on real data? • How do we work on the system? ▫ Observability, controllability? ▫ What is our development platform? Design Constraints FIGURE 1-4 The Vue40 vending machine uses a 16-bit Hitachi cpu. FIGURE 1-5 The Seagate Barracuda XT disk drive incorporates two ARM Cortex-R4 processors – one to control the servos and the other to handle the command and data flow. 1.3 WHAT DOES “REAL-TIME” MEAN? One of the primary design goals of real-time systems is minimizing response time. A soft real-time system is one that is designed to compute the response as fast as possible but does not have an explicit deadline. If a deadline is imposed, the system is known as a hard real-time system. Keeping response times of hard realtime systems 1.4 WHAT DOES “MULTITHREADING” MEAN? Hyper-Threading Technology is a hardware innovation that allows more than one thread to run on each core. More threads means more work can be done in parallel. ... This means that one physical core now works like two “logical cores” that can handle different software threads. 1.5 HOW POWERFUL ARE EMBEDDED PROCESSORS? A microcontroller unit (MCU) includes a processor, memory, I/O ports, timers, and multiple peripherals all on a single chip. In the past, MCUs typically employed 8- and 16-bit processors. Today, the growing demand for intelligent devices such as smart phones, GPS devices, portable media players, and network routers for the home is pushing MCU to move to 32-bit processors that offer greater performance and functionality. As shown in Figure 1-8, 32-bit processors are rapidly replacing their predecessors in new embedded designs. 1.6 WHAT PROGRAMMING LANGUAGES ARE USED? 1.7 HOW IS BUILDING AN EMBEDDED APPLICATION DIFFERENT? 1.8 HOW BIG ARE TYPICAL EMBEDDED PROGRAMS? We have grown used to desktop application programs that require several mega- bytes of memory and disk space. So, it is surprising how little memory is used in embedded products, especially when you consider that both the embedded applica- tion and its real-time kernel are stored in memory. Two typical examples appear in Table 1-2.