FreeRTOS Extended Maintenance Program (EMP) registration now open.
Providing security patches and critical bug fixes on FreeRTOS Long Term Support (LTS) versions for up to 10 additional years. See the
FreeRTOS-Plus-TCP v3.0.0 released:
We've added comprehensive unit tests and penetration and protocol testing. See the
Featured FreeRTOS IoT Integrations:
Introducing three featured integrations for more secure IoT applications. See the
Delta Over-the-Air Updates:
Announcing Delta OTA updates. See the
December 2021 Releases:
Include MCUBoot demo and a new FreeRTOS download. See the
to be enabled.
Click here to
view a static menu.
The RTOS macro portRESTORE_CONTEXT() is the reverse of portSAVE_CONTEXT(). The context of the task being resumed was previously stored
in the tasks stack. The real time kernel retrieves the stack pointer for the task then POP's the context back into the correct
asm volatile (
"lds r26, pxCurrentTCB nt" (1)
"lds r27, pxCurrentTCB + 1 nt" (2)
"ld r28, x+ nt"
"out __SP_L__, r28 nt" (3)
"ld r29, x+ nt"
"out __SP_H__, r29 nt" (4)
"pop r31 nt"
"pop r30 nt"
"pop r1 nt"
"pop r0 nt" (5)
"out __SREG__, r0 nt" (6)
"pop r0 nt" (7)
Referring to the code above:
The FreeRTOS pxCurrentTCB variable holds the address from where the tasks stack pointer can be retrieved.
This is loaded into the X register (1 and 2).
The stack pointer for the task being resumed is loaded into the AVR stack pointer, first the low byte (3), then the high
The processor registers are then popped from the stack in reverse numerical order, down to R1.
The status register stored on the stack between registers R1 and R0, so is restored (6) before R0 (7).
Next: RTOS Implementation - Putting It All Together
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.