build_arm.yml 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217
  1. name: Build ARM
  2. on:
  3. push:
  4. paths:
  5. - 'src/**'
  6. - 'examples/**'
  7. - 'lib/**'
  8. - 'hw/**'
  9. pull_request:
  10. branches: [ master ]
  11. paths:
  12. - 'src/**'
  13. - 'examples/**'
  14. - 'lib/**'
  15. - 'hw/**'
  16. concurrency:
  17. group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
  18. cancel-in-progress: true
  19. jobs:
  20. # ---------------------------------------
  21. # Build ARM family
  22. # ---------------------------------------
  23. build-arm:
  24. runs-on: ubuntu-latest
  25. strategy:
  26. fail-fast: false
  27. matrix:
  28. family:
  29. # Alphabetical order
  30. - 'broadcom_32bit'
  31. - 'imxrt'
  32. - 'lpc15'
  33. - 'lpc18'
  34. - 'lpc54'
  35. - 'lpc55'
  36. - 'mm32'
  37. - 'msp432e4'
  38. - 'nrf'
  39. - 'rp2040'
  40. - 'samd11'
  41. - 'samd21'
  42. - 'samd51'
  43. - 'saml2x'
  44. - 'stm32f0'
  45. - 'stm32f1'
  46. - 'stm32f4'
  47. - 'stm32f7'
  48. - 'stm32g4'
  49. - 'stm32h7'
  50. - 'stm32l4'
  51. - 'stm32wb'
  52. - 'tm4c123'
  53. - 'xmc4000'
  54. steps:
  55. - name: Setup Python
  56. uses: actions/setup-python@v4
  57. with:
  58. python-version: '3.x'
  59. - name: Install ARM GCC
  60. uses: carlosperate/arm-none-eabi-gcc-action@v1
  61. with:
  62. release: '11.2-2022.02'
  63. - name: Checkout TinyUSB
  64. uses: actions/checkout@v3
  65. - name: Checkout common submodules in lib
  66. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip lib/sct_neopixel
  67. - name: Checkout hathach/linkermap
  68. uses: actions/checkout@v3
  69. with:
  70. repository: hathach/linkermap
  71. path: linkermap
  72. - name: Checkout pico-sdk for rp2040
  73. if: matrix.family == 'rp2040'
  74. run: |
  75. git clone --depth 1 -b develop https://github.com/raspberrypi/pico-sdk ~/pico-sdk
  76. echo >> $GITHUB_ENV PICO_SDK_PATH=~/pico-sdk
  77. - name: Get Dependencies
  78. run: python3 tools/get_dependencies.py ${{ matrix.family }}
  79. - name: Build
  80. run: python3 tools/build_family.py ${{ matrix.family }}
  81. - name: Linker Map
  82. run: |
  83. pip install linkermap/
  84. # find -quit to only print linkermap of 1 board per example
  85. for ex in `ls -d examples/*/*/`
  86. do
  87. find ${ex} -name *.map -print -quit | xargs -I % sh -c 'echo "::group::%"; linkermap -v %; echo "::endgroup::"'
  88. done
  89. # Following steps are for Hardware Test with self-hosted
  90. - name: Prepare Artifacts
  91. if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
  92. run: find examples/ -name "*.elf" -exec mv {} . \;
  93. - name: Upload Artifacts for Hardware Test
  94. if: matrix.family == 'rp2040' && github.repository_owner == 'hathach'
  95. uses: actions/upload-artifact@v3
  96. with:
  97. name: ${{ matrix.family }}
  98. path: |
  99. *.elf
  100. # ---------------------------------------
  101. # Build all no-family (orphaned) boards
  102. # disable this workflow since it is often failed randomly
  103. # ---------------------------------------
  104. build-board:
  105. runs-on: ubuntu-latest
  106. if: false
  107. strategy:
  108. fail-fast: false
  109. matrix:
  110. example:
  111. # Alphabetical order, a group of 4
  112. - 'device/audio_test device/board_test device/cdc_dual_ports device/cdc_msc'
  113. - 'device/cdc_msc_freertos device/dfu_runtime device/hid_composite device/hid_composite_freertos'
  114. - 'device/hid_generic_inout device/hid_multiple_interface device/midi_test device/msc_dual_lun'
  115. - 'device/net_lwip_webserver'
  116. - 'device/uac2_headset device/usbtmc device/webusb_serial host/cdc_msc_hid'
  117. steps:
  118. - name: Setup Python
  119. uses: actions/setup-python@v4
  120. with:
  121. python-version: '3.x'
  122. - name: Install ARM GCC
  123. uses: carlosperate/arm-none-eabi-gcc-action@v1
  124. with:
  125. release: '11.2-2022.02'
  126. - name: Checkout TinyUSB
  127. uses: actions/checkout@v3
  128. - name: Checkout common submodules in lib
  129. run: git submodule update --init lib/FreeRTOS-Kernel lib/lwip
  130. - name: Build
  131. run: python3 tools/build_board.py ${{ matrix.example }}
  132. # ---------------------------------------
  133. # Hardware in the loop (HIL)
  134. # Current self-hosted instance is running on an RPI4 with
  135. # - pico + pico-probe connected via USB
  136. # - pico-probe is /dev/ttyACM0
  137. # ---------------------------------------
  138. hw-rp2040-test:
  139. # Limit the run to only hathach due to limited resource on RPI4
  140. if: github.repository_owner == 'hathach'
  141. needs: build-arm
  142. runs-on: [self-hosted, Linux, ARM64, rp2040]
  143. steps:
  144. - name: Clean workspace
  145. run: |
  146. echo "Cleaning up previous run"
  147. rm -rf "${{ github.workspace }}"
  148. mkdir -p "${{ github.workspace }}"
  149. - name: Download rp2040 Artifacts
  150. uses: actions/download-artifact@v3
  151. with:
  152. name: rp2040
  153. - name: Create flash.sh
  154. run: |
  155. echo > flash.sh 'cmdout=$(openocd -f "interface/picoprobe.cfg" -f "target/rp2040.cfg" -c "program $1 reset exit")'
  156. echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
  157. chmod +x flash.sh
  158. - name: Test cdc_dual_ports
  159. run: |
  160. ./flash.sh cdc_dual_ports.elf
  161. while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 5 ]; do :; done
  162. test -e /dev/ttyACM1 && echo "ttyACM1 exists"
  163. test -e /dev/ttyACM2 && echo "ttyACM2 exists"
  164. - name: Test cdc_msc
  165. run: |
  166. ./flash.sh cdc_msc.elf
  167. readme='/media/pi/TinyUSB MSC/README.TXT'
  168. while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 5 ]; do :; done
  169. test -e /dev/ttyACM1 && echo "ttyACM1 exists"
  170. test -f "$readme" && echo "$readme exists"
  171. cat "$readme"
  172. - name: Test dfu
  173. run: |
  174. ./flash.sh dfu.elf
  175. while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 5 ]; do :; done
  176. dfu-util -d cafe -a 0 -U dfu0
  177. dfu-util -d cafe -a 1 -U dfu1
  178. grep "TinyUSB DFU! - Partition 0" dfu0
  179. grep "TinyUSB DFU! - Partition 1" dfu1
  180. - name: Test dfu_runtime
  181. run: |
  182. ./flash.sh dfu_runtime.elf
  183. while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 5 ]; do :; done
  184. # - name: Test hid_boot_interface
  185. # run: |
  186. # ./flash.sh hid_boot_interface.elf
  187. # while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 5 ]; do :; done