summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJean Gressmann <[email protected]>2021-03-21 09:53:57 +0100
committerJean Gressmann <[email protected]>2021-03-21 09:53:57 +0100
commit8e6f298aa163fe92547e4b8a207c71e7edf2ab26 (patch)
tree0967a5d9629326ac3300450c50f8062c82247df9 /examples
parent1f9b7b0c4832a2d740bbfe9b437065ea3d24407a (diff)
parent42681edaf31ad18fbab6a8b9d581092ae16d841d (diff)
Merge upstream TinyUSB master
Diffstat (limited to 'examples')
-rw-r--r--examples/device/audio_test/CMakeLists.txt3
-rw-r--r--examples/device/board_test/CMakeLists.txt4
-rw-r--r--examples/device/cdc_dual_ports/CMakeLists.txt3
-rw-r--r--examples/device/cdc_dual_ports/src/main.c6
-rw-r--r--examples/device/cdc_dual_ports/src/tusb_config.h2
-rw-r--r--examples/device/cdc_msc/CMakeLists.txt3
-rw-r--r--examples/device/cdc_msc/src/main.c28
-rw-r--r--examples/device/cdc_msc/src/tusb_config.h3
-rw-r--r--examples/device/cdc_msc_freertos/Makefile2
-rw-r--r--examples/device/cdc_msc_freertos/src/main.c22
-rw-r--r--examples/device/cdc_msc_freertos/src/tusb_config.h3
-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_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/net_lwip_webserver/Makefile2
-rw-r--r--examples/device/net_lwip_webserver/src/usb_descriptors.c1
-rw-r--r--examples/device/uac2_headset/CMakeLists.txt3
-rw-r--r--examples/device/usbtmc/CMakeLists.txt2
-rw-r--r--examples/device/webusb_serial/CMakeLists.txt3
-rw-r--r--examples/host/cdc_msc_hid/CMakeLists.txt3
-rw-r--r--examples/make.mk2
-rw-r--r--examples/rules.mk81
28 files changed, 84 insertions, 118 deletions
diff --git a/examples/device/audio_test/CMakeLists.txt b/examples/device/audio_test/CMakeLists.txt
index 7038dd041..03f2439e2 100644
--- a/examples/device/audio_test/CMakeLists.txt
+++ b/examples/device/audio_test/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/board_test/CMakeLists.txt b/examples/device/board_test/CMakeLists.txt
index 4e6a9b3f8..b4c4ce4d0 100644
--- a/examples/device/board_test/CMakeLists.txt
+++ b/examples/device/board_test/CMakeLists.txt
@@ -9,15 +9,17 @@ 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)
diff --git a/examples/device/cdc_dual_ports/CMakeLists.txt b/examples/device/cdc_dual_ports/CMakeLists.txt
index 5e3ec0909..94e4fc1fa 100644
--- a/examples/device/cdc_dual_ports/CMakeLists.txt
+++ b/examples/device/cdc_dual_ports/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/cdc_dual_ports/src/main.c b/examples/device/cdc_dual_ports/src/main.c
index 198c4252b..34cd29edd 100644
--- a/examples/device/cdc_dual_ports/src/main.c
+++ b/examples/device/cdc_dual_ports/src/main.c
@@ -63,13 +63,11 @@ static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count)
}
else
{
- // echo back additional ports as upper case
+ // echo back 2nd port as upper case
if (islower(buf[i])) buf[i] -= 'a' - 'A';
}
tud_cdc_n_write_char(itf, buf[i]);
-
- if ( buf[i] == '\r' ) tud_cdc_n_write_char(itf, '\n');
}
tud_cdc_n_write_flush(itf);
}
@@ -85,7 +83,7 @@ static void cdc_task(void)
{
// connected() check for DTR bit
// Most but not all terminal client set this when making connection
- if ( tud_cdc_n_connected(itf) )
+ // if ( tud_cdc_n_connected(itf) )
{
if ( tud_cdc_n_available(itf) )
{
diff --git a/examples/device/cdc_dual_ports/src/tusb_config.h b/examples/device/cdc_dual_ports/src/tusb_config.h
index 69001bdec..7db520dd1 100644
--- a/examples/device/cdc_dual_ports/src/tusb_config.h
+++ b/examples/device/cdc_dual_ports/src/tusb_config.h
@@ -104,6 +104,8 @@
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+// CDC Endpoint transfer buffer size, more is faster
+#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#ifdef __cplusplus
}
diff --git a/examples/device/cdc_msc/CMakeLists.txt b/examples/device/cdc_msc/CMakeLists.txt
index 41dd167b7..f6cf64521 100644
--- a/examples/device/cdc_msc/CMakeLists.txt
+++ b/examples/device/cdc_msc/CMakeLists.txt
@@ -17,9 +17,8 @@ elseif(FAMILY STREQUAL "rp2040")
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
diff --git a/examples/device/cdc_msc/src/main.c b/examples/device/cdc_msc/src/main.c
index a20a80fcd..131ae6549 100644
--- a/examples/device/cdc_msc/src/main.c
+++ b/examples/device/cdc_msc/src/main.c
@@ -48,7 +48,6 @@ enum {
static uint32_t blink_interval_ms = BLINK_NOT_MOUNTED;
void led_blinking_task(void);
-
void cdc_task(void);
/*------------- MAIN -------------*/
@@ -112,18 +111,16 @@ void cdc_task(void)
// connected and there are data available
if ( tud_cdc_available() )
{
- uint8_t buf[64];
-
- // read and echo back
+ // read datas
+ char buf[64];
uint32_t count = tud_cdc_read(buf, sizeof(buf));
+ (void) count;
- for(uint32_t i=0; i<count; i++)
- {
- tud_cdc_write_char(buf[i]);
-
- if ( buf[i] == '\r' ) tud_cdc_write_char('\n');
- }
-
+ // Echo back
+ // Note: Skip echo by commenting out write() and write_flush()
+ // for throughput test e.g
+ // $ dd if=/dev/zero of=/dev/ttyACM0 count=10000
+ tud_cdc_write(buf, count);
tud_cdc_write_flush();
}
}
@@ -135,12 +132,13 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
(void) itf;
(void) rts;
- // connected
+ // TODO set some indicator
if ( dtr )
{
- // print initial message when connected
- tud_cdc_write_str("\r\nTinyUSB CDC MSC device example\r\n");
- tud_cdc_write_flush();
+ // Terminal connected
+ }else
+ {
+ // Terminal disconnected
}
}
diff --git a/examples/device/cdc_msc/src/tusb_config.h b/examples/device/cdc_msc/src/tusb_config.h
index e0099785b..9a0262d30 100644
--- a/examples/device/cdc_msc/src/tusb_config.h
+++ b/examples/device/cdc_msc/src/tusb_config.h
@@ -106,6 +106,9 @@
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+// CDC Endpoint transfer buffer size, more is faster
+#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+
// MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_EP_BUFSIZE 512
diff --git a/examples/device/cdc_msc_freertos/Makefile b/examples/device/cdc_msc_freertos/Makefile
index 36174b5e1..86bacd2d4 100644
--- a/examples/device/cdc_msc_freertos/Makefile
+++ b/examples/device/cdc_msc_freertos/Makefile
@@ -1,3 +1,5 @@
+DEPS_SUBMODULES += lib/FreeRTOS-Kernel
+
include ../../../tools/top.mk
include ../../make.mk
diff --git a/examples/device/cdc_msc_freertos/src/main.c b/examples/device/cdc_msc_freertos/src/main.c
index e90c3f0d9..5779b7d45 100644
--- a/examples/device/cdc_msc_freertos/src/main.c
+++ b/examples/device/cdc_msc_freertos/src/main.c
@@ -179,14 +179,13 @@ void cdc_task(void* params)
// read and echo back
uint32_t count = tud_cdc_read(buf, sizeof(buf));
+ (void) count;
- for(uint32_t i=0; i<count; i++)
- {
- tud_cdc_write_char(buf[i]);
-
- if ( buf[i] == '\r' ) tud_cdc_write_char('\n');
- }
-
+ // Echo back
+ // Note: Skip echo by commenting out write() and write_flush()
+ // for throughput test e.g
+ // $ dd if=/dev/zero of=/dev/ttyACM0 count=10000
+ tud_cdc_write(buf, count);
tud_cdc_write_flush();
}
}
@@ -202,12 +201,13 @@ void tud_cdc_line_state_cb(uint8_t itf, bool dtr, bool rts)
(void) itf;
(void) rts;
- // connected
+ // TODO set some indicator
if ( dtr )
{
- // print initial message when connected
- tud_cdc_write_str("\r\nTinyUSB CDC MSC device with FreeRTOS example\r\n");
- tud_cdc_write_flush();
+ // Terminal connected
+ }else
+ {
+ // Terminal disconnected
}
}
diff --git a/examples/device/cdc_msc_freertos/src/tusb_config.h b/examples/device/cdc_msc_freertos/src/tusb_config.h
index fe4845a08..ff5438349 100644
--- a/examples/device/cdc_msc_freertos/src/tusb_config.h
+++ b/examples/device/cdc_msc_freertos/src/tusb_config.h
@@ -106,6 +106,9 @@
#define CFG_TUD_CDC_RX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
#define CFG_TUD_CDC_TX_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+// CDC Endpoint transfer buffer size, more is faster
+#define CFG_TUD_CDC_EP_BUFSIZE (TUD_OPT_HIGH_SPEED ? 512 : 64)
+
// MSC Buffer size of Device Mass storage
#define CFG_TUD_MSC_EP_BUFSIZE 512
diff --git a/examples/device/dfu_runtime/CMakeLists.txt b/examples/device/dfu_runtime/CMakeLists.txt
index 5e3ec0909..ea294b3b9 100644
--- a/examples/device/dfu_runtime/CMakeLists.txt
+++ b/examples/device/dfu_runtime/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/dynamic_configuration/CMakeLists.txt b/examples/device/dynamic_configuration/CMakeLists.txt
index be6224360..09a8dcc4c 100644
--- a/examples/device/dynamic_configuration/CMakeLists.txt
+++ b/examples/device/dynamic_configuration/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/hid_composite/CMakeLists.txt b/examples/device/hid_composite/CMakeLists.txt
index 5e3ec0909..c85f2ace2 100644
--- a/examples/device/hid_composite/CMakeLists.txt
+++ b/examples/device/hid_composite/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/hid_composite_freertos/Makefile b/examples/device/hid_composite_freertos/Makefile
index db7dfd345..1c1959590 100644
--- a/examples/device/hid_composite_freertos/Makefile
+++ b/examples/device/hid_composite_freertos/Makefile
@@ -1,3 +1,5 @@
+DEPS_SUBMODULES += lib/FreeRTOS-Kernel
+
include ../../../tools/top.mk
include ../../make.mk
diff --git a/examples/device/hid_generic_inout/CMakeLists.txt b/examples/device/hid_generic_inout/CMakeLists.txt
index 5e3ec0909..5de4a932d 100644
--- a/examples/device/hid_generic_inout/CMakeLists.txt
+++ b/examples/device/hid_generic_inout/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/hid_multiple_interface/CMakeLists.txt b/examples/device/hid_multiple_interface/CMakeLists.txt
index 5e3ec0909..5de4a932d 100644
--- a/examples/device/hid_multiple_interface/CMakeLists.txt
+++ b/examples/device/hid_multiple_interface/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/midi_test/CMakeLists.txt b/examples/device/midi_test/CMakeLists.txt
index 5e3ec0909..5de4a932d 100644
--- a/examples/device/midi_test/CMakeLists.txt
+++ b/examples/device/midi_test/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/msc_dual_lun/CMakeLists.txt b/examples/device/msc_dual_lun/CMakeLists.txt
index 0036dc685..48e183edc 100644
--- a/examples/device/msc_dual_lun/CMakeLists.txt
+++ b/examples/device/msc_dual_lun/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/net_lwip_webserver/CMakeLists.txt b/examples/device/net_lwip_webserver/CMakeLists.txt
index c9aabc636..69a242be8 100644
--- a/examples/device/net_lwip_webserver/CMakeLists.txt
+++ b/examples/device/net_lwip_webserver/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/net_lwip_webserver/Makefile b/examples/device/net_lwip_webserver/Makefile
index fa93cf87f..c3e0d8899 100644
--- a/examples/device/net_lwip_webserver/Makefile
+++ b/examples/device/net_lwip_webserver/Makefile
@@ -1,3 +1,5 @@
+DEPS_SUBMODULES += lib/lwip
+
include ../../../tools/top.mk
include ../../make.mk
diff --git a/examples/device/net_lwip_webserver/src/usb_descriptors.c b/examples/device/net_lwip_webserver/src/usb_descriptors.c
index f1c0b478c..1a77c39d7 100644
--- a/examples/device/net_lwip_webserver/src/usb_descriptors.c
+++ b/examples/device/net_lwip_webserver/src/usb_descriptors.c
@@ -142,7 +142,6 @@ static uint8_t const ecm_configuration[] =
// - Windows only works with RNDIS
// - MacOS only works with CDC-ECM
// - Linux will work on both
-// Note index is Num-1x
static uint8_t const * const configuration_arr[2] =
{
[CONFIG_ID_RNDIS] = rndis_configuration,
diff --git a/examples/device/uac2_headset/CMakeLists.txt b/examples/device/uac2_headset/CMakeLists.txt
index 5e3ec0909..5de4a932d 100644
--- a/examples/device/uac2_headset/CMakeLists.txt
+++ b/examples/device/uac2_headset/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/device/usbtmc/CMakeLists.txt b/examples/device/usbtmc/CMakeLists.txt
index 808bdbcf8..f40d123b0 100644
--- a/examples/device/usbtmc/CMakeLists.txt
+++ b/examples/device/usbtmc/CMakeLists.txt
@@ -11,8 +11,8 @@ 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)
diff --git a/examples/device/webusb_serial/CMakeLists.txt b/examples/device/webusb_serial/CMakeLists.txt
index 5e3ec0909..5de4a932d 100644
--- a/examples/device/webusb_serial/CMakeLists.txt
+++ b/examples/device/webusb_serial/CMakeLists.txt
@@ -9,10 +9,11 @@ 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)
diff --git a/examples/host/cdc_msc_hid/CMakeLists.txt b/examples/host/cdc_msc_hid/CMakeLists.txt
index 2302678b7..7413e4087 100644
--- a/examples/host/cdc_msc_hid/CMakeLists.txt
+++ b/examples/host/cdc_msc_hid/CMakeLists.txt
@@ -14,10 +14,11 @@ if(FAMILY STREQUAL "esp32s2")
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)
diff --git a/examples/make.mk b/examples/make.mk
index 53f633b18..e04a2592a 100644
--- a/examples/make.mk
+++ b/examples/make.mk
@@ -40,7 +40,7 @@ ifeq ($(FAMILY),)
include $(TOP)/hw/bsp/$(BOARD)/board.mk
else
# Include Family and Board specific defs
- -include $(TOP)/$(FAMILY_PATH)/family.mk
+ include $(TOP)/$(FAMILY_PATH)/family.mk
SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
endif
diff --git a/examples/rules.mk b/examples/rules.mk
index a97eb566a..9265bb684 100644
--- a/examples/rules.mk
+++ b/examples/rules.mk
@@ -5,69 +5,9 @@
# Set all as default goal
.DEFAULT_GOAL := all
-ifeq ($(FAMILY),esp32s2)
-# ---------------------------------------
-# Espressif IDF use CMake build system, this add wrapper target to call idf.py
-# ---------------------------------------
-
-.PHONY: all clean flash
-
-all:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) build
-
-build: all
-
-clean:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) clean
-
-fullclean:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) fullclean
-
-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) flash
-
-bootloader-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) bootloader-flash
-
-app-flash:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) app-flash
-
-erase:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) erase_flash
-
-monitor:
- idf.py -B$(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) $(CMAKE_DEFSYM) monitor
-
-uf2: $(BUILD)/$(PROJECT).uf2
-
-UF2_FAMILY_ID = 0xbfdd4eee
-$(BUILD)/$(PROJECT).uf2: $(BUILD)/$(PROJECT).bin
- @echo CREATE $@
- $(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
-endif
-
-$(BUILD):
- cmake -S . -B $(BUILD) -DFAMILY=$(FAMILY) -DBOARD=$(BOARD) -DPICO_BUILD_DOCS=0 $(CMAKE_DEFSYM)
-
-all: $(BUILD)
- $(MAKE) -C $(BUILD)
-
-clean:
- $(RM) -rf $(BUILD)
-
-#flash: flash-pyocd
-flash:
- @$(CP) $(BUILD)/$(PROJECT).uf2 /media/$(USER)/RPI-RP2
-
-else
+# ESP32-S2 and RP2040 has its own CMake build system
+ifneq ($(FAMILY),esp32s2)
+ifneq ($(FAMILY),rp2040)
# ---------------------------------------
# GNU Make build system
# ---------------------------------------
@@ -93,8 +33,7 @@ SRC_C += \
src/class/msc/msc_device.c \
src/class/net/net_device.c \
src/class/usbtmc/usbtmc_device.c \
- src/class/vendor/vendor_device.c \
- src/portable/$(VENDOR)/$(CHIP_FAMILY)/dcd_$(CHIP_FAMILY).c
+ src/class/vendor/vendor_device.c
# TinyUSB stack include
INC += $(TOP)/src
@@ -195,12 +134,12 @@ else
$(RM) -rf $(BUILD)
endif
+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-%:
- @echo $* = $($*)
+# ---------------------------------------
+# Flash Targets
+# ---------------------------------------
# Flash binary using Jlink
ifeq ($(OS),Windows_NT)
@@ -245,3 +184,7 @@ copy-artifact: $(BIN)
#@$(CP) $(BUILD)/$(PROJECT).hex $(BIN)
#@$(CP) $(BUILD)/$(PROJECT).elf $(BIN)
+# Print out the value of a make variable.
+# https://stackoverflow.com/questions/16467718/how-to-print-out-a-variable-in-makefile
+print-%:
+ @echo $* = $($*)