portPRIVILEGE_BIT does it do anything on esp32?

Cellie
Posts: 45
Joined: Sat Feb 27, 2016 9:47 pm

portPRIVILEGE_BIT does it do anything on esp32?

Postby Cellie » Tue Apr 30, 2024 2:30 pm

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?

MicroController
Posts: 1725
Joined: Mon Oct 17, 2022 7:38 pm
Location: Europe, Germany

Re: portPRIVILEGE_BIT does it do anything on esp32?

Postby MicroController » Tue Apr 30, 2024 2:42 pm

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.

Cellie
Posts: 45
Joined: Sat Feb 27, 2016 9:47 pm

Re: portPRIVILEGE_BIT does it do anything on esp32?

Postby Cellie » Tue Apr 30, 2024 2:50 pm

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?

Who is online

Users browsing this forum: No registered users and 170 guests