Hi,
with IDF version 4.4.3, the tinyusb examples yield a file not found error for usbtiny.h. The default config seems to be correct, but the relevant directory seems to be missing on the include path.
I setup the IDF with running the install.sh and sourcing the export.sh scripts, and building starts with 'idf.py build' as expected.
Only after 1019 of 1095 I get the following error:
[1019/1035] Building C object esp-idf/main/..._idf_main.dir/tusb_serial_device_main.c.obj
FAILED: esp-idf/main/CMakeFiles/__idf_main.dir/tusb_serial_device_main.c.obj
/home/thomas/.espressif/tools/xtensa-esp32-elf/esp-2021r2-patch5-8.4.0/xtensa-esp32-elf/bin/xtensa-esp32-elf-gcc -DHAVE_CONFIG_H -DMBEDTLS_CONFIG_FILE=\"mbedtls/esp_config.h\" -DUNITY_INCLUDE_CONFIG_H -DWITH_POSIX -Iconfig -I../main -I../../../../../components/newlib/platform_include -I../../../../../components/freertos/include -I../../../../../components/freertos/include/esp_additions/freertos -I../../../../../components/freertos/port/xtensa/include -I../../../../../components/freertos/include/esp_additions -I../../../../../components/esp_hw_support/include -I../../../../../components/esp_hw_support/include/soc -I../../../../../components/esp_hw_support/include/soc/esp32 -I../../../../../components/esp_hw_support/port/esp32/. -I../../../../../components/esp_hw_support/port/esp32/private_include -I../../../../../components/heap/include -I../../../../../components/log/include -I../../../../../components/lwip/include/apps -I../../../../../components/lwip/include/apps/sntp -I../../../../../components/lwip/lwip/src/include -I../../../../../components/lwip/port/esp32/include -I../../../../../components/lwip/port/esp32/include/arch -I../../../../../components/soc/include -I../../../../../components/soc/esp32/. -I../../../../../components/soc/esp32/include -I../../../../../components/hal/esp32/include -I../../../../../components/hal/include -I../../../../../components/hal/platform_port/include -I../../../../../components/esp_rom/include -I../../../../../components/esp_rom/include/esp32 -I../../../../../components/esp_rom/esp32 -I../../../../../components/esp_common/include -I../../../../../components/esp_system/include -I../../../../../components/esp_system/port/soc -I../../../../../components/esp_system/port/public_compat -I../../../../../components/esp32/include -I../../../../../components/xtensa/include -I../../../../../components/xtensa/esp32/include -I../../../../../components/driver/include -I../../../../../components/driver/esp32/include -I../../../../../components/esp_pm/include -I../../../../../components/esp_ringbuf/include -I../../../../../components/efuse/include -I../../../../../components/efuse/esp32/include -I../../../../../components/vfs/include -I../../../../../components/esp_wifi/include -I../../../../../components/esp_event/include -I../../../../../components/esp_netif/include -I../../../../../components/esp_eth/include -I../../../../../components/tcpip_adapter/include -I../../../../../components/esp_phy/include -I../../../../../components/esp_phy/esp32/include -I../../../../../components/esp_ipc/include -I../../../../../components/app_trace/include -I../../../../../components/esp_timer/include -I../../../../../components/mbedtls/port/include -I../../../../../components/mbedtls/mbedtls/include -I../../../../../components/mbedtls/esp_crt_bundle/include -I../../../../../components/app_update/include -I../../../../../components/spi_flash/include -I../../../../../components/bootloader_support/include -I../../../../../components/nvs_flash/include -I../../../../../components/pthread/include -I../../../../../components/esp_gdbstub/include -I../../../../../components/esp_gdbstub/xtensa -I../../../../../components/esp_gdbstub/esp32 -I../../../../../components/espcoredump/include -I../../../../../components/espcoredump/include/port/xtensa -I../../../../../components/wpa_supplicant/include -I../../../../../components/wpa_supplicant/port/include -I../../../../../components/wpa_supplicant/esp_supplicant/include -I../../../../../components/ieee802154/include -I../../../../../components/console -I../../../../../components/asio/asio/asio/include -I../../../../../components/asio/port/include -I../../../../../components/cbor/port/include -I../../../../../components/unity/include -I../../../../../components/unity/unity/src -I../../../../../components/cmock/CMock/src -I../../../../../components/coap/port/include -I../../../../../components/coap/libcoap/include -I../../../../../components/nghttp/port/include -I../../../../../components/nghttp/nghttp2/lib/includes -I../../../../../components/esp-tls -I../../../../../components/esp-tls/esp-tls-crypto -I../../../../../components/esp_adc_cal/include -I../../../../../components/esp_hid/include -I../../../../../components/tcp_transport/include -I../../../../../components/esp_http_client/include -I../../../../../components/esp_http_server/include -I../../../../../components/esp_https_ota/include -I../../../../../components/esp_lcd/include -I../../../../../components/esp_lcd/interface -I../../../../../components/protobuf-c/protobuf-c -I../../../../../components/protocomm/include/common -I../../../../../components/protocomm/include/security -I../../../../../components/protocomm/include/transports -I../../../../../components/mdns/include -I../../../../../components/esp_local_ctrl/include -I../../../../../components/sdmmc/include -I../../../../../components/esp_serial_slave_link/include -I../../../../../components/esp_websocket_client/include -I../../../../../components/expat/expat/expat/lib -I../../../../../components/expat/port/include -I../../../../../components/wear_levelling/include -I../../../../../components/fatfs/diskio -I../../../../../components/fatfs/vfs -I../../../../../components/fatfs/src -I../../../../../components/freemodbus/common/include -I../../../../../components/idf_test/include -I../../../../../components/idf_test/include/esp32 -I../../../../../components/jsmn/include -I../../../../../components/json/cJSON -I../../../../../components/libsodium/libsodium/src/libsodium/include -I../../../../../components/libsodium/port_include -I../../../../../components/mqtt/esp-mqtt/include -I../../../../../components/openssl/include -I../../../../../components/perfmon/include -I../../../../../components/spiffs/include -I../../../../../components/ulp/include -I../../../../../components/wifi_provisioning/include -mlongcalls -Wno-frame-address -ffunction-sections -fdata-sections -Wall -Werror=all -Wno-error=unused-function -Wno-error=unused-variable -Wno-error=deprecated-declarations -Wextra -Wno-unused-parameter -Wno-sign-compare -ggdb -Og -fmacro-prefix-map=/work/idf-esp32-v4.4/examples/peripherals/usb/tusb_serial_device=. -fmacro-prefix-map=/work/idf-esp32-v4.4=IDF -fstrict-volatile-bitfields -Wno-error=unused-but-set-variable -fno-jump-tables -fno-tree-switch-conversion -std=gnu99 -Wno-old-style-declaration -D_GNU_SOURCE -DIDF_VER=\"v4.4.3-dirty\" -DESP_PLATFORM -D_POSIX_READER_WRITER_LOCKS -MD -MT esp-idf/main/CMakeFiles/__idf_main.dir/tusb_serial_device_main.c.obj -MF esp-idf/main/CMakeFiles/__idf_main.dir/tusb_serial_device_main.c.obj.d -o esp-idf/main/CMakeFiles/__idf_main.dir/tusb_serial_device_main.c.obj -c ../main/tusb_serial_device_main.c
../main/tusb_serial_device_main.c:18:10: fatal error: tinyusb.h: No such file or directory
#include "tinyusb.h"
^~~~~~~~~~~
compilation terminated.
[1025/1035] Building C object esp-idf/libso...ypto_core/ed25519/ref10/ed25519_ref10.c.obj
ninja: build stopped: subcommand failed.
ninja failed with exit code 1
This is with:
commit 6407ecb3f8d2cc07c4c230e7e64f2046af5c86f7 (HEAD, tag: v4.4.3)
Author: Ivan Grokhotkov <ivan@espressif.com>
Date: Tue Nov 8 16:22:14 2022 +0100
versions: Update version to 4.4.3
Any ideas? Same with tusb_console example...
usbtiny.h not found
Re: usbtiny.h not found
Hi, the issue is that you are compiling the example for the ESP32 chip, which doesn't have USB support. If you are actually intending to run the example on the ESP32-S2 or ESP32-S3, you need to run `idf.py set-target esp32s2` or `idf.py set-target esp32s3` and then build again.
-
- Posts: 18
- Joined: Sun Jul 03, 2022 8:35 pm
Re: usbtiny.h not found
Yes, that did the trick for the example.
Unfortunately, I am having trouble integrating the set-target step into my build environment that should use the -B flag for setting the build directory, and some more -Ddefines that get their value via environment variables in the CMakeLists.txt with the add_compile_definitions(MY_DEF=$ENV{MY_DEF}). Additionally, I want to set the sdkconfig from a build specific file that I tried symlinking to sdkconfig.defaults.
After setting up the target with "idf.py set-target esp32-s2" the build env has the correct settings with my custom definitions but seems incomplete with respect to the target device. So running ninja directly does not work. If I run "idf.py build" instead, the config get the correct target device, but loses the custom -D definitions.
Any idea how to setup such an environment?
Unfortunately, I am having trouble integrating the set-target step into my build environment that should use the -B flag for setting the build directory, and some more -Ddefines that get their value via environment variables in the CMakeLists.txt with the add_compile_definitions(MY_DEF=$ENV{MY_DEF}). Additionally, I want to set the sdkconfig from a build specific file that I tried symlinking to sdkconfig.defaults.
After setting up the target with "idf.py set-target esp32-s2" the build env has the correct settings with my custom definitions but seems incomplete with respect to the target device. So running ninja directly does not work. If I run "idf.py build" instead, the config get the correct target device, but loses the custom -D definitions.
Any idea how to setup such an environment?
-
- Posts: 18
- Joined: Sun Jul 03, 2022 8:35 pm
Re: usbtiny.h not found
OK, I found the root cause of the problem. The .c file referencing "usbtiny.h" is in a components subdirectory. If I move the #include directive to a file under the main directory, the components directory of tinyusb is added to the build command of the relevant file, and the error does not appear.
The same problem does not appear with components that are ESP32, only with ESP32-S2 components.
Can I file a bug-report for this?
The same problem does not appear with components that are ESP32, only with ESP32-S2 components.
Can I file a bug-report for this?
Re: usbtiny.h not found
You can combine both steps by doing "idf.py -DIDF_TARGET=esp32s2 -B your-build-dir build".maierkomor wrote: After setting up the target with "idf.py set-target esp32-s2" the build env has the correct settings with my custom definitions but seems incomplete with respect to the target device. So running ninja directly does not work. If I run "idf.py build" instead, the config get the correct target device, but loses the custom -D definitions.
(If you are doing builds for different targets, you may also want to move the sdkconfig file into the build directory, since sdkconfig file is target-specific. That would be "idf.py -DIDF_TARGET=esp32s2 -DSDKCONFIG=your-build-dir/sdkconfig -B your-build-dir build"
You probably need to specify the component requirements in component CMakeLists.txt: https://docs.espressif.com/projects/esp ... quirements.maierkomor wrote: OK, I found the root cause of the problem. The .c file referencing "usbtiny.h" is in a components subdirectory. If I move the #include directive to a file under the main directory, the components directory of tinyusb is added to the build command of the relevant file, and the error does not appear.
The reason why you didn't have to do this for the "main" component is explained here: https://docs.espressif.com/projects/esp ... quirements
-
- Posts: 18
- Joined: Sun Jul 03, 2022 8:35 pm
Re: usbtiny.h not found
Thanks for the tip. I will give that a try.
Who is online
Users browsing this forum: Bing [Bot], emaayan and 123 guests