Quality RTOS & Embedded Software

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


Loading

How does ulCriticalNesting work?

Posted by Nobody/Anonymous on September 20, 2006
Forgive me for what may be a very poor question. Maybe I just need to write this out... This is related to my work on the AT91SAM7S256 port of FreeRTOS (using WinARM to compile).

How is ulCriticalNesting supposed to work? I think that what I am seeing is that whenever a task is created, vPortEnterCritical() is called which increments ulCriticalNesting (initially it is 9999UL so now it would be 10000UL). When the creation of the task is complete then it calls vPortExitCritical() and first checks to see if ulCriticalNesting is greater than 0. It is. Then it decrements ulCriticalNesting (back to 9999UL in this case) and checks if ulCriticalNesting is equal to 0. It is NOT. Since it is NOT, then it does NOT enable the interrupts.

Am I not understanding this code correctly? How will ulCriticalNesting ever allow for the interrupts to be enabled again?

Darrik

RE: How does ulCriticalNesting work?

Posted by Richard on September 20, 2006
ulCriticalNesting - I think I said uxCriticalNesting in my reply to another post a few moments ago which may be related to this question.

ulCriticalNesting is stored as part of the task context. It is initialised to zero *within the task* - so when a task starts executing it will get set to zero. As per my previous post if you set a break point at the start of the task, then inspect ulCriticalNesting, you should find that it is zero.

Before the scheduler is started ulCriticalNesting is set to a non-zero value to prevent it ever reaching zero before the scheduler is properly initialised. It will be overwritten with zero when the first task starts.

Regards.


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


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

Latest News

NXP tweet showing LPC5500 (ARMv8-M Cortex-M33) running FreeRTOS.

Meet Richard Barry and learn about running FreeRTOS on RISC-V at FOSDEM 2019

Version 10.1.1 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