1 / 14

Embedded Operating System Design

Embedded Operating System Design. October 4, 2012 Doug Kelly. Embedded Platforms. What’s different? System-on-Chip ( SoC ) integrates components Storage (MNAND, NOR, SD…) Power requirements/management May have memory management (MMU) May have graphics processor (GPU)

caelan
Download Presentation

Embedded Operating System Design

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 Operating System Design October 4, 2012 Doug Kelly

  2. Embedded Platforms • What’s different? • System-on-Chip (SoC) integrates components • Storage (MNAND, NOR, SD…) • Power requirements/management • May have memory management (MMU) • May have graphics processor (GPU) • May have direct memory access (DMA) • More specialized hardware • Digital signal processor (DSP) • GPS baseband processor • Camera/imaging processor

  3. Embedded Platforms - Processors • ARM, MIPS, RISC…? • ARM is RISC-based, sold as IP “blocks” • Core processor • Debugging coprocessor • GPU block (Mali), or 3rd-party vendors (SGX, Tegra) • Vector Floating Point (VFP) • NEON (SIMD processing architecture) • Memory management • Cache memory • 32-bit architecture • Three instruction sets (ARM, Thumb, Thumb2)

  4. Embedded Platforms • Okay, so what? • Floating point is not free. • Time-critical tasks need servicing • Other devices may be using memory bus • May only have physical addressing • Storage is slow, cache is limited • Engineers need to solve this!

  5. Operating System Design • EmebeddedOSes exist! • Home-grown, open-source or commercial • GarminOS • WindowsCE (Windows Embedded Compact) • VxWorks • QNX • Linux (RTLinux) • eCos • Handle scheduling by priority or round-robin • WinCE has 256 process priorities (8 for applications) and round-robin scheduling within a priority

  6. Operating System Design - Memory • RTOSes handle memory management • Some platforms don’t have MMUs, now what? • May not be possible to use dynamic memory • Safest, most portable option. • Relies on static structures within program to use as scratch space • Design a malloc() replacement? • Need to mark memory in-use, so it isn’t used while defragging memory • Pointer to allocated memory may change, so requires careful design

  7. Operating System Design - Scheduling • Threads can be used to limit impact of non-critical failures in some applications • Priority systems guarantee most critical tasks run when needed • Lower priority tasks run when higher tasks are blocked in some form (may be waiting for next event) • But… higher priority tasks could be blocked if a lower-priority task holds a resource!

  8. Operating System Design - Scheduling • Priority “inversion” temporarily raises priority • Allows low-priority tasks to finish faster, unblocking high-priority tasks • Control your loops/recursion! • Some coding guidelines for embedded systems prohibit recursion, since it can quickly go without bound or exceed stack space. • A high priority task stuck in a runaway loop can result in an unresponsive or useless system. • Watch for deadlocks! • True in any OS, but may be catastrophic in some cases • Some RTOSes can detect deadlocks • Always reserve resources in the same order

  9. Operating System Design - Interrupts • IRQ, FIQ • Come in many flavors • Hardware • External peripherals • DMA • Timers • Special-purpose hardware interrupt • Service watchdog timers, handle rescheduling, sometimes communication • Software • When good software goes bad • “Data Abort” – illegal memory access, page faults (if supported) • “Pre-fetch Abort” • “Undefined Instruction” • Division by zero, etc.

  10. Operating System Design - Interrupts • ISRs used to handle interrupts • ISRs may have limitations imposed by OS, platform, or processor technology • Timing constraints • Access to memory • IRQ may be interrupted • Must not block! • Handling dependent on the interrupt vector table • Defines both exception and IRQ/FIQ handlers • Fast and efficient is the key!

  11. Operating System Design - IPC • Inter-process communication used to interact with the system at all levels • Hardware drivers have no business updating UI state, nor should UI touch hardware • Can also be used to process long-running jobs • May be simple events, or contain data • Who owns the data? • Which thread is the event processed on? • When is the event processed? • Callback functions to return control • Boost signals/slots • Object-Oriented Callbacks

  12. Debugging • JTAG • Closest to processor, can access entire memory bus • May be useful for saving snapshot of device state for future analysis. • Can also load code into RAM and reset registers (but peripherals may not reset!) • WinCE: KITL • Kernel level transport, has a fair-amount of control • Allows developer to see “into” kernel calls • WinCE also supports Visual Studio Remote Debugging • Linux/Other: GDB • Can be implemented on many platforms; gdb has stubs • Don’t rule out printf()!

  13. Questions? Doug Kelly Software Engineer doug.kelly@garmin.com

More Related