Quality RTOS & Embedded Software

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


Use of xTaskGetApplicationTaskTag within an interrupt handler

Posted by casper0 on March 7, 2016

I have been using 'xTaskGetApplicationTaskTag' to help with debugging tags switches by including it as one of the things to do during a 'traceTASKSWITCHEDIN' event. It's been "working", but only that 1) I was using a version of FreeRTOS prior to 8.1.0 for some time, and 2) I did not have 'configASSERT' turned on. Both recently changed and now the assertion within 'vPortEnterCritical', called from 'xTaskGetApplicationTaskTag', fails.

Maybe this is nit picking, since the call's name does not end with 'fromISR', I suppose it now may not be used from within an interrupt call, which the task switch is ('PendSV_Handler'), anymore. That's too bad, because it is useful. BUT, when I look at the source for 'xTaskGetApplicationTaskTag' it indicates that is ought to be able to be called from within an interrupt (still). Then again, since the 'vPortEnterCritical' routine was changed and "became" non-interrupt safe, it will fail the assertion.

What's the best way for me to continue using this feature? My guess is to use 'pxCurrentTCB->pxTaskTag' directly rather than call the function.

And a fix for the 'xTaskGetApplicationTaskTag' routine would be to eliminate the comment that indicates it can be used from within a interrupt service routine.

Use of xTaskGetApplicationTaskTag within an interrupt handler

Posted by rtel on March 8, 2016

This comment is relevant to Cortex-M3/4/7 ports only: I think in your case it is still ok to use the function in an interrupt. I would not recomment compiling without configASSERT() though, so perhaps just remove the offending configASSERT() from your build.

[ 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