From fd55b96ca1856d692e4055eaeae467b8b848520c Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 11:45:50 +0700 Subject: [PATCH 1/8] test changing upload artifacts for hil test --- .github/workflows/build_esp.yml | 13 +++++++++++++ .github/workflows/cmake_arm.yml | 18 +++++++++--------- 2 files changed, 22 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index 4568695c2..e2bf5e0cb 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -48,3 +48,16 @@ jobs: - name: Build run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32.py ${{ matrix.board }} + + - name: test dir + run: tree + + - name: Upload Artifacts for Hardware Testing + if: matrix.board == 'espressif_s3_devkitc' && github.repository_owner == 'hathach' + uses: actions/upload-artifact@v3 + with: + name: ${{ matrix.board }} + path: | + cmake-build/cmake-build-${{ matrix.board }}/device/*/*.elf + cmake-build/cmake-build-${{ matrix.board }}/device/*/config.env + cmake-build/cmake-build-${{ matrix.board }}/device/*/flash_args diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index f4b93cec7..818dbeda9 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -87,21 +87,21 @@ jobs: PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk # Upload binaries for hardware test with self-hosted - - name: Prepare rp2040 Artifacts - if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach' - working-directory: ${{github.workspace}}/cmake-build/cmake-build-raspberry_pi_pico - run: | - find device/ -name "*.elf" -exec mv {} ../../ \; - # find host/ -name "*.elf" -exec mv {} ../../ \; - # find dual/ -name "*.elf" -exec mv {} ../../ \; +# - name: Prepare rp2040 Artifacts +# if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach' +# working-directory: ${{github.workspace}}/cmake-build/cmake-build-raspberry_pi_pico +# run: | +# find device/ -name "*.elf" -exec mv {} ../../ \; +# # find host/ -name "*.elf" -exec mv {} ../../ \; +# # find dual/ -name "*.elf" -exec mv {} ../../ \; - - name: Upload Artifacts for rp2040 + - name: Upload Artifacts for Hardware Testing if: contains(matrix.family,'rp2040') && github.repository_owner == 'hathach' uses: actions/upload-artifact@v3 with: name: rp2040 path: | - *.elf + cmake-build/cmake-build-raspberry_pi_pico/device/*/*.elf # --------------------------------------- # Hardware in the loop (HIL) From 0642a6d9e7ece8f12090e3d3cf63379284f90a36 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 11:56:04 +0700 Subject: [PATCH 2/8] more artifacts --- .github/workflows/build_esp.yml | 10 ++++--- .github/workflows/cmake_arm.yml | 47 +++++++++++++-------------------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index e2bf5e0cb..56e649935 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -30,7 +30,7 @@ jobs: matrix: board: # ESP32-S2 - - 'espressif_kaluga_1' +# - 'espressif_kaluga_1' # ESP32-S3 - 'espressif_s3_devkitc' @@ -58,6 +58,8 @@ jobs: with: name: ${{ matrix.board }} path: | - cmake-build/cmake-build-${{ matrix.board }}/device/*/*.elf - cmake-build/cmake-build-${{ matrix.board }}/device/*/config.env - cmake-build/cmake-build-${{ matrix.board }}/device/*/flash_args + cmake-build/cmake-build-${{ matrix.board }}/*/*/bootloader/bootloader.bin + cmake-build/cmake-build-${{ matrix.board }}/*/*/*.bin + 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 diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index 818dbeda9..801e2b043 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -33,25 +33,25 @@ jobs: matrix: family: # Alphabetical order - - 'imxrt' - - 'kinetis_kl' - - 'lpc18 lpc40 lpc43' - - 'lpc54 lpc55' - - 'mcx' - - 'nrf' - - 'ra' +# - 'imxrt' +# - 'kinetis_kl' +# - 'lpc18 lpc40 lpc43' +# - 'lpc54 lpc55' +# - 'mcx' +# - 'nrf' +# - 'ra' - 'rp2040' - - 'samd21' - - 'samd51' - - 'stm32f0' - - 'stm32f1' - - 'stm32f4' - - 'stm32f7' - - 'stm32g0' - - 'stm32g4' - - 'stm32h7' - - 'stm32l4' - - 'stm32u5' +# - 'samd21' +# - 'samd51' +# - 'stm32f0' +# - 'stm32f1' +# - 'stm32f4' +# - 'stm32f7' +# - 'stm32g0' +# - 'stm32g4' +# - 'stm32h7' +# - 'stm32l4' +# - 'stm32u5' steps: - name: Setup Python uses: actions/setup-python@v4 @@ -86,22 +86,13 @@ jobs: # for rp2040, there is no harm if defined for other families PICO_SDK_PATH: ${{ github.workspace }}/pico-sdk - # Upload binaries for hardware test with self-hosted -# - name: Prepare rp2040 Artifacts -# if: contains(matrix.family, 'rp2040') && github.repository_owner == 'hathach' -# working-directory: ${{github.workspace}}/cmake-build/cmake-build-raspberry_pi_pico -# run: | -# find device/ -name "*.elf" -exec mv {} ../../ \; -# # find host/ -name "*.elf" -exec mv {} ../../ \; -# # find dual/ -name "*.elf" -exec mv {} ../../ \; - - name: Upload Artifacts for Hardware Testing if: contains(matrix.family,'rp2040') && github.repository_owner == 'hathach' uses: actions/upload-artifact@v3 with: name: rp2040 path: | - cmake-build/cmake-build-raspberry_pi_pico/device/*/*.elf + cmake-build/cmake-build-raspberry_pi_pico/*/*/*.elf # --------------------------------------- # Hardware in the loop (HIL) From 721ae45ebbbf679776d9bdc218a483d77b175462 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 14:29:11 +0700 Subject: [PATCH 3/8] update hil test to support s3 --- .github/workflows/build_esp.yml | 36 +++++++++++++++++ .github/workflows/cmake_arm.yml | 20 +++++---- hw/bsp/espressif/boards/family.c | 2 +- test/hil/hil_pi4.json | 10 +++++ test/hil/hil_test.py | 69 +++++++++++++++++++------------- 5 files changed, 101 insertions(+), 36 deletions(-) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index 56e649935..62bdb266c 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -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 diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index 801e2b043..f917c4582 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -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 diff --git a/hw/bsp/espressif/boards/family.c b/hw/bsp/espressif/boards/family.c index c32ccbc84..325e9ab0f 100644 --- a/hw/bsp/espressif/boards/family.c +++ b/hw/bsp/espressif/boards/family.c @@ -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 } diff --git a/test/hil/hil_pi4.json b/test/hil/hil_pi4.json index d613f8da8..6ebb6c8f0 100644 --- a/test/hil/hil_pi4.json +++ b/test/hil/hil_pi4.json @@ -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" } ] } diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index b307a45f6..a6932cfcc 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -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() From 3689c4c60400d95178063199e713b9dc1405a199 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 14:38:37 +0700 Subject: [PATCH 4/8] more test --- .github/workflows/cmake_arm.yml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index f917c4582..c8f8fb99a 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -125,6 +125,13 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ matrix.board }} + path: cmake-build/cmake-build-${{ matrix.board }} + + - name: Display structure of downloaded files + run: ls -R + working-directory: cmake-build/cmake-build-${{ matrix.board }} + + - run: tree - name: Test on actual hardware run: | From c8291168301b597f586d15510c780a9bdb8d0e69 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 14:43:54 +0700 Subject: [PATCH 5/8] extract artifacts to same folder structure as ci build --- .github/workflows/build_esp.yml | 2 +- .github/workflows/cmake_arm.yml | 7 ------- test/hil/hil_test.py | 8 ++------ 3 files changed, 3 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index 62bdb266c..c3fd53bf6 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -78,7 +78,6 @@ jobs: matrix: board: - 'espressif_s3_devkitc' - steps: - name: Clean workspace run: | @@ -95,6 +94,7 @@ jobs: uses: actions/download-artifact@v3 with: name: ${{ matrix.board }} + path: cmake-build/cmake-build-${{ matrix.board }} - name: Test on actual hardware run: | diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index c8f8fb99a..1ec90b10a 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -108,7 +108,6 @@ jobs: matrix: board: - 'raspberry_pi_pico' - steps: - name: Clean workspace run: | @@ -127,12 +126,6 @@ jobs: name: ${{ matrix.board }} path: cmake-build/cmake-build-${{ matrix.board }} - - name: Display structure of downloaded files - run: ls -R - working-directory: cmake-build/cmake-build-${{ matrix.board }} - - - run: tree - - name: Test on actual hardware run: | python3 test/hil/hil_test.py --board ${{ matrix.board }} hil_pi4.json diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index a6932cfcc..1b1349fb8 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -304,14 +304,10 @@ def main(config_file, board): test_list.remove(skip) for test in test_list: + # cmake, make 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' + f'examples/device/{test}/_build/{item["name"]}/{test}.elf' ] fw = None From e1142d4527aa811d89276abe37060503703011b8 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 14:52:21 +0700 Subject: [PATCH 6/8] wrap up s3 hil test --- .github/workflows/build_esp.yml | 6 +----- .github/workflows/cmake_arm.yml | 36 ++++++++++++++++----------------- test/hil/hil_test.py | 4 +++- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/.github/workflows/build_esp.yml b/.github/workflows/build_esp.yml index c3fd53bf6..fded0e85d 100644 --- a/.github/workflows/build_esp.yml +++ b/.github/workflows/build_esp.yml @@ -30,10 +30,9 @@ jobs: matrix: board: # ESP32-S2 -# - 'espressif_kaluga_1' + - 'espressif_kaluga_1' # ESP32-S3 - 'espressif_s3_devkitc' - steps: - name: Setup Python uses: actions/setup-python@v4 @@ -49,9 +48,6 @@ jobs: - name: Build run: docker run --rm -v $PWD:/project -w /project espressif/idf:latest python3 tools/build_esp32.py ${{ matrix.board }} - - name: test dir - run: tree - - name: Upload Artifacts for Hardware Testing if: matrix.board == 'espressif_s3_devkitc' && github.repository_owner == 'hathach' uses: actions/upload-artifact@v3 diff --git a/.github/workflows/cmake_arm.yml b/.github/workflows/cmake_arm.yml index 1ec90b10a..535244c47 100644 --- a/.github/workflows/cmake_arm.yml +++ b/.github/workflows/cmake_arm.yml @@ -33,25 +33,25 @@ jobs: matrix: family: # Alphabetical order -# - 'imxrt' -# - 'kinetis_kl' -# - 'lpc18 lpc40 lpc43' -# - 'lpc54 lpc55' -# - 'mcx' -# - 'nrf' -# - 'ra' + - 'imxrt' + - 'kinetis_kl' + - 'lpc18 lpc40 lpc43' + - 'lpc54 lpc55' + - 'mcx' + - 'nrf' + - 'ra' - 'rp2040' -# - 'samd21' -# - 'samd51' -# - 'stm32f0' -# - 'stm32f1' -# - 'stm32f4' -# - 'stm32f7' -# - 'stm32g0' -# - 'stm32g4' -# - 'stm32h7' -# - 'stm32l4' -# - 'stm32u5' + - 'samd21' + - 'samd51' + - 'stm32f0' + - 'stm32f1' + - 'stm32f4' + - 'stm32f7' + - 'stm32g0' + - 'stm32g4' + - 'stm32h7' + - 'stm32l4' + - 'stm32u5' steps: - name: Setup Python uses: actions/setup-python@v4 diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index 1b1349fb8..fe31a54e8 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -304,9 +304,11 @@ def main(config_file, board): test_list.remove(skip) for test in test_list: - # cmake, make fw_list = [ + # cmake: esp32 use .bin file f'cmake-build/cmake-build-{item["name"]}/device/{test}/{test}.elf', + f'cmake-build/cmake-build-{item["name"]}/device/{test}/{test}.bin', + # make f'examples/device/{test}/_build/{item["name"]}/{test}.elf' ] From aa21d50196442e40aa009e61a72d5c4c435551e0 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 15:23:09 +0700 Subject: [PATCH 7/8] rename hil json debugger to flasher, replace jlink cpu with flasher_args --- test/hil/hil_hfp.json | 18 +++++++++--------- test/hil/hil_pi4.json | 12 ++++++------ test/hil/hil_test.py | 16 ++++++++-------- 3 files changed, 23 insertions(+), 23 deletions(-) diff --git a/test/hil/hil_hfp.json b/test/hil/hil_hfp.json index 58f550901..e79a3cfc9 100644 --- a/test/hil/hil_hfp.json +++ b/test/hil/hil_hfp.json @@ -3,23 +3,23 @@ { "name": "stm32l412nucleo", "uid": "41003B000E504E5457323020", - "debugger": "jlink", - "debugger_sn": "774470029", - "cpu": "STM32L412KB" + "flasher": "jlink", + "flasher_sn": "774470029", + "flasher_args": "-device STM32L412KB" }, { "name": "stm32f746disco", "uid": "210041000C51343237303334", - "debugger": "jlink", - "debugger_sn": "770935966", - "cpu": "STM32F746NG" + "flasher": "jlink", + "flasher_sn": "770935966", + "flasher_args": "-device STM32F746NG" }, { "name": "lpcxpresso43s67", "uid": "08F000044528BAAA8D858F58C50700F5", - "debugger": "jlink", - "debugger_sn": "728973776", - "cpu": "LPC43S67_M4" + "flasher": "jlink", + "flasher_sn": "728973776", + "flasher_args": "-device LPC43S67_M4" } ] } diff --git a/test/hil/hil_pi4.json b/test/hil/hil_pi4.json index 6ebb6c8f0..e9a6721ea 100644 --- a/test/hil/hil_pi4.json +++ b/test/hil/hil_pi4.json @@ -3,9 +3,9 @@ { "name": "raspberry_pi_pico", "uid": "E6614C311B764A37", - "debugger": "openocd", - "debugger_sn": "E6614103E72C1D2F", - "debugger_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"" + "flasher": "openocd", + "flasher_sn": "E6614103E72C1D2F", + "flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"" }, { "name": "espressif_s3_devkitc", @@ -13,9 +13,9 @@ "tests": [ "cdc_msc_freertos", "hid_composite_freertos" ], - "debugger": "esptool", - "debugger_sn": "461cb8d7decdeb119be9b506e93fd3f1", - "debugger_args": "-b 1500000" + "flasher": "esptool", + "flasher_sn": "461cb8d7decdeb119be9b506e93fd3f1", + "flasher_args": "-b 1500000" } ] } diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index fe31a54e8..9cb009264 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -43,7 +43,7 @@ def get_serial_dev(id, vendor_str, product_str, ifnum): # known vendor and product return f'/dev/serial/by-id/usb-{vendor_str}_{product_str}_{id}-if{ifnum:02d}' else: - # just use id: mostly for cp210x/ftdi debugger + # just use id: mostly for cp210x/ftdi flasher pattern = f'/dev/serial/by-id/usb-*_{id}-if{ifnum:02d}*' port_list = glob.glob(pattern) return port_list[0] @@ -100,14 +100,14 @@ def read_disk_file(id, fname): # ------------------------------------------------------------- -# Flash with debugger +# Flashing firmware # ------------------------------------------------------------- def flash_jlink(board, firmware): script = ['halt', 'r', f'loadfile {firmware}', 'r', 'go', 'exit'] with open('flash.jlink', 'w') as f: f.writelines(f'{s}\n' for s in script) ret = subprocess.run( - f'JLinkExe -USB {board["debugger_sn"]} -device {board["cpu"]} -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink', + f'JLinkExe -USB {board["flasher_sn"]} {board["flasher_args"]} -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) os.remove('flash.jlink') return ret @@ -115,19 +115,19 @@ def flash_jlink(board, firmware): def flash_openocd(board, firmware): ret = subprocess.run( - f'openocd -c "adapter serial {board["debugger_sn"]}" {board["debugger_args"]} -c "program {firmware} reset exit"', + f'openocd -c "adapter serial {board["flasher_sn"]}" {board["flasher_args"]} -c "program {firmware} reset exit"', shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) return ret def flash_esptool(board, firmware): - port = get_serial_dev(board["debugger_sn"], None, None, 0) + port = get_serial_dev(board["flasher_sn"], None, None, 0) dir = os.path.dirname(firmware) with open(f'{dir}/config.env') as f: IDF_TARGET = json.load(f)['IDF_TARGET'] with open(f'{dir}/flash_args') as f: flash_args = f.read().strip().replace('\n', ' ') - command = (f'esptool.py --chip {IDF_TARGET} -p {port} {board["debugger_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) return ret @@ -286,7 +286,7 @@ def main(config_file, board): for item in config_boards: print(f'Testing board:{item["name"]}') - debugger = item['debugger'].lower() + flasher = item['flasher'].lower() # default to all tests if 'tests' in item: @@ -325,7 +325,7 @@ def main(config_file, board): print(f' {test} ...', end='') # flash firmware - ret = globals()[f'flash_{debugger}'](item, fw) + ret = globals()[f'flash_{flasher}'](item, fw) assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode() # run test From f5f087e99cae5de00dc6d0b1b2bef534f0442c95 Mon Sep 17 00:00:00 2001 From: hathach Date: Mon, 11 Dec 2023 15:56:48 +0700 Subject: [PATCH 8/8] skip iar build for f4 and h7 to save build time --- .github/workflows/build_iar.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build_iar.yml b/.github/workflows/build_iar.yml index 1eacf90c9..b4c3052ed 100644 --- a/.github/workflows/build_iar.yml +++ b/.github/workflows/build_iar.yml @@ -32,7 +32,7 @@ jobs: # Alphabetical order # Note: bundle multiple families into a matrix since there is only one self-hosted instance can # run IAR build. Too many matrix can hurt due to setup/teardown overhead. - - 'lpc43 stm32f0 stm32f1 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4' + - 'lpc43 stm32f0 stm32f1 stm32f7 stm32g0 stm32g4 stm32l4' steps: - name: Clean workspace run: |