From 7ff14a652ba1348f863338479eb3347a06fcc80a Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 1 Mar 2021 22:13:21 +0700 Subject: add submodule lib/FreeRTOS-Kernel --- examples/device/cdc_msc_freertos/Makefile | 2 +- .../ses/lpc175x_6x/lpc175x_6x.emProject | 50 +++++++++++----------- .../cdc_msc_freertos/ses/nrf5x/nrf5x.emProject | 48 ++++++++++----------- .../cdc_msc_freertos/ses/samd21/samd21.emProject | 48 ++++++++++----------- .../cdc_msc_freertos/ses/samd51/samd51.emProject | 48 ++++++++++----------- .../device/cdc_msc_freertos/src/freertos_hook.c | 2 +- examples/device/hid_composite_freertos/Makefile | 2 +- .../hid_composite_freertos/src/freertos_hook.c | 2 +- 8 files changed, 101 insertions(+), 101 deletions(-) (limited to 'examples/device') 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 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - - - - + + + + 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 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - - - - + + + + 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 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - - - - + + + + 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 @@ - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + - - + + - + - - - - + + + + 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/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/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; -- cgit v1.3.1 From 83ce2dfcb73da5e2e59a3232dfb930710d687f2f Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 1 Mar 2021 22:30:39 +0700 Subject: fix freeRTOS config symbol warning with latest kernel --- examples/device/cdc_msc_freertos/src/FreeRTOSConfig.h | 1 + examples/device/hid_composite_freertos/src/FreeRTOSConfig.h | 1 + 2 files changed, 2 insertions(+) (limited to 'examples/device') 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/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 -- cgit v1.3.1 From c34b6b2324809276664070a8c52bfa71ceaf9d06 Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 2 Mar 2021 01:18:05 +0700 Subject: remove lib/CMSIS_4 submodule, move nrf to lib/CMSIS_5 --- .gitmodules | 4 ---- examples/device/cdc_msc/ses/nrf5x/nrf5x.emProject | 2 +- hw/bsp/nrf/family.mk | 2 +- lib/CMSIS_4 | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) delete mode 160000 lib/CMSIS_4 (limited to 'examples/device') diff --git a/.gitmodules b/.gitmodules index e33532c4e..209b6ea95 100644 --- a/.gitmodules +++ b/.gitmodules @@ -22,9 +22,6 @@ [submodule "lib/lwip"] path = lib/lwip url = https://github.com/lwip-tcpip/lwip.git -[submodule "lib/CMSIS_4"] - path = lib/CMSIS_4 - url = https://github.com/ARM-software/CMSIS.git [submodule "hw/mcu/st/cmsis_device_f4"] path = hw/mcu/st/cmsis_device_f4 url = https://github.com/STMicroelectronics/cmsis_device_f4.git @@ -113,7 +110,6 @@ path = hw/mcu/raspberrypi/pico-sdk url = https://github.com/raspberrypi/pico-sdk.git fetchRecurseSubmodules = false - [submodule "lib/FreeRTOS-Kernel"] path = lib/FreeRTOS-Kernel url = https://github.com/FreeRTOS/FreeRTOS-Kernel.git 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/hw/bsp/nrf/family.mk b/hw/bsp/nrf/family.mk index 16c912dc4..4c9e36ed0 100644 --- a/hw/bsp/nrf/family.mk +++ b/hw/bsp/nrf/family.mk @@ -40,7 +40,7 @@ SRC_C += \ INC += \ $(TOP)/$(BOARD_PATH) \ - $(TOP)/lib/CMSIS_4/CMSIS/Include \ + $(TOP)/lib/CMSIS_5/CMSIS/Core/Include \ $(TOP)/hw/mcu/nordic \ $(TOP)/hw/mcu/nordic/nrfx \ $(TOP)/hw/mcu/nordic/nrfx/mdk \ diff --git a/lib/CMSIS_4 b/lib/CMSIS_4 deleted file mode 160000 index f2cad4345..000000000 --- a/lib/CMSIS_4 +++ /dev/null @@ -1 +0,0 @@ -Subproject commit f2cad4345783c948ed4a7f5cdb02cdc0856366f1 -- cgit v1.3.1 From ce942baad2b5601984662b428140e3cb9acdabbc Mon Sep 17 00:00:00 2001 From: hathach Date: Tue, 2 Mar 2021 22:57:33 +0700 Subject: update pico-sdk to more recent commit - move target_link_libraries() to family.cmake - enable pico_bootsel_via_double_reset --- examples/device/audio_test/CMakeLists.txt | 3 --- examples/device/board_test/CMakeLists.txt | 3 --- examples/device/cdc_dual_ports/CMakeLists.txt | 3 --- examples/device/cdc_msc/CMakeLists.txt | 3 --- examples/device/dfu_runtime/CMakeLists.txt | 3 --- examples/device/dynamic_configuration/CMakeLists.txt | 3 --- examples/device/hid_composite/CMakeLists.txt | 3 --- examples/device/hid_generic_inout/CMakeLists.txt | 3 --- examples/device/hid_multiple_interface/CMakeLists.txt | 3 --- examples/device/midi_test/CMakeLists.txt | 3 --- examples/device/msc_dual_lun/CMakeLists.txt | 3 --- examples/device/net_lwip_webserver/CMakeLists.txt | 3 --- examples/device/uac2_headset/CMakeLists.txt | 3 --- examples/device/usbtmc/CMakeLists.txt | 3 --- examples/device/webusb_serial/CMakeLists.txt | 3 --- examples/host/cdc_msc_hid/CMakeLists.txt | 3 --- examples/rules.mk | 3 ++- hw/bsp/rp2040/family.cmake | 8 ++++++++ hw/bsp/rp2040/family.mk | 2 ++ hw/mcu/raspberrypi/pico-sdk | 2 +- 20 files changed, 13 insertions(+), 50 deletions(-) (limited to 'examples/device') 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/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_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/host/cdc_msc_hid/CMakeLists.txt b/examples/host/cdc_msc_hid/CMakeLists.txt index dc2effde9..2302678b7 100644 --- a/examples/host/cdc_msc_hid/CMakeLists.txt +++ b/examples/host/cdc_msc_hid/CMakeLists.txt @@ -38,9 +38,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/rules.mk b/examples/rules.mk index 2b28a4714..561494c6d 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -194,6 +194,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-%: @@ -227,7 +229,6 @@ flash-pyocd: $(BUILD)/$(PROJECT).hex pyocd flash -t $(PYOCD_TARGET) $< pyocd reset -t $(PYOCD_TARGET) -endif # GNU Make #-------------- Artifacts -------------- diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake index 699ad174d..e779e4cbb 100644 --- a/hw/bsp/rp2040/family.cmake +++ b/hw/bsp/rp2040/family.cmake @@ -1,3 +1,11 @@ +target_link_libraries(${PROJECT} + pico_stdlib + pico_bootsel_via_double_reset + pico_fix_rp2040_usb_device_enumeration +) + +pico_add_extra_outputs(${PROJECT}) + # TinyUSB Stack source set(SRC_TINYUSB ${TOP}/src/tusb.c diff --git a/hw/bsp/rp2040/family.mk b/hw/bsp/rp2040/family.mk index 8e30e7eb6..9aacae37d 100644 --- a/hw/bsp/rp2040/family.mk +++ b/hw/bsp/rp2040/family.mk @@ -1 +1,3 @@ FAMILY_SUBMODULES = hw/mcu/raspberrypi/pico-sdk + +JLINK_DEVICE = rp2040_m0_0 diff --git a/hw/mcu/raspberrypi/pico-sdk b/hw/mcu/raspberrypi/pico-sdk index 2d5789eca..61978dc70 160000 --- a/hw/mcu/raspberrypi/pico-sdk +++ b/hw/mcu/raspberrypi/pico-sdk @@ -1 +1 @@ -Subproject commit 2d5789eca89658a7f0a01e2d6010c0f254605d72 +Subproject commit 61978dc707c7f2026efa4c3300bbb94baa89c78a -- cgit v1.3.1 From 4a73b6a21930c71368153fe4197b96f9d100fc4c Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 10 Mar 2021 11:23:44 +0700 Subject: update doc for BOARD name, add note for udev on Linux --- docs/getting_started.md | 4 ++++ examples/device/99-tinyusb.rules | 14 ++++++++++++++ examples/device/webusb_serial/src/main.c | 20 ++++++++++++++++++++ tools/usb_drivers/99-tinyusb.rules | 18 ------------------ 4 files changed, 38 insertions(+), 18 deletions(-) create mode 100644 examples/device/99-tinyusb.rules delete mode 100644 tools/usb_drivers/99-tinyusb.rules (limited to 'examples/device') diff --git a/docs/getting_started.md b/docs/getting_started.md index 870491fe2..8ec0ea748 100644 --- a/docs/getting_started.md +++ b/docs/getting_started.md @@ -47,6 +47,8 @@ $ git submodule update --init lib In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the `make` to build your board. +Note: some examples especially those that uses Vendor class (e.g webUSB) may requires udev permission on Linux (and/or macOS) to access usb device. It depends on your OS distro, typically copy `/examples/device/99-tinyusb.rules` file to /etc/udev/rules.d/ then run `sudo udevadm control --reload-rules && sudo udevadm trigger` is good enough. + ### Build To build example, first change directory to an example folder. @@ -61,6 +63,8 @@ Then compile with `make BOARD=[board_name] all`, for example $ make BOARD=feather_nrf52840_express all ``` +Note: `BOARD` can be found as directory name in `hw/bsp`, either in its family/boards or directly under bsp (no family). + #### Port Selection If a board has several ports, one port is chosen by default in the individual board.mk file. Use option `PORT=x` To choose another port. For example to select the HS port of a STM32F746Disco board, use: 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/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index 143a73374..6a5a9fa61 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 #include #include diff --git a/tools/usb_drivers/99-tinyusb.rules b/tools/usb_drivers/99-tinyusb.rules deleted file mode 100644 index 334159f9a..000000000 --- a/tools/usb_drivers/99-tinyusb.rules +++ /dev/null @@ -1,18 +0,0 @@ -# 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" - -# Xplained Pro SamG55 Device -SUBSYSTEMS=="usb", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1" -SUBSYSTEMS=="tty", ATTRS{idVendor}=="03eb", ATTRS{idProduct}=="2111", MODE="0666", GROUP="users", ENV{ID_MM_DEVICE_IGNORE}="1" -- cgit v1.3.1 From 38ebb8502da82e7deb1a3d8360bedc87c4923683 Mon Sep 17 00:00:00 2001 From: hathach Date: Wed, 10 Mar 2021 11:31:50 +0700 Subject: clean up --- examples/device/webusb_serial/src/main.c | 83 +++++++++++++++++--------------- 1 file changed, 45 insertions(+), 38 deletions(-) (limited to 'examples/device') diff --git a/examples/device/webusb_serial/src/main.c b/examples/device/webusb_serial/src/main.c index 6a5a9fa61..c85b3cc9a 100644 --- a/examples/device/webusb_serial/src/main.c +++ b/examples/device/webusb_serial/src/main.c @@ -169,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); - - case VENDOR_REQUEST_MICROSOFT: - if ( request->wIndex == 7 ) + 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); + + 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 -- cgit v1.3.1