Introduction To Embedded Systems - Ela

1y ago
9 Views
2 Downloads
6.43 MB
294 Pages
Last View : Today
Last Download : 3m ago
Upload by : Milena Petrie
Transcription

11JU1A0407 INTRODUCTION TO EMBEDDED SYSTEMS USING WINDOWS EMBEDDED CE A Tutorial Approach with Laboratory Exercises for Windows Embedded CE 6.0 and the eBox 2300 SoC Embedded Computer January 2007 James O. Hamblen School of Electrical and Computer Engineering Georgia Institute of Technology

2 Introduction to Embedded Systems using Windows Embedded CE Copyright 2007 Georgia Institute of Technology and James O. Hamblen Portions Copyright 2006 Microsoft Corporation, reprinted with permission from Microsoft Corporation. Contents licensed for non-commercial academic use for research and classroom/lab instruction. The author and publisher of this book have used their best efforts in preparing this book. These efforts include the development, research, and testing of the theories and programs to determine their effectiveness. These example programs are provided for educational use only. The author and publisher make no warranty of any kind, expressed or implied, with regard to these programs or the documentation contained in this book. The author and publisher shall not be liable in any event for incidental or consequential damages in connection with, or arising out of, the furnishing, performance, or use of these programs ActiveSync, ActiveX, Developer Studio, DirectX, Microsoft, MS-DOS, Visual Basic, Visual C , Visual C#, Visual Studio, Wind32, Windows, Windows NT, Windows XP, and Windows Server are either registered trademarks or trademarks of Microsoft Corporation in the United States and/or other countries. Other product and company names mentioned herein may be the trademarks of their respective owners. Microsoft Windows Embedded CE source code is reprinted with permission from Microsoft Corporation.

INTRODUCTION TO EMBEDDED SYSTEMS USING WINDOWS EMBEDDED CE Table of Contents Preface 8 1. Introduction to Embedded Systems 12 1.1 Examples of Embedded Systems 12 1.2 Real-Time Operating Systems 15 1.3 Operating Systems for Embedded Systems 16 1.4 Processors and Software used in new Embedded System Designs 17 1.5 Introduction to the Embedded System Design Process 21 1.6 Development of an Embedded Systems Design 22 1.7 Memory Technologies used in Embedded Devices 23 1.8 For additional information: 24 2 Introduction to Embedded System I/O Architectures 26 2.1 Example of a first generation microprocessor bus 26 2.2 Building I/O interface hardware that attaches to a bus 31 2.3 Software used to transfer data to I/O Ports 35 2.4 Example of a second generation microprocessor bus 36 2.5 Software support for PCI devices 40 2.6 Example of a third generation microprocessor bus 40 2.7 An Example X86 Embedded System 41 2.8 I/O Transfer Techniques 42 2.9 Program Driven I/O Transfers 42 2.10 Interrupt Driven I/O Transfers 43 2.11 Direct Memory Access (DMA) I/O Transfers 45 2.12 OS support for Device Independent I/O & Files 46 2.13 Unicode and ASCII character encodings 46

4 Introduction to Embedded Systems using Windows Embedded CE 2.14 For additional information: 48 2.15 Laboratory Exercises 48 3 I/O Interfacing Standards for External Devices 50 3.1 Parallel Printer Interface 50 3.2 Software support for the parallel printer port 51 3.3 RS-232C Serial I/O Interface 51 3.4 Software support for serial communications 54 3.5 The PS/2 Keyboard and Mouse Interface 54 3.6 Software for the PS/2 Keyboard and Mouse Interface 56 3.7 SPI Bus Interface 56 3.8 I2C Bus Interface 57 3.9 Software support for SPI and I2C devices 60 3.10 Analog Inputs and Outputs 60 3.11 The Universal Serial Bus (USB) 61 3.12 Software support for USB devices 63 3.13 Audio I/O Devices 64 3.14 Interfacing to motors and relays 65 3.15 For Additional Information 66 4 The Ethernet Network Interface 68 4.1 Terminology 68 4.2 Frame Types 69 4.3 CSMA/CD over a Shared Medium Ethernet 70 4.4 Segmentation, Bridges, and Routers 71 4.5 The TCP/IP Network Protocol 72 4.6 Application Protocols 73 4.7 Transport Protocols 74 4.8 Network Communication Protocols 74 4.9 Network Topology 74 4.10 Software support for Networking 74 4.11 For Additional Information 75 5 The eBox 2300 Embedded Computer System 78 5.1 Architecture of the eBox 2300 78 5.2 Booting the eBox 80 5.3 Interfacing external hardware to the eBox 2300 82

Introduction to Embedded Systems using Windows Embedded CE 5 5.4 Interfacing external hardware using USB 83 5.5 Interfacing a USB Web Camera 84 5.6 Interfacing external hardware using the Serial Port 84 5.7 Low-cost Sensors for Embedded System Projects 85 5.8 Using Servos for Embedded System Projects 87 5.9 Example Student Projects using the eBox 88 5.10 For Additional Information 92 5.11 Laboratory Exercises 92 6 Architecture of a Real-Time Embedded OS – CE 6.0 94 6.1 User Applications 96 6.2 The Kernel 98 6.3 Memory Architecture 99 6.4 Core operating system (OS) services 106 6.5 File systems 106 6.6 Graphics, Windowing, and Events Subsystem (GWES) 108 6.7 Processes and Threads 108 6.8 Multitasking and Scheduling 110 6.9 Real-Time Performance 113 6.10 Synchronization Primitives 115 6.11 Interprocess Communication 118 6.12 Interrupt Processing 119 6.13 Device Drivers 123 6.14 User Mode Drivers 124 6.15 The Registry 126 6.16 Device Manager 128 6.17 Loader 131 6.18 Power Management 132 6.19 OS Security Features 135 6.20 OS Networking Features 137 6.21 The OS Build System and Platform Builder 141 6.22 Platform Builder Terminology 142 6.23 Building a Run-time image 143 6.24 Build System Configuration Files 145 6.25 For Additional Information 149

6 Introduction to Embedded Systems using Windows Embedded CE 7 Building a customized CE Kernel 152 7.1 Videos & Virtual Labs: An introduction to the CE tools via the web 152 7.2 Software Installation Instructions 154 7.3 Tutorial I: Building a new OS kernel using the Ebox BSP 156 7.4 Tutorial II: Downloading a new OS kernel to the Ebox 2300 172 7.5 Tutorial III: Creating, compiling, and debugging a C/C Subproject 179 7.6 Tutorial IV: Generating a new SDK for use by application developers 185 7.7 Tutorial V: Creating and Building a C# Project 189 7.8 Tutorial VI: Deploying new application code to the target device 194 7.9 For Additional Information 203 7.10 Laboratory Exercises 203 8 Applications Programming in CE 206 8.1 FileIO example program 206 8.2 SerialIO example program using OS File I/O Calls 207 8.3 PortIO example program using the CE Device Driver Kit 211 8.4 Linking to other modules using the Project’s sources file 215 8.5 ILASMIO example program using in-line X86 assembly code 217 8.6 Thread and synchronization event example program 220 8.7 The Producer Consumer Problem 224 8.8 AC97 example program using CE API audio functions 230 8.9 A basic Windows application, the Hello World example 231 8.10 Managed Code vs. Native Code 235 8.11 The C# Hello World Example Program 236 8.12 Phidget USB drivers and example programs 237 8.13 Calling C/C functions from C# 240 8.14 For Additional Information 241 8.15 Laboratory Exercises 241 9 Introduction to I/O Device Drivers 246 9.1 The Stream Interface Model for Device Drivers 247 9.2 ISR & IST Processing for Device Drivers 252 9.3 DMA operations in Device Drivers 258 9.4 A simple example device driver for the Ebox 259 9.5 Production Quality Drivers 269 9.6 For Additional Information 269

Introduction to Embedded Systems using Windows Embedded CE 9.7 7 Laboratory Exercises 270 10 Advanced OS Topics 272 10.1 Porting the OS to a new device 272 10.2 Developing a BSP for a new board design 273 10.3 Developing a Bootloader for a new device 274 10.4 Modifying the OEM Adaptation Layer 275 10.5 Moving a new OS image to the eBox for standalone booting 278 10.6 Tools for Testing 279 10.7 Safety-Critical Coding 283 10.8 Licensing and IP issues for Embedded Systems 284 10.9 For Additional Information 286 10.10 Laboratory Exercises 286 Appendix A: Automatically running an Application 287 Appendix B: Using the CE Remote Display Application 289 Appendix C: Making a bootable USB drive for the eBox 291 Appendix D: Information on the CD-ROM Design Files 293

8 Introduction to Embedded Systems using Windows Embedded CE Preface Intended Audience The goal of these materials is to develop academic curriculum materials for students that can be used in undergraduate degree programs in Computer Science, Computer Engineering, and Electrical Engineering. Student laboratory assignments developed for these materials use Windows Embedded CE 6.0 a commercial RTOS designed for embedded systems. Target devices include an ARM emulator and a low-cost X86 SOC computer, the eBox 2300. Phidgets USB-based I/O devices and sensors can also be used for projects needing additional I/O such as analog inputs and digital inputs and outputs. At many schools, these materials would be appropriate for two undergraduate courses, Embedded Systems, and Senior Design Project. These are typically three hour credit classes. It is assumed students have had some prior coursework in programming in C or Java, digital hardware, introduction to computer architecture, and in some cases an introductory operating systems class. An Embedded Systems Design course has replaced the traditional microprocessor/microcontroller based design course at many schools. An embedded systems class is elective in most CS and EE degree programs, and typically is required in CmpE degree programs. At many schools, these courses need to be updated with newer technology that more accurately reflects current design practice and the technology used in new embedded products. The introductory operating systems classes typically include several OS case studies. The material in the Chapter on the Windows Embedded CE Architecture could be also be used to as one of these case studies as an example of a popular commercial RTOS used to develop embedded systems. Many students today also use an embedded computer board for their senior design project. These materials would also provide students an overview and tutorials on using a Windows CE 6.0 and the eBox computer for their design project. Topic Selection and Organization The text starts with an overview of the embedded system design process and the tools used to develop embedded systems in Chapter 1. Chapters 2-5 introduce the basic hardware design concepts needed to understand how software communicates to I/O devices in embedded systems. Several of the more commonly used I/O interface standards are described along with an overview of the eBox 2300 architecture. Chapters 6-10 introduces the Windows Embedded CE 6.0 operating system and include getting started tutorials on building a new OS kernel and applications development. These development tools run from the familiar Visual Studio IDE.

Introduction to Embedded Systems using Windows Embedded CE 9 Early tutorials can use the ARM emulator and then move to the Ebox 2300 target hardware. A new OS can be generated on the PC-based development system and downloaded over the network to the eBox in just a few minutes. Source code and project files are provided for a number of application programs that utilize OS API calls to use different hardware features of the eBox. Software and Hardware Packages Windows Embedded CE 6.0 is now available free to faculty and students under the MSDN Academic Alliance program and in a 180-day free trial version. One other key consideration for schools and students is the cost of the embedded computer system. The current academic pricing for the eBox 2300 MSJK CE embedded computer with CE preinstalled and a full set of cables is roughly the same as an academic textbook. Additional Web Material and Resources Updates to this material will be posted at the Microsoft Academic Alliance Curriculum Repository web site at: http://www.msdnaacr.net/curriculum/facetmain.aspx Links to other Microsoft resources for schools can be found at the Windows Embedded Academic Program (WEMAP) web site at: /default.aspx Information on obtaining academic discounts for the eBox 2300 MSJK SOC embedded computer system can be found at: www.embeddedpc.net/academic/eBox2300.html Phidget USB I/O devices and sensors are available from Phidgets Inc: www.phidgets.com and www.phdigetsusa.com

10 Introduction to Embedded Systems using Windows Embedded CE Acknowledgements This work was funded at the Georgia Institute of Technology in the School of Electrical and Computer Engineering under a research contract with Microsoft Corporation. GIT Contract 210663C, J. O. Hamblen, Principal Investigator. Lindsay Kane, Mike Hall, and Sue Loh at Microsoft, Samuel Phung at ICOP, Jim Wilson and David Jones have provided materials, software, hardware, helpful advice, and encouragement. Wallace Tennille, Yony Feng, and all of the students in the Embedded Systems Design class in the Fall of 2006 helped to develop, test, and improve this material.

CHAPTER 1 Introduction to Embedded Systems This TMIO ConnectIO Oven is an embedded system. It can refrigerate food prior to cooking it. It can be remotely controlled over the Internet or via a phone. It runs the Windows Embedded CE OS. Call it on the way home and your food will be ready when you arrive. Photograph courtesy of TMIO LLC.

12 Introduction to Embedded Systems using Windows Embedded CE 1. Introduction to Embedded Systems An Embedded system is any electronic device that incorporates a computer in its implementation. The user of an embedded device is often not even aware that a computer is present in the device. The computer is used primarily to provide flexibility and to simplify the system design. Unlike a PC, program code is usually stored in ROM and not a hard disk drive. Typically, the end user does not develop new software for the embedded device. With advances in VLSI technology, embedded systems have become so inexpensive that they are found in most of today’s electronic devices. 1.1 Examples of Embedded Systems A robot such as the Mars rover seen in Figure 1.1 is an embedded system. A cell phone, PDA, or portable multimedia player as seen in Figure 1.2 is an embedded device. Even the electric toothbrush seen in Figure 1.2 is an embedded system. A small microcontroller in the toothbrush provides programmable speed control and a battery state of charge indication. High end automobiles can contain over fifty embedded microcontrollers. A typical middle class household has over fifty embedded devices. For every PC in the world there are over one hundred embedded devices. All told, embedded devices account for most of the world’s production of microprocessors. Figure 1.1 Robots such as the Mars Rovers are Embedded Systems. Photograph courtesy of NASA/JPL CALTECH.

Introduction to Embedded Systems using Windows Embedded CE 13 As seen in table 1.1, embedded devices can be found in a wide array of products including aircraft and military systems, biomedical systems, cars, communications, computer I/O devices, electronic instrumentation, home electronics, industrial equipment, office machines, personal devices, robots, and smart toys. Embedded devices can be found everywhere. Embedded systems designers often face challenging design goals. Embedded systems must be reliable. Many embedded devices can’t crash, and may not be able to reboot. Software can’t be updated in many embedded devices. Many devices have critical performance & power design constraints. Real-time constraints occur in many applications and many devices have limited memory and processing power. Some devices may need to run on battery power for long periods of time. In addition, consumer devices typically have a fast time to market on new products and are very cost competitive. Figure 1.2 Cell phones, PDAs, and Multimedia Players are all embedded systems. Even this electric toothbrush! Photographs courtesy of Motorola, Microsoft, and Philips Sonicare.

14 Introduction to Embedded Systems using Windows Embedded CE Table 1.1 Examples of Embedded Systems Aircraft & Military Systems Biomedical Systems Cars Communications Consumer Electronics Computer I/O Devices Electronic Instrumentation Industrial Equipment Office Machines Personal Devices Robots Toys Aircraft autopilots, avionics and navigation systems, automatic landing systems, guidance systems, engine controls. CAT scan and Ultrasound imaging systems, patient monitors, heart pacers. Engine control, anti-lock braking systems, traction control systems, air bag controls, heating and air conditioning controls, GPS mapping, Satellite Radio, On-board Diagnostics. Communication Satellites, network routers, switches, hubs. TVs, ovens, dishwashers, DVD players, stereos, security systems, lawn sprinkler controls, thermostats, cameras, clock radios, answering machines, set top boxes, other appliances. Keyboards, mice, printers, scanners, displays, modems, hard disk drives, DVD drives, graphics cards, USB devices. Data acquisition systems, oscilloscopes, voltmeters, signal generators, logic analyzers. Elevator controls, surveillance systems, robots, CNC machines, Programmable Logic Controllers, industrial automation and control systems. FAX machines, copiers, telephones, calculators, cash registers. Cell phones, portable MP3 players, Video players, Personal Digital Assistants (PDAs), electronic wrist watches, handheld video games, digital cameras, GPS systems. Industrial robots, autonomous vehicles, space exploration robots (i.e. Mars robots) Video Game systems, “Aibo”, "Furby“, and “Elmo” type robot toys.

Introduction to Embedded Systems using Windows Embedded CE 15 1.2 Real-Time Operating Systems A real-time system must respond to external inputs and produce new outputs in a limited amount of time as seen in Figure 1.3. The response time needs to be bounded. Response times that are too long can cause real-time systems to fail. An illustrative example of a real-time system is the automobile airbag controller in your car. When the airbag’s motion sensors (accelerometers) detect a collision, the system needs to respond by deploying the airbag within 10ms or the system fails. At high speeds, with any delay longer than 10ms the driver will have already impacted the steering wheel before the airbag deploys. External Input Event Process New Data Output Response to Event System Response Time Figure 1.3 A real-time system must respond to external inputs and produce new outputs in a limited amount of time or the system fails. Current response times are around 0.5 to 10ms. In a soft Real-Time System, critical tasks get priority. A soft real-time system normally meets the real-time response constraint. A typical soft real-time example is a multimedia player. The player could occasionally skip a video frame or audio sample and a user might not even notice as long as it ran correctly the vast majority of the time. In a hard real-time system, a new output response must always be computed by the specified time bound or the system will fail. For a hard real-time example, consider a fly-by-wire (i.e. computer controlled) aircraft control system. In an aircraft flight control system when the pilot moves the control yoke, the flight control surfaces need to move very quickly in response or the aircraft would become unstable and crash. To insure safety, the FAA actually tests and certifies the real-time response of computer controlled flight simulators and aircraft. Virtual memory page swapping and garbage collection routines needed for object oriented languages can cause problems in hard real-time systems. Even caching is sometimes an issue since it can cause program execution times to vary. Many embedded systems are real-time systems with several inputs and outputs. Multiple events are occurring independently. Programming is simplified by separating the tasks, but this requires the CPU to switch back and forth among

16 Introduction to Embedded Systems using Windows Embedded CE the different tasks. An operating system that supports multitasking has features to time slice the CPU among multiple tasks. The OS also provides the synchronization primitives needed to coordinate activities among different tasks running in parallel. Operating systems are often categorized by their real-time characteristics. A real-time operating system must be carefully designed in order to support realtime applications. A recent study concluded that 95% of real-time applications require a bounded response time in the range of 0.5 ms to 10 ms. Only a 10% variance (50 us to 1 ms jitter) in the response time can be tolerated. By these measures, most general purpose operating systems are not real-time. Using these measures, an embedded OS such as Windows Embedded CE qualifies as a real-time operating system (RTOS). The Kernel code in an RTOS is written so that processor interrupts are only disabled for very short periods of time. The maximum interrupt response time (latency) is a key factor in the response time of an RTOS. A traditional desktop OS like Windows XP can be considered only a soft real-time OS at best. Some third party tools are available for Windows XP that improve the response time. 1.3 Operating Systems for Embedded Systems Most new devices have complex software that needs support for multitasking, synchronization of tasks, support for a wide range of I/O devices, scheduling and buffering of I.O operations, memory management, support for graphics displays, file systems, networking, security, and power management. An operating system can provide all of these features to aid application developers. Application programmers are more productive since they can work at a higher level of abstraction by using these features provided by the operating system. A recently released cell phone design contained over five million lines of code. Few, if any projects, will have the time and funding needed to develop all of this code entirely on their own. In cases such as this, it makes economic sense to use an existing operating system. The development time and costs saved more than pays for the licensing fees for the operating system. The typical commercial embedded OS license fees run only a few dollars per device. Some very simple low-end devices might not need an OS, but new devices are constantly getting more complex. For these reasons, most embedded devices use an embedded operating system. Embedded operating systems typically are developed largely in C/C and come bundled with a C/C compiler, assembler, and debugging tools to assist designers in developing application programs and testing the device. Embedded system development tools must also support program execution using code stored in non-volatile memory such as ROM or Flash memory.

Introduction to Embedded Systems using Windows Embedded CE 17 1.4 Processors and Software used in new Embedded System Designs Annual surveys of designers working on new embedded devices are conducted by several of the popular trade publications. It is interesting to examine the general trends uncovered by these surveys and see what types of new embedded systems are currently being developed. Figure 1.4 shows the bit size of processors currently being used in new embedded designs. Most current design activity appears to be centered around 32-bit processors. It is not surprising that given the continuing advances in VLSI technology the trend has always been toward larger and more powerful processors in embedded devices. The program code and applications running on new embedded devices also continues to increase both in complexity and memory requirements. 64-bit 32-bit 16-bit 8-bit 4-bit 0.00% 10.00% 20.00% 30.00% 40.00% 50.00% 60.00% Figure 1.4 Processor bit size used in new embedded designs. Figure 1.5 shows the annual 32 and 64-bit microprocessor sales data for 2002. ARM and X86 based processors have the largest market share followed by several other RISC processors, MIPS, SuperH, and PowerPC. Current data is believed to be similar, but is not publicly available. The ARM processor is a 32bit RISC low-power design from an English IP company, ARM ltd (Advanced RISC Machines) http://www.arm.com/. ARM does not make any processor chips, instead they produce their revenue by licensing the ARM IP processor designs to semiconductor manufacturers that produce their own version of an ARM processor. ARM’s processor designs are licensed to over 100 chip manufacturers. ARM is used in many devices such as cell phones, iPod Nano, Cameras, Handheld Games, HDTVs, and Set-Top boxes. 80% of ARM processors are in cell phones. A good performance/power ratio makes it a very popular choice in low power and battery operated devices.

18 Introduction to Embedded Systems using Windows Embedded CE ARM’s thumb instruction subset is coded into 16-bits and decompressed onthe-fly to full 32-bit instructions. It can switch from 16-bit to 32-bi

EMBEDDED CE A Tutorial Approach with Laboratory Exercises for Windows Embedded CE 6.0 and the eBox 2300 SoC Embedded Computer January 2007 James O. Hamblen School of Electrical and Computer Engineering . 1.4 Processors and Software used in new Embedded System Designs _ 17

Related Documents:

ELA ITEMS 5th GRADE SAMPLE ELA ITEMS 7TH GRADE SAMPLE ELA ITEMS 8TH GRADE SAMPLE ELA ITEMS ELA ITEMS . ELA Grade 6 Draft Sample PT Item Form C3 T1, T3, T4 And C4 T2, T3, T4 . ELA.6.PT.3.03.083 C3 T1, T3, T4 And C4 T2, T3, T4 . Sample Item ID: ELA.6.PT.3.03.083 . Title: Young Wonders

A Proud Heritage: African Americans and Pro Football RI, W, SL ELA 1-2 African American Football Pioneers RI, W, SL ELA 3-4 All About Grammar L ELA 5-6 Analyzing Media Messages RI, SL ELA 7-8 Analyzing Poetry RL, RI, W, SL ELA 9-11 Breaking the Color Barrier: The Kansas Comet’s Roommate RL, RI, W, SL ELA 12-13 Descriptive Writing RI, W, L ELA 14

Summer 2018 ELA Course Registration Guide (pg.2) (pg.2) Email Directory and ELA T.Q. Quick Links . ELA 103: The Denver ELA Program ELA 104: Academic Language in the Content Areas .

FSA ELA Session Timing The FSA ELA includes the Text-Based Writing Component, administered separately from the rest of FSA ELA to allow time for hand-scoring; will be reported as part of a single ELA score. Headphones are required for all students for Grades 5- 11 ELA listening items (CBT). External keyboards are strongly recommended. 11

ELA.EE.RL.3.2 Associate details with events in stories from diverse cultures. ELA.EE.RL.3.3 Identify the feelings of characters in a story. ELA.EE.RL.3.5 Determine the beginning, middle, and end of a familiar story with a logical order. ELA.EE.RI.3.1 Answer who and what questions to demonstrate understanding of details in a text.

2. Embedded systems Vs General Computing system Page 4 Sec 1.2 ; 3. History of embedded systems , classification of embedded system Page 5,6 Sec 1.3 , Sec 1,4 . 4. Major application area of embedded sys Page 7 Sec 1.5 5. Purpose of embeded system Page 8 Sec 1.6 6. Typical Embedded sys: Core of embedded system Page 15 Chap 2 : 7. Memory Page 28

CO4: Investigate case studies in industrial embedded systems Introduction to Embedded systems, Characteristics and quality attributes (Design Metric) of embedded system, hardware/software co-design, Embedded micro controller cores, embedded memories, Embedded Product development life cycle, Program modeling concepts: DFG, FSM, Petri-net, UML.

CCSS.ELA-Literacy.RI.5.6 CCSS.ELA-Literacy.RI.5.7 CCSS.ELA-Literacy.RI.5.8 CCSS.ELA-Literacy.RI.5.9 CCSS.ELA-Literacy.RI.5.10 II THE PLAY’S THE THING: OUR STORY This new musical adaptation is based on the beloved and bestselling Scholastic Publishing series, THE MAGIC SCHOOLBUS . In this adventure, the Magic School Bus