Using tinyusb from a component

ghoti57
Posts: 3
Joined: Sat Apr 22, 2023 1:33 pm

Using tinyusb from a component

Postby ghoti57 » Sat Apr 22, 2023 2:23 pm

ESP-IDF 5.0.1
Windows 11


I can create a fairly trivial project using tinyusb that creates two cdc-acm serial ports and echoes output 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([attachment=1]test.zip[/attachment]
    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
Attachments
test1.zip
Last build error with component
(3.24 KiB) Downloaded 146 times
test.zip
Simple working project
(2.65 KiB) Downloaded 164 times

ghoti57
Posts: 3
Joined: Sat Apr 22, 2023 1:33 pm

Re: Using tinyusb from a component

Postby ghoti57 » Mon Apr 24, 2023 7:25 am

This really belongs under ESP-IDF so reposted there and closing this topic

Who is online

Users browsing this forum: No registered users and 71 guests