Bläddra i källkod

Merge branch 'master' into master

Ha Thach 4 år sedan
förälder
incheckning
7de166390e
100 ändrade filer med 282 tillägg och 36 borttagningar
  1. 1 1
      .github/workflows/build_aarch64.yml
  2. 2 1
      .github/workflows/build_arm.yml
  3. 2 0
      .gitignore
  4. 3 0
      .gitmodules
  5. 3 2
      README.rst
  6. 1 1
      docs/reference/supported.rst
  7. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAMD11
  8. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAME5X
  9. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAMG
  10. 3 0
      examples/device/audio_4_channel_mic/skip.txt
  11. 0 0
      examples/device/audio_test/.skip.MCU_SAMD11
  12. 0 0
      examples/device/audio_test/.skip.MCU_SAME5X
  13. 0 0
      examples/device/audio_test/.skip.MCU_SAMG
  14. 3 0
      examples/device/audio_test/skip.txt
  15. 0 0
      examples/device/cdc_msc/.skip.MCU_SAMD11
  16. 1 0
      examples/device/cdc_msc/skip.txt
  17. 1 0
      examples/device/cdc_msc/src/msc_disk.c
  18. 2 1
      examples/device/cdc_msc/src/tusb_config.h
  19. 10 0
      examples/device/cdc_msc/src/usb_descriptors.c
  20. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_BCM2711
  21. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_CXD56
  22. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_GD32VF103
  23. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX
  24. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_MSP430x5xx
  25. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_RP2040
  26. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_SAMD11
  27. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_SAMX7X
  28. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
  29. 10 0
      examples/device/cdc_msc_freertos/skip.txt
  30. 0 4
      examples/device/dfu/.skip.MCU_TM4C123
  31. 2 0
      examples/device/dfu/skip.txt
  32. 0 0
      examples/device/dynamic_configuration/.skip.MCU_SAMD11
  33. 1 0
      examples/device/dynamic_configuration/skip.txt
  34. 2 1
      examples/device/hid_boot_interface/src/tusb_config.h
  35. 2 1
      examples/device/hid_composite/src/tusb_config.h
  36. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_BCM2711
  37. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_CXD56
  38. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_GD32VF103
  39. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_MSP430x5xx
  40. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_RP2040
  41. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_SAMD11
  42. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_SAMX7X
  43. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_VALENTYUSB_EPTRI
  44. 9 0
      examples/device/hid_composite_freertos/skip.txt
  45. 2 1
      examples/device/hid_multiple_interface/src/tusb_config.h
  46. 2 1
      examples/device/midi_test/src/tusb_config.h
  47. 10 4
      examples/device/midi_test/src/usb_descriptors.c
  48. 0 0
      examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX
  49. 0 0
      examples/device/msc_dual_lun/.skip.MCU_SAMD11
  50. 2 0
      examples/device/msc_dual_lun/skip.txt
  51. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_BCM2711
  52. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX
  53. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_LPC13XX
  54. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX
  55. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_MSP430x5xx
  56. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_NUC121
  57. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_SAMD11
  58. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_STM32L0
  59. 10 0
      examples/device/net_lwip_webserver/skip.txt
  60. 0 0
      examples/device/uac2_headset/.skip.MCU_LPC11UXX
  61. 0 0
      examples/device/uac2_headset/.skip.MCU_LPC13XX
  62. 0 0
      examples/device/uac2_headset/.skip.MCU_NUC121
  63. 0 0
      examples/device/uac2_headset/.skip.MCU_SAMD11
  64. 0 0
      examples/device/uac2_headset/.skip.MCU_SAME5X
  65. 0 0
      examples/device/uac2_headset/.skip.MCU_SAMG
  66. 6 0
      examples/device/uac2_headset/skip.txt
  67. 1 0
      examples/device/usbtmc/skip.txt
  68. 0 1
      examples/device/video_capture/.skip.MCU_MSP430x5xx
  69. 0 0
      examples/device/video_capture/.skip.MCU_SAMD11
  70. 2 0
      examples/device/video_capture/skip.txt
  71. 1 1
      examples/device/video_capture/src/usb_descriptors.h
  72. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X
  73. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X
  74. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC18XX
  75. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC40XX
  76. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC43XX
  77. 0 0
      examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX
  78. 0 0
      examples/host/cdc_msc_hid/.only.MCU_MSP432E4
  79. 0 0
      examples/host/cdc_msc_hid/.only.MCU_RP2040
  80. 9 0
      examples/host/cdc_msc_hid/only.txt
  81. 0 0
      examples/host/hid_controller/.only.MCU_LPC175X_6X
  82. 0 0
      examples/host/hid_controller/.only.MCU_LPC177X_8X
  83. 0 0
      examples/host/hid_controller/.only.MCU_LPC18XX
  84. 0 0
      examples/host/hid_controller/.only.MCU_LPC40XX
  85. 0 0
      examples/host/hid_controller/.only.MCU_LPC43XX
  86. 0 0
      examples/host/hid_controller/.only.MCU_MIMXRT10XX
  87. 0 0
      examples/host/hid_controller/.only.MCU_MSP432E4
  88. 0 0
      examples/host/hid_controller/.only.MCU_RP2040
  89. 9 0
      examples/host/hid_controller/only.txt
  90. 3 1
      examples/make.mk
  91. 8 2
      examples/rules.mk
  92. 4 1
      hw/bsp/board_mcu.h
  93. 0 0
      hw/bsp/broadcom_32bit/boards/raspberrypi_zero_w/board.h
  94. 5 0
      hw/bsp/broadcom_32bit/boards/raspberrypi_zero_w/board.mk
  95. 22 10
      hw/bsp/broadcom_32bit/family.c
  96. 46 0
      hw/bsp/broadcom_32bit/family.mk
  97. 38 0
      hw/bsp/broadcom_64bit/boards/raspberrypi_cm4/board.h
  98. 3 0
      hw/bsp/broadcom_64bit/boards/raspberrypi_cm4/board.mk
  99. 38 0
      hw/bsp/broadcom_64bit/boards/raspberrypi_zero2w/board.h
  100. 3 0
      hw/bsp/broadcom_64bit/boards/raspberrypi_zero2w/board.mk

+ 1 - 1
.github/workflows/build_aarch64.yml

@@ -18,7 +18,7 @@ jobs:
       matrix:
         family:
         # Alphabetical order
-        - 'raspberrypi4'
+        - 'broadcom_64bit'
     steps:
     - name: Setup Python
       uses: actions/setup-python@v2

+ 2 - 1
.github/workflows/build_arm.yml

@@ -39,6 +39,7 @@ jobs:
       matrix:
         family:
         # Alphabetical order
+        - 'broadcom_32bit'
         - 'imxrt'
         - 'lpc15'
         - 'lpc18'
@@ -114,7 +115,7 @@ jobs:
         done
 
   # ---------------------------------------
-  # Build all no-family (opharned) boards
+  # Build all no-family (orphaned) boards
   # ---------------------------------------
   build-board:
     runs-on: ubuntu-latest

+ 2 - 0
.gitignore

@@ -26,3 +26,5 @@ cov-int
 # cppcheck build directories
 *-build-dir
 /_bin/
+__pycache__
+

+ 3 - 0
.gitmodules

@@ -124,6 +124,9 @@
 [submodule "hw/mcu/gd/nuclei-sdk"]
 	path = hw/mcu/gd/nuclei-sdk
 	url = https://github.com/Nuclei-Software/nuclei-sdk.git
+[submodule "hw/mcu/bridgetek/ft9xx/ft90x-sdk"]
+	path = hw/mcu/bridgetek/ft9xx/ft90x-sdk
+	url = https://github.com/BRTSG-FOSS/ft90x-sdk
 [submodule "hw/mcu/mindmotion/mm32sdk"]
 	path = hw/mcu/mindmotion/mm32sdk
 	url = https://github.com/hathach/mm32sdk.git

+ 3 - 2
README.rst

@@ -75,7 +75,7 @@ Supports multiple device configurations by dynamically changing USB descriptors,
 -  Vendor-specific class support with generic In & Out endpoints. Can be used with MS OS 2.0 compatible descriptor to load winUSB driver without INF file.
 -  `WebUSB <https://github.com/WICG/webusb>`__ with vendor-specific class
 
-If you have a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface [raspberrypi/pico-sdk#197](https://github.com/raspberrypi/pico-sdk/pull/197)
+If you have a special requirement, `usbd_app_driver_get_cb()` can be used to write your own class driver without modifying the stack. Here is how the RPi team added their reset interface `raspberrypi/pico-sdk#197 <https://github.com/raspberrypi/pico-sdk/pull/197>`_
 
 Host Stack
 ==========
@@ -91,7 +91,8 @@ TinyUSB is completely thread-safe by pushing all Interrupt Service Request (ISR)
 
 - **No OS**
 - **FreeRTOS**
-- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its [own repo](https://github.com/hathach/mynewt-tinyusb-example)
+- `RT-Thread <https://github.com/RT-Thread/rt-thread>`_
+- **Mynewt** Due to the newt package build system, Mynewt examples are better to be on its `own repo <https://github.com/hathach/mynewt-tinyusb-example>`_
 
 Local Docs
 ==========

+ 1 - 1
docs/reference/supported.rst

@@ -60,7 +60,7 @@ Supported MCUs
 +--------------+---------+-------------+--------+------+-----------+-------------------+--------------+
 | Raspberry Pi | RP2040                | ✔      | ✔    | ✖         | rp2040            |              |
 +--------------+-----------------------+--------+------+-----------+-------------------+--------------+
-| Renesas      | RX 63N, 65N, 72N      | ✔      |     | ✖         | usba              |              |
+| Renesas      | RX 63N, 65N, 72N      | ✔      |     | ✖         | usba              |              |
 +--------------+-----------------------+--------+------+-----------+-------------------+--------------+
 | Silabs       | EFM32GG12             | ✔      |      | ✖         | dwc2              |              |
 +--------------+-----------------------+--------+------+-----------+-------------------+--------------+

+ 0 - 0
examples/device/audio_4_channel_mic/.skip.MCU_SAMD11


+ 0 - 0
examples/device/audio_4_channel_mic/.skip.MCU_SAME5X


+ 0 - 0
examples/device/audio_4_channel_mic/.skip.MCU_SAMG


+ 3 - 0
examples/device/audio_4_channel_mic/skip.txt

@@ -0,0 +1,3 @@
+mcu:SAMD11
+mcu:SAME5X
+mcu:SAMG

+ 0 - 0
examples/device/audio_test/.skip.MCU_SAMD11


+ 0 - 0
examples/device/audio_test/.skip.MCU_SAME5X


+ 0 - 0
examples/device/audio_test/.skip.MCU_SAMG


+ 3 - 0
examples/device/audio_test/skip.txt

@@ -0,0 +1,3 @@
+mcu:SAMD11
+mcu:SAME5X
+mcu:SAMG

+ 0 - 0
examples/device/cdc_msc/.skip.MCU_SAMD11


+ 1 - 0
examples/device/cdc_msc/skip.txt

@@ -0,0 +1 @@
+mcu:SAMD11

+ 1 - 0
examples/device/cdc_msc/src/msc_disk.c

@@ -142,6 +142,7 @@ bool tud_msc_test_unit_ready_cb(uint8_t lun)
 
   // RAM disk is ready until ejected
   if (ejected) {
+    // Additional Sense 3A-00 is NOT_FOUND
     tud_msc_set_sense(lun, SCSI_SENSE_NOT_READY, 0x3a, 0x00);
     return false;
   }

+ 2 - 1
examples/device/cdc_msc/src/tusb_config.h

@@ -48,7 +48,8 @@
 // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
 #ifndef BOARD_DEVICE_RHPORT_SPEED
   #if TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX, OPT_MCU_MIMXRT10XX, OPT_MCU_NUC505) ||\
-      TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711)
+      TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711) ||\
+      TU_CHECK_MCU(OPT_MCU_FT90X, OPT_MCU_FT93X)
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_HIGH_SPEED
   #else
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_FULL_SPEED

+ 10 - 0
examples/device/cdc_msc/src/usb_descriptors.c

@@ -117,6 +117,16 @@ enum
   #define EPNUM_MSC_OUT     0x05
   #define EPNUM_MSC_IN      0x84
 
+#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
+  // FT9XX doesn't support a same endpoint number with different direction IN and OUT
+  //    e.g EP1 OUT & EP1 IN cannot exist together
+  #define EPNUM_CDC_NOTIF   0x81
+  #define EPNUM_CDC_OUT     0x02
+  #define EPNUM_CDC_IN      0x83
+
+  #define EPNUM_MSC_OUT     0x04
+  #define EPNUM_MSC_IN      0x85
+
 #else
   #define EPNUM_CDC_NOTIF   0x81
   #define EPNUM_CDC_OUT     0x02

+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_BCM2711


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_CXD56


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_GD32VF103


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_MSP430x5xx


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_RP2040


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_SAMD11


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_SAMX7X


+ 0 - 0
examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI


+ 10 - 0
examples/device/cdc_msc_freertos/skip.txt

@@ -0,0 +1,10 @@
+mcu:CXD56
+mcu:MSP430x5xx
+mcu:SAMD11
+mcu:VALENTYUSB_EPTRI
+mcu:MKL25ZXX
+mcu:RP2040
+mcu:SAMX7X
+mcu:GD32VF103
+family:broadcom_64bit
+family:broadcom_32bit

+ 0 - 4
examples/device/dfu/.skip.MCU_TM4C123

@@ -1,4 +0,0 @@
-LINK _build/ek-tm4c123gxl/dfu.elf
-/home/runner/cache/toolchain/xpack-arm-none-eabi-gcc-10.2.1-1.1/bin/../lib/gcc/arm-none-eabi/10.2.1/../../../../arm-none-eabi/bin/ld: section .ARM.exidx.text._close LMA [0000000000002980,0000000000002987] overlaps section .data LMA [0000000000002980,0000000000002a03]
-collect2: error: ld returned 1 exit status
-make: *** [../../rules.mk:94: _build/ek-tm4c123gxl/dfu.elf] Error 1

+ 2 - 0
examples/device/dfu/skip.txt

@@ -0,0 +1,2 @@
+mcu:TM4C123
+mcu:BCM2835

+ 0 - 0
examples/device/dynamic_configuration/.skip.MCU_SAMD11


+ 1 - 0
examples/device/dynamic_configuration/skip.txt

@@ -0,0 +1 @@
+mcu:SAMD11

+ 2 - 1
examples/device/hid_boot_interface/src/tusb_config.h

@@ -48,7 +48,8 @@
 // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
 #ifndef BOARD_DEVICE_RHPORT_SPEED
   #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
-       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56 || CFG_TUSB_MCU == OPT_MCU_SAMX7X)
+       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56 || CFG_TUSB_MCU == OPT_MCU_SAMX7X || \
+       CFG_TUSB_MCU == OPT_MCU_FT90X   || CFG_TUSB_MCU == OPT_MCU_FT93X)
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_HIGH_SPEED
   #else
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_FULL_SPEED

+ 2 - 1
examples/device/hid_composite/src/tusb_config.h

@@ -48,7 +48,8 @@
 // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
 #ifndef BOARD_DEVICE_RHPORT_SPEED
   #if TU_CHECK_MCU(OPT_MCU_LPC18XX, OPT_MCU_LPC43XX, OPT_MCU_MIMXRT10XX, OPT_MCU_NUC505) ||\
-      TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711)
+      TU_CHECK_MCU(OPT_MCU_CXD56, OPT_MCU_SAMX7X, OPT_MCU_BCM2711) ||\
+      TU_CHECK_MCU(OPT_MCU_FT90X, OPT_MCU_FT93X)
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_HIGH_SPEED
   #else
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_FULL_SPEED

+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_BCM2711


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_CXD56


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_GD32VF103


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_MSP430x5xx


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_RP2040


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_SAMD11


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_SAMX7X


+ 0 - 0
examples/device/hid_composite_freertos/.skip.MCU_VALENTYUSB_EPTRI


+ 9 - 0
examples/device/hid_composite_freertos/skip.txt

@@ -0,0 +1,9 @@
+mcu:CXD56
+mcu:MSP430x5xx
+mcu:SAMD11
+mcu:VALENTYUSB_EPTRI
+mcu:RP2040
+mcu:SAMX7X
+mcu:GD32VF103
+family:broadcom_64bit
+family:broadcom_32bit

+ 2 - 1
examples/device/hid_multiple_interface/src/tusb_config.h

@@ -48,7 +48,8 @@
 // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
 #ifndef BOARD_DEVICE_RHPORT_SPEED
   #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
-       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56)
+       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56 || \
+       CFG_TUSB_MCU == OPT_MCU_FT90X   || CFG_TUSB_MCU == OPT_MCU_FT93X)
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_HIGH_SPEED
   #else
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_FULL_SPEED

+ 2 - 1
examples/device/midi_test/src/tusb_config.h

@@ -48,7 +48,8 @@
 // Default to Highspeed for MCU with internal HighSpeed PHY (can be port specific), otherwise FullSpeed
 #ifndef BOARD_DEVICE_RHPORT_SPEED
   #if (CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX || \
-       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56)
+       CFG_TUSB_MCU == OPT_MCU_NUC505  || CFG_TUSB_MCU == OPT_MCU_CXD56 || \
+       CFG_TUSB_MCU == OPT_MCU_FT90X   || CFG_TUSB_MCU == OPT_MCU_FT93X)
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_HIGH_SPEED
   #else
     #define BOARD_DEVICE_RHPORT_SPEED   OPT_MODE_FULL_SPEED

+ 10 - 4
examples/device/midi_test/src/usb_descriptors.c

@@ -83,9 +83,15 @@ enum
 #if CFG_TUSB_MCU == OPT_MCU_LPC175X_6X || CFG_TUSB_MCU == OPT_MCU_LPC177X_8X || CFG_TUSB_MCU == OPT_MCU_LPC40XX
   // LPC 17xx and 40xx endpoint type (bulk/interrupt/iso) are fixed by its number
   // 0 control, 1 In, 2 Bulk, 3 Iso, 4 In etc ...
-  #define EPNUM_MIDI   0x02
+  #define EPNUM_MIDI_OUT   0x02
+  #define EPNUM_MIDI_IN   0x02
+#elif CFG_TUSB_MCU == OPT_MCU_FT90X || CFG_TUSB_MCU == OPT_MCU_FT93X
+  // On Bridgetek FT9xx endpoint numbers must be unique...
+  #define EPNUM_MIDI_OUT   0x02
+  #define EPNUM_MIDI_IN   0x03
 #else
-  #define EPNUM_MIDI   0x01
+  #define EPNUM_MIDI_OUT   0x01
+  #define EPNUM_MIDI_IN   0x01
 #endif
 
 uint8_t const desc_fs_configuration[] =
@@ -94,7 +100,7 @@ uint8_t const desc_fs_configuration[] =
   TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
 
   // Interface number, string index, EP Out & EP In address, EP size
-  TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 64)
+  TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI_OUT, (0x80 | EPNUM_MIDI_IN), 64)
 };
 
 #if TUD_OPT_HIGH_SPEED
@@ -104,7 +110,7 @@ uint8_t const desc_hs_configuration[] =
   TUD_CONFIG_DESCRIPTOR(1, ITF_NUM_TOTAL, 0, CONFIG_TOTAL_LEN, 0x00, 100),
 
   // Interface number, string index, EP Out & EP In address, EP size
-  TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI, 0x80 | EPNUM_MIDI, 512)
+  TUD_MIDI_DESCRIPTOR(ITF_NUM_MIDI, 0, EPNUM_MIDI_OUT, (0x80 | EPNUM_MIDI_IN), 512)
 };
 #endif
 

+ 0 - 0
examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX


+ 0 - 0
examples/device/msc_dual_lun/.skip.MCU_SAMD11


+ 2 - 0
examples/device/msc_dual_lun/skip.txt

@@ -0,0 +1,2 @@
+mcu:SAMD11
+mcu:MKL25ZXX

+ 0 - 1
examples/device/net_lwip_webserver/.skip.MCU_BCM2711

@@ -1 +0,0 @@
-tinyusb/lib/lwip/src/include/lwip/arch.h:202:13: error: conflicting types for 'ssize_t'

+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX


+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_LPC13XX


+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX


+ 0 - 1
examples/device/net_lwip_webserver/.skip.MCU_MSP430x5xx

@@ -1 +0,0 @@
-too many warnings for 16-bit integer overflow

+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_NUC121


+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_SAMD11


+ 0 - 0
examples/device/net_lwip_webserver/.skip.MCU_STM32L0


+ 10 - 0
examples/device/net_lwip_webserver/skip.txt

@@ -0,0 +1,10 @@
+mcu:LPC11UXX
+mcu:LPC13XX
+mcu:MSP430x5xx
+mcu:NUC121
+mcu:SAMD11
+mcu:STM32L0
+mcu:MKL25ZXX
+family:broadcom_64bit
+family:broadcom_32bit
+board:curiosity_nano

+ 0 - 0
examples/device/uac2_headset/.skip.MCU_LPC11UXX


+ 0 - 0
examples/device/uac2_headset/.skip.MCU_LPC13XX


+ 0 - 0
examples/device/uac2_headset/.skip.MCU_NUC121


+ 0 - 0
examples/device/uac2_headset/.skip.MCU_SAMD11


+ 0 - 0
examples/device/uac2_headset/.skip.MCU_SAME5X


+ 0 - 0
examples/device/uac2_headset/.skip.MCU_SAMG


+ 6 - 0
examples/device/uac2_headset/skip.txt

@@ -0,0 +1,6 @@
+mcu:LPC11UXX
+mcu:LPC13XX
+mcu:NUC121
+mcu:SAMD11
+mcu:SAME5X
+mcu:SAMG

+ 1 - 0
examples/device/usbtmc/skip.txt

@@ -0,0 +1 @@
+mcu:BCM2835

+ 0 - 1
examples/device/video_capture/.skip.MCU_MSP430x5xx

@@ -1 +0,0 @@
-too many warnings for 16-bit integer overflow

+ 0 - 0
examples/device/video_capture/.skip.MCU_SAMD11


+ 2 - 0
examples/device/video_capture/skip.txt

@@ -0,0 +1,2 @@
+mcu:MSP430x5xx
+mcu:SAMD11

+ 1 - 1
examples/device/video_capture/src/usb_descriptors.h

@@ -103,7 +103,7 @@ enum {
         TUD_VIDEO_DESC_CS_VS_FRM_UNCOMPR_CONT(/*bFrameIndex */1, 0, _width, _height, \
             _width * _height * 16, _width * _height * 16 * _fps, \
             _width * _height * 16, \
-            (10000000/_fps), (10000000/_fps), 10000000, 100000), \
+            (10000000/_fps), (10000000/_fps), (10000000/_fps)*_fps, (10000000/_fps)), \
         TUD_VIDEO_DESC_CS_VS_COLOR_MATCHING(VIDEO_COLOR_PRIMARIES_BT709, VIDEO_COLOR_XFER_CH_BT709, VIDEO_COLOR_COEF_SMPTE170M), \
   /* VS alt 1 */\
   TUD_VIDEO_DESC_STD_VS(1, 1, 1, 0), \

+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_LPC18XX


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_LPC40XX


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_LPC43XX


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_MSP432E4


+ 0 - 0
examples/host/cdc_msc_hid/.only.MCU_RP2040


+ 9 - 0
examples/host/cdc_msc_hid/only.txt

@@ -0,0 +1,9 @@
+mcu:LPC175X_6X
+mcu:LPC177X_8X
+mcu:LPC18XX
+mcu:LPC40XX
+mcu:LPC43XX
+mcu:MIMXRT10XX
+mcu:RP2040
+mcu:MSP432E4
+mcu:RX65X

+ 0 - 0
examples/host/hid_controller/.only.MCU_LPC175X_6X


+ 0 - 0
examples/host/hid_controller/.only.MCU_LPC177X_8X


+ 0 - 0
examples/host/hid_controller/.only.MCU_LPC18XX


+ 0 - 0
examples/host/hid_controller/.only.MCU_LPC40XX


+ 0 - 0
examples/host/hid_controller/.only.MCU_LPC43XX


+ 0 - 0
examples/host/hid_controller/.only.MCU_MIMXRT10XX


+ 0 - 0
examples/host/hid_controller/.only.MCU_MSP432E4


+ 0 - 0
examples/host/hid_controller/.only.MCU_RP2040


+ 9 - 0
examples/host/hid_controller/only.txt

@@ -0,0 +1,9 @@
+mcu:LPC175X_6X
+mcu:LPC177X_8X
+mcu:LPC18XX
+mcu:LPC40XX
+mcu:LPC43XX
+mcu:MIMXRT10XX
+mcu:RP2040
+mcu:MSP432E4
+mcu:RX65X

+ 3 - 1
examples/make.mk

@@ -54,6 +54,8 @@ endif
 #-------------- Cross Compiler  ------------
 # Can be set by board, default to ARM GCC
 CROSS_COMPILE ?= arm-none-eabi-
+# Allow for -Os to be changed by board makefiles in case -Os is not allowed
+CFLAGS_OPTIMIZED ?= -Os
 
 CC = $(CROSS_COMPILE)gcc
 CXX = $(CROSS_COMPILE)g++
@@ -112,7 +114,7 @@ CFLAGS += \
 ifeq ($(DEBUG), 1)
   CFLAGS += -Og
 else
-  CFLAGS += -Os
+  CFLAGS += $(CFLAGS_OPTIMIZED)
 endif
 
 # Log level is mapped to TUSB DEBUG option

+ 8 - 2
examples/rules.mk

@@ -12,8 +12,10 @@ ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
 # Compiler Flags
 # ---------------------------------------
 
+LIBS_GCC ?= -lgcc -lm -lnosys
+
 # libc
-LIBS += -lgcc -lm -lnosys
+LIBS += $(LIBS_GCC)
 
 ifneq ($(BOARD), spresense)
 LIBS += -lc
@@ -49,7 +51,11 @@ ifeq ($(NO_LTO),1)
 CFLAGS := $(filter-out -flto,$(CFLAGS))
 endif
 
-LDFLAGS += $(CFLAGS) -Wl,-T,$(TOP)/$(LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections
+ifneq ($(LD_FILE),)
+LDFLAGS_LD_FILE ?= -Wl,-T,$(TOP)/$(LD_FILE)
+endif
+
+LDFLAGS += $(CFLAGS) $(LDFLAGS_LD_FILE) -Wl,-Map=$@.map -Wl,-cref -Wl,-gc-sections
 ifneq ($(SKIP_NANOLIB), 1)
 LDFLAGS += -specs=nosys.specs -specs=nano.specs
 endif

+ 4 - 1
hw/bsp/board_mcu.h

@@ -32,7 +32,7 @@
 
 //--------------------------------------------------------------------+
 // Low Level MCU header include. TinyUSB stack and example should be
-// platform independent and mostly doens't need to include this file.
+// platform independent and mostly doesn't need to include this file.
 // However there are still certain situation where this file is needed:
 // - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
 // - SWO logging for Cortex M with ITM_SendChar() / ITM_ReceiveChar()
@@ -146,6 +146,9 @@
 #elif CFG_TUSB_MCU == OPT_MCU_TM4C123
   #include "TM4C123.h"
 
+#elif TU_CHECK_MCU(OPT_MCU_BCM2711, OPT_MCU_BCM2835, OPT_MCU_BCM2837)
+  // no header needed
+
 #else
   #error "Missing MCU header"
 #endif

+ 0 - 0
hw/bsp/raspberrypi4/boards/raspberrypi_cm4/board.h → hw/bsp/broadcom_32bit/boards/raspberrypi_zero_w/board.h


+ 5 - 0
hw/bsp/broadcom_32bit/boards/raspberrypi_zero_w/board.mk

@@ -0,0 +1,5 @@
+CFLAGS += -mcpu=arm1176jzf-s \
+          -DBCM_VERSION=2835 \
+          -DCFG_TUSB_MCU=OPT_MCU_BCM2835
+
+SUFFIX = 

+ 22 - 10
hw/bsp/raspberrypi4/family.c → hw/bsp/broadcom_32bit/family.c

@@ -27,8 +27,9 @@
 #include "bsp/board.h"
 #include "board.h"
 
+#include "broadcom/cpu.h"
+#include "broadcom/gpio.h"
 #include "broadcom/interrupts.h"
-#include "broadcom/io.h"
 #include "broadcom/mmu.h"
 #include "broadcom/caches.h"
 #include "broadcom/vcmailbox.h"
@@ -37,9 +38,8 @@
 #define LED_PIN               18
 #define LED_STATE_ON          1
 
-// Button
-#define BUTTON_PIN            16
-#define BUTTON_STATE_ACTIVE   0
+// UART TX
+#define UART_TX_PIN           14
 
 //--------------------------------------------------------------------+
 // Forward USB interrupt events to TinyUSB IRQ Handler
@@ -62,14 +62,26 @@ void board_init(void)
   init_caches();
 
   // LED
-  gpio_initOutputPinWithPullNone(LED_PIN);
+  gpio_set_function(LED_PIN, GPIO_FUNCTION_OUTPUT);
+  gpio_set_pull(LED_PIN, BP_PULL_NONE);
   board_led_write(true);
 
-  // Button
-  // TODO
-
   // Uart
-  uart_init();
+  COMPLETE_MEMORY_READS;
+  AUX->ENABLES_b.UART_1 = true;
+
+  UART1->IER = 0;
+  UART1->CNTL = 0;
+  UART1->LCR_b.DATA_SIZE = UART1_LCR_DATA_SIZE_MODE_8BIT;
+  UART1->MCR = 0;
+  UART1->IER = 0;
+
+  uint32_t source_clock = vcmailbox_get_clock_rate_measured(VCMAILBOX_CLOCK_CORE);
+  UART1->BAUD = ((source_clock / (115200 * 8)) - 1);
+  UART1->CNTL |= UART1_CNTL_TX_ENABLE_Msk;
+  COMPLETE_MEMORY_READS;
+
+  gpio_set_function(UART_TX_PIN, GPIO_FUNCTION_ALT5);
 
   // Turn on USB peripheral.
   vcmailbox_set_power_state(VCMAILBOX_DEVICE_USB_HCD, true);
@@ -87,7 +99,7 @@ void board_init(void)
 
 void board_led_write(bool state)
 {
-  gpio_setPinOutputBool(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
+  gpio_set_value(LED_PIN, state ? LED_STATE_ON : (1-LED_STATE_ON));
 }
 
 uint32_t board_button_read(void)

+ 46 - 0
hw/bsp/broadcom_32bit/family.mk

@@ -0,0 +1,46 @@
+MCU_DIR = hw/mcu/broadcom
+DEPS_SUBMODULES += $(MCU_DIR)
+
+include $(TOP)/$(BOARD_PATH)/board.mk
+
+CFLAGS += \
+	-Wall \
+	-O0 \
+	-ffreestanding \
+	-nostdlib \
+	-nostartfiles \
+	-mgeneral-regs-only \
+	-fno-exceptions \
+	-std=c17
+
+CROSS_COMPILE = arm-none-eabi-
+
+# mcu driver cause following warnings
+CFLAGS += -Wno-error=cast-qual
+
+SRC_C += \
+	src/portable/synopsys/dwc2/dcd_dwc2.c \
+	$(MCU_DIR)/broadcom/gen/interrupt_handlers.c \
+	$(MCU_DIR)/broadcom/gpio.c \
+	$(MCU_DIR)/broadcom/interrupts.c \
+	$(MCU_DIR)/broadcom/mmu.c \
+	$(MCU_DIR)/broadcom/caches.c \
+	$(MCU_DIR)/broadcom/vcmailbox.c
+
+SKIP_NANOLIB = 1
+
+LD_FILE = $(MCU_DIR)/broadcom/link$(SUFFIX).ld
+
+INC += \
+	$(TOP)/$(BOARD_PATH) \
+	$(TOP)/$(MCU_DIR)
+
+SRC_S += $(MCU_DIR)/broadcom/boot$(SUFFIX).S
+
+$(BUILD)/kernel$(SUFFIX).img: $(BUILD)/$(PROJECT).elf
+	$(OBJCOPY) -O binary $^ $@
+
+# Copy to kernel to netboot drive or SD card
+# Change destinaation to fit your need
+flash: $(BUILD)/kernel$(SUFFIX).img
+	@$(CP) $< /home/$(USER)/Documents/code/pi_tinyusb/boot_cpy

+ 38 - 0
hw/bsp/broadcom_64bit/boards/raspberrypi_cm4/board.h

@@ -0,0 +1,38 @@
+/* 
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* BOARD_H_ */

+ 3 - 0
hw/bsp/broadcom_64bit/boards/raspberrypi_cm4/board.mk

@@ -0,0 +1,3 @@
+CFLAGS += -mcpu=cortex-a72 \
+          -DBCM_VERSION=2711 \
+          -DCFG_TUSB_MCU=OPT_MCU_BCM2711

+ 38 - 0
hw/bsp/broadcom_64bit/boards/raspberrypi_zero2w/board.h

@@ -0,0 +1,38 @@
+/* 
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2020, Ha Thach (tinyusb.org)
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ *
+ * This file is part of the TinyUSB stack.
+ */
+
+#ifndef BOARD_H_
+#define BOARD_H_
+
+#ifdef __cplusplus
+ extern "C" {
+#endif
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif /* BOARD_H_ */

+ 3 - 0
hw/bsp/broadcom_64bit/boards/raspberrypi_zero2w/board.mk

@@ -0,0 +1,3 @@
+CFLAGS += -mcpu=cortex-a53 \
+          -DBCM_VERSION=2837 \
+          -DCFG_TUSB_MCU=OPT_MCU_BCM2837

Vissa filer visades inte eftersom för många filer har ändrats