Skip to content

Commit 6c8b1e1

Browse files
committed
main: restore compatibility with single-core RTOS operation
1 parent 4eb7210 commit 6c8b1e1

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

src/FreeRTOSConfig.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,9 @@
104104
/* SMP port only */
105105
#define configNUMBER_OF_CORES 2
106106
#define configTICK_CORE 0
107+
#if (configNUMBER_OF_CORES > 1)
107108
#define configUSE_CORE_AFFINITY 1
109+
#endif
108110
#define configRUN_MULTIPLE_PRIORITIES 1
109111
#define configUSE_PASSIVE_IDLE_HOOK 0
110112

src/main.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,14 @@ int main(void) {
140140

141141
if (THREADED) {
142142
xTaskCreate(usb_thread, "TUD", configMINIMAL_STACK_SIZE, NULL, TUD_TASK_PRIO, &tud_taskhandle);
143+
#if (configNUMBER_OF_CORES > 1)
144+
vTaskCoreAffinitySet(tud_taskhandle, (1 << 0));
145+
#endif
143146
#if PICO_RP2040
144147
xTaskCreate(dev_mon, "WDOG", configMINIMAL_STACK_SIZE, NULL, TUD_TASK_PRIO, &mon_taskhandle);
148+
#if (configNUMBER_OF_CORES > 1)
149+
vTaskCoreAffinitySet(mon_taskhandle, (1 << 0));
150+
#endif
145151
#endif
146152
vTaskStartScheduler();
147153
}
@@ -274,7 +280,11 @@ void tud_mount_cb(void)
274280
xTaskCreate(dap_thread, "DAP", configMINIMAL_STACK_SIZE, NULL, DAP_TASK_PRIO, &dap_taskhandle);
275281
/* Autobaud detection using PIO as a frequency counter */
276282
xTaskCreate(autobaud_thread, "ABR", configMINIMAL_STACK_SIZE, NULL, AUTOBAUD_TASK_PRIO, &autobaud_taskhandle);
283+
#if(configNUMBER_OF_CORES > 1)
277284
vTaskCoreAffinitySet(autobaud_taskhandle, (1 << 1));
285+
vTaskCoreAffinitySet(dap_taskhandle, (1 << 0));
286+
vTaskCoreAffinitySet(uart_taskhandle, (1 << 0));
287+
#endif
278288
was_configured = 1;
279289
}
280290
}

0 commit comments

Comments
 (0)