Quality RTOS & Embedded Software

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


Loading

Atomic operations

Posted by incrediball on February 26, 2009
A possible idea for future optimizing...

I notice that critical sections are often used for protecting operations, which depending on system architecture may or may not be atomic operations. For example vTaskSuspendAll increments a portBASE_TYPE and xTaskGetTickCount copies a portTickType, both inside of a critical section. On 32 bit ports the critical sections are probably not necessary.

Like the InterlockedIncrement function in Windows, perhaps macros could be defined in a port specific header file that implement simple atomic operations such as increment, decrement, getting and setting variables of varying sizes. The macro can make use of a critical section if the architecture requires it, otherwise it can just do the basic operation. Any operations throughout the program which are currently always protected by critical sections could then use these macros.

(That would also allow the use of some functions such as xTaskGetTickCount inside of interrupts, albeit port dependent, however. I'm often irritated by the restriction that I cannot use xTaskGetTickCount inside of interrupts, but that's another story.)


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


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

Latest News

Version 10.1.0 of the FreeRTOS kernel is available for immediate download. MIT licensed.

View a recording of the "OTA Update Security and Reliability" webinar, presented by TI and AWS.


Careers

FreeRTOS and other embedded software careers at AWS.



FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Espressif ESP32

IAR Partner

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Renesas

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

Xilinx Microblaze and Zynq partner