portSET_INTERRUPT_MASK_FROM_ISR() not implemented on CCS/ARM_Cortex-R4 port

dj2kenne wrote on Tuesday, December 06, 2016:

In the CCS/ARM_Cortex-R5 port (used for TI Hercules RM57 safety processors, in particular) the portSET_INTERRUPT_MASK_FROM_ISR() macro is not defined, so it ends up being stubbed out.

This macro is used from the various …FromISR() functions to disable interrupts.

Unfortunately, the …FromISR() functions CAN be called from Tasks. In particular, FreeRTOS+UDP does this all the time (see xProcessReceivedUDPPacket() in FreeRTOS_Sockets.c, for example). The net result is that interrupts are not disabled during various OS critical sections inside these …FromISR() functions, and internal OS structures end up getting mangled if interrupts occur at the wrong times.

There seems to be an impression (perpetuated in posts on this forum, even, see https://sourceforge.net/p/freertos/discussion/382005/thread/c7121eea/?limit=25#2487) that this macro can be stubbed out if the port does not support nested interrupts. This is simply untrue.

I have a proposed fix if that would be helpful. I want to make sure that the intent is understood first.

rtel wrote on Tuesday, December 06, 2016:

While the generic Cortex-R port does support interrupt nesting, and does implement portSET_INTERRUPT_MASK_FROM_ISR() (see https://sourceforge.net/p/freertos/code/HEAD/tree/trunk/FreeRTOS/Source/portable/GCC/ARM_CR5/portmacro.h) the older and Hercules specific CCS port you are referring to does not support interrupt nesting as I recall so doesn’t implement portSET_INTERRUPT_MASK_FROM_ISR(). It would be interesting to see your proposed fix, but it might be easist to just replace the ‘FromISR’ versions of functions in the UDP code with their non-ISR equivalents.