Real-time Operating Systems Book 2 - The Practice: Using STM Cube, FreeRTOS and the STM32 Discovery Board (Engineering o
There’s something really satisfying about turning theory into practice, bringing with it a great feeling of accomplishment. Moreover it usually deepens and solidifies your understanding of the theoretical aspects of the subject, while at the same time eliminating misconceptions and misunderstandings. So it’s not surprising that the the fundamental philosophy of this book is that ‘theory is best understood by putting it into practice’. Well, that’s fine as it stands. Unfortunately the practice may a bit more challenging, especially in the field of real-time operating systems. First, you need a sensible, practical toolset on which to carry out the work. Second, for many self-learners, cost is an issue; the tools mustn’t be expensive. Third, they mustn’t be difficult to get, use and maintain. So what we have here is our approach to providing you with a low cost toolset for RTOS experimentation. The toolset used for this work consists of: A graphical tool for configuring microcontrollers (specifically STM32F variants) - STM32CubeMX software application. An Integrated Development Environment for the production of machine code. A very low cost single board computer with inbuilt programmer and debugger All software, which is free, can be run on Windows, OSX or Linux platforms. The Discovery kit is readily available from many electronic suppliers. The RTOS used for this work is FreeRTOS, which is integrated with the CubeMX tool. The author: Jim Cooling has had many years experience in the area of real-time embedded systems, including electronic, software and system design, project management, consultancy, education and course development. He has published extensively on the subject, his books covering many aspects of embedded-systems work such as real-time interfacing, programming, software design and software engineering. Currently he is a partner in Lindentree Associates (which he formed in 1998), providing consultancy and training for real-time embedded systems. See: www.lindentreeuk.co.uk
Why Read This Book
You will learn how to move from RTOS theory to practical, working firmware by building real projects on an affordable STM32 Discovery board using STM32Cube and FreeRTOS. The book emphasizes hands‑on exercises, toolchain setup, and common real‑world patterns so you can quickly prototype, debug, and understand how an RTOS behaves on ARM Cortex‑M hardware.
Who Will Benefit
Embedded developers, students, and hobbyists with basic C and microcontroller experience who want practical, project‑based guidance using FreeRTOS and STM32 hardware.
Level: Intermediate — Prerequisites: Familiarity with C programming, basic embedded concepts (GPIO, interrupts, timers), and elementary electronics; some experience with compiling or using an IDE for microcontrollers is helpful.
Key Takeaways
- Configure and generate STM32 projects using STM32CubeMX/STM32Cube and integrate the HAL into your workflow
- Implement and reason about FreeRTOS concepts: tasks, priorities, scheduling, semaphores, mutexes, queues, and timers
- Build and debug complete firmware on an STM32 Discovery board (flash, use ST‑LINK, and inspect runtime behavior)
- Design interrupt‑safe drivers and integrate peripherals (UART, SPI, I2C, ADC, GPIO) with RTOS tasks
- Use debugging and tracing techniques to profile tasks, find race conditions, and tune system responsiveness
Topics Covered
- 1. Introduction: From Theory to Practice
- 2. Hardware and Toolchain: STM32 Discovery and ST‑LINK
- 3. STM32CubeMX and HAL: Project Generation and Peripheral Setup
- 4. FreeRTOS Fundamentals: Tasks and Scheduler
- 5. Synchronization and Communication: Semaphores, Mutexes, Queues, Timers
- 6. Interrupts, ISRs and RTOS interaction
- 7. Peripheral Examples: UART, SPI, I2C, ADC, PWM
- 8. Building Example Applications on the Discovery Board
- 9. Debugging, Tracing and Performance Analysis
- 10. Power Management and Low‑Power Strategies with an RTOS
- 11. Bringing it Together: Case Studies and Project Ideas
- 12. Appendices: Tool Install, Reference Commands, and Common Pitfalls
Languages, Platforms & Tools
How It Compares
More hands‑on and STM32/FreeRTOS focused than Qing Li's Real‑Time Concepts for Embedded Systems (which is theory heavier); complements Carmine Noviello's Mastering STM32 by emphasizing RTOS patterns and practical FreeRTOS integration.













