Real-Time OS & SW Architecture
A practical program that takes you from your first FreeRTOS task to a complete Zephyr application. You build a real system along the way: requirements, architecture, safe states and signal processing, running on a real STM32 board and measured on a logic analyzer.
▶ Watch the 40-second preview: turn on the sound with the speaker icon
Who is it for?
Profile
- Embedded engineers moving from bare-metal to an RTOS
- Final-year students and PFE / internship candidates
- Engineers changing careers toward embedded systems
- FreeRTOS developers who want to adopt Zephyr
Prerequisites
- C programming (pointers, structs, bit operations)
- Basic microcontroller knowledge: GPIO, interrupts, UART
- A Windows PC; we install WSL (Ubuntu) for Zephyr together
- No prior RTOS experience needed
What you will be able to do
- Explain how a scheduler, the SysTick and a context switch work on ARM Cortex-M
- Design multi-task applications with queues, semaphores, mutexes, event groups, notifications and timers
- Check that a task set meets its deadlines (RMS, CPU load, timing measurements)
- Go from system requirements to software architecture, code and tests (V-model, ASPICE)
- Add fault handling, safe states and self-tests (functional safety, IEC 60730)
- Build, flash and debug Zephyr applications with west, devicetree, zbus, the shell, ztest and file systems
Detailed program
Each session mixes whiteboard theory, live coding and labs on the board. Open a session to see its content.
Module 1: RTOS fundamentals with FreeRTOS
Weekend 1Understand what an RTOS really does and write your first multi-task applications.
01From bare-metal to RTOS: tasks and the schedulerThe RTOS landscape, real time, scheduler internals, first tasks▶
Theory
- The RTOS market and popular solutions
- Bare-metal foreground/background vs RTOS
- What "real time" means: timing, deadlines and determinism
- How the scheduler works: SysTick, kernel, Task Control Block, ready list
- The context switch on ARM Cortex-M
Labs
- Set up STM32CubeIDE and the STM32F407 board
- Wire the board and the logic analyzer
- Configure GPIO and FreeRTOS in CubeMX
- Create tasks with
xTaskCreateand watch them on the logic analyzer - Measure task periods and delays
02Task states, memory and inter-task communicationTask lifecycle, stack and heap, queues, mutexes▶
Theory
- Task states: ready, running, blocked, suspended
- Task stack, heap and
FreeRTOSConfig.h vTaskDelayvsHAL_Delay- Preemptive vs cooperative scheduling; the idle task
- Queues: FIFO concept and API
- Shared resources, semaphores and mutexes
- Under the hood: reading
tasks.c
Labs
- Suspend and resume tasks
- Block a task with
vTaskDelay - Producer / consumer with a queue
- Full and empty queues, and the effect of task priorities
- Protect
printfwith a mutex
Module 2: Advanced FreeRTOS, real-time analysis and SW architecture
Weekend 2Master all the synchronization tools, prove your timing, and design software the way the automotive industry does.
03Synchronization, timing analysis and the V-modelEvent groups, notifications, timers, RMS, ASPICE▶
Theory
- Event groups,
xEventGroupSyncand event-driven design - Task notifications and queue sets
- Mutex, recursive mutex and semaphores
- Software timers
- Periodic and aperiodic tasks
- Rate Monotonic Scheduling (RMS) test and CPU utilization
- Thread safety
- SW architecture: the V-model and the ASPICE process
- System (SYS.2) and software (SWE.1) requirements
Labs
- Event groups in code and on the board
- Trace tasks with Percepio View
- Software timers
- Build an RMS task set and verify it on the logic analyzer
- Case study: a PC ↔ STM32 system over UART, from requirements to design
04From requirements to code: state machines, UART protocol, fault handlingArchitecture, implementation, qualification tests, safe states▶
Theory
- Precise periods with
vTaskDelayUntil - Architecture, sequence and state diagrams
- Inter-task communication design
- Requirements traceability and test specification
- Key architectural concerns: hardware abstraction, execution models
- Fault, error and failure; reliability
- Operating modes: normal, degraded and safe
- Safety requirements and functional safety in the V-model
Labs
- Implement the UART command handler and the system state machine in C
- Detect task overruns
- Run qualification tests and automate them with Python
- PC dashboard with live monitoring
- Switch the system into safe mode on a fault
Module 3: Functional safety, then getting started with Zephyr
Weekend 3Finish the safety architecture on FreeRTOS, then switch to Zephyr: the toolchain, threads and IPC.
05Safety analysis, testing, and an introduction to ZephyrSafety task, TDD, Zephyr setup, architecture and threads▶
Theory
- Kernel vs operating system
- FreeRTOS kernel objects in an architecture; multi-producer / multi-consumer queues
- From requirement to design with ISRs and event groups
- Fault detection and reaction chain; safety analysis table
- Test specification, TDD, unit tests and code coverage
- Zephyr: architecture (kernel, HAL, drivers) and ecosystem
- How a Zephyr application is built (CMake, Kconfig, devicetree)
- Zephyr threads: lifecycle,
k_thread_create, options, priorities - Cooperative vs preemptive threads
Labs
- Heater lab: sensor, actuator and controller
- Implement a safety task and demo the safe mode
- Install Zephyr on WSL and set up the workspace
- Build and flash with
west - Static and dynamic threads
- Cooperative threads and fatal errors
06Zephyr in practice: memory map, build, threads and IPCFlash layout, devicetree, message queues, mailboxes▶
Theory
- Flash sectors and memory layout
- Non-volatile memories: ROM, flash, EEPROM
- The Zephyr build in detail and the memory report
- From the board schematic to the devicetree
- Thread join and parallel execution
- Zephyr IPC overview:
k_msgqandk_mbox
Labs
- Define threads with
K_THREAD_DEFINEandk_thread_create - Flash the board and read the serial output
- Message queue producer / consumer
- Mailbox sender / receiver
Module 4: Advanced Zephyr and a signal-processing project
Weekend 4Use the Zephyr services found in products, then build a real-time FFT application with safety mechanisms.
07Zephyr deep dive: devicetree, zbus, ztest, shell and file systemsFrom native_sim to the project architecture▶
Theory
- FreeRTOS vs Zephyr: kernel vs OS
westcommands and the build system, from sources tozephyr.elfnative_sim: run Zephyr on your PC- Benchmark on Cortex-M4F
- Devicetree: describe the STM32F4 Discovery and its peripherals
- zbus, the Zephyr message bus: channels, listeners, subscribers, and what happens on publish
- Unit testing with ztest and code coverage
- The Zephyr shell
- File systems and storage partitions (LittleFS)
- Project: system and software requirements, AUTOSAR concepts, SW components
Labs
- Run the RMS scheduling lab on
native_sim - Producer / consumer with Zephyr IPC
- zbus: publisher, listener, subscriber; LED and button channels
- Write ztest unit tests and read the coverage report
- Create custom shell commands
- Use LittleFS from the shell
- Start the project architecture and implementation
08Signal processing on STM32: FFT and double bufferingFinal project: a real-time multi-sensor FFT with self-tests▶
Theory
- Signal acquisition: sampling a sensor with the ADC
- FFT on STM32 with CMSIS-DSP
- Double buffering: DMA, half/full-transfer ISR, ping-pong
- Application architecture: tasks and queues
- Startup self-test (auto-test) and the safe state
- Timing analysis: ISR and task budget
- Q&A: Zephyr vs FreeRTOS on ESP32
Labs
- Implement the FFT task
- Flash the board, check it on the logic analyzer, plot the spectrum on the PC
- Send FFT frames to the PC over UART
- Safe mode demo on the board
- Scale to two sensors and two FFT tasks
- Measure timing with the logic analyzer; version the project with Git
One system, built step by step
The labs are not isolated exercises. They follow one industrial workflow:
Tools and hardware
Hardware
- STM32F4 Discovery board (STM32F407, ARM Cortex-M4F)
- Logic analyzer
- USB-UART link to the PC
Software
- STM32CubeIDE and CubeMX, FreeRTOS
- Zephyr RTOS, west and the Zephyr SDK on WSL (Ubuntu)
- VS Code, Git and GitHub, Python
- Percepio View, CMSIS-DSP, logic analyzer software
What's included
- 8 live sessions with the trainer
- All lab sources on GitHub
- Slides and lab companion sheets
- Live Q&A in every session
Join the next session
Free 30-minute call with the trainer: we check the prerequisites with you and share the next dates.
Trainer: Mehdi Hanzouti, Embedded SW Architect · contact@opcode-labs.com