Skip to content

Commit 869cf5e

Browse files
committed
Run USB on the same core as CP
1 parent 39639ec commit 869cf5e

File tree

2 files changed

+10
-5
lines changed

2 files changed

+10
-5
lines changed

ports/espressif/Makefile

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,7 @@ IDF_PATH = $(realpath ./esp-idf)
289289
$(BUILD)/esp-idf:
290290
$(Q)$(MKDIR) -p $@
291291

292+
TARGET_SDKCONFIG = esp-idf-config/sdkconfig-$(IDF_TARGET).defaults
292293
FLASH_SDKCONFIG = esp-idf-config/sdkconfig-$(CIRCUITPY_ESP_FLASH_SIZE).defaults
293294
ifeq ($(DEBUG), 1)
294295
DEBUG_SDKCONFIG = esp-idf-config/sdkconfig-debug.defaults
@@ -317,10 +318,11 @@ $(BUILD)/esp-idf/partition_table/partition-table.bin: $(BUILD)/esp-idf/config/sd
317318
IDF_PATH=$(IDF_PATH) ninja -C $(BUILD)/esp-idf partition_table/partition-table.bin
318319

319320
# run menuconfig and then remove standard settings
320-
menuconfig: $(BUILD)/esp-idf/config
321+
menuconfig: $(BUILD)/esp-idf/config $(BUILD)/esp-idf/config/sdkconfig.h
321322
$(Q)ninja -C $(BUILD)/esp-idf menuconfig
322-
$(Q)diff --old-line-format= --unchanged-line-format= esp-idf-config/sdkconfig.defaults $(BUILD)/esp-idf/sdkconfig > $(BUILD)/sdkconfig.diff || true
323-
$(Q)grep -Fvxf $(DEBUG_SDKCONFIG) -f $(FLASH_SDKCONFIG) $(BUILD)/sdkconfig.diff > boards/$(BOARD)/sdkconfig
323+
# Newer versions of the idf will have save-defconfig that will only include non-default values.
324+
# We should use that when available. For now, we sort out everything.
325+
python tools/update_sdkconfig.py --board=$(BOARD) --debug=$(DEBUG)
324326

325327
# qstr builds include headers so we need to make sure they are up to date
326328
$(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h

ports/espressif/supervisor/usb.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,16 @@ void init_usb_hardware(void) {
109109
usb_hal_init(&hal);
110110
configure_pins(&hal);
111111

112-
(void)xTaskCreateStatic(usb_device_task,
112+
// Pin the USB task to the same core as CircuitPython. This way we leave
113+
// the other core for networking.
114+
(void)xTaskCreateStaticPinnedToCore(usb_device_task,
113115
"usbd",
114116
USBD_STACK_SIZE,
115117
NULL,
116118
5,
117119
usb_device_stack,
118-
&usb_device_taskdef);
120+
&usb_device_taskdef,
121+
xPortGetCoreID());
119122
}
120123

121124
/**

0 commit comments

Comments
 (0)