From ec018fbf4ed30b014b82f993246f8730687e649a Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 8 Oct 2020 17:17:37 +0700 Subject: [PATCH 1/9] clean up jlink default interface --- examples/rules.mk | 2 ++ hw/bsp/adafruit_clue/board.mk | 1 - hw/bsp/arduino_nano33_ble/board.mk | 1 - hw/bsp/circuitplayground_bluefruit/board.mk | 1 - hw/bsp/circuitplayground_express/board.mk | 1 - hw/bsp/d5035_01/board.mk | 1 - hw/bsp/da14695_dk_usb/board.mk | 1 - hw/bsp/da1469x_dk_pro/board.mk | 1 - hw/bsp/ea4088qs/board.mk | 1 - hw/bsp/ea4357/board.mk | 1 - hw/bsp/feather_m0_express/board.mk | 1 - hw/bsp/feather_m4_express/board.mk | 1 - hw/bsp/feather_nrf52840_express/board.mk | 1 - hw/bsp/feather_nrf52840_sense/board.mk | 1 - hw/bsp/feather_stm32f405/board.mk | 1 - hw/bsp/itsybitsy_m0/board.mk | 1 - hw/bsp/itsybitsy_m4/board.mk | 1 - hw/bsp/itsybitsy_nrf52840/board.mk | 1 - hw/bsp/lpcxpresso11u37/board.mk | 1 - hw/bsp/lpcxpresso11u68/board.mk | 1 - hw/bsp/lpcxpresso1347/board.mk | 1 - hw/bsp/lpcxpresso1549/board.mk | 1 - hw/bsp/lpcxpresso1769/board.mk | 1 - hw/bsp/lpcxpresso51u68/board.mk | 1 - hw/bsp/lpcxpresso54114/board.mk | 1 - hw/bsp/lpcxpresso55s69/board.mk | 1 - hw/bsp/luna/board.mk | 1 - hw/bsp/mbed1768/board.mk | 1 - hw/bsp/mcb1800/board.mk | 1 - hw/bsp/metro_m0_express/board.mk | 1 - hw/bsp/metro_m4_express/board.mk | 1 - hw/bsp/mimxrt1010_evk/board.mk | 1 - hw/bsp/mimxrt1020_evk/board.mk | 1 - hw/bsp/mimxrt1050_evkb/board.mk | 1 - hw/bsp/mimxrt1060_evk/board.mk | 1 - hw/bsp/mimxrt1064_evk/board.mk | 1 - hw/bsp/nrf52840_mdk_dongle/board.mk | 1 - hw/bsp/nutiny_nuc121s/board.mk | 1 - hw/bsp/nutiny_nuc125s/board.mk | 1 - hw/bsp/nutiny_nuc126v/board.mk | 1 - hw/bsp/nutiny_sdk_nuc120/board.mk | 1 - hw/bsp/nutiny_sdk_nuc505/board.mk | 1 - hw/bsp/pca10056/board.mk | 1 - hw/bsp/pca10059/board.mk | 1 - hw/bsp/pca10100/board.mk | 1 - hw/bsp/pyboardv11/board.mk | 1 - hw/bsp/raytac_mdbt50q_rx/board.mk | 1 - hw/bsp/samd11_xplained/board.mk | 1 - hw/bsp/samg55xplained/board.mk | 1 - hw/bsp/seeeduino_xiao/board.mk | 1 - hw/bsp/stm32f070rbnucleo/board.mk | 1 - hw/bsp/stm32f072disco/board.mk | 1 - hw/bsp/stm32f103bluepill/board.mk | 1 - hw/bsp/stm32f207nucleo/board.mk | 1 - hw/bsp/stm32f303disco/board.mk | 1 - hw/bsp/stm32f401blackpill/board.mk | 1 - hw/bsp/stm32f407disco/board.mk | 1 - hw/bsp/stm32f411blackpill/board.mk | 1 - hw/bsp/stm32f411disco/board.mk | 1 - hw/bsp/stm32f412disco/board.mk | 1 - hw/bsp/stm32h743eval/board.mk | 1 - hw/bsp/stm32h745disco/board.mk | 1 - hw/bsp/stm32l0538disco/board.mk | 1 - hw/bsp/stm32l476disco/board.mk | 1 - hw/bsp/teensy_40/board.mk | 1 - 65 files changed, 2 insertions(+), 64 deletions(-) diff --git a/examples/rules.mk b/examples/rules.mk index dacb81363..e972ce735 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -147,6 +147,8 @@ else JLINKEXE = JLinkExe endif +JLINK_IF ?= swd + # Flash using jlink flash-jlink: $(BUILD)/$(BOARD)-firmware.hex @echo halt > $(BUILD)/$(BOARD).jlink diff --git a/hw/bsp/adafruit_clue/board.mk b/hw/bsp/adafruit_clue/board.mk index 5290455cc..d5f7c7cd4 100644 --- a/hw/bsp/adafruit_clue/board.mk +++ b/hw/bsp/adafruit_clue/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # For uf2 conversion UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/arduino_nano33_ble/board.mk b/hw/bsp/arduino_nano33_ble/board.mk index 0a25d0b19..d1d62bdf2 100644 --- a/hw/bsp/arduino_nano33_ble/board.mk +++ b/hw/bsp/arduino_nano33_ble/board.mk @@ -51,7 +51,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # flash using bossac (as part of Nano33 BSP tools) # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/circuitplayground_bluefruit/board.mk b/hw/bsp/circuitplayground_bluefruit/board.mk index 5290455cc..d5f7c7cd4 100644 --- a/hw/bsp/circuitplayground_bluefruit/board.mk +++ b/hw/bsp/circuitplayground_bluefruit/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # For uf2 conversion UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/circuitplayground_express/board.mk b/hw/bsp/circuitplayground_express/board.mk index e20272ad1..09b7b53a5 100644 --- a/hw/bsp/circuitplayground_express/board.mk +++ b/hw/bsp/circuitplayground_express/board.mk @@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using jlink flash: $(BUILD)/$(BOARD)-firmware.uf2 diff --git a/hw/bsp/d5035_01/board.mk b/hw/bsp/d5035_01/board.mk index cbc9ca5bb..0a7db6403 100644 --- a/hw/bsp/d5035_01/board.mk +++ b/hw/bsp/d5035_01/board.mk @@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = ATSAME51J19 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/da14695_dk_usb/board.mk b/hw/bsp/da14695_dk_usb/board.mk index f5b8873f9..8fef7d10f 100644 --- a/hw/bsp/da14695_dk_usb/board.mk +++ b/hw/bsp/da14695_dk_usb/board.mk @@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure # For flash-jlink target JLINK_DEVICE = DA14695 -JLINK_IF = swd # flash using jlink but with some twists flash: flash-dialog diff --git a/hw/bsp/da1469x_dk_pro/board.mk b/hw/bsp/da1469x_dk_pro/board.mk index 6708955f2..60a62378c 100644 --- a/hw/bsp/da1469x_dk_pro/board.mk +++ b/hw/bsp/da1469x_dk_pro/board.mk @@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure # For flash-jlink target JLINK_DEVICE = DA14699 -JLINK_IF = swd # flash using jlink but with some twists flash: flash-dialog diff --git a/hw/bsp/ea4088qs/board.mk b/hw/bsp/ea4088qs/board.mk index 51a6009a0..15e0bfb86 100644 --- a/hw/bsp/ea4088qs/board.mk +++ b/hw/bsp/ea4088qs/board.mk @@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = LPC4088 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/ea4357/board.mk b/hw/bsp/ea4357/board.mk index 3ebe107e2..f6c42e0cf 100644 --- a/hw/bsp/ea4357/board.mk +++ b/hw/bsp/ea4357/board.mk @@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = LPC4357_M4 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/feather_m0_express/board.mk b/hw/bsp/feather_m0_express/board.mk index 7b6891e03..4128ed264 100644 --- a/hw/bsp/feather_m0_express/board.mk +++ b/hw/bsp/feather_m0_express/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/feather_m4_express/board.mk b/hw/bsp/feather_m4_express/board.mk index 34c98597c..fadf65307 100644 --- a/hw/bsp/feather_m4_express/board.mk +++ b/hw/bsp/feather_m4_express/board.mk @@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = ATSAMD51J19 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/feather_nrf52840_express/board.mk b/hw/bsp/feather_nrf52840_express/board.mk index 7b2625cd4..6cc972835 100644 --- a/hw/bsp/feather_nrf52840_express/board.mk +++ b/hw/bsp/feather_nrf52840_express/board.mk @@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # For uf2 conversion UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/feather_nrf52840_sense/board.mk b/hw/bsp/feather_nrf52840_sense/board.mk index 5290455cc..d5f7c7cd4 100644 --- a/hw/bsp/feather_nrf52840_sense/board.mk +++ b/hw/bsp/feather_nrf52840_sense/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # For uf2 conversion UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/feather_stm32f405/board.mk b/hw/bsp/feather_stm32f405/board.mk index 8233c6608..1988fa46e 100644 --- a/hw/bsp/feather_stm32f405/board.mk +++ b/hw/bsp/feather_stm32f405/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f405rg -JLINK_IF = swd # Path to STM32 Cube Programmer CLI, should be added into system path STM32Prog = STM32_Programmer_CLI diff --git a/hw/bsp/itsybitsy_m0/board.mk b/hw/bsp/itsybitsy_m0/board.mk index 7b6891e03..4128ed264 100644 --- a/hw/bsp/itsybitsy_m0/board.mk +++ b/hw/bsp/itsybitsy_m0/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/itsybitsy_m4/board.mk b/hw/bsp/itsybitsy_m4/board.mk index 34c98597c..fadf65307 100644 --- a/hw/bsp/itsybitsy_m4/board.mk +++ b/hw/bsp/itsybitsy_m4/board.mk @@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = ATSAMD51J19 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/itsybitsy_nrf52840/board.mk b/hw/bsp/itsybitsy_nrf52840/board.mk index 7b2625cd4..6cc972835 100644 --- a/hw/bsp/itsybitsy_nrf52840/board.mk +++ b/hw/bsp/itsybitsy_nrf52840/board.mk @@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # For uf2 conversion UF2_FAMILY = 0xADA52840 diff --git a/hw/bsp/lpcxpresso11u37/board.mk b/hw/bsp/lpcxpresso11u37/board.mk index d1c48a2e5..d34125ac7 100644 --- a/hw/bsp/lpcxpresso11u37/board.mk +++ b/hw/bsp/lpcxpresso11u37/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = LPC11U37/401 -JLINK_IF = swd # flash using pyocd flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/lpcxpresso11u68/board.mk b/hw/bsp/lpcxpresso11u68/board.mk index d9017ae1a..67124ab90 100644 --- a/hw/bsp/lpcxpresso11u68/board.mk +++ b/hw/bsp/lpcxpresso11u68/board.mk @@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = LPC11U68 -JLINK_IF = swd # flash using pyocd flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/lpcxpresso1347/board.mk b/hw/bsp/lpcxpresso1347/board.mk index 6dc3937f6..915834ddf 100644 --- a/hw/bsp/lpcxpresso1347/board.mk +++ b/hw/bsp/lpcxpresso1347/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = LPC1347 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/lpcxpresso1549/board.mk b/hw/bsp/lpcxpresso1549/board.mk index 18325c5f7..27c3ca8d6 100644 --- a/hw/bsp/lpcxpresso1549/board.mk +++ b/hw/bsp/lpcxpresso1549/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = LPC1549 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/lpcxpresso1769/board.mk b/hw/bsp/lpcxpresso1769/board.mk index a345e5a27..11da5f722 100644 --- a/hw/bsp/lpcxpresso1769/board.mk +++ b/hw/bsp/lpcxpresso1769/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = LPC1769 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/lpcxpresso51u68/board.mk b/hw/bsp/lpcxpresso51u68/board.mk index 7dc7de341..cb36b3409 100644 --- a/hw/bsp/lpcxpresso51u68/board.mk +++ b/hw/bsp/lpcxpresso51u68/board.mk @@ -41,7 +41,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = LPC51U68 -JLINK_IF = swd # flash using pyocd (51u68 is not supported yet) flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/lpcxpresso54114/board.mk b/hw/bsp/lpcxpresso54114/board.mk index 2bab0340f..cc0f6cd43 100644 --- a/hw/bsp/lpcxpresso54114/board.mk +++ b/hw/bsp/lpcxpresso54114/board.mk @@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = LPC54114J256_M4 -JLINK_IF = swd # flash using pyocd flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/lpcxpresso55s69/board.mk b/hw/bsp/lpcxpresso55s69/board.mk index 24c5ae89c..f98144cc5 100644 --- a/hw/bsp/lpcxpresso55s69/board.mk +++ b/hw/bsp/lpcxpresso55s69/board.mk @@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure # For flash-jlink target JLINK_DEVICE = LPC55S69 -JLINK_IF = swd # flash using pyocd flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/luna/board.mk b/hw/bsp/luna/board.mk index 44f6fd75b..9969b97fe 100644 --- a/hw/bsp/luna/board.mk +++ b/hw/bsp/luna/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using jlink flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/mbed1768/board.mk b/hw/bsp/mbed1768/board.mk index 3bdc8a27a..54a8357cc 100644 --- a/hw/bsp/mbed1768/board.mk +++ b/hw/bsp/mbed1768/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = LPC1768 -JLINK_IF = swd # flash using pyocd flash: $(BUILD)/$(BOARD)-firmware.hex diff --git a/hw/bsp/mcb1800/board.mk b/hw/bsp/mcb1800/board.mk index e3f07d0d0..f8fd25800 100644 --- a/hw/bsp/mcb1800/board.mk +++ b/hw/bsp/mcb1800/board.mk @@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = LPC1857 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/metro_m0_express/board.mk b/hw/bsp/metro_m0_express/board.mk index 7b6891e03..4128ed264 100644 --- a/hw/bsp/metro_m0_express/board.mk +++ b/hw/bsp/metro_m0_express/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/metro_m4_express/board.mk b/hw/bsp/metro_m4_express/board.mk index 34c98597c..fadf65307 100644 --- a/hw/bsp/metro_m4_express/board.mk +++ b/hw/bsp/metro_m4_express/board.mk @@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = ATSAMD51J19 -JLINK_IF = swd # flash using bossac at least version 1.8 # can be found in arduino15/packages/arduino/tools/bossac/ diff --git a/hw/bsp/mimxrt1010_evk/board.mk b/hw/bsp/mimxrt1010_evk/board.mk index 4dc11693a..6197c5365 100644 --- a/hw/bsp/mimxrt1010_evk/board.mk +++ b/hw/bsp/mimxrt1010_evk/board.mk @@ -46,7 +46,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1011DAE5A -JLINK_IF = swd # flash by copying bin file to DAP Mass Storage flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/mimxrt1020_evk/board.mk b/hw/bsp/mimxrt1020_evk/board.mk index 52148b684..c5b285b47 100644 --- a/hw/bsp/mimxrt1020_evk/board.mk +++ b/hw/bsp/mimxrt1020_evk/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1021DAG5A -JLINK_IF = swd # flash by copying bin file to DAP Mass Storage flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/mimxrt1050_evkb/board.mk b/hw/bsp/mimxrt1050_evkb/board.mk index 4b642085d..2148f8298 100644 --- a/hw/bsp/mimxrt1050_evkb/board.mk +++ b/hw/bsp/mimxrt1050_evkb/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1052xxx6B -JLINK_IF = swd # flash by copying bin file to DAP Mass Storage flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/mimxrt1060_evk/board.mk b/hw/bsp/mimxrt1060_evk/board.mk index fae0ad0ae..cf4007914 100644 --- a/hw/bsp/mimxrt1060_evk/board.mk +++ b/hw/bsp/mimxrt1060_evk/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1062xxx6A -JLINK_IF = swd # flash by copying bin file to DAP Mass Storage flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/mimxrt1064_evk/board.mk b/hw/bsp/mimxrt1064_evk/board.mk index d8a892442..5f230d687 100644 --- a/hw/bsp/mimxrt1064_evk/board.mk +++ b/hw/bsp/mimxrt1064_evk/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1064xxx6A -JLINK_IF = swd # flash by copying bin file to DAP Mass Storage flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/nrf52840_mdk_dongle/board.mk b/hw/bsp/nrf52840_mdk_dongle/board.mk index 9ba04ba1f..8ce8929b8 100644 --- a/hw/bsp/nrf52840_mdk_dongle/board.mk +++ b/hw/bsp/nrf52840_mdk_dongle/board.mk @@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # flash using Nordic nrfutil (pip2 install nrfutil) # make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash diff --git a/hw/bsp/nutiny_nuc121s/board.mk b/hw/bsp/nutiny_nuc121s/board.mk index e89877820..0a8b6e048 100644 --- a/hw/bsp/nutiny_nuc121s/board.mk +++ b/hw/bsp/nutiny_nuc121s/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = NUC121SC2AE -JLINK_IF = swd # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source diff --git a/hw/bsp/nutiny_nuc125s/board.mk b/hw/bsp/nutiny_nuc125s/board.mk index 5bba8dee3..31577d800 100644 --- a/hw/bsp/nutiny_nuc125s/board.mk +++ b/hw/bsp/nutiny_nuc125s/board.mk @@ -33,7 +33,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = NUC125SC2AE -JLINK_IF = swd # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source diff --git a/hw/bsp/nutiny_nuc126v/board.mk b/hw/bsp/nutiny_nuc126v/board.mk index 21f2c9c53..7bf3989fc 100644 --- a/hw/bsp/nutiny_nuc126v/board.mk +++ b/hw/bsp/nutiny_nuc126v/board.mk @@ -53,7 +53,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = NUC126VG4AE -JLINK_IF = swd # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source diff --git a/hw/bsp/nutiny_sdk_nuc120/board.mk b/hw/bsp/nutiny_sdk_nuc120/board.mk index 95acdb5f2..51841643a 100644 --- a/hw/bsp/nutiny_sdk_nuc120/board.mk +++ b/hw/bsp/nutiny_sdk_nuc120/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = NUC120LE3 -JLINK_IF = swd # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton # Please compile and install it from github source diff --git a/hw/bsp/nutiny_sdk_nuc505/board.mk b/hw/bsp/nutiny_sdk_nuc505/board.mk index 8752ef8ea..2d00cd9be 100644 --- a/hw/bsp/nutiny_sdk_nuc505/board.mk +++ b/hw/bsp/nutiny_sdk_nuc505/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = NUC505YO13Y -JLINK_IF = swd # Note # To be able to program the SPI flash, it need to boot with ICP mode "1011". diff --git a/hw/bsp/pca10056/board.mk b/hw/bsp/pca10056/board.mk index 0971e64c8..8f4887dcb 100644 --- a/hw/bsp/pca10056/board.mk +++ b/hw/bsp/pca10056/board.mk @@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/pca10059/board.mk b/hw/bsp/pca10059/board.mk index 72dfefdcb..bd7a80c0e 100644 --- a/hw/bsp/pca10059/board.mk +++ b/hw/bsp/pca10059/board.mk @@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # flash using Nordic nrfutil (pip2 install nrfutil) # make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash diff --git a/hw/bsp/pca10100/board.mk b/hw/bsp/pca10100/board.mk index 5231aaf63..4b5be082e 100644 --- a/hw/bsp/pca10100/board.mk +++ b/hw/bsp/pca10100/board.mk @@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52833_XXAA -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/pyboardv11/board.mk b/hw/bsp/pyboardv11/board.mk index 9da0541ec..3be06e844 100644 --- a/hw/bsp/pyboardv11/board.mk +++ b/hw/bsp/pyboardv11/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f405rg -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/raytac_mdbt50q_rx/board.mk b/hw/bsp/raytac_mdbt50q_rx/board.mk index 47bb430fc..e153aab0b 100644 --- a/hw/bsp/raytac_mdbt50q_rx/board.mk +++ b/hw/bsp/raytac_mdbt50q_rx/board.mk @@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = nRF52840_xxAA -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/samd11_xplained/board.mk b/hw/bsp/samd11_xplained/board.mk index 6aec6509c..c80ece4a6 100644 --- a/hw/bsp/samd11_xplained/board.mk +++ b/hw/bsp/samd11_xplained/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD11D14 -JLINK_IF = swd # flash using edbg flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/samg55xplained/board.mk b/hw/bsp/samg55xplained/board.mk index a58a7b41d..79716d36d 100644 --- a/hw/bsp/samg55xplained/board.mk +++ b/hw/bsp/samg55xplained/board.mk @@ -47,7 +47,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = ATSAMG55J19 -JLINK_IF = swd # flash using edbg from https://github.com/ataradov/edbg flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/seeeduino_xiao/board.mk b/hw/bsp/seeeduino_xiao/board.mk index d762c4eca..172f6f537 100644 --- a/hw/bsp/seeeduino_xiao/board.mk +++ b/hw/bsp/seeeduino_xiao/board.mk @@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = ATSAMD21G18 -JLINK_IF = swd # flash using jlink flash: flash-jlink diff --git a/hw/bsp/stm32f070rbnucleo/board.mk b/hw/bsp/stm32f070rbnucleo/board.mk index 8ae75dd96..eec479bb4 100644 --- a/hw/bsp/stm32f070rbnucleo/board.mk +++ b/hw/bsp/stm32f070rbnucleo/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = stm32f070rb -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f072disco/board.mk b/hw/bsp/stm32f072disco/board.mk index e6787b266..4155acf84 100644 --- a/hw/bsp/stm32f072disco/board.mk +++ b/hw/bsp/stm32f072disco/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = stm32f072rb -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f103bluepill/board.mk b/hw/bsp/stm32f103bluepill/board.mk index 028c567b1..124b16021 100644 --- a/hw/bsp/stm32f103bluepill/board.mk +++ b/hw/bsp/stm32f103bluepill/board.mk @@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = stm32f103c8 -JLINK_IF = swd # flash target ROM bootloader flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/stm32f207nucleo/board.mk b/hw/bsp/stm32f207nucleo/board.mk index 9eaff8548..27d8638d3 100644 --- a/hw/bsp/stm32f207nucleo/board.mk +++ b/hw/bsp/stm32f207nucleo/board.mk @@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3 # For flash-jlink target JLINK_DEVICE = stm32f207zg -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f303disco/board.mk b/hw/bsp/stm32f303disco/board.mk index 07312ac82..cb94dac3b 100644 --- a/hw/bsp/stm32f303disco/board.mk +++ b/hw/bsp/stm32f303disco/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f303vc -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f401blackpill/board.mk b/hw/bsp/stm32f401blackpill/board.mk index 38cabcc5a..993e29c5f 100644 --- a/hw/bsp/stm32f401blackpill/board.mk +++ b/hw/bsp/stm32f401blackpill/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f401cc -JLINK_IF = swd # flash target ROM bootloader flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/stm32f407disco/board.mk b/hw/bsp/stm32f407disco/board.mk index df2ee4ba5..87b7bea10 100644 --- a/hw/bsp/stm32f407disco/board.mk +++ b/hw/bsp/stm32f407disco/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f407vg -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f411blackpill/board.mk b/hw/bsp/stm32f411blackpill/board.mk index 36897607f..3441dbb52 100644 --- a/hw/bsp/stm32f411blackpill/board.mk +++ b/hw/bsp/stm32f411blackpill/board.mk @@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f411ce -JLINK_IF = swd # flash target ROM bootloader flash: $(BUILD)/$(BOARD)-firmware.bin diff --git a/hw/bsp/stm32f411disco/board.mk b/hw/bsp/stm32f411disco/board.mk index 5e0d6c3a0..f15d802ab 100644 --- a/hw/bsp/stm32f411disco/board.mk +++ b/hw/bsp/stm32f411disco/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f411ve -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32f412disco/board.mk b/hw/bsp/stm32f412disco/board.mk index 5cf5e9b7a..0cc32da20 100644 --- a/hw/bsp/stm32f412disco/board.mk +++ b/hw/bsp/stm32f412disco/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32f41zx -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32h743eval/board.mk b/hw/bsp/stm32h743eval/board.mk index 47d592c58..543b40a30 100644 --- a/hw/bsp/stm32h743eval/board.mk +++ b/hw/bsp/stm32h743eval/board.mk @@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = stm32h743xi -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32h745disco/board.mk b/hw/bsp/stm32h745disco/board.mk index b3477b1e6..eb87e7461 100644 --- a/hw/bsp/stm32h745disco/board.mk +++ b/hw/bsp/stm32h745disco/board.mk @@ -52,7 +52,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = stm32h745xi -JLINK_IF = swd # flash target using on-board stlink flash: flash-stlink diff --git a/hw/bsp/stm32l0538disco/board.mk b/hw/bsp/stm32l0538disco/board.mk index 241ad5d28..bcfaee7ac 100644 --- a/hw/bsp/stm32l0538disco/board.mk +++ b/hw/bsp/stm32l0538disco/board.mk @@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0 # For flash-jlink target JLINK_DEVICE = STM32L053R8 -JLINK_IF = swd # Path to STM32 Cube Programmer CLI, should be added into system path STM32Prog = STM32_Programmer_CLI diff --git a/hw/bsp/stm32l476disco/board.mk b/hw/bsp/stm32l476disco/board.mk index dc6b886db..e2fc010dc 100644 --- a/hw/bsp/stm32l476disco/board.mk +++ b/hw/bsp/stm32l476disco/board.mk @@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F # For flash-jlink target JLINK_DEVICE = stm32l476vg -JLINK_IF = swd # Path to STM32 Cube Programmer CLI, should be added into system path STM32Prog = STM32_Programmer_CLI diff --git a/hw/bsp/teensy_40/board.mk b/hw/bsp/teensy_40/board.mk index 0a19fe63a..e49f13a1f 100644 --- a/hw/bsp/teensy_40/board.mk +++ b/hw/bsp/teensy_40/board.mk @@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1062xxx6A -JLINK_IF = swd # flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli # Make sure it is in your PATH From e8b3af038edf2195a8b65e3f66f7097445f07ff2 Mon Sep 17 00:00:00 2001 From: hathach Date: Thu, 8 Oct 2020 17:19:48 +0700 Subject: [PATCH 2/9] add flash-pyocd support --- examples/rules.mk | 4 ++++ hw/bsp/mimxrt1015_evk/board.mk | 9 +++------ 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/examples/rules.mk b/examples/rules.mk index e972ce735..a062c29c5 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -163,4 +163,8 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex flash-stlink: $(BUILD)/$(BOARD)-firmware.elf STM32_Programmer_CLI --connect port=swd --write $< --go +# flash with pyocd +flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex + pyocd flash -t $(PYOCD_TARGET) $< + endif # Make target diff --git a/hw/bsp/mimxrt1015_evk/board.mk b/hw/bsp/mimxrt1015_evk/board.mk index 7df60c2c6..3ce7c2f82 100644 --- a/hw/bsp/mimxrt1015_evk/board.mk +++ b/hw/bsp/mimxrt1015_evk/board.mk @@ -45,12 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1015DAF5A -JLINK_IF = swd -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1015-EVK/ +# For flash-pyocd target +PYOCD_TARGET = mimxrt1015 # flash using pyocd -#flash: $(BUILD)/$(BOARD)-firmware.hex -# pyocd flash -b MIMXRT1015-EVK $< +flash: flash-pyocd From 344d589a354ec719333c10d315f4f186b178d2d7 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 13:48:08 +0700 Subject: [PATCH 3/9] use pyocd for iMXRT boards --- examples/rules.mk | 1 + hw/bsp/mimxrt1010_evk/board.mk | 8 +++++--- hw/bsp/mimxrt1020_evk/board.mk | 8 +++++--- hw/bsp/mimxrt1050_evkb/board.mk | 9 ++++----- hw/bsp/mimxrt1060_evk/board.mk | 8 +++++--- hw/bsp/mimxrt1064_evk/board.mk | 8 +++++--- 6 files changed, 25 insertions(+), 17 deletions(-) diff --git a/examples/rules.mk b/examples/rules.mk index a062c29c5..7ed648a8b 100644 --- a/examples/rules.mk +++ b/examples/rules.mk @@ -166,5 +166,6 @@ flash-stlink: $(BUILD)/$(BOARD)-firmware.elf # flash with pyocd flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex pyocd flash -t $(PYOCD_TARGET) $< + pyocd reset -t $(PYOCD_TARGET) endif # Make target diff --git a/hw/bsp/mimxrt1010_evk/board.mk b/hw/bsp/mimxrt1010_evk/board.mk index 6197c5365..3ff916624 100644 --- a/hw/bsp/mimxrt1010_evk/board.mk +++ b/hw/bsp/mimxrt1010_evk/board.mk @@ -47,6 +47,8 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1011DAE5A -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1010-EVK/ +# For flash-pyocd target +PYOCD_TARGET = mimxrt1010 + +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/mimxrt1020_evk/board.mk b/hw/bsp/mimxrt1020_evk/board.mk index c5b285b47..66bcdf89b 100644 --- a/hw/bsp/mimxrt1020_evk/board.mk +++ b/hw/bsp/mimxrt1020_evk/board.mk @@ -46,6 +46,8 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1021DAG5A -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1020-EVK/ +# For flash-pyocd target +PYOCD_TARGET = mimxrt1020 + +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/mimxrt1050_evkb/board.mk b/hw/bsp/mimxrt1050_evkb/board.mk index 2148f8298..123e2ea82 100644 --- a/hw/bsp/mimxrt1050_evkb/board.mk +++ b/hw/bsp/mimxrt1050_evkb/board.mk @@ -43,9 +43,8 @@ CHIP_FAMILY = transdimension # For freeRTOS port source FREERTOS_PORT = ARM_CM7/r0p1 -# For flash-jlink target -JLINK_DEVICE = MIMXRT1052xxx6B +# For flash-pyocd target +PYOCD_TARGET = mimxrt1050 -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1050-EVK/ +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/mimxrt1060_evk/board.mk b/hw/bsp/mimxrt1060_evk/board.mk index cf4007914..5c93e1cdf 100644 --- a/hw/bsp/mimxrt1060_evk/board.mk +++ b/hw/bsp/mimxrt1060_evk/board.mk @@ -46,6 +46,8 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1062xxx6A -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1060-EVK/ +# For flash-pyocd target +PYOCD_TARGET = mimxrt1060 + +# flash using pyocd +flash: flash-pyocd diff --git a/hw/bsp/mimxrt1064_evk/board.mk b/hw/bsp/mimxrt1064_evk/board.mk index 5f230d687..f6a277497 100644 --- a/hw/bsp/mimxrt1064_evk/board.mk +++ b/hw/bsp/mimxrt1064_evk/board.mk @@ -46,6 +46,8 @@ FREERTOS_PORT = ARM_CM7/r0p1 # For flash-jlink target JLINK_DEVICE = MIMXRT1064xxx6A -# flash by copying bin file to DAP Mass Storage -flash: $(BUILD)/$(BOARD)-firmware.bin - cp $< /media/$(USER)/RT1064-EVK/ +# For flash-pyocd target +PYOCD_TARGET = mimxrt1064 + +# flash using pyocd +flash: flash-pyocd From 2219068371fa514e320ddf1c6059c3f6ed901ae7 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 13:50:55 +0700 Subject: [PATCH 4/9] rename hid multiple interface --- .github/workflows/build.yml | 2 +- .../{hid_multipleinterface => hid_multiple_interface}/Makefile | 0 .../src/main.c | 0 .../src/tusb_config.h | 0 .../src/usb_descriptors.c | 0 5 files changed, 1 insertion(+), 1 deletion(-) rename examples/device/{hid_multipleinterface => hid_multiple_interface}/Makefile (100%) rename examples/device/{hid_multipleinterface => hid_multiple_interface}/src/main.c (100%) rename examples/device/{hid_multipleinterface => hid_multiple_interface}/src/tusb_config.h (100%) rename examples/device/{hid_multipleinterface => hid_multiple_interface}/src/usb_descriptors.c (100%) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e2db8f775..fd48eef1b 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -35,7 +35,7 @@ jobs: - 'device/hid_composite' - 'device/hid_composite_freertos' - 'device/hid_generic_inout' - - 'device/hid_multipleinterface' + - 'device/hid_multiple_interface' - 'device/midi_test' - 'device/msc_dual_lun' - 'device/net_lwip_webserver' diff --git a/examples/device/hid_multipleinterface/Makefile b/examples/device/hid_multiple_interface/Makefile similarity index 100% rename from examples/device/hid_multipleinterface/Makefile rename to examples/device/hid_multiple_interface/Makefile diff --git a/examples/device/hid_multipleinterface/src/main.c b/examples/device/hid_multiple_interface/src/main.c similarity index 100% rename from examples/device/hid_multipleinterface/src/main.c rename to examples/device/hid_multiple_interface/src/main.c diff --git a/examples/device/hid_multipleinterface/src/tusb_config.h b/examples/device/hid_multiple_interface/src/tusb_config.h similarity index 100% rename from examples/device/hid_multipleinterface/src/tusb_config.h rename to examples/device/hid_multiple_interface/src/tusb_config.h diff --git a/examples/device/hid_multipleinterface/src/usb_descriptors.c b/examples/device/hid_multiple_interface/src/usb_descriptors.c similarity index 100% rename from examples/device/hid_multipleinterface/src/usb_descriptors.c rename to examples/device/hid_multiple_interface/src/usb_descriptors.c From 2e464c5015f83ee52465e61160def7662b6541bc Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 13:57:23 +0700 Subject: [PATCH 5/9] clean up example --- .../device/hid_multiple_interface/src/main.c | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/examples/device/hid_multiple_interface/src/main.c b/examples/device/hid_multiple_interface/src/main.c index b1957b9fc..3599683c5 100644 --- a/examples/device/hid_multiple_interface/src/main.c +++ b/examples/device/hid_multiple_interface/src/main.c @@ -34,6 +34,12 @@ // MACRO CONSTANT TYPEDEF PROTYPES //--------------------------------------------------------------------+ +// Interface index depends on the order in configuration descriptor +enum { + ITF_KEYBOARD = 0, + ITF_MOUSE = 1 +}; + /* Blink pattern * - 250 ms : device not mounted * - 1000 ms : device mounted @@ -104,10 +110,6 @@ void tud_resume_cb(void) void hid_task(void) { - //Set up interfaces - const uint8_t keyboard_interface = 0; - const uint8_t mouse_interface = 1; - // Poll every 10ms const uint32_t interval_ms = 10; static uint32_t start_ms = 0; @@ -126,7 +128,7 @@ void hid_task(void) } /*------------- Keyboard -------------*/ - if ( tud_hid_n_ready(keyboard_interface) ) + if ( tud_hid_n_ready(ITF_KEYBOARD) ) { // use to avoid send multiple consecutive zero report for keyboard static bool has_key = false; @@ -136,29 +138,26 @@ void hid_task(void) uint8_t keycode[6] = { 0 }; keycode[0] = HID_KEY_A; - tud_hid_n_keyboard_report(keyboard_interface, 0, 0, keycode); + tud_hid_n_keyboard_report(ITF_KEYBOARD, 0, 0, keycode); has_key = true; }else { // send empty key report if previously has key pressed - if (has_key) tud_hid_n_keyboard_report(keyboard_interface, 0, 0, NULL); + if (has_key) tud_hid_n_keyboard_report(ITF_KEYBOARD, 0, 0, NULL); has_key = false; } } /*------------- Mouse -------------*/ - if ( tud_hid_n_ready(mouse_interface) ) + if ( tud_hid_n_ready(ITF_MOUSE) ) { if ( btn ) { int8_t const delta = 5; // no button, right + down, no scroll pan - tud_hid_n_mouse_report(mouse_interface, 0, 0x00, delta, delta, 0, 0); - - // delay a bit before attempt to send keyboard report - board_delay(10); + tud_hid_n_mouse_report(ITF_MOUSE, 0, 0x00, delta, delta, 0, 0); } } } From 13abcb953fcd3d51983e9768619adde776af257e Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 20:24:10 +0700 Subject: [PATCH 6/9] rename multiple hid callback --- .../device/hid_multiple_interface/src/main.c | 4 +-- .../src/usb_descriptors.c | 2 +- src/class/hid/hid_device.c | 8 ++--- src/class/hid/hid_device.h | 32 ++++++++++--------- 4 files changed, 24 insertions(+), 22 deletions(-) diff --git a/examples/device/hid_multiple_interface/src/main.c b/examples/device/hid_multiple_interface/src/main.c index 3599683c5..7cb1d75a7 100644 --- a/examples/device/hid_multiple_interface/src/main.c +++ b/examples/device/hid_multiple_interface/src/main.c @@ -166,7 +166,7 @@ void hid_task(void) // Invoked when received GET_REPORT control request // Application must fill buffer report's content and return its length. // Return zero will cause the stack to STALL request -uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) +uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen) { // TODO not Implemented (void) itf; @@ -180,7 +180,7 @@ uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type // Invoked when received SET_REPORT control request or // received data on OUT endpoint ( Report ID = 0, Type = 0 ) -void tud_hid_n_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) +void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize) { // TODO set LED based on CAPLOCK, NUMLOCK etc... (void) itf; diff --git a/examples/device/hid_multiple_interface/src/usb_descriptors.c b/examples/device/hid_multiple_interface/src/usb_descriptors.c index dd8ef7120..0d67d499a 100644 --- a/examples/device/hid_multiple_interface/src/usb_descriptors.c +++ b/examples/device/hid_multiple_interface/src/usb_descriptors.c @@ -83,7 +83,7 @@ uint8_t const desc_hid_report2[] = // Invoked when received GET HID REPORT DESCRIPTOR // Application return pointer to descriptor // Descriptor contents must exist long enough for transfer to complete -uint8_t const * tud_hid_n_descriptor_report_cb(uint8_t itf) +uint8_t const * tud_hid_descriptor_report_cb(uint8_t itf) { if (itf == 0) { diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index 45b6aaaca..b1a4bb8de 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -250,7 +250,7 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request else if (request->bRequest == TUSB_REQ_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT) { #if CFG_TUD_HID>1 - uint8_t const * desc_report = tud_hid_n_descriptor_report_cb(hid_itf); + uint8_t const * desc_report = tud_hid_descriptor_report_cb(hid_itf); #else uint8_t const * desc_report = tud_hid_descriptor_report_cb(); #endif @@ -273,7 +273,7 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request uint8_t const report_id = tu_u16_low(request->wValue); #if CFG_TUD_HID>1 - uint16_t xferlen = tud_hid_n_get_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); + uint16_t xferlen = tud_hid_get_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); #else uint16_t xferlen = tud_hid_get_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); #endif @@ -347,7 +347,7 @@ bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_requ #if CFG_TUD_HID>1 uint8_t const hid_itf = get_hid_index_by_itfnum((uint8_t)p_request->wIndex); TU_VERIFY(hid_itf<0xFF); - tud_hid_n_set_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); + tud_hid_set_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); #else tud_hid_set_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); #endif @@ -373,7 +373,7 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_ if (ep_addr == p_hid->ep_out) { #if CFG_TUD_HID>1 - tud_hid_n_set_report_cb(itf, 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); + tud_hid_set_report_cb(itf, 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); #else tud_hid_set_report_cb(0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); #endif diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h index 4b8cb17d5..fc060f0ce 100644 --- a/src/class/hid/hid_device.h +++ b/src/class/hid/hid_device.h @@ -84,30 +84,20 @@ static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8 // Callbacks (Weak is optional) //--------------------------------------------------------------------+ +#if CFG_TUD_HID > 1 + // Invoked when received GET HID REPORT DESCRIPTOR request // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete -#if CFG_TUD_HID>1 -uint8_t const * tud_hid_n_descriptor_report_cb(uint8_t itf); -#else -uint8_t const * tud_hid_descriptor_report_cb(void); -#endif +uint8_t const * tud_hid_descriptor_report_cb(uint8_t itf); // Invoked when received GET_REPORT control request // Application must fill buffer report's content and return its length. // Return zero will cause the stack to STALL request -#if CFG_TUD_HID>1 -uint16_t tud_hid_n_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen); -#else -uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen); -#endif +uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen); // Invoked when received SET_REPORT control request or // received data on OUT endpoint ( Report ID = 0, Type = 0 ) -#if CFG_TUD_HID>1 -void tud_hid_n_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); -#else -void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); -#endif +void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); // Invoked when received SET_PROTOCOL request ( mode switch Boot <-> Report ) TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode); @@ -117,6 +107,18 @@ TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode); // - Idle Rate > 0 : skip duplication, but send at least 1 report every idle rate (in unit of 4 ms). TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate); +#else + +uint8_t const * tud_hid_descriptor_report_cb(void); +uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen); +void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); + +TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode); +TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate); + +#endif + + //--------------------------------------------------------------------+ // Inline Functions //--------------------------------------------------------------------+ From 8ba0c362ccb72a04ec101610f4b7f9c8577a26da Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 20:51:20 +0700 Subject: [PATCH 7/9] update tud_hid_boot_mode_cb/tud_hid_set_idle_cb support mul interfaces also clean up code --- src/class/hid/hid_device.c | 90 ++++++++++++++++++++------------------ src/class/hid/hid_device.h | 5 ++- 2 files changed, 50 insertions(+), 45 deletions(-) diff --git a/src/class/hid/hid_device.c b/src/class/hid/hid_device.c index b1a4bb8de..11da5f220 100644 --- a/src/class/hid/hid_device.c +++ b/src/class/hid/hid_device.c @@ -57,17 +57,7 @@ typedef struct CFG_TUSB_MEM_SECTION static hidd_interface_t _hidd_itf[CFG_TUD_HID]; /*------------- Helpers -------------*/ -static inline hidd_interface_t* get_interface_by_itfnum(uint8_t itf_num) -{ - for (uint8_t i=0; i < CFG_TUD_HID; i++ ) - { - if ( itf_num == _hidd_itf[i].itf_num ) return &_hidd_itf[i]; - } - - return NULL; -} - -static inline uint8_t get_hid_index_by_itfnum(uint8_t itf_num) +static inline uint8_t get_index_by_itfnum(uint8_t itf_num) { for (uint8_t i=0; i < CFG_TUD_HID; i++ ) { @@ -227,13 +217,10 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request { TU_VERIFY(request->bmRequestType_bit.recipient == TUSB_REQ_RCPT_INTERFACE); - hidd_interface_t* p_hid = get_interface_by_itfnum( (uint8_t) request->wIndex ); - TU_ASSERT(p_hid); + uint8_t const hid_itf = get_index_by_itfnum((uint8_t) request->wIndex); + TU_VERIFY(hid_itf < CFG_TUD_HID); - #if CFG_TUD_HID>1 - uint8_t const hid_itf = get_hid_index_by_itfnum((uint8_t) request->wIndex); - TU_VERIFY(hid_itf<0xFF); - #endif + hidd_interface_t* p_hid = &_hidd_itf[hid_itf]; if (request->bmRequestType_bit.type == TUSB_REQ_TYPE_STANDARD) { @@ -249,11 +236,11 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request } else if (request->bRequest == TUSB_REQ_GET_DESCRIPTOR && desc_type == HID_DESC_TYPE_REPORT) { - #if CFG_TUD_HID>1 - uint8_t const * desc_report = tud_hid_descriptor_report_cb(hid_itf); - #else - uint8_t const * desc_report = tud_hid_descriptor_report_cb(); - #endif + uint8_t const * desc_report = tud_hid_descriptor_report_cb( + #if CFG_TUD_HID > 1 + hid_itf // TODO for backward compatible callback, remove later when appropriate + #endif + ); tud_control_xfer(rhport, request, (void*) desc_report, p_hid->report_desc_len); } else @@ -272,11 +259,12 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request uint8_t const report_type = tu_u16_high(request->wValue); uint8_t const report_id = tu_u16_low(request->wValue); - #if CFG_TUD_HID>1 - uint16_t xferlen = tud_hid_get_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); - #else - uint16_t xferlen = tud_hid_get_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength); - #endif + uint16_t xferlen = tud_hid_get_report_cb( + #if CFG_TUD_HID > 1 + hid_itf, // TODO for backward compatible callback, remove later when appropriate + #endif + report_id, (hid_report_type_t) report_type, p_hid->epin_buf, request->wLength + ); TU_ASSERT( xferlen > 0 ); tud_control_xfer(rhport, request, p_hid->epin_buf, xferlen); @@ -293,7 +281,12 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request if ( tud_hid_set_idle_cb ) { // stall request if callback return false - if ( !tud_hid_set_idle_cb(p_hid->idle_rate) ) return false; + TU_VERIFY( tud_hid_set_idle_cb( + #if CFG_TUD_HID > 1 + hid_itf, // TODO for backward compatible callback, remove later when appropriate + #endif + p_hid->idle_rate) + ); } tud_control_status(rhport, request); @@ -314,7 +307,15 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request case HID_REQ_CONTROL_SET_PROTOCOL: p_hid->boot_mode = 1 - request->wValue; // 0 is Boot, 1 is Report protocol - if (tud_hid_boot_mode_cb) tud_hid_boot_mode_cb(p_hid->boot_mode); + if (tud_hid_boot_mode_cb) + { + tud_hid_boot_mode_cb( + #if CFG_TUD_HID > 1 + hid_itf, // TODO for backward compatible callback, remove later when appropriate + #endif + p_hid->boot_mode + ); + } tud_control_status(rhport, request); break; @@ -334,8 +335,11 @@ bool hidd_control_request(uint8_t rhport, tusb_control_request_t const * request bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_request) { (void) rhport; - hidd_interface_t* p_hid = get_interface_by_itfnum( (uint8_t) p_request->wIndex ); - TU_ASSERT(p_hid); + + uint8_t const hid_itf = get_index_by_itfnum((uint8_t) p_request->wIndex); + TU_VERIFY(hid_itf < CFG_TUD_HID); + + hidd_interface_t* p_hid = &_hidd_itf[hid_itf]; if (p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS && p_request->bRequest == HID_REQ_CONTROL_SET_REPORT) @@ -344,13 +348,12 @@ bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_requ uint8_t const report_type = tu_u16_high(p_request->wValue); uint8_t const report_id = tu_u16_low(p_request->wValue); - #if CFG_TUD_HID>1 - uint8_t const hid_itf = get_hid_index_by_itfnum((uint8_t)p_request->wIndex); - TU_VERIFY(hid_itf<0xFF); - tud_hid_set_report_cb(hid_itf, report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); - #else - tud_hid_set_report_cb(report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength); - #endif + tud_hid_set_report_cb( + #if CFG_TUD_HID > 1 + hid_itf, // TODO for backward compatible callback, remove later when appropriate + #endif + report_id, (hid_report_type_t) report_type, p_hid->epout_buf, p_request->wLength + ); } return true; @@ -372,11 +375,12 @@ bool hidd_xfer_cb(uint8_t rhport, uint8_t ep_addr, xfer_result_t result, uint32_ if (ep_addr == p_hid->ep_out) { - #if CFG_TUD_HID>1 - tud_hid_set_report_cb(itf, 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); - #else - tud_hid_set_report_cb(0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes); - #endif + tud_hid_set_report_cb( + #if CFG_TUD_HID > 1 + itf, // TODO for backward compatible callback, remove later when appropriate + #endif + 0, HID_REPORT_TYPE_INVALID, p_hid->epout_buf, xferred_bytes + ); TU_ASSERT(usbd_edpt_xfer(rhport, p_hid->ep_out, p_hid->epout_buf, sizeof(p_hid->epout_buf))); } diff --git a/src/class/hid/hid_device.h b/src/class/hid/hid_device.h index fc060f0ce..d5b5b7296 100644 --- a/src/class/hid/hid_device.h +++ b/src/class/hid/hid_device.h @@ -100,15 +100,16 @@ uint16_t tud_hid_get_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t void tud_hid_set_report_cb(uint8_t itf, uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); // Invoked when received SET_PROTOCOL request ( mode switch Boot <-> Report ) -TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t boot_mode); +TU_ATTR_WEAK void tud_hid_boot_mode_cb(uint8_t itf, uint8_t boot_mode); // Invoked when received SET_IDLE request. return false will stall the request // - Idle Rate = 0 : only send report if there is changes, i.e skip duplication // - Idle Rate > 0 : skip duplication, but send at least 1 report every idle rate (in unit of 4 ms). -TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate); +TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t itf, uint8_t idle_rate); #else +// TODO for backward compatible callback, remove later when appropriate uint8_t const * tud_hid_descriptor_report_cb(void); uint16_t tud_hid_get_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t* buffer, uint16_t reqlen); void tud_hid_set_report_cb(uint8_t report_id, hid_report_type_t report_type, uint8_t const* buffer, uint16_t bufsize); From 8cf1ed6e4ee385dbfb7ef7dd1446c52eab67f503 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 21:01:52 +0700 Subject: [PATCH 8/9] try GITHUB_PATH for ci --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index fd48eef1b..227593e8a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,14 +66,14 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin`" - echo "::add-path::`echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin`" + echo `$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH + echo `echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` >> $GITHUB_PATH # TI MSP430 GCC mkdir -p /tmp/dl/ [ -f "/tmp/dl/msp430-gcc.tar.bz2" ] || wget --progress=dot:mega $MSP430GCC_URL -O /tmp/dl/msp430-gcc.tar.bz2 tar -C $HOME -xaf /tmp/dl/msp430-gcc.tar.bz2 - echo "::add-path::`echo $HOME/msp430-gcc-*_linux64/bin`" + echo `echo $HOME/msp430-gcc-*_linux64/bin` >> $GITHUB_PATH - name: Checkout TinyUSB uses: actions/checkout@v2 From 3fd38ddf0493f84eb3124aacf9ccd7c76643a2c9 Mon Sep 17 00:00:00 2001 From: hathach Date: Fri, 9 Oct 2020 21:10:59 +0700 Subject: [PATCH 9/9] fix ci build --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 227593e8a..8bb382a8d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -66,7 +66,7 @@ jobs: npm install --global xpm xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest xpm install --global @xpack-dev-tools/riscv-none-embed-gcc@latest - echo `$HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH + echo `echo $HOME/opt/xPacks/@xpack-dev-tools/arm-none-eabi-gcc/*/.content/bin` >> $GITHUB_PATH echo `echo $HOME/opt/xPacks/@xpack-dev-tools/riscv-none-embed-gcc/*/.content/bin` >> $GITHUB_PATH # TI MSP430 GCC