Skip to content

Commit 5d0b0d0

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents e16cf12 + 8bae6af commit 5d0b0d0

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

ports/espressif/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ INC += \
9494
-isystem esp-idf/components/esp_event/include \
9595
-isystem esp-idf/components/esp_hw_support/include \
9696
-isystem esp-idf/components/esp_hw_support/include/soc \
97+
-isystem esp-idf/components/esp_ipc/include \
9798
-isystem esp-idf/components/esp_netif/include \
9899
-isystem esp-idf/components/esp_pm/include \
99100
-isystem esp-idf/components/esp_ringbuf/include \

ports/espressif/supervisor/port.c

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@
7777

7878
#include "esp_debug_helpers.h"
7979

80+
#include "esp_ipc.h"
81+
8082
#ifdef CONFIG_SPIRAM
8183
#include "esp32/spiram.h"
8284
#endif
@@ -103,14 +105,26 @@ TaskHandle_t circuitpython_task = NULL;
103105

104106
extern void esp_restart(void) NORETURN;
105107

106-
STATIC void tick_timer_cb(void *arg) {
108+
STATIC void tick_on_cp_core(void *arg) {
107109
supervisor_tick();
108110

109111
// CircuitPython's VM is run in a separate FreeRTOS task from timer callbacks. So, we have to
110112
// notify the main task every time in case it's waiting for us.
111113
xTaskNotifyGive(circuitpython_task);
112114
}
113115

116+
// This function may happen on the PRO core when CP is on the APP core. So, make
117+
// sure we run on the CP core.
118+
STATIC void tick_timer_cb(void *arg) {
119+
#if defined(CONFIG_FREERTOS_UNICORE) && CONFIG_FREERTOS_UNICORE
120+
tick_on_cp_core(arg);
121+
#else
122+
// This only blocks until the start of the function. That's ok since the PRO
123+
// core shouldn't care what we do.
124+
esp_ipc_call(CONFIG_ESP_MAIN_TASK_AFFINITY, tick_on_cp_core, NULL);
125+
#endif
126+
}
127+
114128
void sleep_timer_cb(void *arg);
115129

116130
safe_mode_t port_init(void) {

0 commit comments

Comments
 (0)