mirror of
https://github.com/hathach/tinyusb.git
synced 2025-03-13 19:19:18 +00:00
update hil test to support s3
This commit is contained in:
parent
0642a6d9e7
commit
721ae45ebb
36
.github/workflows/build_esp.yml
vendored
36
.github/workflows/build_esp.yml
vendored
@ -63,3 +63,39 @@ jobs:
|
||||
cmake-build/cmake-build-${{ matrix.board }}/*/*/partition_table/partition-table.bin
|
||||
cmake-build/cmake-build-${{ matrix.board }}/*/*/config.env
|
||||
cmake-build/cmake-build-${{ matrix.board }}/*/*/flash_args
|
||||
|
||||
# ---------------------------------------
|
||||
# Hardware in the loop (HIL)
|
||||
# Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
|
||||
# ---------------------------------------
|
||||
hil-test:
|
||||
# run only with hathach's commit due to limited resource on RPI4
|
||||
if: github.repository_owner == 'hathach'
|
||||
needs: build-esp
|
||||
runs-on: [self-hosted, esp32s3, hardware-in-the-loop]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- 'espressif_s3_devkitc'
|
||||
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
run: |
|
||||
echo "Cleaning up previous run"
|
||||
rm -rf "${{ github.workspace }}"
|
||||
mkdir -p "${{ github.workspace }}"
|
||||
|
||||
- name: Checkout test/hil
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
sparse-checkout: test/hil
|
||||
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: ${{ matrix.board }}
|
||||
|
||||
- name: Test on actual hardware
|
||||
run: |
|
||||
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
|
||||
|
20
.github/workflows/cmake_arm.yml
vendored
20
.github/workflows/cmake_arm.yml
vendored
@ -90,20 +90,24 @@ jobs:
|
||||
if: contains(matrix.family,'rp2040') && github.repository_owner == 'hathach'
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: rp2040
|
||||
name: raspberry_pi_pico
|
||||
path: |
|
||||
cmake-build/cmake-build-raspberry_pi_pico/*/*/*.elf
|
||||
|
||||
# ---------------------------------------
|
||||
# Hardware in the loop (HIL)
|
||||
# Current self-hosted instance is running on an RPI4.
|
||||
# For attached hardware checkout hil_pi4.json
|
||||
# Current self-hosted instance is running on an RPI4. For attached hardware checkout hil_pi4.json
|
||||
# ---------------------------------------
|
||||
hw-rp2040-test:
|
||||
hil-test:
|
||||
# run only with hathach's commit due to limited resource on RPI4
|
||||
if: github.repository_owner == 'hathach'
|
||||
needs: build-arm
|
||||
runs-on: [self-hosted, rp2040, hardware-in-the-loop]
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
board:
|
||||
- 'raspberry_pi_pico'
|
||||
|
||||
steps:
|
||||
- name: Clean workspace
|
||||
@ -117,11 +121,11 @@ jobs:
|
||||
with:
|
||||
sparse-checkout: test/hil
|
||||
|
||||
- name: Download rp2040 Artifacts
|
||||
- name: Download Artifacts
|
||||
uses: actions/download-artifact@v3
|
||||
with:
|
||||
name: rp2040
|
||||
name: ${{ matrix.board }}
|
||||
|
||||
- name: Test on actual hardware (hardware in the loop)
|
||||
- name: Test on actual hardware
|
||||
run: |
|
||||
python3 test/hil/hil_test.py hil_pi4.json
|
||||
python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json
|
||||
|
@ -158,7 +158,7 @@ size_t board_get_unique_id(uint8_t id[], size_t max_len) {
|
||||
|
||||
void board_led_write(bool state) {
|
||||
#ifdef NEOPIXEL_PIN
|
||||
strip->set_pixel(strip, 0, (state ? 0x88 : 0x00), 0x00, 0x00);
|
||||
strip->set_pixel(strip, 0, state ? 0x08 : 0x00, 0x00, 0x00);
|
||||
strip->refresh(strip, 100);
|
||||
#endif
|
||||
}
|
||||
|
@ -6,6 +6,16 @@
|
||||
"debugger": "openocd",
|
||||
"debugger_sn": "E6614103E72C1D2F",
|
||||
"debugger_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\""
|
||||
},
|
||||
{
|
||||
"name": "espressif_s3_devkitc",
|
||||
"uid": "7CDFA1E073CC",
|
||||
"tests": [
|
||||
"cdc_msc_freertos", "hid_composite_freertos"
|
||||
],
|
||||
"debugger": "esptool",
|
||||
"debugger_sn": "461cb8d7decdeb119be9b506e93fd3f1",
|
||||
"debugger_args": "-b 1500000"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
@ -28,6 +28,7 @@
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
import click
|
||||
import serial
|
||||
import subprocess
|
||||
import json
|
||||
@ -262,13 +263,15 @@ def test_hid_composite_freertos(id):
|
||||
# -------------------------------------------------------------
|
||||
# Main
|
||||
# -------------------------------------------------------------
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) != 2:
|
||||
print('Usage:')
|
||||
print('python hitl_test.py config.json')
|
||||
sys.exit(-1)
|
||||
|
||||
with open(f'{os.path.dirname(__file__)}/{sys.argv[1]}') as f:
|
||||
@click.command()
|
||||
@click.argument('config_file')
|
||||
@click.option('-b', '--board', multiple=True, default=None, help='Boards to test, all if not specified')
|
||||
def main(config_file, board):
|
||||
"""
|
||||
Hardware test on specified boards
|
||||
"""
|
||||
config_file = os.path.join(os.path.dirname(__file__), config_file)
|
||||
with open(config_file) as f:
|
||||
config = json.load(f)
|
||||
|
||||
# all possible tests
|
||||
@ -276,13 +279,18 @@ if __name__ == '__main__':
|
||||
'cdc_dual_ports', 'cdc_msc', 'dfu', 'dfu_runtime', 'hid_boot_interface',
|
||||
]
|
||||
|
||||
for board in config['boards']:
|
||||
print(f'Testing board:{board["name"]}')
|
||||
debugger = board['debugger'].lower()
|
||||
if len(board) == 0:
|
||||
config_boards = config['boards']
|
||||
else:
|
||||
config_boards = [e for e in config['boards'] if e['name'] in board]
|
||||
|
||||
for item in config_boards:
|
||||
print(f'Testing board:{item["name"]}')
|
||||
debugger = item['debugger'].lower()
|
||||
|
||||
# default to all tests
|
||||
if 'tests' in board:
|
||||
test_list = board['tests']
|
||||
if 'tests' in item:
|
||||
test_list = item['tests']
|
||||
else:
|
||||
test_list = all_tests
|
||||
|
||||
@ -290,36 +298,43 @@ if __name__ == '__main__':
|
||||
test_list.append('board_test')
|
||||
|
||||
# remove skip_tests
|
||||
if 'tests_skip' in board:
|
||||
for skip in board['tests_skip']:
|
||||
if 'tests_skip' in item:
|
||||
for skip in item['tests_skip']:
|
||||
if skip in test_list:
|
||||
test_list.remove(skip)
|
||||
|
||||
for test in test_list:
|
||||
# cmake, make, download from artifacts
|
||||
elf_list = [
|
||||
f'cmake-build/cmake-build-{board["name"]}/device/{test}/{test}.elf',
|
||||
f'examples/device/{test}/_build/{board["name"]}/{test}.elf',
|
||||
f'{test}.elf'
|
||||
fw_list = [
|
||||
# cmake build
|
||||
f'cmake-build/cmake-build-{item["name"]}/device/{test}/{test}.elf',
|
||||
# make build
|
||||
f'examples/device/{test}/_build/{item["name"]}/{test}.elf',
|
||||
# artifacts: esp32 use bin file
|
||||
f'device/{test}/{test}.elf'
|
||||
f'device/{test}/{test}.bin'
|
||||
]
|
||||
|
||||
elf = None
|
||||
for e in elf_list:
|
||||
if os.path.isfile(e):
|
||||
elf = e
|
||||
fw = None
|
||||
for f in fw_list:
|
||||
if os.path.isfile(f):
|
||||
fw = f
|
||||
break
|
||||
|
||||
if elf is None:
|
||||
print(f'Cannot find firmware file for {test}')
|
||||
if fw is None:
|
||||
print(f'Cannot find binary file for {test}')
|
||||
sys.exit(-1)
|
||||
|
||||
print(f' {test} ...', end='')
|
||||
|
||||
# flash firmware
|
||||
ret = locals()[f'flash_{debugger}'](board, elf)
|
||||
ret = globals()[f'flash_{debugger}'](item, fw)
|
||||
assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode()
|
||||
|
||||
# run test
|
||||
locals()[f'test_{test}'](board['uid'])
|
||||
globals()[f'test_{test}'](item['uid'])
|
||||
|
||||
print('OK')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
Loading…
x
Reference in New Issue
Block a user