1 / 25

Embedded Systems

Embedded Systems. John Regehr CS 5460, Dec 04. Embedded Systems. Account for >99% of new microprocessors Consumer electronics Vehicle control systems Medical equipment Sensor networks. Definitions of “Embedded System”.

sailor
Download Presentation

Embedded Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

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” • A special-purpose computer that interacts with the real world through sensing and/or actuation • 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 • Must run for years on a tiny battery (hearing aid, pacemaker) • Unlimited power (ventilation control) • Real-time • Great harm is done if deadlines are missed (avionics) • Few time constraints (microwave)

  12. More Axes of Variation • Importance • Device is safety critical (nuclear plant) • 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 • A few % in extra costs will kill profitability (many products) • 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 • Pick: • Cheapest CPU that seems like it’ll work • Appropriate language • Appropriate OS • Appropriate software architecture • Appropriate simulation tools • Code… test… repeat

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

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

  22. Interrupts + Events interrupt2() { time_critical_stuff(); enqueue_event (non_time_critical); } main() { while (1) { event_t e = get_event(); if (e) { (e)(); } else { sleep_cpu(); }}} 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 • PBOs periodically invoked by OS • No blocking synchronization • Preemption may or may not be supported my_pbo() { get_inputs (); // No side effects! compute (); store_results (); } Advantages? Disadvantages?

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

More Related