Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem


Loading

Task local variables

Posted by Peter Nielsen on November 24, 2008
Hi

My question:
if i use a lot of local variables in a taskA - i.e. some of them are in CPU registers and some are put on the stack (thats how memory normally are allocated).

Now a higher priority taskB preemtives taskA and do some job and returns control to taskA.

When taskA runs again are all local variables valid or do i have to declare them static - i asume them in Cpu regs. are restored but what about the local vars. which where stored on the stack in taskA ???????








RE: Task local variables

Posted by Jesper Matthiesen on November 24, 2008
yes, all registers are saved on the stack before a context switch and restored afterwards, so your vars will be intact..


[ Back to the top ]    [ About FreeRTOS ]    [ Sitemap ]    [ ]




Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.

Latest News

Meet us at Embedded World. Hall 3A-525.

Hear from Richard Barry at Embedded World. Feb 28, 16:00, Hall 4-428.

Video: Watch James Gosling & Richard Barry at re:Invent, Las Vegas 2017.

FreeRTOS kernel V10.0.1 is available for immediate download. Now MIT licensed.


FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

STMicro RTOS partner supporting ARM7, ARM Cortex-M3, ARM Cortex-M4 and ARM Cortex-M0

Texas Instruments MCU Developer Network RTOS partner for ARM and MSP430 microcontrollers

OpenRTOS and SafeRTOS