Skip to content

Commit

Permalink
more hil update
Browse files Browse the repository at this point in the history
  • Loading branch information
hathach committed Sep 30, 2024
1 parent 376f198 commit e993c0a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 43 deletions.
31 changes: 0 additions & 31 deletions .github/workflows/hil_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,37 +59,6 @@ jobs:
one-per-family: true
upload-artifacts: true

# needs: set-matrix
# runs-on: ubuntu-latest
# strategy:
# fail-fast: false
# matrix:
# board: ${{ fromJSON(needs.set-matrix.outputs.json)['arm-gcc'] }}
# steps:
# - name: Checkout TinyUSB
# uses: actions/checkout@v4
#
# - name: Setup arm-gcc toolchain
# uses: ./.github/actions/setup_toolchain
# with:
# toolchain: 'arm-gcc'
#
# - name: Get Dependencies
# uses: ./.github/actions/get_deps
# with:
# arg: -b${{ matrix.board }}
#
# - name: Build
# run: python tools/build.py -b${{ matrix.board }}
#
# - name: Upload Artifacts for Hardware Testing
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.board }}
# path: |
# cmake-build/cmake-build-*/*/*/*.elf
# cmake-build/cmake-build-*/*/*/*.bin

# ---------------------------------------
# Hardware in the loop (HIL)
# self-hosted running on an VM. For attached hardware checkout test/hil/tinyusb.json
Expand Down
22 changes: 10 additions & 12 deletions test/hil/hil_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ def read_disk_file(uid, lun, fname):
# -------------------------------------------------------------
# Flashing firmware
# -------------------------------------------------------------
def run_cmd(cmd):
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
def run_cmd(cmd, cwd=None):
r = subprocess.run(cmd, cwd=cwd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if r.returncode != 0:
title = f'COMMAND FAILED: {cmd}'
print()
Expand Down Expand Up @@ -204,14 +204,14 @@ def flash_wlink_rs(board, firmware):

def flash_esptool(board, firmware):
port = get_serial_dev(board["flasher_sn"], None, None, 0)
dir = os.path.dirname(f'{firmware}.bin')
with open(f'{dir}/config.env') as f:
IDF_TARGET = json.load(f)['IDF_TARGET']
with open(f'{dir}/flash_args') as f:
fw_dir = os.path.dirname(f'{firmware}.bin')
with open(f'{fw_dir}/config.env') as f:
idf_target = json.load(f)['IDF_TARGET']
with open(f'{fw_dir}/flash_args') as f:
flash_args = f.read().strip().replace('\n', ' ')
command = (f'esptool.py --chip {IDF_TARGET} -p {port} {board["flasher_args"]} '
command = (f'esptool.py --chip {idf_target} -p {port} {board["flasher_args"]} '
f'--before=default_reset --after=hard_reset write_flash {flash_args}')
ret = subprocess.run(command, shell=True, cwd=dir, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ret = run_cmd(command, cwd=fw_dir)
return ret


Expand Down Expand Up @@ -306,8 +306,7 @@ def test_device_dfu(board):
# Wait device enum
timeout = ENUM_TIMEOUT
while timeout:
ret = subprocess.run(f'dfu-util -l',
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ret = run_cmd(f'dfu-util -l')
stdout = ret.stdout.decode()
if f'serial="{uid}"' in stdout and 'Found DFU: [cafe:4000]' in stdout:
break
Expand Down Expand Up @@ -348,8 +347,7 @@ def test_device_dfu_runtime(board):
# Wait device enum
timeout = ENUM_TIMEOUT
while timeout:
ret = subprocess.run(f'dfu-util -l',
shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
ret = run_cmd(f'dfu-util -l')
stdout = ret.stdout.decode()
if f'serial="{uid}"' in stdout and 'Found Runtime: [cafe:4000]' in stdout:
break
Expand Down

0 comments on commit e993c0a

Please sign in to comment.