Presentation is loading. Please wait.

Presentation is loading. Please wait.

Embedded Systems John Regehr CS 5460, Dec 04. Embedded Systems  Account for >99% of new microprocessors  Consumer electronics  Vehicle control systems.

Similar presentations


Presentation on theme: "Embedded Systems John Regehr CS 5460, Dec 04. Embedded Systems  Account for >99% of new microprocessors  Consumer electronics  Vehicle control systems."— Presentation transcript:

1 Embedded Systems John Regehr CS 5460, Dec 04

2 Embedded Systems  Account for >99% of new microprocessors  Consumer electronics  Vehicle control systems  Medical equipment  Sensor networks

3 Definitions of “Embedded System” 1. A special-purpose computer that interacts with the real world through sensing and/or actuation 2. Almost any computer that isn’t a PC

4 More definitions  Microprocessor: A regular CPU  Microcontroller: A small system on a chip that contains extra logic for interfacing with the real world  Analog to digital and digital to analog converters  Pulse width modulation  Networks: serial, I2C, CAN, USB, etc…

5 Embedded Characteristics  Close interaction with the physical world  Often must operate in real time  Constrained resources  Memory  SRAM, DRAM, flash, EEPROM, …  Power  CPU cycles

6 More Characteristics  Often there is no:  Virtual memory  Memory protection  Hardware supported user-kernel boundary  Secondary storage  Hard to upgrade once deployed  Cost sensitive  Per-unit cost often dominates overall cost of a product

7 Important Difference  Unlike PC software, embedded software is developed in the context of a particular piece of hardware  This is good: App can be tailored very specifically to platform  This is bad: All this tailoring is hard work

8 CPU Options  Create custom hardware  May not need any CPU at all!  4-bit microcontroller  Few bytes of RAM  No OS  Software all in assembly  These are getting less popular

9 More CPU Options  8-bit microcontroller  A few bytes to a few hundred KB of RAM  At the small end software is in asm, at the high end C, C++, Java  Might run a home-grown OS, might run a commercial RTOS  Typically costs a few $$

10 More CPU Options  16- and 32-bit microcontrollers  Few KB to many MB of RAM  Usually runs an RTOS: vxWorks, WinCE, QNX, ucLinux, …  May or may not have caches  Wide range of costs  32- or 64-bit microprocessor  Basically a PC in a small package  Runs Win XP, Linux, or whatever  Relatively expensive in power and $$

11 Axes of Variation  Power 1. Must run for years on a tiny battery (hearing aid, pacemaker) 2. Unlimited power (ventilation control)  Real-time 1. Great harm is done if deadlines are missed (avionics) 2. Few time constraints (microwave)

12 More Axes of Variation  Importance 1. Device is safety critical (nuclear plant) 2. Failure is largely irrelevant (toy, electric toothbrush)  Upgradability  Impossible to update (spacecraft, pacemaker)  Easily updated (firmware in a PC network card)

13 More Variation  Cost sensitivity 1. A few % in extra costs will kill profitability (many products) 2. Cost is largely irrelevant (military applications)  The point: Embedded systems are highly diverse, it’s hard to make generalizations in this domain

14 Programming Languages  Assembler  No space overhead  Good programmers write fast code  Non-portable  Hard to debug  C  Little space and time overhead  Somewhat portable  Good compilers exist

15 More Languages  C++  Often used as a “better C”  Low space and time overhead if used carefully  Java  More portable  Full Java requires lots of RAM  J2ME popular on cell-phone types of devices  Bad for real-time!

16 RTOS  Low end: Not much more than a threads library  High end: Stripped-down version of Linux or WinXP  Important qualities:  Predictability  Reliability  Efficiency  Do Linux and XP have these?

17 What’s Hard?  Concurrency – threads, bottom- halves, interrupts  Debugging  Often printf and gdb don’t exist  Creating correct software – can’t patch a pacemaker  Getting a product out the door quickly  Meeting resource constraints (power, RAM, etc.)

18 Some Tradeoffs  Advanced tools are expensive ($10,000+ per developer) but can help a lot  Buying an OS helps but usually results in less efficient systems  Complex software architecture provides rich functionality but may be slow and hard to debug

19 Creating Embedded SW 1. Pick:  Cheapest CPU that seems like it’ll work  Appropriate language  Appropriate OS  Appropriate software architecture  Appropriate simulation tools 2. Code… test… repeat

20 Cyclic Executive main() { init(); while (1) { a(); b(); c(); d(); }} Advantages? Disadvantages?

21 Cyclic Exec. Variations main() { init(); while (1) { wait_on_clock(); a(); b(); c(); }} main() { init(); while (1) { a(); b(); a(); c(); a(); }}

22 Interrupts + Events main() { while (1) { event_t e = get_event(); if (e) { (e)(); } else { sleep_cpu(); }}} interrupt2() { time_critical_stuff(); enqueue_event (non_time_critical); } Advantages? Disadvantages?

23 Multithreading  Threads are usually sleeping on events  Highest priority thread runs except when:  It’s blocked  An interrupt is running  It wakes up and another thread is executing in the kernel Advantages? Disadvantages?

24 Port Based Objects my_pbo() { get_inputs (); // No side effects! compute (); store_results (); } Advantages? Disadvantages?  PBOs periodically invoked by OS  No blocking synchronization  Preemption may or may not be supported

25 Summary  Very different from programming desktop apps  Software architecture is worth thinking about in advance  Embedded systems are fun


Download ppt "Embedded Systems John Regehr CS 5460, Dec 04. Embedded Systems  Account for >99% of new microprocessors  Consumer electronics  Vehicle control systems."

Similar presentations


Ads by Google