Skip to content

Commit

Permalink
Run USB on the same core as CP
Browse files Browse the repository at this point in the history
  • Loading branch information
tannewt committed Jan 13, 2022
1 parent 39639ec commit 869cf5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
8 changes: 5 additions & 3 deletions ports/espressif/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ IDF_PATH = $(realpath ./esp-idf)
$(BUILD)/esp-idf:
$(Q)$(MKDIR) -p $@

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

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

# qstr builds include headers so we need to make sure they are up to date
$(HEADER_BUILD)/qstr.split: | $(BUILD)/esp-idf/config/sdkconfig.h
Expand Down
7 changes: 5 additions & 2 deletions ports/espressif/supervisor/usb.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,16 @@ void init_usb_hardware(void) {
usb_hal_init(&hal);
configure_pins(&hal);

(void)xTaskCreateStatic(usb_device_task,
// Pin the USB task to the same core as CircuitPython. This way we leave
// the other core for networking.
(void)xTaskCreateStaticPinnedToCore(usb_device_task,
"usbd",
USBD_STACK_SIZE,
NULL,
5,
usb_device_stack,
&usb_device_taskdef);
&usb_device_taskdef,
xPortGetCoreID());
}

/**
Expand Down

0 comments on commit 869cf5e

Please sign in to comment.