mirror of
https://github.com/hathach/tinyusb.git
synced 2025-04-16 05:42:56 +00:00
update ci to also build host example
This commit is contained in:
parent
865ebf7c5d
commit
5fb3d439b3
19
.github/workflows/build.yml
vendored
19
.github/workflows/build.yml
vendored
@ -26,9 +26,22 @@ jobs:
|
|||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
example: ['board_test', 'cdc_dual_ports', 'cdc_msc', 'cdc_msc_freertos', 'dfu_rt',
|
example:
|
||||||
'hid_composite', 'hid_composite_freertos', 'hid_generic_inout', 'midi_test', 'msc_dual_lun', 'net_lwip_webserver',
|
- 'device/board_test'
|
||||||
'usbtmc', 'webusb_serial']
|
- 'device/cdc_dual_ports'
|
||||||
|
- 'device/cdc_msc'
|
||||||
|
- 'device/cdc_msc_freertos'
|
||||||
|
- 'device/dfu_rt'
|
||||||
|
- 'device/hid_composite'
|
||||||
|
- 'device/hid_composite_freertos'
|
||||||
|
- 'device/hid_generic_inout'
|
||||||
|
- 'device/midi_test'
|
||||||
|
- 'device/msc_dual_lun'
|
||||||
|
- 'device/net_lwip_webserver'
|
||||||
|
- 'device/usbtmc'
|
||||||
|
- 'device/webusb_serial'
|
||||||
|
- 'host/cdc_msc_hid'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Setup Python
|
- name: Setup Python
|
||||||
uses: actions/setup-python@v1
|
uses: actions/setup-python@v1
|
||||||
|
0
examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC175X_6X
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC177X_8X
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC18XX
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC18XX
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC40XX
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC40XX
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC43XX
Normal file
0
examples/host/cdc_msc_hid/.only.MCU_LPC43XX
Normal file
@ -185,7 +185,8 @@ void tuh_hid_keyboard_unmounted_cb(uint8_t dev_addr)
|
|||||||
// invoked ISR context
|
// invoked ISR context
|
||||||
void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event)
|
void tuh_hid_keyboard_isr(uint8_t dev_addr, xfer_result_t event)
|
||||||
{
|
{
|
||||||
|
(void) dev_addr;
|
||||||
|
(void) event;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@ -206,6 +207,8 @@ void tuh_hid_mouse_unmounted_cb(uint8_t dev_addr)
|
|||||||
// invoked ISR context
|
// invoked ISR context
|
||||||
void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event)
|
void tuh_hid_mouse_isr(uint8_t dev_addr, xfer_result_t event)
|
||||||
{
|
{
|
||||||
|
(void) dev_addr;
|
||||||
|
(void) event;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -4,6 +4,10 @@ import sys
|
|||||||
import subprocess
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
SUCCEEDED = "\033[32msucceeded\033[0m"
|
||||||
|
FAILED = "\033[31mfailed\033[0m"
|
||||||
|
SKIPPED = "\033[33mskipped\033[0m"
|
||||||
|
|
||||||
success_count = 0
|
success_count = 0
|
||||||
fail_count = 0
|
fail_count = 0
|
||||||
skip_count = 0
|
skip_count = 0
|
||||||
@ -11,15 +15,19 @@ exit_status = 0
|
|||||||
|
|
||||||
total_time = time.monotonic()
|
total_time = time.monotonic()
|
||||||
|
|
||||||
build_format = '| {:23} | {:30} | {:9} | {:7} | {:6} | {:6} |'
|
build_format = '| {:29} | {:30} | {:18} | {:7} | {:6} | {:6} |'
|
||||||
build_separator = '-' * 100
|
build_separator = '-' * 106
|
||||||
|
|
||||||
# If examples are not specified in arguments, build all
|
# If examples are not specified in arguments, build all
|
||||||
all_examples = []
|
all_examples = []
|
||||||
|
|
||||||
for entry in os.scandir("examples/device"):
|
for entry in os.scandir("examples/device"):
|
||||||
if entry.is_dir():
|
if entry.is_dir():
|
||||||
all_examples.append(entry.name)
|
all_examples.append("device/" + entry.name)
|
||||||
|
|
||||||
|
for entry in os.scandir("examples/host"):
|
||||||
|
if entry.is_dir():
|
||||||
|
all_examples.append("host/" + entry.name)
|
||||||
|
|
||||||
if len(sys.argv) > 1:
|
if len(sys.argv) > 1:
|
||||||
input_examples = list(set(all_examples).intersection(sys.argv))
|
input_examples = list(set(all_examples).intersection(sys.argv))
|
||||||
@ -43,14 +51,14 @@ if len(sys.argv) > 1:
|
|||||||
all_boards.sort()
|
all_boards.sort()
|
||||||
|
|
||||||
def build_example(example, board):
|
def build_example(example, board):
|
||||||
subprocess.run("make -C examples/device/{} BOARD={} clean".format(example, board), shell=True,
|
subprocess.run("make -C examples/{} BOARD={} clean".format(example, board), shell=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
return subprocess.run("make -j -C examples/device/{} BOARD={} all".format(example, board), shell=True,
|
return subprocess.run("make -j -C examples/{} BOARD={} all".format(example, board), shell=True,
|
||||||
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
|
|
||||||
def build_size(example, board):
|
def build_size(example, board):
|
||||||
#elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board)
|
#elf_file = 'examples/device/{}/_build/build-{}/{}-firmware.elf'.format(example, board, board)
|
||||||
elf_file = 'examples/device/{}/_build/build-{}/*.elf'.format(example, board)
|
elf_file = 'examples/{}/_build/build-{}/*.elf'.format(example, board)
|
||||||
size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
|
size_output = subprocess.run('size {}'.format(elf_file), shell=True, stdout=subprocess.PIPE).stdout.decode("utf-8")
|
||||||
size_list = size_output.split('\n')[1].split('\t')
|
size_list = size_output.split('\n')[1].split('\t')
|
||||||
flash_size = int(size_list[0])
|
flash_size = int(size_list[0])
|
||||||
@ -58,7 +66,7 @@ def build_size(example, board):
|
|||||||
return (flash_size, sram_size)
|
return (flash_size, sram_size)
|
||||||
|
|
||||||
def skip_example(example, board):
|
def skip_example(example, board):
|
||||||
ex_dir = 'examples/device/' + example
|
ex_dir = 'examples/' + example
|
||||||
board_mk = 'hw/bsp/{}/board.mk'.format(board)
|
board_mk = 'hw/bsp/{}/board.mk'.format(board)
|
||||||
|
|
||||||
with open(board_mk) as mk:
|
with open(board_mk) as mk:
|
||||||
@ -74,10 +82,19 @@ def skip_example(example, board):
|
|||||||
if mcu_cflag in mk_contents:
|
if mcu_cflag in mk_contents:
|
||||||
return 1
|
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
|
return 0
|
||||||
|
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
print(build_format.format('Example', 'Board', 'Result', 'Time', 'Flash', 'SRAM'))
|
print(build_format.format('Example', 'Board', '\033[39mResult\033[0m', 'Time', 'Flash', 'SRAM'))
|
||||||
|
|
||||||
for example in all_examples:
|
for example in all_examples:
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
@ -89,19 +106,19 @@ for example in all_examples:
|
|||||||
|
|
||||||
# Check if board is skipped
|
# Check if board is skipped
|
||||||
if skip_example(example, board):
|
if skip_example(example, board):
|
||||||
success = "\033[33mskipped\033[0m "
|
success = SKIPPED
|
||||||
skip_count += 1
|
skip_count += 1
|
||||||
print(build_format.format(example, board, success, '-', flash_size, sram_size))
|
print(build_format.format(example, board, success, '-', flash_size, sram_size))
|
||||||
else:
|
else:
|
||||||
build_result = build_example(example, board)
|
build_result = build_example(example, board)
|
||||||
|
|
||||||
if build_result.returncode == 0:
|
if build_result.returncode == 0:
|
||||||
success = "\033[32msucceeded\033[0m"
|
success = SUCCEEDED
|
||||||
success_count += 1
|
success_count += 1
|
||||||
(flash_size, sram_size) = build_size(example, board)
|
(flash_size, sram_size) = build_size(example, board)
|
||||||
else:
|
else:
|
||||||
exit_status = build_result.returncode
|
exit_status = build_result.returncode
|
||||||
success = "\033[31mfailed\033[0m "
|
success = FAILED
|
||||||
fail_count += 1
|
fail_count += 1
|
||||||
|
|
||||||
build_duration = time.monotonic() - start_time
|
build_duration = time.monotonic() - start_time
|
||||||
@ -114,7 +131,7 @@ for example in all_examples:
|
|||||||
|
|
||||||
total_time = time.monotonic() - total_time
|
total_time = time.monotonic() - total_time
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
print("Build Sumamary: {} \033[32msucceeded\033[0m, {} \033[31mfailed\033[0m, {} \033[33mskipped\033[0m and took {:.2f}s".format(success_count, fail_count, skip_count, total_time))
|
print("Build Summary: {} {}, {} {}, {} {} and took {:.2f}s".format(success_count, SUCCEEDED, fail_count, FAILED, skip_count, SKIPPED, total_time))
|
||||||
print(build_separator)
|
print(build_separator)
|
||||||
|
|
||||||
sys.exit(exit_status)
|
sys.exit(exit_status)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user