No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CMakeLists.txt 1.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. cmake_minimum_required(VERSION 3.13)
  2. # initialize pico-sdk from submodule
  3. # note: this must happen before project()
  4. include(pico-sdk/pico_sdk_init.cmake)
  5. project(trackball)
  6. # initialize the Raspberry Pi Pico SDK
  7. pico_sdk_init()
  8. # copy FatFS source files to build dir, so we can use our own ffconf.h
  9. configure_file(
  10. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.c
  11. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  12. COPYONLY
  13. )
  14. configure_file(
  15. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ff.h
  16. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.h
  17. COPYONLY
  18. )
  19. configure_file(
  20. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/diskio.h
  21. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/diskio.h
  22. COPYONLY
  23. )
  24. configure_file(
  25. ${CMAKE_CURRENT_SOURCE_DIR}/fatfs/source/ffunicode.c
  26. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  27. COPYONLY
  28. )
  29. add_executable(trackball)
  30. target_sources(trackball PUBLIC
  31. src/main.c
  32. src/console.c
  33. src/log.c
  34. src/util.c
  35. src/pmw3360.c
  36. src/usb.c
  37. src/usb_cdc.c
  38. src/usb_descriptors.c
  39. src/usb_hid.c
  40. src/usb_msc.c
  41. src/fat_disk.c
  42. src/debug.c
  43. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ff.c
  44. ${CMAKE_CURRENT_BINARY_DIR}/fatfs/ffunicode.c
  45. )
  46. # Make sure TinyUSB can find tusb_config.h
  47. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_LIST_DIR}/include)
  48. # Make sure FatFS can find ffconf.h
  49. target_include_directories(trackball PUBLIC ${CMAKE_CURRENT_BINARY_DIR}/fatfs)
  50. target_compile_options(trackball PUBLIC
  51. -Wall
  52. -Werror
  53. )
  54. # pull in common dependencies
  55. target_link_libraries(trackball
  56. pico_stdlib
  57. pico_unique_id
  58. tinyusb_device
  59. tinyusb_board
  60. hardware_spi
  61. )
  62. # fix for Errata RP2040-E5 (the fix requires use of GPIO 15)
  63. target_compile_definitions(trackball PUBLIC PICO_RP2040_USB_DEVICE_ENUMERATION_FIX=1)
  64. # create map/bin/hex/uf2 file etc.
  65. pico_add_extra_outputs(trackball)