Quality RTOS & Embedded Software

 Real time embedded FreeRTOS RSS feed 
Real time embedded FreeRTOS mailing list 
Quick Start Supported MCUs PDF Books Trace Tools Ecosystem TCP & FAT Training


freeRTOS critical region

Posted by Nishant Agrawal on December 3, 2010
Hi guys,

I was able to successfully implement other software interrupts on the code, though I have not fully tested it. Now the other thing I am looking forward to implement is to remove disabling of interrupts. Usually with every call to the OS functions there is entering of critical region which disables the interrupt.

Now what I need to confirm is
Is the interrupts disabled to prevent the timer interrupt from doing any context switch?? Can other interrupts be allowed to be processed by just disabling the timer interrupt in the critical region. What are the reasons for disabling the interrupts??

I ask this question because with ARM there is a semaphore instruction and if possible I am thinking of implementing it to prevent shared data problem in case of context switches and other OS function calls.

Thanks and regards,
Nishant Agrawal

RE: freeRTOS critical region

Posted by Dave on December 3, 2010
I think the reasons for disabling interrupts should be obvious. Critical sections protect code segments from access by ANY interrupt, not just the FreeRTOS interrupts. Any interrupt that calls an API function would have to be disabled.

If you are using an ARM Cortex M3 then the port allows interrupts to nest and has critical section calls that only disable interrupts to a certain priority level. It even has alternative critical section implementations that can be used in interrupts themselves. This should not be a problem for you then.

If you are using an ARM7 then an interrupt nesting implementation is possible but stupidly clumsy, which I guess why its not implemented in the release code.

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

Copyright (C) 2004-2010 Richard Barry. Copyright (C) 2010-2016 Real Time Engineers Ltd.
Any and all data, files, source code, html content and documentation included in the FreeRTOSTM distribution or available on this site are the exclusive property of Real Time Engineers Ltd.. See the files license.txt (included in the distribution) and this copyright notice for more information. FreeRTOSTM and FreeRTOS.orgTM are trade marks of Real Time Engineers Ltd.

Latest News:

FreeRTOS V9.0.0 is now available for download.

Free TCP/IP and file system demos for the RTOS

Sponsored Links

⇓ Now With No Code Size Limit! ⇓
⇑ Free Download Without Registering ⇑

FreeRTOS Partners

ARM Connected RTOS partner for all ARM microcontroller cores

Renesas Electronics Gold Alliance RTOS Partner.jpg

Microchip Premier RTOS Partner

RTOS partner of NXP for all NXP ARM microcontrollers

Atmel RTOS partner supporting ARM Cortex-M3 and AVR32 microcontrollers

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

Xilinx Microblaze and Zynq partner

Silicon Labs low power RTOS partner

Altera RTOS partner for Nios II and Cortex-A9 SoC

Freescale Alliance RTOS Member supporting ARM and ColdFire microcontrollers

Infineon ARM Cortex-M microcontrollers

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

Cypress RTOS partner supporting ARM Cortex-M3

Fujitsu RTOS partner supporting ARM Cortex-M3 and FM3

Microsemi (previously Actel) RTOS partner supporting ARM Cortex-M3

Atollic Partner

IAR Partner

Keil ARM Partner

Embedded Artists