portENTER_CRITICAL and taskENTER_CRITICAL in ESP32

Hello:

I’m working with the ESP32 port of FreeRTOS, and have some problems with port/taskENTER_CRITICAL (and EXIT, of course). First, I read here that portENTER/EXIT_CRITICAL are internall calls, and should not be used; instead, taskENTER/EXIT_CRITICAL should be used (commented in this forum: difference between portENTER_CRITICAL () and ); in fact, in the documentation I can find only the taskENTER/EXIT_CRITICAL calls.

Now I try to use them in an ESP32, and I receive a warning that taskENTER/EXIT are deprecated and that I should use portENTER/EXIT… Is this something official, or only something for ESP32?

Also, in the ESP32 the calls receive a parameter, a mux… but in the official documentation they receive nothing. IIRC, I read somewhere that since the ESP32 has two cores, it not only disables the interruptions, but also uses an spinlock to avoid problems between both cores. Is this something that will be added to the standard FreeRTOS, or will be only for ESP32? Also, is it just a mutex semaphore, or is something different? Do I have to initialize the mutex to an specific value, or just calling to xSemaphoreCreateMutex() is enough?

Thanks in advance.

The base FreeRTOS is designed to be efficient on a single-core processor, and I doubt that things needed to make it work on a multi-core processor that would impact performance on a single-core processor are going to ported into the base architecture.

My understanding is that the version of FreeRTOS used on the dual-core ESP32 has been modified by a third party to make it work in that environment. I don’t know how good or how well tested that adaption is, and there are a number of subtle things that need to be taken care of when using multiple cores and it would take a careful study to see if all of those were handled (one big question is how well syncronized the cores keep themselves naturally). I suspect that differences between the ESP32 version and the official FreeRTOS version would need to be dealt with on the support channel of the ESP32.

My first guess would be that the synchronization primitive that the ESP32 taskENTER/EXIT takes is NOT a standard FreeRTOS mutex, but something that the ESP32 port layer provides, as the FreeRTOS mutex uses taskENTER/EXIT in its implementation, and doesn’t have the needed spin-lock for multi-core operation.