Jelajahi Sumber

Merge remote-tracking branch 'hathach/master'

tfx2001 3 tahun lalu
induk
melakukan
08ec092c66
100 mengubah file dengan 700 tambahan dan 171 penghapusan
  1. 3 0
      .github/workflows/build_aarch64.yml
  2. 17 43
      .github/workflows/build_arm.yml
  3. 3 0
      .github/workflows/build_msp430.yml
  4. 3 0
      .github/workflows/build_renesas.yml
  5. 3 0
      .github/workflows/build_riscv.yml
  6. 1 1
      README.rst
  7. 6 1
      docs/reference/getting_started.rst
  8. 3 0
      examples/device/audio_4_channel_mic/CMakeLists.txt
  9. 1 1
      examples/device/audio_4_channel_mic/src/main.c
  10. 2 2
      examples/device/audio_4_channel_mic/src/usb_descriptors.c
  11. 3 0
      examples/device/audio_test/CMakeLists.txt
  12. 1 1
      examples/device/audio_test/src/main.c
  13. 2 2
      examples/device/audio_test/src/usb_descriptors.c
  14. 3 0
      examples/device/board_test/CMakeLists.txt
  15. 3 0
      examples/device/cdc_dual_ports/CMakeLists.txt
  16. 4 2
      examples/device/cdc_dual_ports/src/main.c
  17. 2 2
      examples/device/cdc_dual_ports/src/usb_descriptors.c
  18. 3 0
      examples/device/cdc_msc/CMakeLists.txt
  19. 1 1
      examples/device/cdc_msc/src/usb_descriptors.c
  20. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_F1C100S
  21. 1 1
      examples/device/cdc_msc_freertos/Makefile
  22. 7 6
      examples/device/cdc_msc_freertos/skip.txt
  23. 1 0
      examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h
  24. 2 2
      examples/device/cdc_msc_freertos/src/usb_descriptors.c
  25. 4 1
      examples/device/dfu/CMakeLists.txt
  26. 1 1
      examples/device/dfu/src/usb_descriptors.c
  27. 3 0
      examples/device/dfu_runtime/CMakeLists.txt
  28. 2 2
      examples/device/dfu_runtime/src/usb_descriptors.c
  29. 3 0
      examples/device/dynamic_configuration/CMakeLists.txt
  30. 1 1
      examples/device/dynamic_configuration/src/main.c
  31. 3 3
      examples/device/dynamic_configuration/src/msc_disk.c
  32. 3 3
      examples/device/dynamic_configuration/src/usb_descriptors.c
  33. 3 0
      examples/device/hid_boot_interface/CMakeLists.txt
  34. 1 1
      examples/device/hid_boot_interface/src/main.c
  35. 2 2
      examples/device/hid_boot_interface/src/usb_descriptors.c
  36. 3 0
      examples/device/hid_composite/CMakeLists.txt
  37. 2 2
      examples/device/hid_composite/src/main.c
  38. 2 2
      examples/device/hid_composite/src/usb_descriptors.c
  39. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_F1C100S
  40. 1 1
      examples/device/hid_composite_freertos/Makefile
  41. 7 5
      examples/device/hid_composite_freertos/skip.txt
  42. 1 1
      examples/device/hid_composite_freertos/src/main.c
  43. 2 2
      examples/device/hid_composite_freertos/src/usb_descriptors.c
  44. 3 0
      examples/device/hid_generic_inout/CMakeLists.txt
  45. 2 2
      examples/device/hid_generic_inout/src/usb_descriptors.c
  46. 3 0
      examples/device/hid_multiple_interface/CMakeLists.txt
  47. 2 2
      examples/device/hid_multiple_interface/src/usb_descriptors.c
  48. 3 0
      examples/device/midi_test/CMakeLists.txt
  49. 1 1
      examples/device/midi_test/src/main.c
  50. 2 2
      examples/device/midi_test/src/usb_descriptors.c
  51. 3 0
      examples/device/msc_dual_lun/CMakeLists.txt
  52. 3 3
      examples/device/msc_dual_lun/src/msc_disk_dual.c
  53. 2 2
      examples/device/msc_dual_lun/src/usb_descriptors.c
  54. 11 0
      examples/device/net_lwip_webserver/CMakeLists.txt
  55. 2 2
      examples/device/net_lwip_webserver/src/usb_descriptors.c
  56. 3 0
      examples/device/uac2_headset/CMakeLists.txt
  57. 8 8
      examples/device/uac2_headset/src/main.c
  58. 2 2
      examples/device/uac2_headset/src/usb_descriptors.c
  59. 3 0
      examples/device/usbtmc/CMakeLists.txt
  60. 1 1
      examples/device/usbtmc/src/usb_descriptors.c
  61. 3 0
      examples/device/video_capture/CMakeLists.txt
  62. 2 1
      examples/device/video_capture/skip.txt
  63. 2 2
      examples/device/video_capture/src/usb_descriptors.c
  64. 3 0
      examples/device/webusb_serial/CMakeLists.txt
  65. 2 2
      examples/device/webusb_serial/src/usb_descriptors.c
  66. 15 0
      examples/dual/host_hid_to_device_cdc/CMakeLists.txt
  67. 3 3
      examples/dual/host_hid_to_device_cdc/src/main.c
  68. 1 1
      examples/dual/host_hid_to_device_cdc/src/usb_descriptors.c
  69. 31 0
      examples/example.cmake
  70. 3 0
      examples/host/bare_api/CMakeLists.txt
  71. 2 0
      examples/host/bare_api/only.txt
  72. 8 7
      examples/host/bare_api/src/main.c
  73. 3 0
      examples/host/cdc_msc_hid/CMakeLists.txt
  74. 2 0
      examples/host/cdc_msc_hid/only.txt
  75. 1 1
      examples/host/cdc_msc_hid/src/tusb_config.h
  76. 3 0
      examples/host/hid_controller/CMakeLists.txt
  77. 2 0
      examples/host/hid_controller/only.txt
  78. 11 10
      examples/make.mk
  79. 18 9
      examples/rules.mk
  80. 4 1
      hw/bsp/board.h
  81. 8 2
      hw/bsp/board_mcu.h
  82. 1 1
      hw/bsp/broadcom_32bit/family.mk
  83. 1 1
      hw/bsp/broadcom_64bit/family.mk
  84. 1 0
      hw/bsp/d5035_01/same51j19a_flash.ld
  85. 2 2
      hw/bsp/ea4088qs/ea4088qs.c
  86. 1 1
      hw/bsp/f1c100s/README.md
  87. 1 1
      hw/bsp/frdm_k32l2b/board.mk
  88. 1 1
      hw/bsp/frdm_kl25z/board.mk
  89. 2 2
      hw/bsp/imxrt/boards/mimxrt1050_evkb/board.h
  90. 52 0
      hw/bsp/imxrt/boards/teensy_41/board.h
  91. 10 0
      hw/bsp/imxrt/boards/teensy_41/board.mk
  92. 49 0
      hw/bsp/imxrt/boards/teensy_41/teensy41_flexspi_nor_config.c
  93. 268 0
      hw/bsp/imxrt/boards/teensy_41/teensy41_flexspi_nor_config.h
  94. 2 2
      hw/bsp/imxrt/family.mk
  95. 1 1
      hw/bsp/kuiic/kuiic.c
  96. 1 1
      hw/bsp/lpcxpresso11u37/board.mk
  97. 1 1
      hw/bsp/lpcxpresso1347/board.mk
  98. 0 1
      hw/bsp/mm32/boards/mm32f327x_mb39/mm32f327x_mb39.c
  99. 3 0
      hw/bsp/nutiny_nuc121s/board.mk
  100. 3 0
      hw/bsp/nutiny_nuc125s/board.mk

+ 3 - 0
.github/workflows/build_aarch64.yml

@@ -55,6 +55,9 @@ jobs:
     - name: Set Toolchain Path
     - name: Set Toolchain Path
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
 
 
+    - name: Get Dependencies
+      run: python3 tools/get_dependencies.py ${{ matrix.family }}
+
     - name: Build
     - name: Build
       run: python3 tools/build_family.py ${{ matrix.family }}
       run: python3 tools/build_family.py ${{ matrix.family }}
 
 

+ 17 - 43
.github/workflows/build_arm.yml

@@ -57,13 +57,20 @@ jobs:
         - 'stm32f1'
         - 'stm32f1'
         - 'stm32f4'
         - 'stm32f4'
         - 'stm32f7'
         - 'stm32f7'
+        - 'stm32g4'
         - 'stm32h7'
         - 'stm32h7'
         - 'stm32l4'
         - 'stm32l4'
+        - 'stm32wb'
         - 'tm4c123'
         - 'tm4c123'
         - 'xmc4000'
         - 'xmc4000'
     steps:
     steps:
     - name: Setup Python
     - name: Setup Python
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v3
+
+    - name: Install ARM GCC
+      uses: carlosperate/arm-none-eabi-gcc-action@v1
+      with:
+        release: '11.2-2022.02'
 
 
     - name: Checkout TinyUSB
     - name: Checkout TinyUSB
       uses: actions/checkout@v3
       uses: actions/checkout@v3
@@ -77,32 +84,14 @@ jobs:
          repository: hathach/linkermap
          repository: hathach/linkermap
          path: linkermap
          path: linkermap
 
 
-    - name: Checkout pico-sdk
+    - name: Checkout pico-sdk for rp2040
       if: matrix.family == 'rp2040'
       if: matrix.family == 'rp2040'
       run: |
       run: |
         git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk
         git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk
         echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
         echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
-        git submodule update --init hw/mcu/raspberry_pi/Pico-PIO-USB
-
-    - name: Set Toolchain URL
-      run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz
-
-    - name: Cache Toolchain
-      uses: actions/cache@v2
-      id: cache-toolchain
-      with:
-        path: ~/cache/
-        key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
-
-    - name: Install Toolchain
-      if: steps.cache-toolchain.outputs.cache-hit != 'true'
-      run: |
-        mkdir -p ~/cache/toolchain
-        wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
-        tar -C ~/cache/toolchain -xaf toolchain.tar.gz
 
 
-    - name: Set Toolchain Path
-      run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
+    - name: Get Dependencies
+      run: python3 tools/get_dependencies.py ${{ matrix.family }}
 
 
     - name: Build
     - name: Build
       run: python3 tools/build_family.py ${{ matrix.family }}
       run: python3 tools/build_family.py ${{ matrix.family }}
@@ -133,7 +122,12 @@ jobs:
 
 
     steps:
     steps:
     - name: Setup Python
     - name: Setup Python
-      uses: actions/setup-python@v2
+      uses: actions/setup-python@v3
+
+    - name: Install ARM GCC
+      uses: carlosperate/arm-none-eabi-gcc-action@v1
+      with:
+        release: '11.2-2022.02'
 
 
     - name: Checkout TinyUSB
     - name: Checkout TinyUSB
       uses: actions/checkout@v3
       uses: actions/checkout@v3
@@ -141,25 +135,5 @@ jobs:
     - name: Checkout common submodules in lib
     - name: Checkout common submodules in lib
       run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
       run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
 
 
-    - name: Set Toolchain URL
-      run: echo >> $GITHUB_ENV TOOLCHAIN_URL=https://github.com/xpack-dev-tools/arm-none-eabi-gcc-xpack/releases/download/v10.2.1-1.1/xpack-arm-none-eabi-gcc-10.2.1-1.1-linux-x64.tar.gz
-
-    - name: Cache Toolchain
-      uses: actions/cache@v2
-      id: cache-toolchain
-      with:
-        path: ~/cache/
-        key: ${{ runner.os }}-21-03-04-${{ env.TOOLCHAIN_URL }}
-
-    - name: Install Toolchain
-      if: steps.cache-toolchain.outputs.cache-hit != 'true'
-      run: |
-        mkdir -p ~/cache/toolchain
-        wget --progress=dot:mega $TOOLCHAIN_URL -O toolchain.tar.gz
-        tar -C ~/cache/toolchain -xaf toolchain.tar.gz
-
-    - name: Set Toolchain Path
-      run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
-
     - name: Build
     - name: Build
       run: python3 tools/build_board.py ${{ matrix.example }}
       run: python3 tools/build_board.py ${{ matrix.example }}

+ 3 - 0
.github/workflows/build_msp430.yml

@@ -52,6 +52,9 @@ jobs:
     - name: Set Toolchain Path
     - name: Set Toolchain Path
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
 
 
+    - name: Get Dependencies
+      run: python3 tools/get_dependencies.py ${{ matrix.family }}
+
     - name: Build
     - name: Build
       run: python3 tools/build_family.py ${{ matrix.family }}
       run: python3 tools/build_family.py ${{ matrix.family }}
 
 

+ 3 - 0
.github/workflows/build_renesas.yml

@@ -53,6 +53,9 @@ jobs:
     - name: Set Toolchain Path
     - name: Set Toolchain Path
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
 
 
+    - name: Get Dependencies
+      run: python3 tools/get_dependencies.py ${{ matrix.family }}
+
     - name: Build
     - name: Build
       run: python3 tools/build_family.py ${{ matrix.family }}
       run: python3 tools/build_family.py ${{ matrix.family }}
 
 

+ 3 - 0
.github/workflows/build_riscv.yml

@@ -53,6 +53,9 @@ jobs:
     - name: Set Toolchain Path
     - name: Set Toolchain Path
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
       run: echo >> $GITHUB_PATH `echo ~/cache/toolchain/*/bin`
 
 
+    - name: Get Dependencies
+      run: python3 tools/get_dependencies.py ${{ matrix.family }}
+
     - name: Build
     - name: Build
       run: python3 tools/build_family.py ${{ matrix.family }}
       run: python3 tools/build_family.py ${{ matrix.family }}
 
 

+ 1 - 1
README.rst

@@ -82,7 +82,7 @@ Host Stack
 
 
 - Human Interface Device (HID): Keyboard, Mouse, Generic
 - Human Interface Device (HID): Keyboard, Mouse, Generic
 - Mass Storage Class (MSC)
 - Mass Storage Class (MSC)
-- Hub currently only supports 1 level of hub (due to my laziness)
+- Hub with multiple-level support
 
 
 OS Abstraction layer
 OS Abstraction layer
 ====================
 ====================

+ 6 - 1
docs/reference/getting_started.rst

@@ -50,7 +50,12 @@ Some TinyUSB examples also requires external submodule libraries in ``/lib`` suc
 
 
    $ git submodule update --init lib
    $ git submodule update --init lib
 
 
-In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. Luckily, it will be fetched if needed when you run the ``make`` to build your board.
+In addition, MCU driver submodule is also needed to provide low-level MCU peripheral's driver. To download these depencies for your board, run the ``get-dpes`` as follow.
+
+.. code-block::
+
+   $ make BOARD=feather_nrf52840_express get-deps
+
 
 
 Some modules will also require a module-specific SDK (e.g. RP2040) or binary (e.g. Sony Spresense) to build examples.
 Some modules will also require a module-specific SDK (e.g. RP2040) or binary (e.g. Sony Spresense) to build examples.
 
 

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

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
   ${CMAKE_CURRENT_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}/src
 )
 )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/audio_4_channel_mic/src/main.c

@@ -221,7 +221,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
         // Request uses format layout 2
         // Request uses format layout 2
         TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
         TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
 
 
-        volume[channelNum] = ((audio_control_cur_2_t*) pBuff)->bCur;
+        volume[channelNum] = (uint16_t) ((audio_control_cur_2_t*) pBuff)->bCur;
 
 
         TU_LOG2("    Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
         TU_LOG2("    Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
       return true;
       return true;

+ 2 - 2
examples/device/audio_4_channel_mic/src/usb_descriptors.c

@@ -149,7 +149,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     for(uint8_t i=0; i<chr_count; i++)
     for(uint8_t i=0; i<chr_count; i++)
@@ -159,7 +159,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

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

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
   ${CMAKE_CURRENT_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}/src
 )
 )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/audio_test/src/main.c

@@ -222,7 +222,7 @@ bool tud_audio_set_req_entity_cb(uint8_t rhport, tusb_control_request_t const *
         // Request uses format layout 2
         // Request uses format layout 2
         TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
         TU_VERIFY(p_request->wLength == sizeof(audio_control_cur_2_t));
 
 
-        volume[channelNum] = ((audio_control_cur_2_t*) pBuff)->bCur;
+        volume[channelNum] = (uint16_t) ((audio_control_cur_2_t*) pBuff)->bCur;
 
 
         TU_LOG2("    Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
         TU_LOG2("    Set Volume: %d dB of channel: %u\r\n", volume[channelNum], channelNum);
       return true;
       return true;

+ 2 - 2
examples/device/audio_test/src/usb_descriptors.c

@@ -149,7 +149,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     for(uint8_t i=0; i<chr_count; i++)
     for(uint8_t i=0; i<chr_count; i++)
@@ -159,7 +159,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/board_test/CMakeLists.txt

@@ -36,6 +36,9 @@ else()
           ${CMAKE_CURRENT_SOURCE_DIR}/src
           ${CMAKE_CURRENT_SOURCE_DIR}/src
           )
           )
 
 
+  # Example common such as compiler warnings
+  include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
   # Configure compilation flags and libraries for the example... see the corresponding function
   # Configure compilation flags and libraries for the example... see the corresponding function
   # in hw/bsp/FAMILY/family.cmake for details.
   # in hw/bsp/FAMILY/family.cmake for details.
   family_configure_device_example(${PROJECT})
   family_configure_device_example(${PROJECT})

+ 3 - 0
examples/device/cdc_dual_ports/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 4 - 2
examples/device/cdc_dual_ports/src/main.c

@@ -55,17 +55,19 @@ int main(void)
 // with Serial0 as all lower case, Serial1 as all upper case
 // with Serial0 as all lower case, Serial1 as all upper case
 static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count)
 static void echo_serial_port(uint8_t itf, uint8_t buf[], uint32_t count)
 {
 {
+  uint8_t const case_diff = 'a' - 'A';
+
   for(uint32_t i=0; i<count; i++)
   for(uint32_t i=0; i<count; i++)
   {
   {
     if (itf == 0)
     if (itf == 0)
     {
     {
       // echo back 1st port as lower case
       // echo back 1st port as lower case
-      if (isupper(buf[i])) buf[i] += 'a' - 'A';
+      if (isupper(buf[i])) buf[i] += case_diff;
     }
     }
     else
     else
     {
     {
       // echo back 2nd port as upper case
       // echo back 2nd port as upper case
-      if (islower(buf[i])) buf[i] -= 'a' - 'A';
+      if (islower(buf[i])) buf[i] -= case_diff;
     }
     }
 
 
     tud_cdc_n_write_char(itf, buf[i]);
     tud_cdc_n_write_char(itf, buf[i]);

+ 2 - 2
examples/device/cdc_dual_ports/src/usb_descriptors.c

@@ -236,7 +236,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -247,7 +247,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/cdc_msc/CMakeLists.txt

@@ -24,6 +24,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/cdc_msc/src/usb_descriptors.c

@@ -282,7 +282,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

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


+ 1 - 1
examples/device/cdc_msc_freertos/Makefile

@@ -30,7 +30,7 @@ SRC_C += \
 	$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
 	$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
 
 
 # Suppress FreeRTOS warnings
 # Suppress FreeRTOS warnings
-CFLAGS += -Wno-error=cast-qual
+CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
 
 
 # FreeRTOS (lto + Os) linker issue
 # FreeRTOS (lto + Os) linker issue
 LDFLAGS += -Wl,--undefined=vTaskSwitchContext
 LDFLAGS += -Wl,--undefined=vTaskSwitchContext

+ 7 - 6
examples/device/cdc_msc_freertos/skip.txt

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

+ 1 - 0
examples/device/cdc_msc_freertos/src/FreeRTOSConfig/FreeRTOSConfig.h

@@ -53,6 +53,7 @@
 #if CFG_TUSB_MCU == OPT_MCU_MM32F327X
 #if CFG_TUSB_MCU == OPT_MCU_MM32F327X
   extern u32 SystemCoreClock;
   extern u32 SystemCoreClock;
 #else
 #else
+  // FIXME cause redundant-decls warnings
   extern uint32_t SystemCoreClock;
   extern uint32_t SystemCoreClock;
 #endif
 #endif
 
 

+ 2 - 2
examples/device/cdc_msc_freertos/src/usb_descriptors.c

@@ -247,7 +247,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -258,7 +258,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 4 - 1
examples/device/dfu/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
-family_configure_device_example(${PROJECT})
+family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/dfu/src/usb_descriptors.c

@@ -152,7 +152,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) {
     if ( chr_count > 31 ) {
       chr_count = 31;
       chr_count = 31;
     }
     }

+ 3 - 0
examples/device/dfu_runtime/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/dfu_runtime/src/usb_descriptors.c

@@ -147,7 +147,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) {
     if ( chr_count > 31 ) {
       chr_count = 31;
       chr_count = 31;
     }
     }
@@ -160,7 +160,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (uint16_t)((((uint16_t)TUSB_DESC_STRING) << 8 ) | (2u*chr_count + 2u));
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/dynamic_configuration/CMakeLists.txt

@@ -24,6 +24,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/dynamic_configuration/src/main.c

@@ -181,7 +181,7 @@ void midi_task(void)
   start_ms += 286;
   start_ms += 286;
 
 
   // Previous positions in the note sequence.
   // Previous positions in the note sequence.
-  int previous = note_pos - 1;
+  int previous = (int) (note_pos - 1);
 
 
   // If we currently are at position 0, set the
   // If we currently are at position 0, set the
   // previous position to the last note in the sequence.
   // previous position to the last note in the sequence.

+ 3 - 3
examples/device/dynamic_configuration/src/msc_disk.c

@@ -184,7 +184,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
   uint8_t const* addr = msc_disk[lba] + offset;
   uint8_t const* addr = msc_disk[lba] + offset;
   memcpy(buffer, addr, bufsize);
   memcpy(buffer, addr, bufsize);
 
 
-  return bufsize;
+  return (int32_t) bufsize;
 }
 }
 
 
 // Callback invoked when received WRITE10 command.
 // Callback invoked when received WRITE10 command.
@@ -203,7 +203,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
   (void) lba; (void) offset; (void) buffer;
   (void) lba; (void) offset; (void) buffer;
 #endif
 #endif
 
 
-  return bufsize;
+  return (int32_t) bufsize;
 }
 }
 
 
 // Callback invoked when received an SCSI command not in built-in list below
 // Callback invoked when received an SCSI command not in built-in list below
@@ -237,7 +237,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
   {
   {
     if(in_xfer)
     if(in_xfer)
     {
     {
-      memcpy(buffer, response, resplen);
+      memcpy(buffer, response, (size_t) resplen);
     }else
     }else
     {
     {
       // SCSI output
       // SCSI output

+ 3 - 3
examples/device/dynamic_configuration/src/usb_descriptors.c

@@ -163,7 +163,7 @@ uint8_t const desc_configuration_0[] =
   TUD_CONFIG_DESCRIPTOR(1, ITF_0_NUM_TOTAL, 0, CONFIG_0_TOTAL_LEN, 0x00, 100),
   TUD_CONFIG_DESCRIPTOR(1, ITF_0_NUM_TOTAL, 0, CONFIG_0_TOTAL_LEN, 0x00, 100),
 
 
   // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
   // Interface number, string index, EP notification address and size, EP data address (out, in) and size.
-  TUD_CDC_DESCRIPTOR(ITF_0_NUM_CDC, 0, EPNUM_0_CDC_NOTIF, 8, EPNUM_0_CDC_OUT, EPNUM_0_CDC_IN, 64),
+  TUD_CDC_DESCRIPTOR(ITF_0_NUM_CDC, 0, EPNUM_0_CDC_NOTIF, 8, EPNUM_0_CDC_OUT, EPNUM_0_CDC_IN, TUD_OPT_HIGH_SPEED ? 512 : 64),
 
 
   // Interface number, string index, EP Out & EP In address, EP size
   // Interface number, string index, EP Out & EP In address, EP size
   TUD_MIDI_DESCRIPTOR(ITF_0_NUM_MIDI, 0, EPNUM_0_MIDI_OUT, EPNUM_0_MIDI_IN, TUD_OPT_HIGH_SPEED ? 512 : 64),
   TUD_MIDI_DESCRIPTOR(ITF_0_NUM_MIDI, 0, EPNUM_0_MIDI_OUT, EPNUM_0_MIDI_IN, TUD_OPT_HIGH_SPEED ? 512 : 64),
@@ -226,7 +226,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -237,7 +237,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/hid_boot_interface/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/hid_boot_interface/src/main.c

@@ -181,7 +181,7 @@ void tud_hid_set_protocol_cb(uint8_t instance, uint8_t protocol)
 // Invoked when sent REPORT successfully to host
 // Invoked when sent REPORT successfully to host
 // Application can use this to send the next report
 // Application can use this to send the next report
 // Note: For composite reports, report[0] is report ID
 // Note: For composite reports, report[0] is report ID
-void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len)
+void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
 {
 {
   (void) instance;
   (void) instance;
   (void) report;
   (void) report;

+ 2 - 2
examples/device/hid_boot_interface/src/usb_descriptors.c

@@ -163,7 +163,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -174,7 +174,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/hid_composite/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/hid_composite/src/main.c

@@ -225,12 +225,12 @@ void hid_task(void)
 // Invoked when sent REPORT successfully to host
 // Invoked when sent REPORT successfully to host
 // Application can use this to send the next report
 // Application can use this to send the next report
 // Note: For composite reports, report[0] is report ID
 // Note: For composite reports, report[0] is report ID
-void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len)
+void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
 {
 {
   (void) instance;
   (void) instance;
   (void) len;
   (void) len;
 
 
-  uint8_t next_report_id = report[0] + 1;
+  uint8_t next_report_id = report[0] + 1u;
 
 
   if (next_report_id < REPORT_ID_COUNT)
   if (next_report_id < REPORT_ID_COUNT)
   {
   {

+ 2 - 2
examples/device/hid_composite/src/usb_descriptors.c

@@ -210,7 +210,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -221,7 +221,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

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


+ 1 - 1
examples/device/hid_composite_freertos/Makefile

@@ -29,7 +29,7 @@ SRC_C += \
 	$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
 	$(subst ../../../,,$(wildcard ../../../$(FREERTOS_SRC)/portable/GCC/$(FREERTOS_PORT)/*.c))
 
 
 # Suppress FreeRTOS warnings
 # Suppress FreeRTOS warnings
-CFLAGS += -Wno-error=cast-qual
+CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
 
 
 # FreeRTOS (lto + Os) linker issue
 # FreeRTOS (lto + Os) linker issue
 LDFLAGS += -Wl,--undefined=vTaskSwitchContext
 LDFLAGS += -Wl,--undefined=vTaskSwitchContext

+ 7 - 5
examples/device/hid_composite_freertos/skip.txt

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

+ 1 - 1
examples/device/hid_composite_freertos/src/main.c

@@ -294,7 +294,7 @@ void hid_task(void* param)
 // Invoked when sent REPORT successfully to host
 // Invoked when sent REPORT successfully to host
 // Application can use this to send the next report
 // Application can use this to send the next report
 // Note: For composite reports, report[0] is report ID
 // Note: For composite reports, report[0] is report ID
-void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint8_t len)
+void tud_hid_report_complete_cb(uint8_t instance, uint8_t const* report, uint16_t len)
 {
 {
   (void) instance;
   (void) instance;
   (void) len;
   (void) len;

+ 2 - 2
examples/device/hid_composite_freertos/src/usb_descriptors.c

@@ -208,7 +208,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -219,7 +219,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/hid_generic_inout/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/hid_generic_inout/src/usb_descriptors.c

@@ -153,7 +153,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -164,7 +164,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/hid_multiple_interface/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/hid_multiple_interface/src/usb_descriptors.c

@@ -171,7 +171,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -182,7 +182,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/midi_test/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/midi_test/src/main.c

@@ -140,7 +140,7 @@ void midi_task(void)
   start_ms += 286;
   start_ms += 286;
 
 
   // Previous positions in the note sequence.
   // Previous positions in the note sequence.
-  int previous = note_pos - 1;
+  int previous = (int) (note_pos - 1);
 
 
   // If we currently are at position 0, set the
   // If we currently are at position 0, set the
   // previous position to the last note in the sequence.
   // previous position to the last note in the sequence.

+ 2 - 2
examples/device/midi_test/src/usb_descriptors.c

@@ -166,7 +166,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -177,7 +177,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/msc_dual_lun/CMakeLists.txt

@@ -24,6 +24,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 3 - 3
examples/device/msc_dual_lun/src/msc_disk_dual.c

@@ -277,7 +277,7 @@ int32_t tud_msc_read10_cb(uint8_t lun, uint32_t lba, uint32_t offset, void* buff
   uint8_t const* addr = (lun ? msc_disk1[lba] : msc_disk0[lba]) + offset;
   uint8_t const* addr = (lun ? msc_disk1[lba] : msc_disk0[lba]) + offset;
   memcpy(buffer, addr, bufsize);
   memcpy(buffer, addr, bufsize);
 
 
-  return bufsize;
+  return (int32_t) bufsize;
 }
 }
 
 
 bool tud_msc_is_writable_cb (uint8_t lun)
 bool tud_msc_is_writable_cb (uint8_t lun)
@@ -305,7 +305,7 @@ int32_t tud_msc_write10_cb(uint8_t lun, uint32_t lba, uint32_t offset, uint8_t*
   (void) lun; (void) lba; (void) offset; (void) buffer;
   (void) lun; (void) lba; (void) offset; (void) buffer;
 #endif
 #endif
 
 
-  return bufsize;
+  return (int32_t) bufsize;
 }
 }
 
 
 // Callback invoked when received an SCSI command not in built-in list below
 // Callback invoked when received an SCSI command not in built-in list below
@@ -339,7 +339,7 @@ int32_t tud_msc_scsi_cb (uint8_t lun, uint8_t const scsi_cmd[16], void* buffer,
   {
   {
     if(in_xfer)
     if(in_xfer)
     {
     {
-      memcpy(buffer, response, resplen);
+      memcpy(buffer, response, (size_t) resplen);
     }else
     }else
     {
     {
       // SCSI output
       // SCSI output

+ 2 - 2
examples/device/msc_dual_lun/src/usb_descriptors.c

@@ -168,7 +168,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -179,7 +179,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 11 - 0
examples/device/net_lwip_webserver/CMakeLists.txt

@@ -69,6 +69,17 @@ if (EXISTS ${TOP}/lib/lwip/src)
             ${TOP}/lib/networking/rndis_reports.c
             ${TOP}/lib/networking/rndis_reports.c
             )
             )
 
 
+    # Example common such as compiler warnings
+    include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
+    # due to warnings from other net source, we need to prevent error from some of the warnings options
+    target_compile_options(${PROJECT} PUBLIC
+        -Wno-error=null-dereference
+        -Wno-error=conversion
+        -Wno-error=sign-conversion
+        -Wno-error=sign-compare
+        )
+
     # Configure compilation flags and libraries for the example... see the corresponding function
     # Configure compilation flags and libraries for the example... see the corresponding function
     # in hw/bsp/FAMILY/family.cmake for details.
     # in hw/bsp/FAMILY/family.cmake for details.
     family_configure_device_example(${PROJECT})
     family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/net_lwip_webserver/src/usb_descriptors.c

@@ -231,7 +231,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
     if ( chr_count > (TU_ARRAY_SIZE(_desc_str) - 1)) chr_count = TU_ARRAY_SIZE(_desc_str) - 1;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -242,7 +242,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/uac2_headset/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 8 - 8
examples/device/uac2_headset/src/main.c

@@ -159,7 +159,7 @@ static bool tud_audio_clock_get_request(uint8_t rhport, audio_control_request_t
     {
     {
       TU_LOG1("Clock get current freq %lu\r\n", current_sample_rate);
       TU_LOG1("Clock get current freq %lu\r\n", current_sample_rate);
 
 
-      audio_control_cur_4_t curf = { tu_htole32(current_sample_rate) };
+      audio_control_cur_4_t curf = { (int32_t) tu_htole32(current_sample_rate) };
       return tud_audio_buffer_and_schedule_control_xfer(rhport, (tusb_control_request_t const *)request, &curf, sizeof(curf));
       return tud_audio_buffer_and_schedule_control_xfer(rhport, (tusb_control_request_t const *)request, &curf, sizeof(curf));
     }
     }
     else if (request->bRequest == AUDIO_CS_REQ_RANGE)
     else if (request->bRequest == AUDIO_CS_REQ_RANGE)
@@ -171,8 +171,8 @@ static bool tud_audio_clock_get_request(uint8_t rhport, audio_control_request_t
       TU_LOG1("Clock get %d freq ranges\r\n", N_SAMPLE_RATES);
       TU_LOG1("Clock get %d freq ranges\r\n", N_SAMPLE_RATES);
       for(uint8_t i = 0; i < N_SAMPLE_RATES; i++)
       for(uint8_t i = 0; i < N_SAMPLE_RATES; i++)
       {
       {
-        rangef.subrange[i].bMin = sample_rates[i];
-        rangef.subrange[i].bMax = sample_rates[i];
+        rangef.subrange[i].bMin = (int32_t) sample_rates[i];
+        rangef.subrange[i].bMax = (int32_t) sample_rates[i];
         rangef.subrange[i].bRes = 0;
         rangef.subrange[i].bRes = 0;
         TU_LOG1("Range %d (%d, %d, %d)\r\n", i, (int)rangef.subrange[i].bMin, (int)rangef.subrange[i].bMax, (int)rangef.subrange[i].bRes);
         TU_LOG1("Range %d (%d, %d, %d)\r\n", i, (int)rangef.subrange[i].bMin, (int)rangef.subrange[i].bMax, (int)rangef.subrange[i].bRes);
       }
       }
@@ -204,7 +204,7 @@ static bool tud_audio_clock_set_request(uint8_t rhport, audio_control_request_t
   {
   {
     TU_VERIFY(request->wLength == sizeof(audio_control_cur_4_t));
     TU_VERIFY(request->wLength == sizeof(audio_control_cur_4_t));
 
 
-    current_sample_rate = ((audio_control_cur_4_t const *)buf)->bCur;
+    current_sample_rate = (uint32_t) ((audio_control_cur_4_t const *)buf)->bCur;
 
 
     TU_LOG1("Clock set current freq: %ld\r\n", current_sample_rate);
     TU_LOG1("Clock set current freq: %ld\r\n", current_sample_rate);
 
 
@@ -403,9 +403,9 @@ void audio_task(void)
         // Combine two channels into one
         // Combine two channels into one
         int32_t left = *src++;
         int32_t left = *src++;
         int32_t right = *src++;
         int32_t right = *src++;
-        *dst++ = (left >> 1) + (right >> 1);
+        *dst++ = (int16_t) ((left >> 1) + (right >> 1));
       }
       }
-      tud_audio_write((uint8_t *)mic_buf, spk_data_size / 2);
+      tud_audio_write((uint8_t *)mic_buf, (uint16_t) (spk_data_size / 2));
       spk_data_size = 0;
       spk_data_size = 0;
     }
     }
     else if (current_resolution == 24)
     else if (current_resolution == 24)
@@ -418,9 +418,9 @@ void audio_task(void)
         // Combine two channels into one
         // Combine two channels into one
         int32_t left = *src++;
         int32_t left = *src++;
         int32_t right = *src++;
         int32_t right = *src++;
-        *dst++ = ((left >> 1) + (right >> 1)) & 0xffffff00;
+        *dst++ = (int32_t) ((uint32_t) ((left >> 1) + (right >> 1)) & 0xffffff00ul);
       }
       }
-      tud_audio_write((uint8_t *)mic_buf, spk_data_size / 2);
+      tud_audio_write((uint8_t *)mic_buf, (uint16_t) (spk_data_size / 2));
       spk_data_size = 0;
       spk_data_size = 0;
     }
     }
   }
   }

+ 2 - 2
examples/device/uac2_headset/src/usb_descriptors.c

@@ -155,7 +155,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if (chr_count > 31) chr_count = 31;
     if (chr_count > 31) chr_count = 31;
 
 
     for (uint8_t i = 0; i < chr_count; i++)
     for (uint8_t i = 0; i < chr_count; i++)
@@ -165,7 +165,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2 * chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/usbtmc/CMakeLists.txt

@@ -24,6 +24,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 1 - 1
examples/device/usbtmc/src/usb_descriptors.c

@@ -175,7 +175,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) {
     if ( chr_count > 31 ) {
       chr_count = 31;
       chr_count = 31;
     }
     }

+ 3 - 0
examples/device/video_capture/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
   ${CMAKE_CURRENT_SOURCE_DIR}/src
   ${CMAKE_CURRENT_SOURCE_DIR}/src
 )
 )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

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

@@ -1,2 +1,3 @@
 mcu:MSP430x5xx
 mcu:MSP430x5xx
-mcu:SAMD11
+mcu:NUC121
+mcu:SAMD11

+ 2 - 2
examples/device/video_capture/src/usb_descriptors.c

@@ -149,7 +149,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -160,7 +160,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 3 - 0
examples/device/webusb_serial/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_device_example(${PROJECT})
 family_configure_device_example(${PROJECT})

+ 2 - 2
examples/device/webusb_serial/src/usb_descriptors.c

@@ -235,7 +235,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
     const char* str = string_desc_arr[index];
     const char* str = string_desc_arr[index];
 
 
     // Cap at max char
     // Cap at max char
-    chr_count = strlen(str);
+    chr_count = (uint8_t) strlen(str);
     if ( chr_count > 31 ) chr_count = 31;
     if ( chr_count > 31 ) chr_count = 31;
 
 
     // Convert ASCII string into UTF-16
     // Convert ASCII string into UTF-16
@@ -246,7 +246,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 15 - 0
examples/dual/host_hid_to_device_cdc/CMakeLists.txt

@@ -23,6 +23,21 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
+# due to warnings from other net source, we need to prevent error from some of the warnings options
+target_compile_options(${PROJECT} PUBLIC
+        -Wno-error=shadow
+        -Wno-error=cast-align
+        -Wno-error=cast-qual
+        -Wno-error=redundant-decls
+        -Wno-error=sign-conversion
+        -Wno-error=conversion
+        -Wno-error=sign-compare
+        -Wno-error=unused-function
+        )
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_dual_usb_example(${PROJECT})
 family_configure_dual_usb_example(${PROJECT})

+ 3 - 3
examples/dual/host_hid_to_device_cdc/src/main.c

@@ -160,7 +160,7 @@ void tuh_hid_mount_cb(uint8_t dev_addr, uint8_t instance, uint8_t const* desc_re
   char tempbuf[256];
   char tempbuf[256];
   int count = sprintf(tempbuf, "[%04x:%04x][%u] HID Interface%u, Protocol = %s\r\n", vid, pid, dev_addr, instance, protocol_str[itf_protocol]);
   int count = sprintf(tempbuf, "[%04x:%04x][%u] HID Interface%u, Protocol = %s\r\n", vid, pid, dev_addr, instance, protocol_str[itf_protocol]);
 
 
-  tud_cdc_write(tempbuf, count);
+  tud_cdc_write(tempbuf, (uint32_t) count);
   tud_cdc_write_flush();
   tud_cdc_write_flush();
 
 
   // Receive report from boot keyboard & mouse only
   // Receive report from boot keyboard & mouse only
@@ -179,7 +179,7 @@ void tuh_hid_umount_cb(uint8_t dev_addr, uint8_t instance)
 {
 {
   char tempbuf[256];
   char tempbuf[256];
   int count = sprintf(tempbuf, "[%u] HID Interface%u is unmounted\r\n", dev_addr, instance);
   int count = sprintf(tempbuf, "[%u] HID Interface%u is unmounted\r\n", dev_addr, instance);
-  tud_cdc_write(tempbuf, count);
+  tud_cdc_write(tempbuf, (uint32_t) count);
   tud_cdc_write_flush();
   tud_cdc_write_flush();
 }
 }
 
 
@@ -251,7 +251,7 @@ static void process_mouse_report(uint8_t dev_addr, hid_mouse_report_t const * re
   char tempbuf[32];
   char tempbuf[32];
   int count = sprintf(tempbuf, "[%u] %c%c%c %d %d %d\r\n", dev_addr, l, m, r, report->x, report->y, report->wheel);
   int count = sprintf(tempbuf, "[%u] %c%c%c %d %d %d\r\n", dev_addr, l, m, r, report->x, report->y, report->wheel);
 
 
-  tud_cdc_write(tempbuf, count);
+  tud_cdc_write(tempbuf, (uint32_t) count);
   tud_cdc_write_flush();
   tud_cdc_write_flush();
 }
 }
 
 

+ 1 - 1
examples/dual/host_hid_to_device_cdc/src/usb_descriptors.c

@@ -259,7 +259,7 @@ uint16_t const* tud_descriptor_string_cb(uint8_t index, uint16_t langid)
   }
   }
 
 
   // first byte is length (including header), second byte is string type
   // first byte is length (including header), second byte is string type
-  _desc_str[0] = (TUSB_DESC_STRING << 8 ) | (2*chr_count + 2);
+  _desc_str[0] = (uint16_t) ((TUSB_DESC_STRING << 8 ) | (2*chr_count + 2));
 
 
   return _desc_str;
   return _desc_str;
 }
 }

+ 31 - 0
examples/example.cmake

@@ -0,0 +1,31 @@
+target_compile_options(${PROJECT} PUBLIC
+        -Wall
+        -Wextra
+        -Werror
+        -Wfatal-errors
+        -Wdouble-promotion
+        #-Wstrict-prototypes
+        -Wstrict-overflow
+        #-Werror-implicit-function-declaration
+        -Wfloat-equal
+        #-Wundef
+        -Wshadow
+        -Wwrite-strings
+        -Wsign-compare
+        -Wmissing-format-attribute
+        -Wunreachable-code
+        -Wcast-align
+        -Wcast-function-type
+        -Wcast-qual
+        -Wnull-dereference
+        -Wuninitialized
+        -Wunused
+        -Wredundant-decls
+        )
+
+# GCC version 9 or prior has a bug with incorrect Wconversion warnings
+if (CMAKE_C_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)
+  target_compile_options(${PROJECT} PUBLIC
+        -Wconversion
+        )
+endif()

+ 3 - 0
examples/host/bare_api/CMakeLists.txt

@@ -22,6 +22,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_host_example(${PROJECT})
 family_configure_host_example(${PROJECT})

+ 2 - 0
examples/host/bare_api/only.txt

@@ -3,7 +3,9 @@ mcu:LPC177X_8X
 mcu:LPC18XX
 mcu:LPC18XX
 mcu:LPC40XX
 mcu:LPC40XX
 mcu:LPC43XX
 mcu:LPC43XX
+mcu:MIMXRT
 mcu:MIMXRT10XX
 mcu:MIMXRT10XX
+mcu:MIMXRT11XX
 mcu:RP2040
 mcu:RP2040
 mcu:MSP432E4
 mcu:MSP432E4
 mcu:RX65X
 mcu:RX65X

+ 8 - 7
examples/host/bare_api/src/main.c

@@ -84,8 +84,8 @@ void tuh_mount_cb (uint8_t daddr)
 {
 {
   printf("Device attached, address = %d\r\n", daddr);
   printf("Device attached, address = %d\r\n", daddr);
 
 
-  // Get Device Descriptor sync API
-  // TODO: invoking control trannsfer now has issue with mounting hub with multiple devices attached, fix later
+  // Get Device Descriptor
+  // TODO: invoking control transfer now has issue with mounting hub with multiple devices attached, fix later
   tuh_descriptor_get_device(daddr, &desc_device, 18, print_device_descriptor, 0);
   tuh_descriptor_get_device(daddr, &desc_device, 18, print_device_descriptor, 0);
 }
 }
 
 
@@ -189,7 +189,7 @@ void parse_config_descriptor(uint8_t dev_addr, tusb_desc_configuration_t const*
     if( TUSB_DESC_INTERFACE != tu_desc_type(p_desc) ) return;
     if( TUSB_DESC_INTERFACE != tu_desc_type(p_desc) ) return;
     tusb_desc_interface_t const* desc_itf = (tusb_desc_interface_t const*) p_desc;
     tusb_desc_interface_t const* desc_itf = (tusb_desc_interface_t const*) p_desc;
 
 
-    uint16_t const drv_len = count_interface_total_len(desc_itf, assoc_itf_count, desc_end-p_desc);
+    uint16_t const drv_len = count_interface_total_len(desc_itf, assoc_itf_count, (uint16_t) (desc_end-p_desc));
 
 
     // probably corrupted descriptor
     // probably corrupted descriptor
     if(drv_len < sizeof(tusb_desc_interface_t)) return;
     if(drv_len < sizeof(tusb_desc_interface_t)) return;
@@ -244,7 +244,8 @@ void hid_report_received(tuh_xfer_t* xfer);
 void open_hid_interface(uint8_t daddr, tusb_desc_interface_t const *desc_itf, uint16_t max_len)
 void open_hid_interface(uint8_t daddr, tusb_desc_interface_t const *desc_itf, uint16_t max_len)
 {
 {
   // len = interface + hid + n*endpoints
   // len = interface + hid + n*endpoints
-  uint16_t const drv_len = sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) + desc_itf->bNumEndpoints*sizeof(tusb_desc_endpoint_t);
+  uint16_t const drv_len = (uint16_t) (sizeof(tusb_desc_interface_t) + sizeof(tusb_hid_descriptor_hid_t) +
+                                       desc_itf->bNumEndpoints * sizeof(tusb_desc_endpoint_t));
 
 
   // corrupted descriptor
   // corrupted descriptor
   if (max_len < drv_len) return;
   if (max_len < drv_len) return;
@@ -377,7 +378,7 @@ static void _convert_utf16le_to_utf8(const uint16_t *utf16, size_t utf16_len, ui
     for (size_t i = 0; i < utf16_len; i++) {
     for (size_t i = 0; i < utf16_len; i++) {
         uint16_t chr = utf16[i];
         uint16_t chr = utf16[i];
         if (chr < 0x80) {
         if (chr < 0x80) {
-            *utf8++ = chr & 0xff;
+            *utf8++ = chr & 0xffu;
         } else if (chr < 0x800) {
         } else if (chr < 0x800) {
             *utf8++ = (uint8_t)(0xC0 | (chr >> 6 & 0x1F));
             *utf8++ = (uint8_t)(0xC0 | (chr >> 6 & 0x1F));
             *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F));
             *utf8++ = (uint8_t)(0x80 | (chr >> 0 & 0x3F));
@@ -405,12 +406,12 @@ static int _count_utf8_bytes(const uint16_t *buf, size_t len) {
         }
         }
         // TODO: Handle UTF-16 code points that take two entries.
         // TODO: Handle UTF-16 code points that take two entries.
     }
     }
-    return total_bytes;
+    return (int) total_bytes;
 }
 }
 
 
 static void print_utf16(uint16_t *temp_buf, size_t buf_len) {
 static void print_utf16(uint16_t *temp_buf, size_t buf_len) {
     size_t utf16_len = ((temp_buf[0] & 0xff) - 2) / sizeof(uint16_t);
     size_t utf16_len = ((temp_buf[0] & 0xff) - 2) / sizeof(uint16_t);
-    size_t utf8_len = _count_utf8_bytes(temp_buf + 1, utf16_len);
+    size_t utf8_len = (size_t) _count_utf8_bytes(temp_buf + 1, utf16_len);
     _convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len);
     _convert_utf16le_to_utf8(temp_buf + 1, utf16_len, (uint8_t *) temp_buf, sizeof(uint16_t) * buf_len);
     ((uint8_t*) temp_buf)[utf8_len] = '\0';
     ((uint8_t*) temp_buf)[utf8_len] = '\0';
 
 

+ 3 - 0
examples/host/cdc_msc_hid/CMakeLists.txt

@@ -24,6 +24,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_host_example(${PROJECT})
 family_configure_host_example(${PROJECT})

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

@@ -3,7 +3,9 @@ mcu:LPC177X_8X
 mcu:LPC18XX
 mcu:LPC18XX
 mcu:LPC40XX
 mcu:LPC40XX
 mcu:LPC43XX
 mcu:LPC43XX
+mcu:MIMXRT
 mcu:MIMXRT10XX
 mcu:MIMXRT10XX
+mcu:MIMXRT11XX
 mcu:RP2040
 mcu:RP2040
 mcu:MSP432E4
 mcu:MSP432E4
 mcu:RX65X
 mcu:RX65X

+ 1 - 1
examples/host/cdc_msc_hid/src/tusb_config.h

@@ -89,7 +89,7 @@
 // Size of buffer to hold descriptors and other data used for enumeration
 // Size of buffer to hold descriptors and other data used for enumeration
 #define CFG_TUH_ENUMERATION_BUFSIZE 256
 #define CFG_TUH_ENUMERATION_BUFSIZE 256
 
 
-#define CFG_TUH_HUB                 1
+#define CFG_TUH_HUB                 1 // number of supported hubs
 #define CFG_TUH_CDC                 1
 #define CFG_TUH_CDC                 1
 #define CFG_TUH_HID                 4 // typical keyboard + mouse device can have 3-4 HID interfaces
 #define CFG_TUH_HID                 4 // typical keyboard + mouse device can have 3-4 HID interfaces
 #define CFG_TUH_MSC                 1
 #define CFG_TUH_MSC                 1

+ 3 - 0
examples/host/hid_controller/CMakeLists.txt

@@ -23,6 +23,9 @@ target_include_directories(${PROJECT} PUBLIC
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         ${CMAKE_CURRENT_SOURCE_DIR}/src
         )
         )
 
 
+# Example common such as compiler warnings
+include(${CMAKE_CURRENT_SOURCE_DIR}/../../example.cmake)
+
 # Configure compilation flags and libraries for the example... see the corresponding function
 # Configure compilation flags and libraries for the example... see the corresponding function
 # in hw/bsp/FAMILY/family.cmake for details.
 # in hw/bsp/FAMILY/family.cmake for details.
 family_configure_host_example(${PROJECT})
 family_configure_host_example(${PROJECT})

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

@@ -3,7 +3,9 @@ mcu:LPC177X_8X
 mcu:LPC18XX
 mcu:LPC18XX
 mcu:LPC40XX
 mcu:LPC40XX
 mcu:LPC43XX
 mcu:LPC43XX
+mcu:MIMXRT
 mcu:MIMXRT10XX
 mcu:MIMXRT10XX
+mcu:MIMXRT11XX
 mcu:RP2040
 mcu:RP2040
 mcu:MSP432E4
 mcu:MSP432E4
 mcu:RX65X
 mcu:RX65X

+ 11 - 10
examples/make.mk

@@ -45,11 +45,6 @@ else
   SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
   SRC_C += $(subst $(TOP)/,,$(wildcard $(TOP)/$(FAMILY_PATH)/*.c))
 endif
 endif
 
 
-# Fetch submodules depended by family
-fetch_submodule_if_empty = $(if $(wildcard $(TOP)/$1/*),,$(info $(shell git -C $(TOP) submodule update --init $1)))
-ifdef DEPS_SUBMODULES
-  $(foreach s,$(DEPS_SUBMODULES),$(call fetch_submodule_if_empty,$(s)))
-endif
 
 
 #-------------- Cross Compiler  ------------
 #-------------- Cross Compiler  ------------
 # Can be set by board, default to ARM GCC
 # Can be set by board, default to ARM GCC
@@ -90,13 +85,13 @@ CFLAGS += \
   -ffunction-sections \
   -ffunction-sections \
   -fsingle-precision-constant \
   -fsingle-precision-constant \
   -fno-strict-aliasing \
   -fno-strict-aliasing \
-  -Wdouble-promotion \
-  -Wstrict-prototypes \
-  -Wstrict-overflow \
   -Wall \
   -Wall \
   -Wextra \
   -Wextra \
   -Werror \
   -Werror \
   -Wfatal-errors \
   -Wfatal-errors \
+  -Wdouble-promotion \
+  -Wstrict-prototypes \
+  -Wstrict-overflow \
   -Werror-implicit-function-declaration \
   -Werror-implicit-function-declaration \
   -Wfloat-equal \
   -Wfloat-equal \
   -Wundef \
   -Wundef \
@@ -108,8 +103,14 @@ CFLAGS += \
   -Wcast-align \
   -Wcast-align \
   -Wcast-function-type \
   -Wcast-function-type \
   -Wcast-qual \
   -Wcast-qual \
-  -Wnull-dereference
-
+  -Wnull-dereference \
+  -Wuninitialized \
+  -Wunused \
+  -Wredundant-decls
+
+# conversion is too strict for most mcu driver, may be disable sign/int/arith-conversion
+#  -Wconversion
+  
 # Debugging/Optimization
 # Debugging/Optimization
 ifeq ($(DEBUG), 1)
 ifeq ($(DEBUG), 1)
   CFLAGS += -Og
   CFLAGS += -Og

+ 18 - 9
examples/rules.mk

@@ -5,6 +5,7 @@
 # Set all as default goal
 # Set all as default goal
 .DEFAULT_GOAL := all
 .DEFAULT_GOAL := all
 
 
+# ---------------- GNU Make Start -----------------------
 # ESP32-Sx and RP2040 has its own CMake build system
 # ESP32-Sx and RP2040 has its own CMake build system
 ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
 ifeq (,$(findstring $(FAMILY),esp32s2 esp32s3 rp2040))
 
 
@@ -141,7 +142,23 @@ $(BUILD)/obj/%_asm.o: %.S
 	@echo AS $(notdir $@)
 	@echo AS $(notdir $@)
 	@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
 	@$(CC) -x assembler-with-cpp $(ASFLAGS) -c -o $@ $<
 
 
-endif # GNU Make
+endif
+
+.PHONY: clean
+clean:
+ifeq ($(CMDEXE),1)
+	rd /S /Q $(subst /,\,$(BUILD))
+else
+	$(RM) -rf $(BUILD)
+endif
+# ---------------- GNU Make End -----------------------
+
+# get depenecies
+.PHONY: get-deps
+get-deps:
+  ifdef DEPS_SUBMODULES
+	git -C $(TOP) submodule update --init $(DEPS_SUBMODULES)
+  endif
 
 
 size: $(BUILD)/$(PROJECT).elf
 size: $(BUILD)/$(PROJECT).elf
 	-@echo ''
 	-@echo ''
@@ -152,14 +169,6 @@ size: $(BUILD)/$(PROJECT).elf
 linkermap: $(BUILD)/$(PROJECT).elf
 linkermap: $(BUILD)/$(PROJECT).elf
 	@linkermap -v $<.map
 	@linkermap -v $<.map
 
 
-.PHONY: clean
-clean:
-ifeq ($(CMDEXE),1)
-	rd /S /Q $(subst /,\,$(BUILD))
-else
-	$(RM) -rf $(BUILD)
-endif
-
 # ---------------------------------------
 # ---------------------------------------
 # Flash Targets
 # Flash Targets
 # ---------------------------------------
 # ---------------------------------------

+ 4 - 1
hw/bsp/board.h

@@ -41,7 +41,10 @@
 #include "ansi_escape.h"
 #include "ansi_escape.h"
 #include "tusb.h"
 #include "tusb.h"
 
 
-#define CFG_BOARD_UART_BAUDRATE    115200
+// Define the default baudrate
+#ifndef CFG_BOARD_UART_BAUDRATE
+#define CFG_BOARD_UART_BAUDRATE 115200   ///< Default baud rate
+#endif
 
 
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 // Board Porting API
 // Board Porting API

+ 8 - 2
hw/bsp/board_mcu.h

@@ -31,7 +31,7 @@
 #include "tusb_option.h"
 #include "tusb_option.h"
 
 
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
-// Low Level MCU header include. TinyUSB stack and example should be
+// Low Level MCU header include. Example should be
 // platform independent and mostly doesn'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:
 // However there are still certain situation where this file is needed:
 // - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
 // - FreeRTOSConfig.h to set up correct clock and NVIC interrupts for ARM Cortex
@@ -80,6 +80,9 @@
 #elif CFG_TUSB_MCU == OPT_MCU_STM32F7
 #elif CFG_TUSB_MCU == OPT_MCU_STM32F7
   #include "stm32f7xx.h"
   #include "stm32f7xx.h"
 
 
+#elif CFG_TUSB_MCU == OPT_MCU_STM32G4
+  #include "stm32g4xx.h"
+
 #elif CFG_TUSB_MCU == OPT_MCU_STM32H7
 #elif CFG_TUSB_MCU == OPT_MCU_STM32H7
   #include "stm32h7xx.h"
   #include "stm32h7xx.h"
 
 
@@ -92,6 +95,9 @@
 #elif CFG_TUSB_MCU == OPT_MCU_STM32L4
 #elif CFG_TUSB_MCU == OPT_MCU_STM32L4
   #include "stm32l4xx.h"
   #include "stm32l4xx.h"
 
 
+#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
+  #include "stm32wbxx.h"
+
 #elif CFG_TUSB_MCU == OPT_MCU_CXD56
 #elif CFG_TUSB_MCU == OPT_MCU_CXD56
   // no header needed
   // no header needed
 
 
@@ -104,7 +110,7 @@
 #elif CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI
 #elif CFG_TUSB_MCU == OPT_MCU_VALENTYUSB_EPTRI
   // no header needed
   // no header needed
 
 
-#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX
+#elif CFG_TUSB_MCU == OPT_MCU_MIMXRT
   #include "fsl_device_registers.h"
   #include "fsl_device_registers.h"
 
 
 #elif CFG_TUSB_MCU == OPT_MCU_NUC120
 #elif CFG_TUSB_MCU == OPT_MCU_NUC120

+ 1 - 1
hw/bsp/broadcom_32bit/family.mk

@@ -16,7 +16,7 @@ CFLAGS += \
 CROSS_COMPILE = arm-none-eabi-
 CROSS_COMPILE = arm-none-eabi-
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=cast-qual
+CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
 
 
 SRC_C += \
 SRC_C += \
 	src/portable/synopsys/dwc2/dcd_dwc2.c \
 	src/portable/synopsys/dwc2/dcd_dwc2.c \

+ 1 - 1
hw/bsp/broadcom_64bit/family.mk

@@ -15,7 +15,7 @@ CFLAGS += \
 CROSS_COMPILE = aarch64-none-elf-
 CROSS_COMPILE = aarch64-none-elf-
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=cast-qual
+CFLAGS += -Wno-error=cast-qual -Wno-error=redundant-decls
 
 
 SRC_C += \
 SRC_C += \
 	src/portable/synopsys/dwc2/dcd_dwc2.c \
 	src/portable/synopsys/dwc2/dcd_dwc2.c \

+ 1 - 0
hw/bsp/d5035_01/same51j19a_flash.ld

@@ -160,4 +160,5 @@ SECTIONS
 
 
     . = ALIGN(4);
     . = ALIGN(4);
     _end = . ;
     _end = . ;
+    end = .;
 }
 }

+ 2 - 2
hw/bsp/ea4088qs/ea4088qs.c

@@ -33,11 +33,11 @@
 void USB_IRQHandler(void)
 void USB_IRQHandler(void)
 {
 {
   #if CFG_TUD_ENABLED
   #if CFG_TUD_ENABLED
-    tuh_int_handler(0);
+    tud_int_handler(0);
   #endif
   #endif
 
 
   #if CFG_TUH_ENABLED
   #if CFG_TUH_ENABLED
-    tud_int_handler(0);
+    tuh_int_handler(0);
   #endif
   #endif
 }
 }
 
 

+ 1 - 1
hw/bsp/f1c100s/README.md

@@ -17,4 +17,4 @@ Flash: `make BOARD=f1c100s flash` will write the image to SPI flash, and then re
 
 
 ## TODO
 ## TODO
 
 
-* Add F1C100s to `#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT10XX` high speed MCU check in examples (maybe we should extract the logic?)
+* Add F1C100s to `#if CFG_TUSB_MCU == OPT_MCU_LPC43XX || CFG_TUSB_MCU == OPT_MCU_LPC18XX || CFG_TUSB_MCU == OPT_MCU_MIMXRT` high speed MCU check in examples (maybe we should extract the logic?)

+ 1 - 1
hw/bsp/frdm_k32l2b/board.mk

@@ -9,7 +9,7 @@ CFLAGS += \
   -DCFG_TUSB_MCU=OPT_MCU_K32L2BXX
   -DCFG_TUSB_MCU=OPT_MCU_K32L2BXX
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=unused-parameter
+CFLAGS += -Wno-error=unused-parameter -Wno-error=redundant-decls
 
 
 MCU_DIR = $(SDK_DIR)/devices/K32L2B31A
 MCU_DIR = $(SDK_DIR)/devices/K32L2B31A
 
 

+ 1 - 1
hw/bsp/frdm_kl25z/board.mk

@@ -14,7 +14,7 @@ LDFLAGS += \
   -Wl,--defsym,__heap_size__=0
   -Wl,--defsym,__heap_size__=0
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=unused-parameter -Wno-error=format
+CFLAGS += -Wno-error=unused-parameter -Wno-error=format -Wno-error=redundant-decls
 
 
 MCU_DIR = $(SDK_DIR)/devices/MKL25Z4
 MCU_DIR = $(SDK_DIR)/devices/MKL25Z4
 
 

+ 2 - 2
hw/bsp/imxrt/boards/mimxrt1050_evkb/board.h

@@ -45,7 +45,7 @@
 
 
 // UART
 // UART
 #define UART_PORT             LPUART1
 #define UART_PORT             LPUART1
-#define UART_RX_PINMUX        IOMUXC_GPIO_AD_B0_13_LPUART1_RX
-#define UART_TX_PINMUX        IOMUXC_GPIO_AD_B0_12_LPUART1_TX
+#define UART_RX_PINMUX        IOMUXC_GPIO_AD_B0_13_LPUART1_RXD
+#define UART_TX_PINMUX        IOMUXC_GPIO_AD_B0_12_LPUART1_TXD
 
 
 #endif /* BOARD_H_ */
 #endif /* BOARD_H_ */

+ 52 - 0
hw/bsp/imxrt/boards/teensy_41/board.h

@@ -0,0 +1,52 @@
+/* 
+ * The MIT License (MIT)
+ *
+ * Copyright (c) 2019, 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_
+
+
+// required since iMX RT10xx SDK include this file for board size
+#define BOARD_FLASH_SIZE (8 * 1024 * 1024)
+
+// LED
+#define LED_PINMUX            IOMUXC_GPIO_B0_03_GPIO2_IO03 // D13
+#define LED_PORT              GPIO2
+#define LED_PIN               3
+#define LED_STATE_ON          0
+
+// no button
+#define BUTTON_PINMUX         IOMUXC_GPIO_B0_01_GPIO2_IO01 // D12
+#define BUTTON_PORT           GPIO2
+#define BUTTON_PIN            1
+#define BUTTON_STATE_ACTIVE   0
+
+// UART
+#define UART_PORT             LPUART6
+#define UART_RX_PINMUX        IOMUXC_GPIO_AD_B0_03_LPUART6_RX  // D0
+#define UART_TX_PINMUX        IOMUXC_GPIO_AD_B0_02_LPUART6_TX  // D1
+
+#endif /* BOARD_H_ */

+ 10 - 0
hw/bsp/imxrt/boards/teensy_41/board.mk

@@ -0,0 +1,10 @@
+CFLAGS += -DCPU_MIMXRT1062DVL6A
+MCU_VARIANT = MIMXRT1062
+
+# For flash-jlink target
+JLINK_DEVICE = MIMXRT1062xxx6A
+
+# flash by using teensy_loader_cli https://github.com/PaulStoffregen/teensy_loader_cli
+# Make sure it is in your PATH 
+flash: $(BUILD)/$(PROJECT).hex
+	teensy_loader_cli --mcu=imxrt1062 -v -w $<

+ 49 - 0
hw/bsp/imxrt/boards/teensy_41/teensy41_flexspi_nor_config.c

@@ -0,0 +1,49 @@
+/*
+ * Copyright 2018 NXP
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#include <bsp/imxrt/boards/teensy_40/teensy40_flexspi_nor_config.h>
+
+/* Component ID definition, used by tools. */
+#ifndef FSL_COMPONENT_ID
+#define FSL_COMPONENT_ID "platform.drivers.xip_board"
+#endif
+
+/*******************************************************************************
+ * Code
+ ******************************************************************************/
+#if defined(XIP_BOOT_HEADER_ENABLE) && (XIP_BOOT_HEADER_ENABLE == 1)
+#if defined(__CC_ARM) || defined(__ARMCC_VERSION) || defined(__GNUC__)
+__attribute__((section(".boot_hdr.conf")))
+#elif defined(__ICCARM__)
+#pragma location = ".boot_hdr.conf"
+#endif
+
+const flexspi_nor_config_t qspiflash_config = {
+    .memConfig =
+        {
+            .tag              = FLEXSPI_CFG_BLK_TAG,
+            .version          = FLEXSPI_CFG_BLK_VERSION,
+            .readSampleClkSrc = kFlexSPIReadSampleClk_LoopbackFromDqsPad,
+            .csHoldTime       = 3u,
+            .csSetupTime      = 3u,
+            // Enable DDR mode, Wordaddassable, Safe configuration, Differential clock
+            .sflashPadType = kSerialFlash_4Pads,
+            .serialClkFreq = kFlexSpiSerialClk_100MHz,
+            .sflashA1Size  = 8u * 1024u * 1024u,
+            .lookupTable =
+                {
+                    // Read LUTs
+                    FLEXSPI_LUT_SEQ(CMD_SDR, FLEXSPI_1PAD, 0xEB, RADDR_SDR, FLEXSPI_4PAD, 0x18),
+                    FLEXSPI_LUT_SEQ(DUMMY_SDR, FLEXSPI_4PAD, 0x06, READ_SDR, FLEXSPI_4PAD, 0x04),
+                },
+        },
+    .pageSize           = 256u,
+    .sectorSize         = 4u * 1024u,
+    .blockSize          = 256u * 1024u,
+    .isUniformBlockSize = false,
+};
+#endif /* XIP_BOOT_HEADER_ENABLE */

+ 268 - 0
hw/bsp/imxrt/boards/teensy_41/teensy41_flexspi_nor_config.h

@@ -0,0 +1,268 @@
+/*
+ * Copyright 2018 NXP
+ * All rights reserved.
+ *
+ * SPDX-License-Identifier: BSD-3-Clause
+ */
+
+#ifndef __TEENSY40_FLEXSPI_NOR_CONFIG__
+#define __TEENSY40_FLEXSPI_NOR_CONFIG__
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "fsl_common.h"
+
+/*! @name Driver version */
+/*@{*/
+/*! @brief XIP_BOARD driver version 2.0.0. */
+#define FSL_XIP_BOARD_DRIVER_VERSION (MAKE_VERSION(2, 0, 0))
+/*@}*/
+
+/* FLEXSPI memory config block related defintions */
+#define FLEXSPI_CFG_BLK_TAG (0x42464346UL)     // ascii "FCFB" Big Endian
+#define FLEXSPI_CFG_BLK_VERSION (0x56010400UL) // V1.4.0
+#define FLEXSPI_CFG_BLK_SIZE (512)
+
+/* FLEXSPI Feature related definitions */
+#define FLEXSPI_FEATURE_HAS_PARALLEL_MODE 1
+
+/* Lookup table related defintions */
+#define CMD_INDEX_READ 0
+#define CMD_INDEX_READSTATUS 1
+#define CMD_INDEX_WRITEENABLE 2
+#define CMD_INDEX_WRITE 4
+
+#define CMD_LUT_SEQ_IDX_READ 0
+#define CMD_LUT_SEQ_IDX_READSTATUS 1
+#define CMD_LUT_SEQ_IDX_WRITEENABLE 3
+#define CMD_LUT_SEQ_IDX_WRITE 9
+
+#define CMD_SDR 0x01
+#define CMD_DDR 0x21
+#define RADDR_SDR 0x02
+#define RADDR_DDR 0x22
+#define CADDR_SDR 0x03
+#define CADDR_DDR 0x23
+#define MODE1_SDR 0x04
+#define MODE1_DDR 0x24
+#define MODE2_SDR 0x05
+#define MODE2_DDR 0x25
+#define MODE4_SDR 0x06
+#define MODE4_DDR 0x26
+#define MODE8_SDR 0x07
+#define MODE8_DDR 0x27
+#define WRITE_SDR 0x08
+#define WRITE_DDR 0x28
+#define READ_SDR 0x09
+#define READ_DDR 0x29
+#define LEARN_SDR 0x0A
+#define LEARN_DDR 0x2A
+#define DATSZ_SDR 0x0B
+#define DATSZ_DDR 0x2B
+#define DUMMY_SDR 0x0C
+#define DUMMY_DDR 0x2C
+#define DUMMY_RWDS_SDR 0x0D
+#define DUMMY_RWDS_DDR 0x2D
+#define JMP_ON_CS 0x1F
+#define STOP 0
+
+#define FLEXSPI_1PAD 0
+#define FLEXSPI_2PAD 1
+#define FLEXSPI_4PAD 2
+#define FLEXSPI_8PAD 3
+
+#define FLEXSPI_LUT_SEQ(cmd0, pad0, op0, cmd1, pad1, op1)                                                              \
+    (FLEXSPI_LUT_OPERAND0(op0) | FLEXSPI_LUT_NUM_PADS0(pad0) | FLEXSPI_LUT_OPCODE0(cmd0) | FLEXSPI_LUT_OPERAND1(op1) | \
+     FLEXSPI_LUT_NUM_PADS1(pad1) | FLEXSPI_LUT_OPCODE1(cmd1))
+
+//!@brief Definitions for FlexSPI Serial Clock Frequency
+typedef enum _FlexSpiSerialClockFreq
+{
+    kFlexSpiSerialClk_30MHz  = 1,
+    kFlexSpiSerialClk_50MHz  = 2,
+    kFlexSpiSerialClk_60MHz  = 3,
+    kFlexSpiSerialClk_75MHz  = 4,
+    kFlexSpiSerialClk_80MHz  = 5,
+    kFlexSpiSerialClk_100MHz = 6,
+    kFlexSpiSerialClk_120MHz = 7,
+    kFlexSpiSerialClk_133MHz = 8,
+    kFlexSpiSerialClk_166MHz = 9,
+} flexspi_serial_clk_freq_t;
+
+//!@brief FlexSPI clock configuration type
+enum
+{
+    kFlexSpiClk_SDR, //!< Clock configure for SDR mode
+    kFlexSpiClk_DDR, //!< Clock configurat for DDR mode
+};
+
+//!@brief FlexSPI Read Sample Clock Source definition
+typedef enum _FlashReadSampleClkSource
+{
+    kFlexSPIReadSampleClk_LoopbackInternally      = 0,
+    kFlexSPIReadSampleClk_LoopbackFromDqsPad      = 1,
+    kFlexSPIReadSampleClk_LoopbackFromSckPad      = 2,
+    kFlexSPIReadSampleClk_ExternalInputFromDqsPad = 3,
+} flexspi_read_sample_clk_t;
+
+//!@brief Misc feature bit definitions
+enum
+{
+    kFlexSpiMiscOffset_DiffClkEnable            = 0, //!< Bit for Differential clock enable
+    kFlexSpiMiscOffset_Ck2Enable                = 1, //!< Bit for CK2 enable
+    kFlexSpiMiscOffset_ParallelEnable           = 2, //!< Bit for Parallel mode enable
+    kFlexSpiMiscOffset_WordAddressableEnable    = 3, //!< Bit for Word Addressable enable
+    kFlexSpiMiscOffset_SafeConfigFreqEnable     = 4, //!< Bit for Safe Configuration Frequency enable
+    kFlexSpiMiscOffset_PadSettingOverrideEnable = 5, //!< Bit for Pad setting override enable
+    kFlexSpiMiscOffset_DdrModeEnable            = 6, //!< Bit for DDR clock confiuration indication.
+};
+
+//!@brief Flash Type Definition
+enum
+{
+    kFlexSpiDeviceType_SerialNOR    = 1,    //!< Flash devices are Serial NOR
+    kFlexSpiDeviceType_SerialNAND   = 2,    //!< Flash devices are Serial NAND
+    kFlexSpiDeviceType_SerialRAM    = 3,    //!< Flash devices are Serial RAM/HyperFLASH
+    kFlexSpiDeviceType_MCP_NOR_NAND = 0x12, //!< Flash device is MCP device, A1 is Serial NOR, A2 is Serial NAND
+    kFlexSpiDeviceType_MCP_NOR_RAM  = 0x13, //!< Flash deivce is MCP device, A1 is Serial NOR, A2 is Serial RAMs
+};
+
+//!@brief Flash Pad Definitions
+enum
+{
+    kSerialFlash_1Pad  = 1,
+    kSerialFlash_2Pads = 2,
+    kSerialFlash_4Pads = 4,
+    kSerialFlash_8Pads = 8,
+};
+
+//!@brief FlexSPI LUT Sequence structure
+typedef struct _lut_sequence
+{
+    uint8_t seqNum; //!< Sequence Number, valid number: 1-16
+    uint8_t seqId;  //!< Sequence Index, valid number: 0-15
+    uint16_t reserved;
+} flexspi_lut_seq_t;
+
+//!@brief Flash Configuration Command Type
+enum
+{
+    kDeviceConfigCmdType_Generic,    //!< Generic command, for example: configure dummy cycles, drive strength, etc
+    kDeviceConfigCmdType_QuadEnable, //!< Quad Enable command
+    kDeviceConfigCmdType_Spi2Xpi,    //!< Switch from SPI to DPI/QPI/OPI mode
+    kDeviceConfigCmdType_Xpi2Spi,    //!< Switch from DPI/QPI/OPI to SPI mode
+    kDeviceConfigCmdType_Spi2NoCmd,  //!< Switch to 0-4-4/0-8-8 mode
+    kDeviceConfigCmdType_Reset,      //!< Reset device command
+};
+
+//!@brief FlexSPI Memory Configuration Block
+typedef struct _FlexSPIConfig
+{
+    uint32_t tag;               //!< [0x000-0x003] Tag, fixed value 0x42464346UL
+    uint32_t version;           //!< [0x004-0x007] Version,[31:24] -'V', [23:16] - Major, [15:8] - Minor, [7:0] - bugfix
+    uint32_t reserved0;         //!< [0x008-0x00b] Reserved for future use
+    uint8_t readSampleClkSrc;   //!< [0x00c-0x00c] Read Sample Clock Source, valid value: 0/1/3
+    uint8_t csHoldTime;         //!< [0x00d-0x00d] CS hold time, default value: 3
+    uint8_t csSetupTime;        //!< [0x00e-0x00e] CS setup time, default value: 3
+    uint8_t columnAddressWidth; //!< [0x00f-0x00f] Column Address with, for HyperBus protocol, it is fixed to 3, For
+    //! Serial NAND, need to refer to datasheet
+    uint8_t deviceModeCfgEnable; //!< [0x010-0x010] Device Mode Configure enable flag, 1 - Enable, 0 - Disable
+    uint8_t deviceModeType; //!< [0x011-0x011] Specify the configuration command type:Quad Enable, DPI/QPI/OPI switch,
+    //! Generic configuration, etc.
+    uint16_t waitTimeCfgCommands; //!< [0x012-0x013] Wait time for all configuration commands, unit: 100us, Used for
+    //! DPI/QPI/OPI switch or reset command
+    flexspi_lut_seq_t deviceModeSeq; //!< [0x014-0x017] Device mode sequence info, [7:0] - LUT sequence id, [15:8] - LUt
+    //! sequence number, [31:16] Reserved
+    uint32_t deviceModeArg;    //!< [0x018-0x01b] Argument/Parameter for device configuration
+    uint8_t configCmdEnable;   //!< [0x01c-0x01c] Configure command Enable Flag, 1 - Enable, 0 - Disable
+    uint8_t configModeType[3]; //!< [0x01d-0x01f] Configure Mode Type, similar as deviceModeTpe
+    flexspi_lut_seq_t
+        configCmdSeqs[3]; //!< [0x020-0x02b] Sequence info for Device Configuration command, similar as deviceModeSeq
+    uint32_t reserved1;   //!< [0x02c-0x02f] Reserved for future use
+    uint32_t configCmdArgs[3];     //!< [0x030-0x03b] Arguments/Parameters for device Configuration commands
+    uint32_t reserved2;            //!< [0x03c-0x03f] Reserved for future use
+    uint32_t controllerMiscOption; //!< [0x040-0x043] Controller Misc Options, see Misc feature bit definitions for more
+    //! details
+    uint8_t deviceType;    //!< [0x044-0x044] Device Type:  See Flash Type Definition for more details
+    uint8_t sflashPadType; //!< [0x045-0x045] Serial Flash Pad Type: 1 - Single, 2 - Dual, 4 - Quad, 8 - Octal
+    uint8_t serialClkFreq; //!< [0x046-0x046] Serial Flash Frequencey, device specific definitions, See System Boot
+    //! Chapter for more details
+    uint8_t lutCustomSeqEnable; //!< [0x047-0x047] LUT customization Enable, it is required if the program/erase cannot
+    //! be done using 1 LUT sequence, currently, only applicable to HyperFLASH
+    uint32_t reserved3[2];           //!< [0x048-0x04f] Reserved for future use
+    uint32_t sflashA1Size;           //!< [0x050-0x053] Size of Flash connected to A1
+    uint32_t sflashA2Size;           //!< [0x054-0x057] Size of Flash connected to A2
+    uint32_t sflashB1Size;           //!< [0x058-0x05b] Size of Flash connected to B1
+    uint32_t sflashB2Size;           //!< [0x05c-0x05f] Size of Flash connected to B2
+    uint32_t csPadSettingOverride;   //!< [0x060-0x063] CS pad setting override value
+    uint32_t sclkPadSettingOverride; //!< [0x064-0x067] SCK pad setting override value
+    uint32_t dataPadSettingOverride; //!< [0x068-0x06b] data pad setting override value
+    uint32_t dqsPadSettingOverride;  //!< [0x06c-0x06f] DQS pad setting override value
+    uint32_t timeoutInMs;            //!< [0x070-0x073] Timeout threshold for read status command
+    uint32_t commandInterval;        //!< [0x074-0x077] CS deselect interval between two commands
+    uint16_t dataValidTime[2]; //!< [0x078-0x07b] CLK edge to data valid time for PORT A and PORT B, in terms of 0.1ns
+    uint16_t busyOffset;       //!< [0x07c-0x07d] Busy offset, valid value: 0-31
+    uint16_t busyBitPolarity;  //!< [0x07e-0x07f] Busy flag polarity, 0 - busy flag is 1 when flash device is busy, 1 -
+    //! busy flag is 0 when flash device is busy
+    uint32_t lookupTable[64];           //!< [0x080-0x17f] Lookup table holds Flash command sequences
+    flexspi_lut_seq_t lutCustomSeq[12]; //!< [0x180-0x1af] Customizable LUT Sequences
+    uint32_t reserved4[4];              //!< [0x1b0-0x1bf] Reserved for future use
+} flexspi_mem_config_t;
+
+/*  */
+#define NOR_CMD_INDEX_READ CMD_INDEX_READ               //!< 0
+#define NOR_CMD_INDEX_READSTATUS CMD_INDEX_READSTATUS   //!< 1
+#define NOR_CMD_INDEX_WRITEENABLE CMD_INDEX_WRITEENABLE //!< 2
+#define NOR_CMD_INDEX_ERASESECTOR 3                     //!< 3
+#define NOR_CMD_INDEX_PAGEPROGRAM CMD_INDEX_WRITE       //!< 4
+#define NOR_CMD_INDEX_CHIPERASE 5                       //!< 5
+#define NOR_CMD_INDEX_DUMMY 6                           //!< 6
+#define NOR_CMD_INDEX_ERASEBLOCK 7                      //!< 7
+
+#define NOR_CMD_LUT_SEQ_IDX_READ CMD_LUT_SEQ_IDX_READ //!< 0  READ LUT sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_READSTATUS \
+    CMD_LUT_SEQ_IDX_READSTATUS //!< 1  Read Status LUT sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_READSTATUS_XPI \
+    2 //!< 2  Read status DPI/QPI/OPI sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE \
+    CMD_LUT_SEQ_IDX_WRITEENABLE //!< 3  Write Enable sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_WRITEENABLE_XPI \
+    4 //!< 4  Write Enable DPI/QPI/OPI sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_ERASESECTOR 5 //!< 5  Erase Sector sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_ERASEBLOCK 8  //!< 8 Erase Block sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_PAGEPROGRAM \
+    CMD_LUT_SEQ_IDX_WRITE                //!< 9  Program sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_CHIPERASE 11 //!< 11 Chip Erase sequence in lookupTable id stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_READ_SFDP 13 //!< 13 Read SFDP sequence in lookupTable id stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_RESTORE_NOCMD \
+    14 //!< 14 Restore 0-4-4/0-8-8 mode sequence id in lookupTable stored in config block
+#define NOR_CMD_LUT_SEQ_IDX_EXIT_NOCMD \
+    15 //!< 15 Exit 0-4-4/0-8-8 mode sequence id in lookupTable stored in config blobk
+
+/*
+ *  Serial NOR configuration block
+ */
+typedef struct _flexspi_nor_config
+{
+    flexspi_mem_config_t memConfig; //!< Common memory configuration info via FlexSPI
+    uint32_t pageSize;              //!< Page size of Serial NOR
+    uint32_t sectorSize;            //!< Sector size of Serial NOR
+    uint8_t ipcmdSerialClkFreq;     //!< Clock frequency for IP command
+    uint8_t isUniformBlockSize;     //!< Sector/Block size is the same
+    uint8_t reserved0[2];           //!< Reserved for future use
+    uint8_t serialNorType;          //!< Serial NOR Flash type: 0/1/2/3
+    uint8_t needExitNoCmdMode;      //!< Need to exit NoCmd mode before other IP command
+    uint8_t halfClkForNonReadCmd;   //!< Half the Serial Clock for non-read command: true/false
+    uint8_t needRestoreNoCmdMode;   //!< Need to Restore NoCmd mode after IP commmand execution
+    uint32_t blockSize;             //!< Block size
+    uint32_t reserve2[11];          //!< Reserved for future use
+} flexspi_nor_config_t;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifdef __cplusplus
+}
+#endif
+#endif /* __EVKMIMXRT1060_FLEXSPI_NOR_CONFIG__ */

+ 2 - 2
hw/bsp/imxrt/family.mk

@@ -13,7 +13,7 @@ CFLAGS += \
   -D__ARMVFP__=0 -D__ARMFPV5__=0\
   -D__ARMVFP__=0 -D__ARMFPV5__=0\
   -DXIP_EXTERNAL_FLASH=1 \
   -DXIP_EXTERNAL_FLASH=1 \
   -DXIP_BOOT_HEADER_ENABLE=1 \
   -DXIP_BOOT_HEADER_ENABLE=1 \
-  -DCFG_TUSB_MCU=OPT_MCU_MIMXRT10XX
+  -DCFG_TUSB_MCU=OPT_MCU_MIMXRT
 
 
 ifdef BOARD_TUD_RHPORT
 ifdef BOARD_TUD_RHPORT
 CFLAGS += -DBOARD_TUD_RHPORT=$(BOARD_TUD_RHPORT)
 CFLAGS += -DBOARD_TUD_RHPORT=$(BOARD_TUD_RHPORT)
@@ -23,7 +23,7 @@ CFLAGS += -DBOARD_TUH_RHPORT=$(BOARD_TUH_RHPORT)
 endif
 endif
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough=
+CFLAGS += -Wno-error=unused-parameter -Wno-error=implicit-fallthrough -Wno-error=redundant-decls
 
 
 MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
 MCU_DIR = $(SDK_DIR)/devices/$(MCU_VARIANT)
 
 

+ 1 - 1
hw/bsp/kuiic/kuiic.c

@@ -45,7 +45,7 @@
  * Variables
  * Variables
  ******************************************************************************/
  ******************************************************************************/
 /* System clock frequency. */
 /* System clock frequency. */
-extern uint32_t SystemCoreClock;
+// extern uint32_t SystemCoreClock;
 
 
 /*******************************************************************************
 /*******************************************************************************
  * Variables for BOARD_BootClockRUN configuration
  * Variables for BOARD_BootClockRUN configuration

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

@@ -15,7 +15,7 @@ CFLAGS += \
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
 
 
 # mcu driver cause following warnings
 # mcu driver cause following warnings
-CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter
+CFLAGS += -Wno-error=strict-prototypes -Wno-error=unused-parameter -Wno-error=redundant-decls
 
 
 MCU_DIR = hw/mcu/nxp/lpcopen/lpc11uxx/lpc_chip_11uxx
 MCU_DIR = hw/mcu/nxp/lpcopen/lpc11uxx/lpc_chip_11uxx
 
 

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

@@ -15,7 +15,7 @@ CFLAGS += \
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
   -DCFG_TUSB_MEM_ALIGN='__attribute__((aligned(64)))' 
 
 
 # startup.c and lpc_types.h cause following errors
 # startup.c and lpc_types.h cause following errors
-CFLAGS += -Wno-error=strict-prototypes
+CFLAGS += -Wno-error=strict-prototypes -Wno-error=redundant-decls
 
 
 MCU_DIR = hw/mcu/nxp/lpcopen/lpc13xx/lpc_chip_13xx
 MCU_DIR = hw/mcu/nxp/lpcopen/lpc13xx/lpc_chip_13xx
 
 

+ 0 - 1
hw/bsp/mm32/boards/mm32f327x_mb39/mm32f327x_mb39.c

@@ -52,7 +52,6 @@ void USB_DeviceClockInit (void)
 //--------------------------------------------------------------------+
 //--------------------------------------------------------------------+
 // LED
 // LED
 
 
-void board_led_write (bool state);
 extern u32 SystemCoreClock;
 extern u32 SystemCoreClock;
 const int baudrate = 115200;
 const int baudrate = 115200;
 
 

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

@@ -10,6 +10,9 @@ CFLAGS += \
   -DCFG_EXAMPLE_MSC_READONLY \
   -DCFG_EXAMPLE_MSC_READONLY \
   -DCFG_TUSB_MCU=OPT_MCU_NUC121
   -DCFG_TUSB_MCU=OPT_MCU_NUC121
 
 
+# mcu driver cause following warnings
+CFLAGS += -Wno-error=redundant-decls
+
 # All source paths should be relative to the top level.
 # All source paths should be relative to the top level.
 LD_FILE = hw/bsp/$(BOARD)/nuc121_flash.ld
 LD_FILE = hw/bsp/$(BOARD)/nuc121_flash.ld
 
 

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

@@ -10,6 +10,9 @@ CFLAGS += \
   -DCFG_EXAMPLE_MSC_READONLY \
   -DCFG_EXAMPLE_MSC_READONLY \
   -DCFG_TUSB_MCU=OPT_MCU_NUC121
   -DCFG_TUSB_MCU=OPT_MCU_NUC121
 
 
+# mcu driver cause following warnings
+CFLAGS += -Wno-error=redundant-decls
+
 # All source paths should be relative to the top level.
 # All source paths should be relative to the top level.
 LD_FILE = hw/bsp/$(BOARD)/nuc125_flash.ld
 LD_FILE = hw/bsp/$(BOARD)/nuc125_flash.ld
 
 

Beberapa file tidak ditampilkan karena terlalu banyak file yang berubah dalam diff ini