Skip to content

Commit 7e3b841

Browse files
committed
Update IDF USB example
1 parent 62697f2 commit 7e3b841

File tree

207 files changed

+3359
-44347
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

207 files changed

+3359
-44347
lines changed

examples/espidf-peripherals-usb/components/esp_tinyusb/.gitattributes

Lines changed: 0 additions & 25 deletions
This file was deleted.

examples/espidf-peripherals-usb/components/esp_tinyusb/.gitignore

Lines changed: 0 additions & 30 deletions
This file was deleted.

examples/espidf-peripherals-usb/components/esp_tinyusb/.readthedocs.yaml

Lines changed: 0 additions & 18 deletions
This file was deleted.
Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
## 1.4.4
2+
3+
- esp_tinyusb: Added HighSpeed and Qualifier device descriptors in tinyusb configuration
4+
- CDC-ACM: Removed MIN() definition if already defined
5+
- MSC: Fixed EP size selecting in default configuration descriptor
6+
7+
## 1.4.3
8+
9+
- esp_tinyusb: Added ESP32P4 support (HS only)
10+
11+
## 1.4.2
12+
13+
- MSC: Fixed maximum files open
14+
- Added uninstall function
15+
16+
## 1.4.0
17+
18+
- MSC: Fixed integer overflows
19+
- CDC-ACM: Removed intermediate RX ringbuffer
20+
- CDC-ACM: Increased default FIFO size to 512 bytes
21+
- CDC-ACM: Fixed Virtual File System binding
22+
23+
## 1.3.0
24+
25+
- Added NCM extension
26+
27+
## 1.2.1 - 1.2.2
28+
29+
- Minor bugfixes
30+
31+
## 1.2.0
32+
33+
- Added MSC extension for accessing SPI Flash on memory card https://github.com/espressif/idf-extra-components/commit/a8c00d7707ba4ceeb0970c023d702c7768dba3dc
34+
35+
## 1.1.0
36+
37+
- Added support for NCM, ECM/RNDIS, DFU and Bluetooth TinyUSB drivers https://github.com/espressif/idf-extra-components/commit/79f35c9b047b583080f93a63310e2ee7d82ef17b
38+
39+
## 1.0.4
40+
41+
- Cleaned up string descriptors handling https://github.com/espressif/idf-extra-components/commit/046cc4b02f524d5c7e3e56480a473cfe844dc3d6
42+
43+
## 1.0.2 - 1.0.3
44+
45+
- Minor bugfixes
46+
47+
## 1.0.1
48+
49+
- CDC-ACM: Return ESP_OK if there is nothing to flush https://github.com/espressif/idf-extra-components/commit/388ff32eb09aa572d98c54cb355f1912ce42707c
50+
51+
## 1.0.0
52+
53+
- Initial version based on [esp-idf v4.4.3](https://github.com/espressif/esp-idf/tree/v4.4.3/components/tinyusb)
Lines changed: 39 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,53 @@
1-
idf_build_get_property(target IDF_TARGET)
2-
3-
if(target STREQUAL "esp32s3")
4-
set(tusb_mcu "OPT_MCU_ESP32S3")
5-
set(tusb_family "esp32sx")
6-
elseif(target STREQUAL "esp32s2")
7-
set(tusb_mcu "OPT_MCU_ESP32S2")
8-
set(tusb_family "esp32sx")
9-
else()
10-
message(FATAL_ERROR "TinyUSB is not support on ${target}.")
11-
return()
12-
endif()
13-
14-
set(compile_options
15-
"-DCFG_TUSB_MCU=${tusb_mcu}"
16-
"-DCFG_TUSB_DEBUG=${CONFIG_TINYUSB_DEBUG_LEVEL}"
17-
)
18-
19-
idf_component_get_property(freertos_component_dir freertos COMPONENT_DIR)
20-
21-
set(includes_private
22-
"hw/bsp/"
23-
"src/"
24-
"src/device"
25-
"additions/include_private"
26-
)
27-
28-
set(includes_public
29-
"src/"
30-
"additions/include"
31-
# The FreeRTOS API include convention in tinyusb is different from esp-idf
32-
"${freertos_component_dir}/FreeRTOS-Kernel/include/freertos"
33-
)
34-
351
set(srcs
36-
"src/portable/espressif/${tusb_family}/dcd_${tusb_family}.c"
37-
"src/class/cdc/cdc_device.c"
38-
"src/class/hid/hid_device.c"
39-
"src/class/midi/midi_device.c"
40-
"src/class/msc/msc_device.c"
41-
"src/class/vendor/vendor_device.c"
42-
"src/common/tusb_fifo.c"
43-
"src/device/usbd_control.c"
44-
"src/device/usbd.c"
45-
"src/tusb.c"
46-
"additions/src/descriptors_control.c"
47-
"additions/src/tinyusb.c"
48-
"additions/src/usb_descriptors.c"
2+
"descriptors_control.c"
3+
"tinyusb.c"
4+
"usb_descriptors.c"
495
)
506

517
if(NOT CONFIG_TINYUSB_NO_DEFAULT_TASK)
52-
list(APPEND srcs "additions/src/tusb_tasks.c")
53-
endif()
8+
list(APPEND srcs "tusb_tasks.c")
9+
endif() # CONFIG_TINYUSB_NO_DEFAULT_TASK
5410

5511
if(CONFIG_TINYUSB_CDC_ENABLED)
5612
list(APPEND srcs
57-
"additions/src/cdc.c"
58-
"additions/src/tusb_cdc_acm.c"
59-
"additions/src/tusb_console.c"
60-
"additions/src/vfs_tinyusb.c"
13+
"cdc.c"
14+
"tusb_cdc_acm.c"
6115
)
16+
if(CONFIG_VFS_SUPPORT_IO)
17+
list(APPEND srcs
18+
"tusb_console.c"
19+
"vfs_tinyusb.c"
20+
)
21+
endif() # CONFIG_VFS_SUPPORT_IO
6222
endif() # CONFIG_TINYUSB_CDC_ENABLED
6323

24+
if(CONFIG_TINYUSB_MSC_ENABLED)
25+
list(APPEND srcs
26+
tusb_msc_storage.c
27+
)
28+
endif() # CONFIG_TINYUSB_MSC_ENABLED
29+
30+
if(CONFIG_TINYUSB_NET_MODE_NCM)
31+
list(APPEND srcs
32+
tinyusb_net.c
33+
)
34+
endif() # CONFIG_TINYUSB_NET_MODE_NCM
35+
6436
idf_component_register(SRCS ${srcs}
65-
INCLUDE_DIRS ${includes_public}
66-
PRIV_INCLUDE_DIRS ${includes_private}
67-
PRIV_REQUIRES "vfs" "usb" "driver"
37+
INCLUDE_DIRS "include"
38+
PRIV_INCLUDE_DIRS "include_private"
39+
PRIV_REQUIRES usb
40+
REQUIRES fatfs vfs
6841
)
6942

70-
target_compile_options(${COMPONENT_LIB} PRIVATE ${compile_options})
43+
# Determine whether tinyusb is fetched from component registry or from local path
44+
idf_build_get_property(build_components BUILD_COMPONENTS)
45+
if(tinyusb IN_LIST build_components)
46+
set(tinyusb_name tinyusb) # Local component
47+
else()
48+
set(tinyusb_name espressif__tinyusb) # Managed component
49+
endif()
7150

72-
# when no builtin class driver is enabled, an uint8_t data compared with `BUILTIN_DRIVER_COUNT` will always be false
73-
set_source_files_properties("src/device/usbd.c" PROPERTIES COMPILE_FLAGS "-Wno-type-limits")
51+
# Pass tusb_config.h from this component to TinyUSB
52+
idf_component_get_property(tusb_lib ${tinyusb_name} COMPONENT_LIB)
53+
target_include_directories(${tusb_lib} PRIVATE "include")

examples/espidf-peripherals-usb/components/esp_tinyusb/CODE_OF_CONDUCT.rst

Lines changed: 0 additions & 88 deletions
This file was deleted.

0 commit comments

Comments
 (0)