Просмотр исходного кода

Merge pull request #532 from hathach/house-keeping

House keeping
Ha Thach 5 лет назад
Родитель
Сommit
8a07b9b9c0
73 измененных файлов с 118 добавлено и 165 удалено
  1. 4 4
      .github/workflows/build.yml
  2. 0 0
      examples/device/hid_multiple_interface/Makefile
  3. 13 14
      examples/device/hid_multiple_interface/src/main.c
  4. 0 0
      examples/device/hid_multiple_interface/src/tusb_config.h
  5. 1 1
      examples/device/hid_multiple_interface/src/usb_descriptors.c
  6. 7 0
      examples/rules.mk
  7. 0 1
      hw/bsp/adafruit_clue/board.mk
  8. 0 1
      hw/bsp/arduino_nano33_ble/board.mk
  9. 0 1
      hw/bsp/circuitplayground_bluefruit/board.mk
  10. 0 1
      hw/bsp/circuitplayground_express/board.mk
  11. 0 1
      hw/bsp/d5035_01/board.mk
  12. 0 1
      hw/bsp/da14695_dk_usb/board.mk
  13. 0 1
      hw/bsp/da1469x_dk_pro/board.mk
  14. 0 1
      hw/bsp/ea4088qs/board.mk
  15. 0 1
      hw/bsp/ea4357/board.mk
  16. 0 1
      hw/bsp/feather_m0_express/board.mk
  17. 0 1
      hw/bsp/feather_m4_express/board.mk
  18. 0 1
      hw/bsp/feather_nrf52840_express/board.mk
  19. 0 1
      hw/bsp/feather_nrf52840_sense/board.mk
  20. 0 1
      hw/bsp/feather_stm32f405/board.mk
  21. 0 1
      hw/bsp/itsybitsy_m0/board.mk
  22. 0 1
      hw/bsp/itsybitsy_m4/board.mk
  23. 0 1
      hw/bsp/itsybitsy_nrf52840/board.mk
  24. 0 1
      hw/bsp/lpcxpresso11u37/board.mk
  25. 0 1
      hw/bsp/lpcxpresso11u68/board.mk
  26. 0 1
      hw/bsp/lpcxpresso1347/board.mk
  27. 0 1
      hw/bsp/lpcxpresso1549/board.mk
  28. 0 1
      hw/bsp/lpcxpresso1769/board.mk
  29. 0 1
      hw/bsp/lpcxpresso51u68/board.mk
  30. 0 1
      hw/bsp/lpcxpresso54114/board.mk
  31. 0 1
      hw/bsp/lpcxpresso55s69/board.mk
  32. 0 1
      hw/bsp/luna/board.mk
  33. 0 1
      hw/bsp/mbed1768/board.mk
  34. 0 1
      hw/bsp/mcb1800/board.mk
  35. 0 1
      hw/bsp/metro_m0_express/board.mk
  36. 0 1
      hw/bsp/metro_m4_express/board.mk
  37. 5 4
      hw/bsp/mimxrt1010_evk/board.mk
  38. 3 6
      hw/bsp/mimxrt1015_evk/board.mk
  39. 5 4
      hw/bsp/mimxrt1020_evk/board.mk
  40. 4 6
      hw/bsp/mimxrt1050_evkb/board.mk
  41. 5 4
      hw/bsp/mimxrt1060_evk/board.mk
  42. 5 4
      hw/bsp/mimxrt1064_evk/board.mk
  43. 0 1
      hw/bsp/nrf52840_mdk_dongle/board.mk
  44. 0 1
      hw/bsp/nutiny_nuc121s/board.mk
  45. 0 1
      hw/bsp/nutiny_nuc125s/board.mk
  46. 0 1
      hw/bsp/nutiny_nuc126v/board.mk
  47. 0 1
      hw/bsp/nutiny_sdk_nuc120/board.mk
  48. 0 1
      hw/bsp/nutiny_sdk_nuc505/board.mk
  49. 0 1
      hw/bsp/pca10056/board.mk
  50. 0 1
      hw/bsp/pca10059/board.mk
  51. 0 1
      hw/bsp/pca10100/board.mk
  52. 0 1
      hw/bsp/pyboardv11/board.mk
  53. 0 1
      hw/bsp/raytac_mdbt50q_rx/board.mk
  54. 0 1
      hw/bsp/samd11_xplained/board.mk
  55. 0 1
      hw/bsp/samg55xplained/board.mk
  56. 0 1
      hw/bsp/seeeduino_xiao/board.mk
  57. 0 1
      hw/bsp/stm32f070rbnucleo/board.mk
  58. 0 1
      hw/bsp/stm32f072disco/board.mk
  59. 0 1
      hw/bsp/stm32f103bluepill/board.mk
  60. 0 1
      hw/bsp/stm32f207nucleo/board.mk
  61. 0 1
      hw/bsp/stm32f303disco/board.mk
  62. 0 1
      hw/bsp/stm32f401blackpill/board.mk
  63. 0 1
      hw/bsp/stm32f407disco/board.mk
  64. 0 1
      hw/bsp/stm32f411blackpill/board.mk
  65. 0 1
      hw/bsp/stm32f411disco/board.mk
  66. 0 1
      hw/bsp/stm32f412disco/board.mk
  67. 0 1
      hw/bsp/stm32h743eval/board.mk
  68. 0 1
      hw/bsp/stm32h745disco/board.mk
  69. 0 1
      hw/bsp/stm32l0538disco/board.mk
  70. 0 1
      hw/bsp/stm32l476disco/board.mk
  71. 0 1
      hw/bsp/teensy_40/board.mk
  72. 47 43
      src/class/hid/hid_device.c
  73. 19 16
      src/class/hid/hid_device.h

+ 4 - 4
.github/workflows/build.yml

@@ -35,7 +35,7 @@ jobs:
         - 'device/hid_composite'
         - 'device/hid_composite'
         - 'device/hid_composite_freertos'
         - 'device/hid_composite_freertos'
         - 'device/hid_generic_inout'
         - 'device/hid_generic_inout'
-        - 'device/hid_multipleinterface'
+        - 'device/hid_multiple_interface'
         - 'device/midi_test'
         - 'device/midi_test'
         - 'device/msc_dual_lun'
         - 'device/msc_dual_lun'
         - 'device/net_lwip_webserver'
         - 'device/net_lwip_webserver'
@@ -66,14 +66,14 @@ jobs:
         npm install --global xpm
         npm install --global xpm
         xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
         xpm install --global @xpack-dev-tools/arm-none-eabi-gcc@latest
         xpm install --global @xpack-dev-tools/riscv-none-embed-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 `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
         # TI MSP430 GCC
         mkdir -p /tmp/dl/
         mkdir -p /tmp/dl/
         [ -f "/tmp/dl/msp430-gcc.tar.bz2" ] || wget --progress=dot:mega $MSP430GCC_URL -O /tmp/dl/msp430-gcc.tar.bz2
         [ -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
         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
     - name: Checkout TinyUSB
       uses: actions/checkout@v2
       uses: actions/checkout@v2

+ 0 - 0
examples/device/hid_multipleinterface/Makefile → examples/device/hid_multiple_interface/Makefile


+ 13 - 14
examples/device/hid_multipleinterface/src/main.c → examples/device/hid_multiple_interface/src/main.c

@@ -34,6 +34,12 @@
 // MACRO CONSTANT TYPEDEF PROTYPES
 // MACRO CONSTANT TYPEDEF PROTYPES
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 
 
+// Interface index depends on the order in configuration descriptor
+enum {
+  ITF_KEYBOARD = 0,
+  ITF_MOUSE = 1
+};
+
 /* Blink pattern
 /* Blink pattern
  * - 250 ms  : device not mounted
  * - 250 ms  : device not mounted
  * - 1000 ms : device mounted
  * - 1000 ms : device mounted
@@ -104,10 +110,6 @@ void tud_resume_cb(void)
 
 
 void hid_task(void)
 void hid_task(void)
 {
 {
-  //Set up interfaces
-  const uint8_t keyboard_interface = 0;
-  const uint8_t mouse_interface = 1;
-
   // Poll every 10ms
   // Poll every 10ms
   const uint32_t interval_ms = 10;
   const uint32_t interval_ms = 10;
   static uint32_t start_ms = 0;
   static uint32_t start_ms = 0;
@@ -126,7 +128,7 @@ void hid_task(void)
   }
   }
 
 
   /*------------- Keyboard -------------*/
   /*------------- 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
     // use to avoid send multiple consecutive zero report for keyboard
     static bool has_key = false;
     static bool has_key = false;
@@ -136,29 +138,26 @@ void hid_task(void)
       uint8_t keycode[6] = { 0 };
       uint8_t keycode[6] = { 0 };
       keycode[0] = HID_KEY_A;
       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;
       has_key = true;
     }else
     }else
     {
     {
       // send empty key report if previously has key pressed
       // 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;
       has_key = false;
     }
     }
   }
   }
 
 
   /*------------- Mouse -------------*/
   /*------------- Mouse -------------*/
-  if ( tud_hid_n_ready(mouse_interface) )
+  if ( tud_hid_n_ready(ITF_MOUSE) )
   {
   {
     if ( btn )
     if ( btn )
     {
     {
       int8_t const delta = 5;
       int8_t const delta = 5;
 
 
       // no button, right + down, no scroll pan
       // 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);
     }
     }
   }
   }
 }
 }
@@ -167,7 +166,7 @@ void hid_task(void)
 // Invoked when received GET_REPORT control request
 // Invoked when received GET_REPORT control request
 // Application must fill buffer report's content and return its length.
 // Application must fill buffer report's content and return its length.
 // Return zero will cause the stack to STALL request
 // 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
   // TODO not Implemented
   (void) itf;
   (void) itf;
@@ -181,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
 // Invoked when received SET_REPORT control request or
 // received data on OUT endpoint ( Report ID = 0, Type = 0 )
 // 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...
   // TODO set LED based on CAPLOCK, NUMLOCK etc...
   (void) itf;
   (void) itf;

+ 0 - 0
examples/device/hid_multipleinterface/src/tusb_config.h → examples/device/hid_multiple_interface/src/tusb_config.h


+ 1 - 1
examples/device/hid_multipleinterface/src/usb_descriptors.c → 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
 // Invoked when received GET HID REPORT DESCRIPTOR
 // Application return pointer to descriptor
 // Application return pointer to descriptor
 // Descriptor contents must exist long enough for transfer to complete
 // 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)
   if (itf == 0)
   {
   {

+ 7 - 0
examples/rules.mk

@@ -147,6 +147,8 @@ else
   JLINKEXE = JLinkExe
   JLINKEXE = JLinkExe
 endif
 endif
 
 
+JLINK_IF ?= swd
+
 # Flash using jlink
 # Flash using jlink
 flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
 flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
 	@echo halt > $(BUILD)/$(BOARD).jlink
 	@echo halt > $(BUILD)/$(BOARD).jlink
@@ -161,4 +163,9 @@ flash-jlink: $(BUILD)/$(BOARD)-firmware.hex
 flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
 flash-stlink: $(BUILD)/$(BOARD)-firmware.elf
 	STM32_Programmer_CLI --connect port=swd --write $< --go
 	STM32_Programmer_CLI --connect port=swd --write $< --go
 
 
+# flash with pyocd
+flash-pyocd: $(BUILD)/$(BOARD)-firmware.hex
+	pyocd flash -t $(PYOCD_TARGET) $<
+	pyocd reset -t $(PYOCD_TARGET)
+
 endif # Make target
 endif # Make target

+ 0 - 1
hw/bsp/adafruit_clue/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # For uf2 conversion
 # For uf2 conversion
 UF2_FAMILY = 0xADA52840
 UF2_FAMILY = 0xADA52840

+ 0 - 1
hw/bsp/arduino_nano33_ble/board.mk

@@ -51,7 +51,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # flash using bossac (as part of Nano33 BSP tools)
 # flash using bossac (as part of Nano33 BSP tools)
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/circuitplayground_bluefruit/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # For uf2 conversion
 # For uf2 conversion
 UF2_FAMILY = 0xADA52840
 UF2_FAMILY = 0xADA52840

+ 0 - 1
hw/bsp/circuitplayground_express/board.mk

@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: $(BUILD)/$(BOARD)-firmware.uf2
 flash: $(BUILD)/$(BOARD)-firmware.uf2

+ 0 - 1
hw/bsp/d5035_01/board.mk

@@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAME51J19
 JLINK_DEVICE = ATSAME51J19
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/da14695_dk_usb/board.mk

@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = DA14695
 JLINK_DEVICE = DA14695
-JLINK_IF = swd
 
 
 # flash using jlink but with some twists
 # flash using jlink but with some twists
 flash: flash-dialog
 flash: flash-dialog

+ 0 - 1
hw/bsp/da1469x_dk_pro/board.mk

@@ -38,7 +38,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = DA14699
 JLINK_DEVICE = DA14699
-JLINK_IF = swd
 
 
 # flash using jlink but with some twists
 # flash using jlink but with some twists
 flash: flash-dialog
 flash: flash-dialog

+ 0 - 1
hw/bsp/ea4088qs/board.mk

@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC4088
 JLINK_DEVICE = LPC4088
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/ea4357/board.mk

@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC4357_M4
 JLINK_DEVICE = LPC4357_M4
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/feather_m0_express/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/feather_m4_express/board.mk

@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD51J19
 JLINK_DEVICE = ATSAMD51J19
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/feather_nrf52840_express/board.mk

@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # For uf2 conversion
 # For uf2 conversion
 UF2_FAMILY = 0xADA52840
 UF2_FAMILY = 0xADA52840

+ 0 - 1
hw/bsp/feather_nrf52840_sense/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # For uf2 conversion
 # For uf2 conversion
 UF2_FAMILY = 0xADA52840
 UF2_FAMILY = 0xADA52840

+ 0 - 1
hw/bsp/feather_stm32f405/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f405rg
 JLINK_DEVICE = stm32f405rg
-JLINK_IF = swd
 
 
 # Path to STM32 Cube Programmer CLI, should be added into system path
 # Path to STM32 Cube Programmer CLI, should be added into system path
 STM32Prog = STM32_Programmer_CLI
 STM32Prog = STM32_Programmer_CLI

+ 0 - 1
hw/bsp/itsybitsy_m0/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/itsybitsy_m4/board.mk

@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD51J19
 JLINK_DEVICE = ATSAMD51J19
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/itsybitsy_nrf52840/board.mk

@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # For uf2 conversion
 # For uf2 conversion
 UF2_FAMILY = 0xADA52840
 UF2_FAMILY = 0xADA52840

+ 0 - 1
hw/bsp/lpcxpresso11u37/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC11U37/401
 JLINK_DEVICE = LPC11U37/401
-JLINK_IF = swd
 
 
 # flash using pyocd 
 # flash using pyocd 
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/lpcxpresso11u68/board.mk

@@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC11U68
 JLINK_DEVICE = LPC11U68
-JLINK_IF = swd
 
 
 # flash using pyocd 
 # flash using pyocd 
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/lpcxpresso1347/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC1347
 JLINK_DEVICE = LPC1347
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/lpcxpresso1549/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC1549
 JLINK_DEVICE = LPC1549
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/lpcxpresso1769/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC1769
 JLINK_DEVICE = LPC1769
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/lpcxpresso51u68/board.mk

@@ -41,7 +41,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC51U68
 JLINK_DEVICE = LPC51U68
-JLINK_IF = swd
 
 
 # flash using pyocd (51u68 is not supported yet)
 # flash using pyocd (51u68 is not supported yet)
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/lpcxpresso54114/board.mk

@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC54114J256_M4
 JLINK_DEVICE = LPC54114J256_M4
-JLINK_IF = swd
 
 
 # flash using pyocd
 # flash using pyocd
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/lpcxpresso55s69/board.mk

@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM33_NTZ/non_secure
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC55S69
 JLINK_DEVICE = LPC55S69
-JLINK_IF = swd
 
 
 # flash using pyocd
 # flash using pyocd
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/luna/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/mbed1768/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC1768
 JLINK_DEVICE = LPC1768
-JLINK_IF = swd
 
 
 # flash using pyocd 
 # flash using pyocd 
 flash: $(BUILD)/$(BOARD)-firmware.hex
 flash: $(BUILD)/$(BOARD)-firmware.hex

+ 0 - 1
hw/bsp/mcb1800/board.mk

@@ -37,7 +37,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = LPC1857
 JLINK_DEVICE = LPC1857
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/metro_m0_express/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 0 - 1
hw/bsp/metro_m4_express/board.mk

@@ -42,7 +42,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD51J19
 JLINK_DEVICE = ATSAMD51J19
-JLINK_IF = swd
 
 
 # flash using bossac at least version 1.8
 # flash using bossac at least version 1.8
 # can be found in arduino15/packages/arduino/tools/bossac/
 # can be found in arduino15/packages/arduino/tools/bossac/

+ 5 - 4
hw/bsp/mimxrt1010_evk/board.mk

@@ -49,8 +49,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1011DAE5A
 JLINK_DEVICE = MIMXRT1011DAE5A
-JLINK_IF = swd
 
 
-# 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

+ 3 - 6
hw/bsp/mimxrt1015_evk/board.mk

@@ -45,12 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1015DAF5A
 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 using pyocd
-#flash: $(BUILD)/$(BOARD)-firmware.hex
-#	pyocd flash -b MIMXRT1015-EVK $<
+flash: flash-pyocd

+ 5 - 4
hw/bsp/mimxrt1020_evk/board.mk

@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1021DAG5A
 JLINK_DEVICE = MIMXRT1021DAG5A
-JLINK_IF = swd
 
 
-# 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

+ 4 - 6
hw/bsp/mimxrt1050_evkb/board.mk

@@ -43,10 +43,8 @@ CHIP_FAMILY = transdimension
 # For freeRTOS port source
 # For freeRTOS port source
 FREERTOS_PORT = ARM_CM7/r0p1
 FREERTOS_PORT = ARM_CM7/r0p1
 
 
-# For flash-jlink target
-JLINK_DEVICE = MIMXRT1052xxx6B
-JLINK_IF = swd
+# 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

+ 5 - 4
hw/bsp/mimxrt1060_evk/board.mk

@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1062xxx6A
 JLINK_DEVICE = MIMXRT1062xxx6A
-JLINK_IF = swd
 
 
-# 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

+ 5 - 4
hw/bsp/mimxrt1064_evk/board.mk

@@ -45,8 +45,9 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1064xxx6A
 JLINK_DEVICE = MIMXRT1064xxx6A
-JLINK_IF = swd
 
 
-# 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

+ 0 - 1
hw/bsp/nrf52840_mdk_dongle/board.mk

@@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # flash using Nordic nrfutil (pip2 install nrfutil)
 # flash using Nordic nrfutil (pip2 install nrfutil)
 # 	make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash
 # 	make BOARD=nrf52840_mdk_dongle SERIAL=/dev/ttyACM0 all flash

+ 0 - 1
hw/bsp/nutiny_nuc121s/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = NUC121SC2AE
 JLINK_DEVICE = NUC121SC2AE
-JLINK_IF = swd
 
 
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Please compile and install it from github source
 # Please compile and install it from github source

+ 0 - 1
hw/bsp/nutiny_nuc125s/board.mk

@@ -33,7 +33,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = NUC125SC2AE
 JLINK_DEVICE = NUC125SC2AE
-JLINK_IF = swd
 
 
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Please compile and install it from github source
 # Please compile and install it from github source

+ 0 - 1
hw/bsp/nutiny_nuc126v/board.mk

@@ -53,7 +53,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = NUC126VG4AE
 JLINK_DEVICE = NUC126VG4AE
-JLINK_IF = swd
 
 
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Please compile and install it from github source
 # Please compile and install it from github source

+ 0 - 1
hw/bsp/nutiny_sdk_nuc120/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = NUC120LE3
 JLINK_DEVICE = NUC120LE3
-JLINK_IF = swd
 
 
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Flash using Nuvoton's openocd fork at https://github.com/OpenNuvoton/OpenOCD-Nuvoton
 # Please compile and install it from github source
 # Please compile and install it from github source

+ 0 - 1
hw/bsp/nutiny_sdk_nuc505/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = NUC505YO13Y
 JLINK_DEVICE = NUC505YO13Y
-JLINK_IF = swd
 
 
 # Note
 # Note
 # To be able to program the SPI flash, it need to boot with ICP mode "1011". 
 # To be able to program the SPI flash, it need to boot with ICP mode "1011". 

+ 0 - 1
hw/bsp/pca10056/board.mk

@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/pca10059/board.mk

@@ -49,7 +49,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # flash using Nordic nrfutil (pip2 install nrfutil)
 # flash using Nordic nrfutil (pip2 install nrfutil)
 # 	make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash
 # 	make BOARD=pca10059 SERIAL=/dev/ttyACM0 all flash

+ 0 - 1
hw/bsp/pca10100/board.mk

@@ -50,7 +50,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52833_XXAA
 JLINK_DEVICE = nRF52833_XXAA
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/pyboardv11/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f405rg
 JLINK_DEVICE = stm32f405rg
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/raytac_mdbt50q_rx/board.mk

@@ -48,7 +48,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = nRF52840_xxAA
 JLINK_DEVICE = nRF52840_xxAA
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/samd11_xplained/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD11D14
 JLINK_DEVICE = ATSAMD11D14
-JLINK_IF = swd
 
 
 # flash using edbg
 # flash using edbg
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/samg55xplained/board.mk

@@ -47,7 +47,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMG55J19
 JLINK_DEVICE = ATSAMG55J19
-JLINK_IF = swd
 
 
 # flash using edbg from https://github.com/ataradov/edbg
 # flash using edbg from https://github.com/ataradov/edbg
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/seeeduino_xiao/board.mk

@@ -39,7 +39,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = ATSAMD21G18
 JLINK_DEVICE = ATSAMD21G18
-JLINK_IF = swd
 
 
 # flash using jlink
 # flash using jlink
 flash: flash-jlink
 flash: flash-jlink

+ 0 - 1
hw/bsp/stm32f070rbnucleo/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f070rb
 JLINK_DEVICE = stm32f070rb
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f072disco/board.mk

@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f072rb
 JLINK_DEVICE = stm32f072rb
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f103bluepill/board.mk

@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f103c8
 JLINK_DEVICE = stm32f103c8
-JLINK_IF = swd
 
 
 # flash target ROM bootloader
 # flash target ROM bootloader
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/stm32f207nucleo/board.mk

@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM3
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f207zg
 JLINK_DEVICE = stm32f207zg
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f303disco/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f303vc
 JLINK_DEVICE = stm32f303vc
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f401blackpill/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f401cc
 JLINK_DEVICE = stm32f401cc
-JLINK_IF = swd
 
 
 # flash target ROM bootloader
 # flash target ROM bootloader
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/stm32f407disco/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f407vg
 JLINK_DEVICE = stm32f407vg
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f411blackpill/board.mk

@@ -40,7 +40,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f411ce
 JLINK_DEVICE = stm32f411ce
-JLINK_IF = swd
 
 
 # flash target ROM bootloader
 # flash target ROM bootloader
 flash: $(BUILD)/$(BOARD)-firmware.bin
 flash: $(BUILD)/$(BOARD)-firmware.bin

+ 0 - 1
hw/bsp/stm32f411disco/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f411ve
 JLINK_DEVICE = stm32f411ve
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32f412disco/board.mk

@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32f41zx
 JLINK_DEVICE = stm32f41zx
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32h743eval/board.mk

@@ -57,7 +57,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32h743xi
 JLINK_DEVICE = stm32h743xi
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32h745disco/board.mk

@@ -52,7 +52,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32h745xi
 JLINK_DEVICE = stm32h745xi
-JLINK_IF = swd
 
 
 # flash target using on-board stlink
 # flash target using on-board stlink
 flash: flash-stlink
 flash: flash-stlink

+ 0 - 1
hw/bsp/stm32l0538disco/board.mk

@@ -44,7 +44,6 @@ FREERTOS_PORT = ARM_CM0
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = STM32L053R8
 JLINK_DEVICE = STM32L053R8
-JLINK_IF = swd
 
 
 # Path to STM32 Cube Programmer CLI, should be added into system path 
 # Path to STM32 Cube Programmer CLI, should be added into system path 
 STM32Prog = STM32_Programmer_CLI
 STM32Prog = STM32_Programmer_CLI

+ 0 - 1
hw/bsp/stm32l476disco/board.mk

@@ -43,7 +43,6 @@ FREERTOS_PORT = ARM_CM4F
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = stm32l476vg
 JLINK_DEVICE = stm32l476vg
-JLINK_IF = swd
 
 
 # Path to STM32 Cube Programmer CLI, should be added into system path
 # Path to STM32 Cube Programmer CLI, should be added into system path
 STM32Prog = STM32_Programmer_CLI
 STM32Prog = STM32_Programmer_CLI

+ 0 - 1
hw/bsp/teensy_40/board.mk

@@ -45,7 +45,6 @@ FREERTOS_PORT = ARM_CM7/r0p1
 
 
 # For flash-jlink target
 # For flash-jlink target
 JLINK_DEVICE = MIMXRT1062xxx6A
 JLINK_DEVICE = MIMXRT1062xxx6A
-JLINK_IF = swd
 
 
 # flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli
 # flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli
 # Make sure it is in your PATH 
 # Make sure it is in your PATH 

+ 47 - 43
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];
 CFG_TUSB_MEM_SECTION static hidd_interface_t _hidd_itf[CFG_TUD_HID];
 
 
 /*------------- Helpers -------------*/
 /*------------- 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++ )
 	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);
   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)
   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)
     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);
-      #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);
       tud_control_xfer(rhport, request, (void*) desc_report, p_hid->report_desc_len);
     }
     }
     else
     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_type = tu_u16_high(request->wValue);
         uint8_t const report_id   = tu_u16_low(request->wValue);
         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);
-        #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 );
         TU_ASSERT( xferlen > 0 );
 
 
         tud_control_xfer(rhport, request, p_hid->epin_buf, xferlen);
         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 )
         if ( tud_hid_set_idle_cb )
         {
         {
           // stall request if callback return false
           // 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);
         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:
       case HID_REQ_CONTROL_SET_PROTOCOL:
         p_hid->boot_mode = 1 - request->wValue; // 0 is Boot, 1 is Report 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);
         tud_control_status(rhport, request);
       break;
       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)
 bool hidd_control_complete(uint8_t rhport, tusb_control_request_t const * p_request)
 {
 {
   (void) rhport;
   (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 &&
   if (p_request->bmRequestType_bit.type == TUSB_REQ_TYPE_CLASS &&
       p_request->bRequest == HID_REQ_CONTROL_SET_REPORT)
       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_type = tu_u16_high(p_request->wValue);
     uint8_t const report_id   = tu_u16_low(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_n_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;
   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 (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);
-    #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)));
     TU_ASSERT(usbd_edpt_xfer(rhport, p_hid->ep_out, p_hid->epout_buf, sizeof(p_hid->epout_buf)));
   }
   }
 
 

+ 19 - 16
src/class/hid/hid_device.h

@@ -84,39 +84,42 @@ static inline bool tud_hid_mouse_report(uint8_t report_id, uint8_t buttons, int8
 // Callbacks (Weak is optional)
 // Callbacks (Weak is optional)
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 
 
+#if CFG_TUD_HID > 1
+
 // Invoked when received GET HID REPORT DESCRIPTOR request
 // Invoked when received GET HID REPORT DESCRIPTOR request
 // Application return pointer to descriptor, whose contents must exist long enough for transfer to complete
 // 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
 // Invoked when received GET_REPORT control request
 // Application must fill buffer report's content and return its length.
 // Application must fill buffer report's content and return its length.
 // Return zero will cause the stack to STALL request
 // 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
 // Invoked when received SET_REPORT control request or
 // received data on OUT endpoint ( Report ID = 0, Type = 0 )
 // 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 )
 // 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
 // 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 : 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).
 // - 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 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);
+
+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);
 TU_ATTR_WEAK bool tud_hid_set_idle_cb(uint8_t idle_rate);
 
 
+#endif
+
+
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 // Inline Functions
 // Inline Functions
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+