summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorHa Thach <[email protected]>2021-03-02 13:03:52 +0700
committerGitHub <[email protected]>2021-03-02 13:03:52 +0700
commit559ff806432cfb9d6af9ddcd585b898f24e8668a (patch)
treefa8b7164157d51a8281cfa7094292029e893d36c /examples
parenta3a9a5efb91b56429ac75c0a81101dedd524eba0 (diff)
parentfa8c7bc334a6ccbca4aacce02e853df020c07815 (diff)
Merge pull request #684 from hathach/rp2040-host-example
add rp2040 to host example build
Diffstat (limited to 'examples')
-rw-r--r--examples/host/cdc_msc_hid/.only.MCU_RP20400
-rw-r--r--examples/host/cdc_msc_hid/CMakeLists.txt46
2 files changed, 46 insertions, 0 deletions
diff --git a/examples/host/cdc_msc_hid/.only.MCU_RP2040 b/examples/host/cdc_msc_hid/.only.MCU_RP2040
new file mode 100644
index 000000000..e69de29bb
--- /dev/null
+++ b/examples/host/cdc_msc_hid/.only.MCU_RP2040
diff --git a/examples/host/cdc_msc_hid/CMakeLists.txt b/examples/host/cdc_msc_hid/CMakeLists.txt
new file mode 100644
index 000000000..dc2effde9
--- /dev/null
+++ b/examples/host/cdc_msc_hid/CMakeLists.txt
@@ -0,0 +1,46 @@
+# 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 "esp32s2")
+ cmake_minimum_required(VERSION 3.5)
+ include(${TOP}/hw/bsp/${FAMILY}/family.cmake)
+ project(${PROJECT})
+
+elseif(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/msc_app.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()