pico-examples icon indicating copy to clipboard operation
pico-examples copied to clipboard

Can't compile TinyUSB examples

Open tobias-groeger opened this issue 2 years ago • 4 comments

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.

tobias-groeger avatar May 10 '23 15:05 tobias-groeger

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.

VBruceHunt avatar Jul 20 '23 19:07 VBruceHunt

i had the same problem, i solved it by:

  1. downloading the module from the website faftfs
  2. move it in the folder pico/pico-sdk/lib
  3. change it's name to fatfs since the CMakelist file was searching for that
  4. inside the same CMake file avaiable at /pico/pico-sdk/lib/tinyusb/examples/host/msc_file_explorer substitute the {TOP} in the path for the fatfs with the PATH_SDK_PATH
  5. once in the folder pico-examples set it on the terminal with the command PICO_SDK_PATH=../../pico-sdk/
  6. finally launch the cmake command cmake -DPICO_BOARD=pico_w ..

jek97 avatar Aug 04 '23 23:08 jek97

what version of SDK? have you updated the TinyUSB version to something different to what the SDK ships with

kilograham avatar Aug 05 '23 21:08 kilograham

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.

0xMaka avatar Feb 18 '24 03:02 0xMaka