summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorhathach <[email protected]>2021-01-24 00:52:46 +0700
committerhathach <[email protected]>2021-01-24 00:52:46 +0700
commit599b428e13a9b71e20a5b3272a3b0c07686cf57c (patch)
tree3ed3208076e964357a0e2af160f359941f50f930 /examples
parent26522d0ec5825280626f49c7191b7964826bed91 (diff)
rp2040 dfu_rt dynamic_configuration compiled
not tested, but should be OK
Diffstat (limited to 'examples')
-rw-r--r--examples/device/dfu_rt/CMakeLists.txt35
-rw-r--r--examples/device/dfu_rt/src/tusb_config.h3
-rw-r--r--examples/device/dynamic_configuration/CMakeLists.txt36
-rw-r--r--examples/device/dynamic_configuration/src/tusb_config.h3
4 files changed, 75 insertions, 2 deletions
diff --git a/examples/device/dfu_rt/CMakeLists.txt b/examples/device/dfu_rt/CMakeLists.txt
new file mode 100644
index 000000000..a1dc14b0a
--- /dev/null
+++ b/examples/device/dfu_rt/CMakeLists.txt
@@ -0,0 +1,35 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# 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
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/dfu_rt/src/tusb_config.h b/examples/device/dfu_rt/src/tusb_config.h
index 226573263..abdbe7526 100644
--- a/examples/device/dfu_rt/src/tusb_config.h
+++ b/examples/device/dfu_rt/src/tusb_config.h
@@ -46,8 +46,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0
diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt
new file mode 100644
index 000000000..783371860
--- /dev/null
+++ b/examples/device/dynamic_configuration/CMakeLists.txt
@@ -0,0 +1,36 @@
+# use directory name for project id
+get_filename_component(PROJECT ${CMAKE_CURRENT_SOURCE_DIR} NAME)
+
+# 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/msc_disk.c
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/usb_descriptors.c
+ )
+
+ # Example include
+ target_include_directories(${PROJECT} PUBLIC
+ ${CMAKE_CURRENT_SOURCE_DIR}/src
+ )
+
+ target_link_libraries(${PROJECT} pico_stdlib)
+ pico_add_extra_outputs(${PROJECT})
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/device/dynamic_configuration/src/tusb_config.h b/examples/device/dynamic_configuration/src/tusb_config.h
index 2f8072f89..23073faf3 100644
--- a/examples/device/dynamic_configuration/src/tusb_config.h
+++ b/examples/device/dynamic_configuration/src/tusb_config.h
@@ -64,8 +64,9 @@
#error "Incorrect RHPort configuration"
#endif
-// This example doesn't use an RTOS
+#ifndef CFG_TUSB_OS
#define CFG_TUSB_OS OPT_OS_NONE
+#endif
// CFG_TUSB_DEBUG is defined by compiler in DEBUG build
// #define CFG_TUSB_DEBUG 0