Including tinyusb in a custom cmake project

adrians
Posts: 3
Joined: Mon Jun 18, 2018 11:05 am

Including tinyusb in a custom cmake project

Postby adrians » Tue Oct 10, 2023 10:05 am

Hi,

I am in the process of updating an open-source project from esp_idf v4.4.5 to release v5.1.1 and I would like some advice on the best way to include a component from the component registry as the project uses Tinyusb which is no longer a core component.

The project is a custom cmake project which uses esp-idf.

The latest documentation doesn't include any details on how to do this and the examples don't include a component from the component registry. See:->https://docs.espressif.com/projects/esp ... -projects.

I hope someone can help.

adrians
Posts: 3
Joined: Mon Jun 18, 2018 11:05 am

Re: Including tinyusb in a custom cmake project

Postby adrians » Mon Oct 23, 2023 9:54 am

Can any of the espressif guys help ?

So given the example cmake shown in the documentation how would add registry components like tiny_usb. As adding them to idf_build_process() doesn't find them and having an idl_components.yml doesn't seem to help. Also with a custom cmake project you would want to control where the components are downloaded.

  1. cmake_minimum_required(VERSION 3.16)
  2. project(my_custom_app C)
  3.  
  4. # Include CMake file that provides ESP-IDF CMake build system APIs.
  5. include($ENV{IDF_PATH}/tools/cmake/idf.cmake)
  6.  
  7. # Include ESP-IDF components in the build, may be thought as an equivalent of
  8. # add_subdirectory() but with some additional processing and magic for ESP-IDF build
  9. # specific build processes.
  10. idf_build_process(esp32)
  11.  
  12. # Create the project executable and plainly link the newlib component to it using
  13. # its alias, idf::newlib.
  14. add_executable(${CMAKE_PROJECT_NAME}.elf main.c)
  15. target_link_libraries(${CMAKE_PROJECT_NAME}.elf idf::newlib)
  16.  
  17. # Let the build system know what the project executable is to attach more targets, dependencies, etc.
  18. idf_build_executable(${CMAKE_PROJECT_NAME}.elf)

Who is online

Users browsing this forum: Bing [Bot] and 260 guests