summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorReinhard Panhuber <[email protected]>2021-03-10 19:33:11 +0100
committerReinhard Panhuber <[email protected]>2021-03-10 19:33:11 +0100
commit8cb3bd3cd30172d3023facb2522a435b414a3b7e (patch)
tree1bc65aa35561cc43f4fab139a3a6e2654b110faa /examples
parentd5a5a1cab63e8e43b22f13db95df35afdfa6befb (diff)
parenta397353916db36d925f5aec654fc66d5ca09f427 (diff)
Merge remote-tracking branch 'upstream/edpt_ISO_xfer' into edpt_ISO_xfer
Diffstat (limited to 'examples')
-rw-r--r--examples/device/99-tinyusb.rules14
-rw-r--r--examples/device/audio_test/CMakeLists.txt3
-rw-r--r--examples/device/board_test/CMakeLists.txt3
-rw-r--r--examples/device/cdc_dual_ports/CMakeLists.txt3
-rw-r--r--examples/device/cdc_msc/CMakeLists.txt3
-rw-r--r--examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject2
-rw-r--r--examples/device/cdc_msc_freertos/Makefile2
-rw-r--r--examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject50
-rw-r--r--examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject48
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject48
-rw-r--r--examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject48
-rw-r--r--examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h1
-rw-r--r--examples/device/cdc_msc_freertos/src/freertos_hook.c2
-rw-r--r--examples/device/dfu_runtime/CMakeLists.txt3
-rw-r--r--examples/device/dynamic_configuration/CMakeLists.txt3
-rw-r--r--examples/device/hid_composite/CMakeLists.txt3
-rw-r--r--examples/device/hid_composite_freertos/Makefile2
-rw-r--r--examples/device/hid_composite_freertos/src/FreeRTOSConfig.h1
-rw-r--r--examples/device/hid_composite_freertos/src/freertos_hook.c2
-rw-r--r--examples/device/hid_generic_inout/CMakeLists.txt3
-rw-r--r--examples/device/hid_multiple_interface/CMakeLists.txt3
-rw-r--r--examples/device/midi_test/CMakeLists.txt3
-rw-r--r--examples/device/msc_dual_lun/CMakeLists.txt3
-rw-r--r--examples/device/net_lwip_webserver/CMakeLists.txt3
-rw-r--r--examples/device/uac2_headset/CMakeLists.txt3
-rw-r--r--examples/device/usbtmc/CMakeLists.txt3
-rw-r--r--examples/device/webusb_serial/CMakeLists.txt3
-rw-r--r--examples/device/webusb_serial/src/main.c101
-rw-r--r--examples/host/cdc_msc_hid/.only.MCU_RP20400
-rw-r--r--examples/host/cdc_msc_hid/CMakeLists.txt43
-rw-r--r--examples/make.mk40
-rw-r--r--examples/rules.mk20
32 files changed, 261 insertions, 208 deletions
diff --git a/examples/device/99-tinyusb.rules b/examples/device/99-tinyusb.rules
new file mode 100644
index 000000000..e6372ed58
--- /dev/null
+++ b/examples/device/99-tinyusb.rules
@@ -0,0 +1,14 @@
+# Copy this file to the location of your distribution's udev rules, for example on Ubuntu:
+# sudo cp 99-tinyusb.rules /etc/udev/rules.d/
+# Then reload udev configuration by executing:
+# sudo udevadm control --reload-rules
+# sudo udevadm trigger
+
+# Check SUBSYSTEM
+SUBSYSTEMS=="hidraw", KERNEL=="hidraw*", MODE="0666", GROUP="dialout"
+
+# Rule applies to all TinyUSB example
+ATTRS{idVendor}=="cafe", MODE="0666", GROUP="dialout"
+
+# Rule to blacklist TinyUSB example from being manipulated by ModemManager.
+SUBSYSTEMS=="usb", ATTRS{idVendor}=="cafe", ENV{ID_MM_DEVICE_IGNORE}="1"
diff --git a/examples/device/audio_test/CMakeLists.txt b/examples/device/audio_test/CMakeLists.txt
index a10473b79..7038dd041 100644
--- a/examples/device/audio_test/CMakeLists.txt
+++ b/examples/device/audio_test/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index b8b7e7297..4e6a9b3f8 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -37,9 +37,6 @@ elseif(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/cdc_dual_ports/CMakeLists.txt b/examples/device/cdc_dual_ports/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/cdc_dual_ports/CMakeLists.txt
+++ b/examples/device/cdc_dual_ports/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt
index 9e0d1f790..41dd167b7 100644
--- a/examples/device/cdc_msc/CMakeLists.txt
+++ b/examples/device/cdc_msc/CMakeLists.txt
@@ -39,9 +39,6 @@ elseif(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject b/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
index f7714f269..944199138 100644
--- a/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
+++ b/examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject
@@ -21,7 +21,7 @@
build_treat_warnings_as_errors="Yes"
c_additional_options="-Wno-error=undef;-Wno-error=unused-parameter;-Wno-error=cast-align;-Wno-error=cast-function-type"
c_preprocessor_definitions="NRF52840_XXAA;__nRF_FAMILY;ARM_MATH_CM4;FLASH_PLACEMENT=1;CFG_TUSB_MCU=OPT_MCU_NRF5X;CFG_TUSB_DEBUG=1"
- c_user_include_directories="../../src;$(rootDir)/lib/CMSIS_4/CMSIS/Include;$(rootDir)/hw;$(rootDir)/src;$(nrfxDir)/..;$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(nrfxDir)/drivers/src"
+ c_user_include_directories="../../src;$(rootDir)/lib/CMSIS_5/CMSIS/Core/Include;$(rootDir)/hw;$(rootDir)/src;$(nrfxDir)/..;$(nrfxDir);$(nrfxDir)/mdk;$(nrfxDir)/hal;$(nrfxDir)/drivers/include;$(nrfxDir)/drivers/src"
debug_register_definition_file="nrf52840_Registers.xml"
debug_target_connection="J-Link"
gcc_enable_all_warnings="Yes"
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
index 3570daa41..36174b5e1 100644
--- a/examples/device/cdc_msc_freertos/Makefile
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -1,7 +1,7 @@
include ../../../tools/top.mk
include ../../make.mk
-FREERTOS_SRC = lib/FreeRTOS/FreeRTOS/Source
+FREERTOS_SRC = lib/FreeRTOS-Kernel
INC += \
src \
diff --git a/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
index 4dc111f2e..691f8c3b0 100644
--- a/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/lpc175x_6x/lpc175x_6x.emProject
@@ -20,7 +20,7 @@
arm_target_interface_type="SWD"
build_treat_warnings_as_errors="No"
c_preprocessor_definitions="LPC175x_6x;__LPC1700_FAMILY;__LPC176x_SUBFAMILY;ARM_MATH_CM3;FLASH_PLACEMENT=1;CORE_M3;CFG_TUSB_MCU=OPT_MCU_LPC175X_6X"
- c_user_include_directories=".;../../src;$(rootDir)/hw;$(rootDir)/src;$(rootDir)/hw/mcu/nxp/lpc_driver/lpc_chip_175x_6x/inc;$(rootDir)/lib/FreeRTOS/Source/include;$(rootDir)/lib/FreeRTOS/Source/portable/GCC/ARM_CM3"
+ c_user_include_directories=".;../../src;$(rootDir)/hw;$(rootDir)/src;$(rootDir)/hw/mcu/nxp/lpc_driver/lpc_chip_175x_6x/inc;$(rootDir)/lib/FreeRTOS-Kernel/include;$(rootDir)/lib/FreeRTOS-Kernel/portable/GCC/ARM_CM3"
debug_register_definition_file="LPC176x5x_Registers.xml"
debug_target_connection="J-Link"
gcc_enable_all_warnings="Yes"
@@ -92,39 +92,39 @@
<folder Name="FreeRTOS">
<folder Name="Source">
<folder Name="include">
- <file file_name="../../../../../lib/FreeRTOS/Source/include/croutine.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/deprecated_definitions.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/event_groups.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/FreeRTOS.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/list.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/message_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_prototypes.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_wrappers.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/portable.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/projdefs.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/queue.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/semphr.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stack_macros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/StackMacros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stream_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/task.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/timers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/croutine.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/deprecated_definitions.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/event_groups.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/FreeRTOS.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/list.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/message_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_prototypes.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_wrappers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/portable.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/projdefs.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/queue.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/semphr.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stack_macros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/StackMacros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stream_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/task.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/timers.h" />
</folder>
<folder Name="portable">
<folder Name="GCC">
<folder Name="ARM_CM3">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM3/port.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM3/portmacro.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM3/port.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM3/portmacro.h" />
</folder>
</folder>
<folder Name="MemMang">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/MemMang/heap_4.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/MemMang/heap_4.c" />
</folder>
</folder>
- <file file_name="../../../../../lib/FreeRTOS/Source/list.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/queue.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/tasks.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/timers.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/list.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/queue.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/tasks.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/timers.c" />
</folder>
<file file_name="../../../../../lib/FreeRTOS/freertos_hook.c" />
</folder>
diff --git a/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
index f01b26d23..e964d6fb5 100644
--- a/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
+++ b/examples/device/cdc_msc_freertos/ses/nrf5x/nrf5x.emProject
@@ -107,39 +107,39 @@
<folder Name="FreeRTOS">
<folder Name="Source">
<folder Name="include">
- <file file_name="../../../../../lib/FreeRTOS/Source/include/croutine.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/deprecated_definitions.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/event_groups.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/FreeRTOS.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/list.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/message_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_prototypes.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_wrappers.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/portable.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/projdefs.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/queue.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/semphr.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stack_macros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/StackMacros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stream_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/task.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/timers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/croutine.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/deprecated_definitions.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/event_groups.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/FreeRTOS.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/list.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/message_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_prototypes.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_wrappers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/portable.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/projdefs.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/queue.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/semphr.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stack_macros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/StackMacros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stream_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/task.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/timers.h" />
</folder>
<folder Name="portable">
<folder Name="GCC">
<folder Name="ARM_CM4F">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/port.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/portmacro.h" />
</folder>
</folder>
<folder Name="MemMang">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/MemMang/heap_4.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/MemMang/heap_4.c" />
</folder>
</folder>
- <file file_name="../../../../../lib/FreeRTOS/Source/list.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/queue.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/tasks.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/timers.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/list.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/queue.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/tasks.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/timers.c" />
</folder>
</folder>
</folder>
diff --git a/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
index b8b099b68..b3db856d3 100644
--- a/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd21/samd21.emProject
@@ -100,39 +100,39 @@
<folder Name="FreeRTOS">
<folder Name="Source">
<folder Name="include">
- <file file_name="../../../../../lib/FreeRTOS/Source/include/croutine.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/deprecated_definitions.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/event_groups.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/FreeRTOS.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/list.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/message_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_prototypes.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_wrappers.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/portable.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/projdefs.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/queue.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/semphr.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stack_macros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/StackMacros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stream_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/task.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/timers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/croutine.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/deprecated_definitions.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/event_groups.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/FreeRTOS.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/list.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/message_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_prototypes.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_wrappers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/portable.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/projdefs.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/queue.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/semphr.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stack_macros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/StackMacros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stream_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/task.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/timers.h" />
</folder>
<folder Name="portable">
<folder Name="GCC">
<folder Name="ARM_CM0">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM0/port.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM0/portmacro.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM0/port.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM0/portmacro.h" />
</folder>
</folder>
<folder Name="MemMang">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/MemMang/heap_4.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/MemMang/heap_4.c" />
</folder>
</folder>
- <file file_name="../../../../../lib/FreeRTOS/Source/list.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/queue.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/tasks.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/timers.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/list.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/queue.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/tasks.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/timers.c" />
</folder>
<file file_name="../../../../../lib/FreeRTOS/freertos_hook.c" />
</folder>
diff --git a/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
index d84d070c0..77ff38b62 100644
--- a/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
+++ b/examples/device/cdc_msc_freertos/ses/samd51/samd51.emProject
@@ -104,39 +104,39 @@
<folder Name="FreeRTOS">
<folder Name="Source">
<folder Name="include">
- <file file_name="../../../../../lib/FreeRTOS/Source/include/croutine.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/deprecated_definitions.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/event_groups.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/FreeRTOS.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/list.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/message_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_prototypes.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/mpu_wrappers.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/portable.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/projdefs.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/queue.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/semphr.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stack_macros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/StackMacros.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/stream_buffer.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/task.h" />
- <file file_name="../../../../../lib/FreeRTOS/Source/include/timers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/croutine.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/deprecated_definitions.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/event_groups.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/FreeRTOS.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/list.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/message_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_prototypes.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/mpu_wrappers.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/portable.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/projdefs.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/queue.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/semphr.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stack_macros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/StackMacros.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/stream_buffer.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/task.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/include/timers.h" />
</folder>
<folder Name="portable">
<folder Name="GCC">
<folder Name="ARM_CM4F">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM4F/port.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/GCC/ARM_CM4F/portmacro.h" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/port.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/GCC/ARM_CM4F/portmacro.h" />
</folder>
</folder>
<folder Name="MemMang">
- <file file_name="../../../../../lib/FreeRTOS/Source/portable/MemMang/heap_4.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/portable/MemMang/heap_4.c" />
</folder>
</folder>
- <file file_name="../../../../../lib/FreeRTOS/Source/list.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/queue.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/tasks.c" />
- <file file_name="../../../../../lib/FreeRTOS/Source/timers.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/list.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/queue.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/tasks.c" />
+ <file file_name="../../../../../lib/FreeRTOS-Kernel/timers.c" />
</folder>
<file file_name="../../../../../lib/FreeRTOS/freertos_hook.c" />
</folder>
diff --git a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
index 494452d43..7b2b93d7b 100644
--- a/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
+++ b/examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h
@@ -71,6 +71,7 @@ extern uint32_t SystemCoreClock;
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
+#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 0
diff --git a/examples/device/cdc_msc_freertos/src/freertos_hook.c b/examples/device/cdc_msc_freertos/src/freertos_hook.c
index 423bad4d3..df15a8de7 100644
--- a/examples/device/cdc_msc_freertos/src/freertos_hook.c
+++ b/examples/device/cdc_msc_freertos/src/freertos_hook.c
@@ -37,7 +37,7 @@ void vApplicationMallocFailedHook(void)
TU_ASSERT(false, );
}
-void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName)
+void vApplicationStackOverflowHook(xTaskHandle pxTask, char *pcTaskName)
{
(void) pxTask;
(void) pcTaskName;
diff --git a/examples/device/dfu_runtime/CMakeLists.txt b/examples/device/dfu_runtime/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/dfu_runtime/CMakeLists.txt
+++ b/examples/device/dfu_runtime/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt
index b4c95652a..be6224360 100644
--- a/examples/device/dynamic_configuration/CMakeLists.txt
+++ b/examples/device/dynamic_configuration/CMakeLists.txt
@@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/hid_composite/CMakeLists.txt b/examples/device/hid_composite/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/hid_composite/CMakeLists.txt
+++ b/examples/device/hid_composite/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile
index cef1af5a6..db7dfd345 100644
--- a/examples/device/hid_composite_freertos/Makefile
+++ b/examples/device/hid_composite_freertos/Makefile
@@ -1,7 +1,7 @@
include ../../../tools/top.mk
include ../../make.mk
-FREERTOS_SRC = lib/FreeRTOS/FreeRTOS/Source
+FREERTOS_SRC = lib/FreeRTOS-Kernel
INC += \
src \
diff --git a/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h b/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
index 494452d43..7b2b93d7b 100644
--- a/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
+++ b/examples/device/hid_composite_freertos/src/FreeRTOSConfig.h
@@ -71,6 +71,7 @@ extern uint32_t SystemCoreClock;
#define configUSE_TIME_SLICING 0
#define configUSE_NEWLIB_REENTRANT 0
#define configENABLE_BACKWARD_COMPATIBILITY 1
+#define configSTACK_ALLOCATION_FROM_SEPARATE_HEAP 0
#define configSUPPORT_STATIC_ALLOCATION 1
#define configSUPPORT_DYNAMIC_ALLOCATION 0
diff --git a/examples/device/hid_composite_freertos/src/freertos_hook.c b/examples/device/hid_composite_freertos/src/freertos_hook.c
index 423bad4d3..df15a8de7 100644
--- a/examples/device/hid_composite_freertos/src/freertos_hook.c
+++ b/examples/device/hid_composite_freertos/src/freertos_hook.c
@@ -37,7 +37,7 @@ void vApplicationMallocFailedHook(void)
TU_ASSERT(false, );
}
-void vApplicationStackOverflowHook(xTaskHandle pxTask, signed char *pcTaskName)
+void vApplicationStackOverflowHook(xTaskHandle pxTask, char *pcTaskName)
{
(void) pxTask;
(void) pcTaskName;
diff --git a/examples/device/hid_generic_inout/CMakeLists.txt b/examples/device/hid_generic_inout/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/hid_generic_inout/CMakeLists.txt
+++ b/examples/device/hid_generic_inout/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/hid_multiple_interface/CMakeLists.txt
+++ b/examples/device/hid_multiple_interface/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/midi_test/CMakeLists.txt b/examples/device/midi_test/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/midi_test/CMakeLists.txt
+++ b/examples/device/midi_test/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/msc_dual_lun/CMakeLists.txt b/examples/device/msc_dual_lun/CMakeLists.txt
index 6032308f2..0036dc685 100644
--- a/examples/device/msc_dual_lun/CMakeLists.txt
+++ b/examples/device/msc_dual_lun/CMakeLists.txt
@@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/net_lwip_webserver/CMakeLists.txt b/examples/device/net_lwip_webserver/CMakeLists.txt
index e3c8190f4..c9aabc636 100644
--- a/examples/device/net_lwip_webserver/CMakeLists.txt
+++ b/examples/device/net_lwip_webserver/CMakeLists.txt
@@ -80,9 +80,6 @@ if(FAMILY STREQUAL "rp2040")
HTTPD_USE_CUSTOM_FSDATA=0
)
- 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()
diff --git a/examples/device/uac2_headset/CMakeLists.txt b/examples/device/uac2_headset/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/uac2_headset/CMakeLists.txt
+++ b/examples/device/uac2_headset/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/usbtmc/CMakeLists.txt b/examples/device/usbtmc/CMakeLists.txt
index 9a4aa382b..808bdbcf8 100644
--- a/examples/device/usbtmc/CMakeLists.txt
+++ b/examples/device/usbtmc/CMakeLists.txt
@@ -34,9 +34,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/webusb_serial/CMakeLists.txt b/examples/device/webusb_serial/CMakeLists.txt
index f4bf75c26..5e3ec0909 100644
--- a/examples/device/webusb_serial/CMakeLists.txt
+++ b/examples/device/webusb_serial/CMakeLists.txt
@@ -33,9 +33,6 @@ if(FAMILY STREQUAL "rp2040")
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()
diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c
index 143a73374..c85b3cc9a 100644
--- a/examples/device/webusb_serial/src/main.c
+++ b/examples/device/webusb_serial/src/main.c
@@ -23,6 +23,26 @@
*
*/
+/* This example demonstrates WebUSB as web serial with browser with WebUSB support (e.g Chrome).
+ * After enumerated successfully, browser will pop-up notification
+ * with URL to landing page, click on it to test
+ * - Click "Connect" and select device, When connected the on-board LED will litted up.
+ * - Any charters received from either webusb/Serial will be echo back to webusb and Serial
+ *
+ * Note:
+ * - The WebUSB landing page notification is currently disabled in Chrome
+ * on Windows due to Chromium issue 656702 (https://crbug.com/656702). You have to
+ * go to landing page (below) to test
+ *
+ * - On Windows 7 and prior: You need to use Zadig tool to manually bind the
+ * WebUSB interface with the WinUSB driver for Chrome to access. From windows 8 and 10, this
+ * is done automatically by firmware.
+ *
+ * - On Linux/macOS, udev permission may need to be updated by
+ * - copying '/examples/device/99-tinyusb.rules' file to /etc/udev/rules.d/ then
+ * - run 'sudo udevadm control --reload-rules && sudo udevadm trigger'
+ */
+
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -149,52 +169,59 @@ void tud_resume_cb(void)
bool tud_vendor_control_xfer_cb(uint8_t rhport, uint8_t stage, tusb_control_request_t const * request)
{
// nothing to with DATA & ACK stage
- if (stage != CONTROL_STAGE_SETUP ) return true;
+ if (stage != CONTROL_STAGE_SETUP) return true;
- if (request->bmRequestType_bit.type == TUSB_REQ_TYPE_VENDOR) {
- switch (request->bRequest)
- {
- case VENDOR_REQUEST_WEBUSB:
- // match vendor request in BOS descriptor
- // Get landing page url
- return tud_control_xfer(rhport, request, (void*) &desc_url, desc_url.bLength);
+ switch (request->bmRequestType_bit.type)
+ {
+ case TUSB_REQ_TYPE_VENDOR:
+ switch (request->bRequest)
+ {
+ case VENDOR_REQUEST_WEBUSB:
+ // match vendor request in BOS descriptor
+ // Get landing page url
+ return tud_control_xfer(rhport, request, (void*) &desc_url, desc_url.bLength);
+
+ case VENDOR_REQUEST_MICROSOFT:
+ if ( request->wIndex == 7 )
+ {
+ // Get Microsoft OS 2.0 compatible descriptor
+ uint16_t total_len;
+ memcpy(&total_len, desc_ms_os_20+8, 2);
- case VENDOR_REQUEST_MICROSOFT:
- if ( request->wIndex == 7 )
+ return tud_control_xfer(rhport, request, (void*) desc_ms_os_20, total_len);
+ }else
+ {
+ return false;
+ }
+
+ default: break;
+ }
+ break;
+
+ case TUSB_REQ_TYPE_CLASS:
+ if (request->bRequest == 0x22)
+ {
+ // Webserial simulate the CDC_REQUEST_SET_CONTROL_LINE_STATE (0x22) to connect and disconnect.
+ web_serial_connected = (request->wValue != 0);
+
+ // Always lit LED if connected
+ if ( web_serial_connected )
{
- // Get Microsoft OS 2.0 compatible descriptor
- uint16_t total_len;
- memcpy(&total_len, desc_ms_os_20+8, 2);
+ board_led_write(true);
+ blink_interval_ms = BLINK_ALWAYS_ON;
- return tud_control_xfer(rhport, request, (void*) desc_ms_os_20, total_len);
+ tud_vendor_write_str("\r\nTinyUSB WebUSB device example\r\n");
}else
{
- return false;
+ blink_interval_ms = BLINK_MOUNTED;
}
- default:
- return false;
- }
- } else if (
- request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS &&
- request->bRequest == 0x22) {
- // Webserial simulate the CDC_REQUEST_SET_CONTROL_LINE_STATE (0x22) to
- // connect and disconnect.
- web_serial_connected = (request->wValue != 0);
-
- // Always lit LED if connected
- if ( web_serial_connected ) {
- board_led_write(true);
- blink_interval_ms = BLINK_ALWAYS_ON;
-
- tud_vendor_write_str("\r\nTinyUSB WebUSB device example\r\n");
- }else
- {
- blink_interval_ms = BLINK_MOUNTED;
- }
+ // response with status OK
+ return tud_control_status(rhport, request);
+ }
+ break;
- // response with status OK
- return tud_control_status(rhport, request);
+ default: break;
}
// stall unknown request
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..2302678b7
--- /dev/null
+++ b/examples/host/cdc_msc_hid/CMakeLists.txt
@@ -0,0 +1,43 @@
+# 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
+ )
+
+else()
+ message(FATAL_ERROR "Invalid FAMILY specified")
+endif()
diff --git a/examples/make.mk b/examples/make.mk
index 5387a4ec4..82fbd020b 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -15,24 +15,14 @@ check_defined = \
__check_defined = \
$(if $(value $1),, \
$(error Undefined make flag: $1$(if $2, ($2))))
-
-# TODO Check if submodule haven't checkout yet
-fetch_submodule_if_empty = \
- ifeq ($(wildcard $(TOP)/$1/*),) \
- $(info $(shell git -C $(TOP) submodule update --init)) \
- endif
#-------------- Select the board to build for. ------------
-#BOARD_LIST = $(sort $(subst /.,,$(subst $(TOP)/hw/bsp/,,$(wildcard $(TOP)/hw/bsp/*/.))))
-#ifeq ($(filter $(BOARD),$(BOARD_LIST)),)
-# $(info You must provide a BOARD parameter with 'BOARD=', supported boards are:)
-# $(foreach b,$(BOARD_LIST),$(info - $(b)))
-# $(error Invalid BOARD specified)
-#endif
# Board without family
-BOARD_PATH := $(subst $(TOP)/,,$(wildcard $(TOP)/hw/bsp/$(BOARD)))
+ifneq ($(wildcard $(TOP)/hw/bsp/$(BOARD)/board.mk),)
+BOARD_PATH := hw/bsp/$(BOARD)
FAMILY :=
+endif
# Board within family
ifeq ($(BOARD_PATH),)
@@ -42,6 +32,7 @@ ifeq ($(BOARD_PATH),)
endif
ifeq ($(BOARD_PATH),)
+ $(info You must provide a BOARD parameter with 'BOARD=')
$(error Invalid BOARD specified)
endif
@@ -56,6 +47,16 @@ endif
#TODO $(call fetch_submodule_if_empty,lib/sct_neopixel)
+# Fetch submodules depended by family
+fetch_submodule_if_empty = \
+ ifeq ($(wildcard $(TOP)/$1/*),) \
+ $(info $(shell git -C $(TOP) submodule update --init $1)) \
+ endif
+
+ifdef DEPS_SUBMODULES
+ $(foreach s,$(DEPS_SUBMODULES),:$(call fetch_submodule_if_empty,$(s)))
+endif
+
#-------------- Cross Compiler ------------
# Can be set by board, default to ARM GCC
CROSS_COMPILE ?= arm-none-eabi-
@@ -65,13 +66,14 @@ CXX = $(CROSS_COMPILE)g++
OBJCOPY = $(CROSS_COMPILE)objcopy
SIZE = $(CROSS_COMPILE)size
MKDIR = mkdir
+
ifeq ($(CMDEXE),1)
-CP = copy
-RM = del
+ CP = copy
+ RM = del
else
-SED = sed
-CP = cp
-RM = rm
+ SED = sed
+ CP = cp
+ RM = rm
endif
#-------------- Source files and compiler flags --------------
@@ -80,6 +82,8 @@ endif
SRC_C += hw/bsp/board.c
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(BOARD_PATH)/*.c))
+INC += $(TOP)/$(FAMILY_PATH)
+
# Compiler Flags
CFLAGS += \
-ggdb \
diff --git a/examples/rules.mk b/examples/rules.mk
index d248ed247..a97eb566a 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -6,7 +6,9 @@
.DEFAULT_GOAL := all
ifeq ($(FAMILY),esp32s2)
+# ---------------------------------------
# Espressif IDF use CMake build system, this add wrapper target to call idf.py
+# ---------------------------------------
.PHONY: all clean flash
@@ -44,6 +46,9 @@ $(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
$(PYTHON) $(TOP)/tools/uf2/utils/uf2conv.py -f $(UF2_FAMILY_ID) -b 0x0 -c -o $@ $^
else ifeq ($(FAMILY),rp2040)
+# ---------------------------------------
+# RP2040 CMake
+# ---------------------------------------
ifeq ($(DEBUG), 1)
CMAKE_DEFSYM += -DCMAKE_BUILD_TYPE=Debug
@@ -58,11 +63,14 @@ all: $(BUILD)
clean:
$(RM) -rf $(BUILD)
+#flash: flash-pyocd
flash:
@$(CP) $(BUILD)/$(PROJECT).uf2 /media/$(USER)/RPI-RP2
else
+# ---------------------------------------
# GNU Make build system
+# ---------------------------------------
# libc
LIBS += -lgcc -lm -lnosys
@@ -93,12 +101,11 @@ INC += $(TOP)/src
CFLAGS += $(addprefix -I,$(INC))
-# TODO Skip nanolib for MSP430
-ifeq ($(BOARD), msp_exp430f5529lp)
- LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
-else
- LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections -specs=nosys.specs -specs=nano.specs
+LDFLAGS += $(CFLAGS) -fshort-enums -Wl,-T,$(TOP)/$(LD_FILE) -Wl,[email protected] -Wl,-cref -Wl,-gc-sections
+ifneq ($(SKIP_NANOLIB), 1)
+LDFLAGS += -specs=nosys.specs -specs=nano.specs
endif
+
ASFLAGS += $(CFLAGS)
# Assembly files can be name with upper case .S, convert it to .s
@@ -188,6 +195,8 @@ else
$(RM) -rf $(BUILD)
endif
+endif # GNU Make
+
# Print out the value of a make variable.
# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
print-%:
@@ -221,7 +230,6 @@ flash-pyocd: $(BUILD)/$(PROJECT).hex
pyocd flash -t $(PYOCD_TARGET) $<
pyocd reset -t $(PYOCD_TARGET)
-endif # GNU Make
#-------------- Artifacts --------------