Ensure supervisor_tick is run on the same core as CP
This commit is contained in:
parent
53b6c4b5f0
commit
78942112c7
@ -94,6 +94,7 @@ INC += \
|
||||
-isystem esp-idf/components/esp_event/include \
|
||||
-isystem esp-idf/components/esp_hw_support/include \
|
||||
-isystem esp-idf/components/esp_hw_support/include/soc \
|
||||
-isystem esp-idf/components/esp_ipc/include \
|
||||
-isystem esp-idf/components/esp_netif/include \
|
||||
-isystem esp-idf/components/esp_pm/include \
|
||||
-isystem esp-idf/components/esp_ringbuf/include \
|
||||
|
@ -77,6 +77,8 @@
|
||||
|
||||
#include "esp_debug_helpers.h"
|
||||
|
||||
#include "esp_ipc.h"
|
||||
|
||||
#ifdef CONFIG_SPIRAM
|
||||
#include "esp32/spiram.h"
|
||||
#endif
|
||||
@ -103,7 +105,7 @@ TaskHandle_t circuitpython_task = NULL;
|
||||
|
||||
extern void esp_restart(void) NORETURN;
|
||||
|
||||
STATIC void tick_timer_cb(void *arg) {
|
||||
STATIC void tick_on_cp_core(void *arg) {
|
||||
supervisor_tick();
|
||||
|
||||
// CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to
|
||||
@ -111,6 +113,18 @@ STATIC void tick_timer_cb(void *arg) {
|
||||
xTaskNotifyGive(circuitpython_task);
|
||||
}
|
||||
|
||||
// This function may happen on the PRO core when CP is on the APP core. So, make
|
||||
// sure we run on the CP core.
|
||||
STATIC void tick_timer_cb(void *arg) {
|
||||
#if defined(CONFIG_FREERTOS_UNICORE) && CONFIG_FREERTOS_UNICORE
|
||||
tick_on_cp_core(arg);
|
||||
#else
|
||||
// This only blocks until the start of the function. That's ok since the PRO
|
||||
// core shouldn't care what we do.
|
||||
esp_ipc_call(CONFIG_ESP_MAIN_TASK_AFFINITY, tick_on_cp_core, NULL);
|
||||
#endif
|
||||
}
|
||||
|
||||
void sleep_timer_cb(void *arg);
|
||||
|
||||
safe_mode_t port_init(void) {
|
||||
|
Loading…
Reference in New Issue
Block a user