Try   HackMD

Getting Started with Real-time Operating Systems

Video link: https://atollic.wistia.com/medias/gwgee6ev93

RTOS Introduction

microcontroller

  • before , 4~16K RAM, 8MHz CPU
  • now, 16~32K RAM

we can build really cool stuff.

Bare-metal scheduling technique

Round-Robin Scheduling

int main(void) { System_Init(); while (1) { Task1(); Task2(); Task3(); } return 1; }
  • pros
    • easy to implement
  • cons
    • Adding new task will change the real-time attribute (need to tune again)
    • not the best for RTOS

Round-Robin scheduling improvement

With interrupts, we can change the current task.

Cooperative Scheduling

  • Read system time

    • Run task1? yes: Task1, no: check next task
    • Run task2? yes: Task2, no: read system time
  • procs

    • only need to check all task end with the deadline
    • can have interrupt
    • can have hard real-time
  • cons

    • Can't preemptive

Task Concurrency

  • Sequential Tasks
    • Task 1
    • Task 2
    • Task 3
    • Task 1
    • …
  • Concurrent Tasks
    • Task 1
    • Task 3
    • Task 1
    • Task 2
    • Task 1
    • …

RTOS Characteristics

A Real-Time Operating System (RTOS) is an operating system designed to manage hardware resources of an embedded system with very precise timing and a high degree of reliability.

  • Example 6 characteristics
    • Reliability
    • Predictability
    • Performance
    • Compactness
    • Scalability
    • Multi-Tasking

Bara-metal or RTOS

  • 7 Reason to choose an RTOS
    • Concurrency
    • Preemption
      • a task to be interrupt by higher priority to run on the CPU
      • In bare-metal, using preemption will make code too complex.
    • Available RAM
    • Available flash
    • Sync tools
    • 3rd party software
    • Ease of use

FreeRTOS

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Task Fundamentals

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Create Task

xTaskCreate( Led_BlueBlink, /* Task Pointer */ (const char *const) "led_blue", /* Task Name */ configMINIMAL_STACK_SIZE, /* Stack Depth */ 0, /* Parameters to Pass to task */ 1, /* Task Priority */ 0 /* Pass handle to create task */ );

Task States

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

FreeRTOS Resource

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →