summaryrefslogtreecommitdiff
path: root/examples/device/dfu/CMakeLists.txt
diff options
context:
space:
mode:
authorJeremiah McCarthy <[email protected]>2021-05-05 17:42:38 -0400
committerJeremiah McCarthy <[email protected]>2021-05-05 17:42:38 -0400
commitdab1ed6b327a41976a2d4968d80747ac35fde113 (patch)
tree27ded090d08ab5568df3e595f8ce46a7b8648d3e /examples/device/dfu/CMakeLists.txt
parentf830800d00520ed2a91d9095e77738f4558324b2 (diff)
Add example to be tested
Update API description.
Diffstat (limited to 'examples/device/dfu/CMakeLists.txt')
-rw-r--r--examples/device/dfu/CMakeLists.txt41
1 files changed, 41 insertions, 0 deletions
diff --git a/examples/device/dfu/CMakeLists.txt b/examples/device/dfu/CMakeLists.txt
new file mode 100644
index 000000000..f4bf75c26
--- /dev/null
+++ b/examples/device/dfu/CMakeLists.txt
@@ -0,0 +1,41 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+set(PROJECT ${BOARD}-${PROJECT})
+
+# TOP is absolute path to root directory of TinyUSB git repo
+set(TOP "../../..")
+get_filename_component(TOP "${TOP}" REALPATH)
+
+# Check for -DFAMILY=
+if(FAMILY STREQUAL "rp2040")
+ cmake_minimum_required(VERSION 3.12)
+ set(PICO_SDK_PATH ${TOP}/hw/mcu/raspberrypi/pico-sdk)
+ include(${PICO_SDK_PATH}/pico_sdk_init.cmake)
+ project(${PROJECT})
+ pico_sdk_init()
+ add_executable(${PROJECT})
+
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+
+ # Example source
+ target_sources(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ # Example defines
+ target_compile_definitions(${PROJECT} PUBLIC
+ CFG_TUSB_OS=OPT_OS_PICO
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib pico_fix_rp2040_usb_device_enumeration)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()