Page 1 of 1

portPRIVILEGE_BIT does it do anything on esp32?

Posted: Tue Apr 30, 2024 2:30 pm
by Cellie
Hi all.

Searched the forum search (which sucks very hard) and the esp-idf documentation but could not find anything related.

I want to know if the `portPRIVILEGE_BIT` setting on a task does anything and if so what?
Take for example this piece of code:

Code: Select all

    taskResult = xTaskCreate(
        serverTask,
        "serverTask",
        4096,
        NULL,
        (tskIDLE_PRIORITY + 10) | portPRIVILEGE_BIT,
        NULL);
Suppose there are 2 tasks with prio 10, one privileged and the other task unprivileged.
What difference does it make for the scheduler? Or any other effects?

Re: portPRIVILEGE_BIT does it do anything on esp32?

Posted: Tue Apr 30, 2024 2:42 pm
by MicroController
That bit does nothing on the ESP32s. It's also not about scheduling priorities but to mark a task as running with more permissions than normal tasks, c.f. https://www.freertos.org/a00125.html
Systems that include MPU support can optionally create a task in a privileged (system) mode by setting the bit portPRIVILEGE_BIT in uxPriority.
While (some of) the ESP32s have MPUs and permission controller hardware, it is not used by the IDF-FreeRTOS port; hence every task will run without any restrictions on what it is allowed to do; they're all running with full system permissions just like a priviledged task normally would.

Re: portPRIVILEGE_BIT does it do anything on esp32?

Posted: Tue Apr 30, 2024 2:50 pm
by Cellie
Thanks. I read the FreeRTOS thing. I like FreeRTOS a lot, but only have experience on esp32.

You know of any mcu that implements the privilege?