Run USB on the same core as CP

This commit is contained in:
Scott Shawcroft 2022-01-12 14:55:22 -08:00
parent 39639ecd17
commit 869cf5eba5
No known key found for this signature in database
GPG Key ID: 0DFD512649C052DA
2 changed files with 10 additions and 5 deletions

View File

@ -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
@ -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

View File

@ -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());
}
/**