Bladeren bron

Unify skip and only logic for build scripts

And switch to a single file that can include mcu, family or board.
Scott Shawcroft 4 jaren geleden
bovenliggende
commit
7b27b8f498
85 gewijzigde bestanden met toevoegingen van 136 en 82 verwijderingen
  1. 2 0
      .gitignore
  2. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAMD11
  3. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAME5X
  4. 0 0
      examples/device/audio_4_channel_mic/.skip.MCU_SAMG
  5. 3 0
      examples/device/audio_4_channel_mic/skip.txt
  6. 0 0
      examples/device/audio_test/.skip.MCU_SAMD11
  7. 0 0
      examples/device/audio_test/.skip.MCU_SAME5X
  8. 0 0
      examples/device/audio_test/.skip.MCU_SAMG
  9. 3 0
      examples/device/audio_test/skip.txt
  10. 0 0
      examples/device/cdc_msc/.skip.MCU_SAMD11
  11. 1 0
      examples/device/cdc_msc/skip.txt
  12. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_BCM2711
  13. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_BCM2835
  14. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_BCM2837
  15. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_CXD56
  16. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_GD32VF103
  17. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_MKL25ZXX
  18. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_MSP430x5xx
  19. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_RP2040
  20. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_SAMD11
  21. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_SAMX7X
  22. 0 0
      examples/device/cdc_msc_freertos/.skip.MCU_VALENTYUSB_EPTRI
  23. 10 0
      examples/device/cdc_msc_freertos/skip.txt
  24. 0 4
      examples/device/dfu/.skip.MCU_TM4C123
  25. 1 0
      examples/device/dfu/skip.txt
  26. 0 0
      examples/device/dynamic_configuration/.skip.MCU_SAMD11
  27. 1 0
      examples/device/dynamic_configuration/skip.txt
  28. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_BCM2711
  29. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_BCM2835
  30. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_BCM2837
  31. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_CXD56
  32. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_GD32VF103
  33. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_MSP430x5xx
  34. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_RP2040
  35. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_SAMD11
  36. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_SAMX7X
  37. 0 0
      examples/device/hid_composite_freertos/.skip.MCU_VALENTYUSB_EPTRI
  38. 9 0
      examples/device/hid_composite_freertos/skip.txt
  39. 0 0
      examples/device/msc_dual_lun/.skip.MCU_MKL25ZXX
  40. 0 0
      examples/device/msc_dual_lun/.skip.MCU_SAMD11
  41. 2 0
      examples/device/msc_dual_lun/skip.txt
  42. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_BCM2711
  43. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_BCM2835
  44. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_BCM2837
  45. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_LPC11UXX
  46. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_LPC13XX
  47. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_MKL25ZXX
  48. 0 1
      examples/device/net_lwip_webserver/.skip.MCU_MSP430x5xx
  49. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_NUC121
  50. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_SAMD11
  51. 0 0
      examples/device/net_lwip_webserver/.skip.MCU_STM32L0
  52. 10 0
      examples/device/net_lwip_webserver/skip.txt
  53. 0 0
      examples/device/uac2_headset/.skip.MCU_LPC11UXX
  54. 0 0
      examples/device/uac2_headset/.skip.MCU_LPC13XX
  55. 0 0
      examples/device/uac2_headset/.skip.MCU_NUC121
  56. 0 0
      examples/device/uac2_headset/.skip.MCU_SAMD11
  57. 0 0
      examples/device/uac2_headset/.skip.MCU_SAME5X
  58. 0 0
      examples/device/uac2_headset/.skip.MCU_SAMG
  59. 6 0
      examples/device/uac2_headset/skip.txt
  60. 0 1
      examples/device/video_capture/.skip.MCU_MSP430x5xx
  61. 0 0
      examples/device/video_capture/.skip.MCU_SAMD11
  62. 2 0
      examples/device/video_capture/skip.txt
  63. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X
  64. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X
  65. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC18XX
  66. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC40XX
  67. 0 0
      examples/host/cdc_msc_hid/.only.MCU_LPC43XX
  68. 0 0
      examples/host/cdc_msc_hid/.only.MCU_MIMXRT10XX
  69. 0 0
      examples/host/cdc_msc_hid/.only.MCU_MSP432E4
  70. 0 0
      examples/host/cdc_msc_hid/.only.MCU_RP2040
  71. 8 0
      examples/host/cdc_msc_hid/only.txt
  72. 0 0
      examples/host/hid_controller/.only.MCU_LPC175X_6X
  73. 0 0
      examples/host/hid_controller/.only.MCU_LPC177X_8X
  74. 0 0
      examples/host/hid_controller/.only.MCU_LPC18XX
  75. 0 0
      examples/host/hid_controller/.only.MCU_LPC40XX
  76. 0 0
      examples/host/hid_controller/.only.MCU_LPC43XX
  77. 0 0
      examples/host/hid_controller/.only.MCU_MIMXRT10XX
  78. 0 0
      examples/host/hid_controller/.only.MCU_MSP432E4
  79. 0 0
      examples/host/hid_controller/.only.MCU_RP2040
  80. 8 0
      examples/host/hid_controller/only.txt
  81. 0 0
      hw/bsp/samd21/boards/curiosity_nano/.skip.device.net_lwip_webserver
  82. 3 28
      tools/build_board.py
  83. 3 4
      tools/build_esp32sx.py
  84. 3 41
      tools/build_family.py
  85. 61 0
      tools/build_utils.py

+ 2 - 0
.gitignore

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

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


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


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


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

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

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


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


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


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

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

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


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

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

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


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


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


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


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


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


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


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


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


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


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


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

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

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

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

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

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

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


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

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

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


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


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


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


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


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


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


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


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


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


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

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

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


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


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

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

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

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

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

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

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

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

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


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


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


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

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

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


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


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


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

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

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


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


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


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


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


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


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

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

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

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

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


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

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

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


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


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


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


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


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


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


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


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

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

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


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


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


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


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


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


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


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


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

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

+ 0 - 0
hw/bsp/samd21/boards/curiosity_nano/.skip.device.net_lwip_webserver


+ 3 - 28
tools/build_board.py

@@ -4,6 +4,8 @@ import sys
 import subprocess
 import time
 
+import build_utils
+
 SUCCEEDED = "\033[32msucceeded\033[0m"
 FAILED = "\033[31mfailed\033[0m"
 SKIPPED = "\033[33mskipped\033[0m"
@@ -50,7 +52,7 @@ def build_board(example, board):
     sram_size = "-"
 
     # Check if board is skipped
-    if skip_example(example, board):
+    if build_utils.skip_example(example, board):
         success = SKIPPED
         skip_count += 1
         print(build_format.format(example, board, success, '-', flash_size, sram_size))
@@ -82,33 +84,6 @@ def build_size(example, board):
     sram_size = int(size_list[1]) + int(size_list[2])
     return (flash_size, sram_size)
 
-def skip_example(example, board):
-    ex_dir = 'examples/' + example
-    board_mk = 'hw/bsp/{}/board.mk'.format(board)
-    with open(board_mk) as mk:
-        mk_contents = mk.read()
-
-        # Skip all OPT_MCU_NONE these are WIP port
-        if '-DCFG_TUSB_MCU=OPT_MCU_NONE' in mk_contents:
-            return 1
-
-        # Skip if CFG_TUSB_MCU in board.mk to match skip file
-        for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
-            mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
-            if mcu_cflag in mk_contents:
-                return 1
-
-        # Build only list, if exists only these MCU are built
-        only_list = list(glob.iglob(ex_dir + '/.only.MCU_*'))
-        if len(only_list) > 0:
-            for only_file in only_list:
-                mcu_cflag = '-DCFG_TUSB_MCU=OPT_' + os.path.basename(only_file).split('.')[2]
-                if mcu_cflag in mk_contents:
-                    return 0
-            return 1
-
-    return 0
-
 print(build_separator)
 print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
 

+ 3 - 4
tools/build_esp32sx.py

@@ -4,6 +4,8 @@ import sys
 import subprocess
 import time
 
+import build_utils
+
 SUCCEEDED = "\033[32msucceeded\033[0m"
 FAILED = "\033[31mfailed\033[0m"
 SKIPPED = "\033[33mskipped\033[0m"
@@ -51,7 +53,7 @@ def build_board(example, board):
     sram_size = "-"
 
     # Check if board is skipped
-    if skip_example(example, board):
+    if build_utils.skip_example(example, board):
         success = SKIPPED
         skip_count += 1
         print(build_format.format(example, board, success, '-', flash_size, sram_size))
@@ -83,9 +85,6 @@ def build_size(example, board):
     sram_size = int(size_list[1]) + int(size_list[2])
     return (flash_size, sram_size)
 
-def skip_example(example, board):
-    return 0
-
 print(build_separator)
 print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
 print(build_separator)

+ 3 - 41
tools/build_family.py

@@ -4,6 +4,8 @@ import sys
 import subprocess
 import time
 
+import build_utils
+
 SUCCEEDED = "\033[32msucceeded\033[0m"
 FAILED = "\033[31mfailed\033[0m"
 SKIPPED = "\033[33mskipped\033[0m"
@@ -62,7 +64,7 @@ def build_board(example, board):
     sram_size = "-"
 
     # Check if board is skipped
-    if skip_example(example, board):
+    if build_utils.skip_example(example, board):
         success = SKIPPED
         skip_count += 1
         print(build_format.format(example, board, success, '-', flash_size, sram_size))
@@ -95,46 +97,6 @@ def build_size(example, board):
     sram_size = int(size_list[1]) + int(size_list[2])
     return (flash_size, sram_size)
 
-def skip_example(example, board):
-    ex_dir = 'examples/' + example
-    
-    # Check if example is skipped by family or board directory
-    skip_file = ".skip." + example.replace('/', '.');
-    if os.path.isfile("hw/bsp/{}/{}".format(family, skip_file)) or os.path.isfile("hw/bsp/{}/boards/{}/{}".format(family, board, skip_file)):
-        return 1
-
-    # Otherwise check if mcu is excluded by example directory
-
-    # family CMake
-    family_mk = 'hw/bsp/{}/family.cmake'.format(family)
-
-    # family.mk
-    if not os.path.exists(family_mk):
-        family_mk = 'hw/bsp/{}/family.mk'.format(family)
-
-    with open(family_mk) as mk:
-        mk_contents = mk.read()
-
-        # Skip all OPT_MCU_NONE these are WIP port
-        if 'CFG_TUSB_MCU=OPT_MCU_NONE' in mk_contents:
-            return 1
-
-        # Skip if CFG_TUSB_MCU in family.mk to match skip file
-        for skip_file in glob.iglob(ex_dir + '/.skip.MCU_*'):
-            mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(skip_file).split('.')[2]
-            if mcu_cflag in mk_contents:
-                return 1
-
-        # Build only list, if exists only these MCU are built
-        only_list = list(glob.iglob(ex_dir + '/.only.MCU_*'))
-        if len(only_list) > 0:
-            for only_file in only_list:
-                mcu_cflag = 'CFG_TUSB_MCU=OPT_' + os.path.basename(only_file).split('.')[2]
-                if mcu_cflag in mk_contents:
-                    return 0
-            return 1
-    return 0
-
 print(build_separator)
 print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
 

+ 61 - 0
tools/build_utils.py

@@ -0,0 +1,61 @@
+import pathlib
+
+def skip_example(example, board):
+    ex_dir = pathlib.Path('examples/') / example
+    bsp = pathlib.Path("hw/bsp")
+
+    board_dir = list(bsp.glob("*/boards/" + board))
+    if not board_dir:
+        # Skip unknown boards
+        return True
+
+    board_dir = list(board_dir)[0]
+    
+    family_dir = board_dir.parent.parent
+    family = family_dir.name
+
+    # family CMake
+    family_mk = family_dir / "family.cmake"
+
+    # family.mk
+    if not family_mk.exists():
+        family_mk = family_dir / "family.mk"
+
+    mk_contents = family_mk.read_text()
+
+    # Find the mcu
+    if "CFG_TUSB_MCU=OPT_MCU_" not in mk_contents:
+        board_mk = board_dir / "board.cmake"
+        if not board_mk.exists():
+            board_mk = board_dir / "board.mk"
+
+        mk_contents = board_mk.read_text()
+
+    for token in mk_contents.split():
+        if "CFG_TUSB_MCU=OPT_MCU_" in token:
+            # Strip " because cmake files has them.
+            token = token.strip("\"")
+            _, opt_mcu = token.split("=")
+            mcu = opt_mcu[len("OPT_MCU_"):]
+
+    # Skip all OPT_MCU_NONE these are WIP port
+    if mcu == "NONE":
+        return True
+
+    skip_file = ex_dir / "skip.txt"
+    only_file = ex_dir / "only.txt"
+
+    if skip_file.exists() and only_file.exists():
+        raise RuntimeError("Only have a skip or only file. Not both.")
+    elif skip_file.exists():
+        skips = skip_file.read_text().split()
+        return ("mcu:" + mcu in skips or
+                "board:" + board in skips or
+                "family:" + family in skips)
+    elif only_file.exists():
+        onlys = only_file.read_text().split()
+        return not ("mcu:" + mcu in onlys or
+                    "board:" + board in onlys or
+                    "family:" + family in onlys)
+
+    return False