Use of xTaskGetApplicationTaskTag within an interrupt handler

I am using the Coretex-M4 port of FreeRTOS, version 10.1.1, and I get a configASSERT when I use the function xTaskGetApplicationTaskTag within the traceTASKSWITCHEDIN handler. This topic has already been discussed at: https://www.freertos.org/FreeRTOSSupportForumArchive/March2016/freertosUseofxTaskGetApplicationTaskTagwithinaninterrupthandler045d9b72j.html However, no solution was supplied, other than a suggestion to comment out the offending configASSERT. Is there a plan to make a xTaskGetApplicationTaskTagFromISR function to solve this problem properly? I would also like to point out that accessing pxCurrentTCB directly is no solution, as this pointer is statically defined in tasks.c. This is good data hiding practice, but does not help me in this instance. Thank you

Use of xTaskGetApplicationTaskTag within an interrupt handler

Which assert are you hitting? I can’t see one in that function – although there is one in taskENTER_CRITICAL() which is called from that function – but that will only get hit if interrupt priorities are invalid.

Use of xTaskGetApplicationTaskTag within an interrupt handler

Sorry – look properly – the assert in ENTER_CRITICAL() is checking if it is being called from an interrupt – so that probably is the problem. One answer would be to provide a FromISR() version of xTaskGetApplicationTaskTag() – would that be helpful for you?

Use of xTaskGetApplicationTaskTag within an interrupt handler

@Richard Barry. Yes, I think a FromISR() version of xTaskGetApplicationTaskTag() would be helpful for me. It is as you wrote in your second reply. The assert in taskENTER_CRITICAL() is being hit, because the OS is already in a critical section / in the ISR.

Use of xTaskGetApplicationTaskTag within an interrupt handler

Try checking out the latest head revision from SVN – xTaskGetApplicationTaskTagFromISR() is implemented on line 2870 (or thereabouts) of https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/tasks.c

Use of xTaskGetApplicationTaskTag within an interrupt handler

@Richard Barry. Thank you!! It works!! I made the following tests * My test environment is an LPC4088 Quick Start Board from Embedded Artists. This is a Cortex M4 processor * I am running FreeRTOS version 10.1.1, using the ARMCM4F port, patched with tasks.c and tasks.h from svn revieion r2588 * I have defined the macros traceTASKSWITCHEDIN and traceTASKSWITCHEDOUT in FreeRTOSConfig.h * I call the new function xTaskGetApplicationTaskTagFromISR from within the traceTASKSWITCHED_IN function * The function returned the expected value (originally set from vTaskSetApplicationTaskTag) Once again, thank you for the excellent support Peter