Hello,
Suppose a task running on Core 0 posts some data to a FreeRTOS queue. Suppose further that a very high-priority task, that's pinned to Core 1, is currently blocked, pending on information to enter that queue.
Ideally, the high-priority task should very quickly become unblocked and preempt whatever task is currently running on Core 1 --- without needing to wait for that lower-priority task's tick time to expire. Does this happen and if so by what mechanism is Core 1 alerted to do an immediate context switch?
Thanks.
Unblocking a Task on the "Other" Core
-
- Posts: 16
- Joined: Wed Jul 12, 2023 4:26 am
Re: Unblocking a Task on the "Other" Core
Hi gfvalvo,
I was wondering this myself. For what it's worth, it appears to me that one CPU sends an interrupt to the other when a yield is needed. See taskYIELD_OTHER_CORE in tasks.c. There are registers (in the System Registers block) that allow a CPU to trigger interrupts on the other.
esp_programmer
I was wondering this myself. For what it's worth, it appears to me that one CPU sends an interrupt to the other when a yield is needed. See taskYIELD_OTHER_CORE in tasks.c. There are registers (in the System Registers block) that allow a CPU to trigger interrupts on the other.
esp_programmer
Re: Unblocking a Task on the "Other" Core
esp_programmer wrote: ↑Wed Jul 19, 2023 10:51 pmHi gfvalvo,
... See taskYIELD_OTHER_CORE in tasks.c.
@esp_programmer, thanks for the reply. Where did you find task.c? It's not in my installation, only task.h. Also there is no mention of 'taskYIELD_OTHER_CORE' in any file of my ESP32 installation.
However, I did find the following in portmacro.h. I think it pretty much answers my question.
Code: Select all
/**
* @brief Yields the other core
*
* - Send an interrupt to another core in order to make the task running on it yield for a higher-priority task.
* - Can be used to yield current core as well
*
* @note [refactor-todo] Put this into private macros as its only called from task.c and is not public API
* @param coreid ID of core to yield
*/
void vPortYieldOtherCore(BaseType_t coreid);
-
- Posts: 16
- Joined: Wed Jul 12, 2023 4:26 am
Re: Unblocking a Task on the "Other" Core
Hi gfvalvo,
I am using an older version of the esp-idf (5.0). Looks like they have moved some things from tasks.c. As you noted, the function that is used is https://github.com/espressif/esp-idf/bl ... ort.c#L562 .
Thanks
I am using an older version of the esp-idf (5.0). Looks like they have moved some things from tasks.c. As you noted, the function that is used is https://github.com/espressif/esp-idf/bl ... ort.c#L562 .
Thanks
Who is online
Users browsing this forum: No registered users and 41 guests