Free RTOS in STM32 Board

Course Syllabus

STM32 FreeRTOS Programming – Course Syllabus

Learn FreeRTOS fundamentals, task management, scheduling, synchronization, interrupts, and real-time application development using STM32 microcontrollers.

Module 1: RTOS Fundamentals

  • What is an RTOS?
  • Hard vs Soft Real-Time Systems
  • RTOS vs GPOS (Scheduling, Latency, Priority Inversion)
  • FreeRTOS Porting Method

Module 2: Task Creation and Management

  • Task Implementation Function
  • xTaskCreate() and Starting the Scheduler
  • TCB, Stack and Heap Allocation
  • Idle Task and Task States (Introduction)

Module 3: FreeRTOS Interrupt and RTOS Tick

  • Why a Scheduler is Needed
  • vTaskStartScheduler() Internals
  • RTOS Tick and SysTick Configuration
  • What the Tick ISR Does

Module 4: Scheduling Policies

  • Task States (Running, Ready, Blocked, Suspended)
  • Pre-emptive Scheduling
  • Priority-based Pre-emptive Scheduling
  • Co-operative Scheduling and Comparison of Policies

Module 5: Context Switching and Error Handling

  • What is Context Switching?
  • ARM Cortex-M Registers (PSP and MSP)
  • PendSV: Switching Out and Switching In
  • Error Handling (configASSERT, Stack Overflow, Malloc Failed)

Module 6: Task Deletion, Priorities and Delays

  • FreeRTOS Coding Conventions and Data Types
  • Deleting a Task
  • vTaskPrioritySet() and uxTaskPriorityGet()
  • Blocking vs Non-Blocking Delay (vTaskDelay, vTaskDelayUntil)

Module 7: Task Notifications

  • Task Notification Concept (32-bit Value)
  • xTaskNotifyWait()
  • xTaskNotify()
  • Exercise: LED and Button Tasks

Module 8: Software Timers

  • Software Timer Concept
  • One-Shot vs Auto-Reload Timers
  • Timer Services (Daemon) Task
  • xTimerCreate() and xTimerStart()

Module 9: Semaphores

  • Task Synchronization Concept
  • Binary Semaphore
  • Counting Semaphore
  • xSemaphoreGive() and xSemaphoreTake()

Module 10: Mutex, Priority Inheritance and Priority Inversion

  • Mutual Exclusion and Shared Resources
  • Mutex vs Binary Semaphore
  • Priority Inversion Problem
  • Priority Inheritance

Module 11: Idle Task and Hook Functions

  • Idle Task and Its Significance
  • Idle Hook Function
  • Tick Hook Function
  • Exercise: Put the MCU to Sleep from the Idle Task

Module 12: Interrupt Configuration on Cortex-M

  • configKERNEL_INTERRUPT_PRIORITY
  • configMAX_SYSCALL_INTERRUPT_PRIORITY
  • Priority Registers and Priority Bits
  • Rules for ISRs Using RTOS APIs

Module 13: Interrupt-Safe APIs

  • GPIO, EXTI and Interrupt Controller
  • Interrupt-Safe vs Interrupt-Unsafe APIs
  • Why FromISR APIs are Needed
  • xHigherPriorityTaskWoken

Module 14: Queue Introduction

  • What is a Queue? (FIFO)
  • xQueueCreate()
  • xQueueSend() and xQueueReceive()
  • Blocking on Queues and Timeouts

Module 15: Queue Project

  • Project Requirement and Design
  • Integrating Tasks, Queues and Interrupts
  • Implementation and Testing
  • Revision and Q&A

Hands-On Project

FreeRTOS Task and Queue-Based Application

Participants will build a practical STM32 FreeRTOS application using multiple tasks, queue communication, and interrupt handling.
  • Create and manage multiple FreeRTOS tasks
  • Implement queue-based communication between tasks
  • Integrate GPIO interrupts with FreeRTOS tasks
  • Use interrupt-safe FreeRTOS APIs
  • Test and debug the application on STM32 hardware

Course Outcome

By the end of this course, participants will understand FreeRTOS fundamentals, task creation and management, scheduling policies, context switching, task notifications, software timers, semaphores, mutexes, interrupt handling, and queue communication. Participants will gain practical experience developing a multitasking real-time application using STM32 microcontrollers and FreeRTOS.