I just discovered a horrible truth. We have ported our application to RTX RTOS v5. Our environment requires leaving one high priority interrupt running while disabling all others, including any kernel interrupts, like task switching. To accomplish this on ARM, I set the BASEPRI to allow only this one interrupt. In at lease one instance, our code disable interrupts and makes a kernel call (osNewMutex in this case) to create a global mutex on the fly that will be used by multiple threads. The OSs that our code was ported from allowed this. RTX does not. It returns NULL in this case.
So how do I make this work? Modifying existing code to prevent this will be difficult and may break existing products. I see that I will have to modify the existing RTOS5 library to allow for BASEPRI to be non-zero. Is it possible to temporarily boost the SVC interrupt priority to below the needed interrupt and exclude it from BASEPRI?
Hi Robert,
from my view, DisableInterrupts and RestoreInterrupts should not do anything since higher-priority interrupts will happen anyways and preempt the current execution (either system interrupt of lower-priority interrupt or any application code (thread)).
Of course higher priority will happen in any moment of code execution thus if you are accessing the same memory that your higher-priority interrupt is also accessing that might be a problem.
Maybe, you can consider using producer-consumer concept, in which ISR just produces messages and application code just consumes them (meaning using mechanism called Message Queue).
RTX Mutex functions can't be used from ISRs, Semaphores however can, so maybe that would help if you don't want to change the concept of a whole application.
Best regards, Milorad