Can't compile TinyUSB examples
When trying to execute cmake for pico-examples I get the following error:
CMake Error at .../pico-sdk/lib/tinyusb/examples/host/msc_file_explorer/CMakeLists.txt:13 (add_executable):
Cannot find source file:
/lib/fatfs/source/ff.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
Upon further investigation I found that the TinyUSB examples are added from the the submodule in the pico-sdk.
In the msc_file_explorer example in $PICO_SDK_PATH/lib/tinyusb/examples/host/msc_file_explorer/CMakeLists.txt
some of the source files are added relative to the ${TOP} cmake variable which isn't set so the files aren't found properly.
I am running gcc version 12.2.0 and cmake version 3.26.3.
Also trying to execute cmake -G "NMake Makefiles" .. and get the same result:
TinyUSB available at C:/VSARM/sdk/pico/pico-sdk/lib/tinyusb/src/portable/raspberrypi/rp2040; enabling build support for USB.
-- Configuring done (9.6s)
CMake Error at C:/VSARM/sdk/pico/pico-sdk/lib/tinyusb/examples/host/msc_file_explorer/CMakeLists.txt:13 (add_executable):
Cannot find source file:
/lib/fatfs/source/ff.c
Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
.hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc
-- Generating done (8.4s)
CMake Generate step failed. Build files cannot be regenerated correctly.
PS C:\VSARM\sdk\pico\pico-examples\build>
I'm running gcc version 12.2.1 and cmake version 3.26.4.
i had the same problem, i solved it by:
- downloading the module from the website faftfs
- move it in the folder
pico/pico-sdk/lib - change it's name to
fatfssince the CMakelist file was searching for that - inside the same CMake file avaiable at
/pico/pico-sdk/lib/tinyusb/examples/host/msc_file_explorersubstitute the{TOP}in the path for the fatfs with thePATH_SDK_PATH - once in the folder
pico-examplesset it on the terminal with the commandPICO_SDK_PATH=../../pico-sdk/ - finally launch the cmake command
cmake -DPICO_BOARD=pico_w ..
what version of SDK? have you updated the TinyUSB version to something different to what the SDK ships with
Did get this issue after a hiatus, had done a git pull on the sdk but not the examples repo. Updating examples did the trick.