Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8093

SDK • Re: How can I compile TinyUSB in my project?

$
0
0
Well oh my god it complied. Thanks gmx and hippy

I had tried to get host_cdc_msc_hid to work out of the master tree before, but failed on all attempts. I tried again, used some of the knowledge I gained from hippy's help. In case others read this I did the following
1. Created a new c/c++ project in vscode, I called it "host_cdc_msc_hid", this sets everything up for the PI extension in VS code, including adding all the necessary lines to the top of the "CMakeLists.txt" file to make it build in VS code.
2. Compiled it to check it worked.
2. Renamed "CMakeLists.txt" to "CMakeListsold.txt" (just in case I needed to refer back to this file) before I copied all the files from "pico-examples\usb\host\host_cdc_msc_hid" into the new project folder.
3. Edited the "CMakeLists.txt" and made the following alterations

Removed host_cdc_msc_hid.c from so it now reads (maybe this means it defaults to the [projectname].c file?)

Code:

add_executable(host_cdc_msc_hid)
Added

Code:

# Example sourcetarget_sources(host_cdc_msc_hid PUBLIC        ${CMAKE_CURRENT_LIST_DIR}/hid_app.c        ${CMAKE_CURRENT_LIST_DIR}/main.c        ${CMAKE_CURRENT_LIST_DIR}/msc_app.c        ${CMAKE_CURRENT_LIST_DIR}/cdc_app.c        )
Added tinyusb_board and tinyusb_host to the link libraries list

Code:

# Add the standard library to the buildtarget_link_libraries(host_cdc_msc_hid        pico_stdlib    tinyusb_host    tinyusb_board)
Changed PRIVATE to PUBLIC for include directories

Code:

# Add the standard include files to the buildtarget_include_directories(host_cdc_msc_hid PUBLIC        ${CMAKE_CURRENT_LIST_DIR})

Statistics: Posted by stevewk — Sat Feb 14, 2026 9:43 am



Viewing all articles
Browse latest Browse all 8093

Trending Articles