Quality RTOS & Embedded Software

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


migrating from 8.0.0 to 8.2.1

Posted by williamjsell on May 20, 2015

I had an issue with the migration from 8.0.0 to 8.2.1. I copied all relevant files over and the built the new image (I had to remove a cast from FreeRTOSConfig.h for configMAX_PRIORITIES). When I ran the system, I had an assertion on line 3466 in tasks.c:

	if( pxMutexHolder != NULL )
		/* A task can only have an inherited priority if it holds the mutex.
		If the mutex is held by a task then it cannot be given from an
		interrupt, and if a mutex is given by the holding task then it must
		be the running state task. */
		configASSERT( pxTCB == pxCurrentTCB );

This works fine on the 8.0.0, but this assert check is not made, so maybe something bad is happening and not being trapped? Anyway, I had to pull back to 8.0.0 until I can get an indication as to the problem.

migrating from 8.0.0 to 8.2.1

Posted by rtel on May 21, 2015

Some optimisations were made to giving semaphores from interrupts. Previously the semaphore give from ISR macro used the queue send from ISR function - now it has its own function which allows it to be slimmer (parts of the function relevant only to a queue do not have to be executed). That did however mean that mutexes can no longer be given from interrupts if a priority has been inherited - as you have found.

It may be possible to call xQueueSendFromISR() to give a mutex from an interrupt, instead of xSemaphoreGiveFromISR() (you may need to cast the SemaphoreHandlet to a QueueHandlet when passing in the parameter to avoid compiler warnings). It is on our todo list to look at this to see if it is safe, and if not, make it safe. You could try it.


migrating from 8.0.0 to 8.2.1

Posted by williamjsell on July 22, 2015

I just encountered this problem again on a different processor and project; I am not sure what you are suggesting for a solution. If I follow the call stack back, the call to xSemaphoreGive(calibrationMutex); is made, but as you can see this is not from an ISR. Isn't this a critical error in the v8.2.1, seeing that I have encountered it twice now...?

migrating from 8.0.0 to 8.2.1

Posted by edwards3 on July 22, 2015

Is the task giving the mutex holding the mutex? Or is it giving it without taking it first?

migrating from 8.0.0 to 8.2.1

Posted by williamjsell on July 23, 2015

I have a gatekeeper task which takes the mutex, which allows the gk queue to fill with additional requests. The GK task signals an event_group which pumps a state machine. When the state machine has concluded, it calls a function to give the mutex, which allows the next request in the queue to run. This scheme works well with 8.0.0 but fails with 8.2.1

migrating from 8.0.0 to 8.2.1

Posted by richard_damon on July 24, 2015

That sounds like a better use for a semaphore than a mutex. The big feature of the mutex over a semaphore is that it will boost the priority of the task holding it to avoid priority inversion if needed. It sounds like the task that took the mutex (the Gate Keeper) isn't the task responsible for the processing so the priority boost doesn't do anything.

I am also not sure from your description who else is trying to acquire the mutex to provide the exclusion.

migrating from 8.0.0 to 8.2.1

Posted by athos1984 on October 2, 2015

I have the same issue. No ISR involved, no difference between semaphore and mutex, no issue in RTOS v8.0.0.

Is there any possibility to get a solution?

migrating from 8.0.0 to 8.2.1

Posted by athos1984 on July 5, 2016

Still there, also with v9.0.0

[ 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.

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.


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


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