Using tinyusb from a component
Posted: Mon Apr 24, 2023 7:24 am
ESP-IDF 5.0.1
Windows 11
I originally posted this under hardware but in hindsight this is a tool problem so I'm re-posting here (and closing original post)
I can create a fairly trivial project using tinyusb that creates two cdc-acm serial ports and echoes input from each in the other (test.zip).
However if I try to move usb.c and usb.h into a component I can't get the system to build.
In the first instance i just moved usb.c and usb.h to components\usb
created components\usb\CmakeLists.txt
CODE: SELECT ALL
idf_component_register(
SRCS "usb.c"
INCLUDE_DIRS "."
)
and updated main\CMakeLists.txt
CODE: SELECT ALL
# See the build system documentation in IDF programming guide
# for more information about component CMakeLists.txt files.
idf_component_register( SRCS main.c
REQUIRES usb
)
Attempting to build now produces the following errors
CODE: SELECT ALL
<path>/eclipse-workspace/test1/components/usb/usb.c:6:10: fatal error: tinyusb.h: No such file or directory
6 | #include "tinyusb.h"
| ^~~~~~~~~~~
compilation terminated.
<path>/eclipse-workspace/test1/managed_components/espressif__esp_tinyusb/tinyusb.c:12:10: fatal error: esp_private/usb_phy.h: No such file or directory
12 | #include "esp_private/usb_phy.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
The first can be fixed by adding a REQUIRES line to components\usb\CMakeLists.txt
CODE: SELECT ALL
idf_component_register(
SRCS "usb.c"
INCLUDE_DIRS "."
REQUIRES tinyusb
)
However, I can find no way to eliminate the second error.
I've tried moving idf_components.yml to various other parts of the project to no avail.
test1.zip is my latest component version
Anybody know how to get rid of this error please
Windows 11
I originally posted this under hardware but in hindsight this is a tool problem so I'm re-posting here (and closing original post)
I can create a fairly trivial project using tinyusb that creates two cdc-acm serial ports and echoes input from each in the other (test.zip).
However if I try to move usb.c and usb.h into a component I can't get the system to build.
In the first instance i just moved usb.c and usb.h to components\usb
created components\usb\CmakeLists.txt
CODE: SELECT ALL
idf_component_register(
SRCS "usb.c"
INCLUDE_DIRS "."
)
and updated main\CMakeLists.txt
CODE: SELECT ALL
# See the build system documentation in IDF programming guide
# for more information about component CMakeLists.txt files.
idf_component_register( SRCS main.c
REQUIRES usb
)
Attempting to build now produces the following errors
CODE: SELECT ALL
<path>/eclipse-workspace/test1/components/usb/usb.c:6:10: fatal error: tinyusb.h: No such file or directory
6 | #include "tinyusb.h"
| ^~~~~~~~~~~
compilation terminated.
<path>/eclipse-workspace/test1/managed_components/espressif__esp_tinyusb/tinyusb.c:12:10: fatal error: esp_private/usb_phy.h: No such file or directory
12 | #include "esp_private/usb_phy.h"
| ^~~~~~~~~~~~~~~~~~~~~~~
compilation terminated.
The first can be fixed by adding a REQUIRES line to components\usb\CMakeLists.txt
CODE: SELECT ALL
idf_component_register(
SRCS "usb.c"
INCLUDE_DIRS "."
REQUIRES tinyusb
)
However, I can find no way to eliminate the second error.
I've tried moving idf_components.yml to various other parts of the project to no avail.
test1.zip is my latest component version
Anybody know how to get rid of this error please