1 / 11

MicroC/OS-II

MicroC/OS-II. Embedded Systems Design and Implementation. MicroC/OS-2. Real-time kernel 5,500 lines of code portable (written in ANSI C) ROMable Scalable (services selectable) Preemptive Multitasking Interrupt management Rich services. Accessing critical section.

yitta
Download Presentation

MicroC/OS-II

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. MicroC/OS-II Embedded Systems Design and Implementation

  2. MicroC/OS-2 • Real-time kernel • 5,500 lines of code • portable (written in ANSI C) • ROMable • Scalable (services selectable) • Preemptive • Multitasking • Interrupt management • Rich services

  3. Accessing critical section • OS_ENTER_CRITICAL -- disabling interrupt • OS_EXIT_CRITICAL -- enabling interrupt

  4. Issues with disabling interrupt • If you call the processor supported instruction directly • you may get inconsistency • Use PSW (processor status word) • can be done on the stack or local variable

  5. Tasks • A task is often written as an infinite loop or as self-terminating • MicroC/OS-II supports 64 tasks, two are used by the system (priority 62 and 63) • lower number = higher priority • each task must have a unique priority; thus task id = task priority

  6. Task creation • can be done prior to multitasking or dynamically • what happens of the priority of the created task is higher than its creator? • a task can suspend itself or wait for for events to occur

  7. Task States task waiting task dormant task ready task running ISR running

  8. Task control block • data structure that is used to maintain the state of a task when it is preempted so that it can resume where it left off • maintain information about the runtime stack (current top of stack, bottom of stack, stack size) • CPU content is saved on the stack

  9. Task scheduling • execute the highest priority task ready to run • task scheduling is done in constant time • context switch is done through software trap • save CPU content of preempted task • restore CPU content of the next running task

  10. Locking scheduler • allows a task to keep control of the CPU • interrupts still being serviced if enabled • locking function can be nested 255 levels deep

  11. Idle and statistics tasks • idle task -- lowest priority task • increment counters to support statistics task • statistics task -- lowest-prio - 1 • compute the percentage of CPU usage

More Related