How to taskYIELD() in an unprivileged thread with MPU?

tbacarrot wrote on Friday, October 19, 2018:

Hi all, I’m working on an Arm Cortex-M platform which enables MPU. It seems that taskYIELD() is a privileged function. So I wonder how to execute the same operation as taskYIELD() does in an unprivileged thread, when MPU is enabled.

I searched in mpu_wrappers.c but could not find a wrapper of taskYIELD(). May I know which API I should take a look at?

Thank you.

rtel wrote on Saturday, October 20, 2018:

You are right in that I don’t think there is a way of calling yield() from an unprivileged task, presumably because it writes to the hardware registers. It is something we could add in, if it is necessary for applications, although it is not somethign that is normally used unless you have preemption turned off - is that the case in your application?

tbacarrot wrote on Monday, October 22, 2018:

Hi Richard, thx.
I don’t have a special case yet in which yield() is the only solution.
It just crossed my mind when I implemented an unprivileged thread which should give a mutex and schedule it out. But It seems that semophore give might not always yield another thread immediately. Please correct me if I’m wrong.
So I’d like to check taskYIELD() and I saw in some FreeRTOS docs that yield() is directly called from a normal task. So I’m a little confused.