Updated Apr 2025
RTOS Implementation
Introduction
This section describes part of the FreeRTOS implementation.
These pages will be helpful if you:
- wish to modify the FreeRTOS source code.
- port the real time kernel to another microcontroller or prototyping board.
- are new to using an RTOS and wish to get more information on their operation and implementation.
The FreeRTOS real time kernel has been ported to a number of different microcontroller architectures. The Atmel AVR port was chosen for this example due to:
- the simplicity of the AVR
architecture.
- the free availability of the utilized WinAVR (GCC) development tools
.
- the low cost of the STK500 prototyping board
The section concludes with a detailed step by step look at one complete context switch.
Building Blocks
- Development Tools
- The RTOS Tick
- GCC Signal Attribute
- GCC Naked Attribute
- FreeRTOS Tick Code
- The AVR Context
- Saving the Context
- Restoring the Context
Detailed Example
The final part of section 2 shows how these building blocks and source code modules are used to achieve a context switch on the AVR microcontroller. The example demonstrates in seven steps the process of switching from a lower priority task, called TaskA, to a higher priority task, called TaskB.
The source code is compatible with the WinAVR development tools.