Skip to content

Commit 271e2a3

Browse files
authored
Merge pull request #2749 from hathach/hil-change
HIL test hardware changes
2 parents c60934e + 3f4f6c0 commit 271e2a3

File tree

11 files changed

+83
-47
lines changed

11 files changed

+83
-47
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -120,10 +120,8 @@ jobs:
120120
fail-fast: false
121121
matrix:
122122
board:
123-
# ESP32-S2
124123
- 'espressif_kaluga_1'
125-
# ESP32-S3 skip since devkitm is also compiled in hil-test workflow
126-
#- 'espressif_s3_devkitm'
124+
- 'espressif_s3_devkitm'
127125
with:
128126
build-system: 'cmake'
129127
toolchain: 'esp-idf'

.github/workflows/cifuzz.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
with:
2727
oss-fuzz-project-name: 'tinyusb'
2828
language: c++
29-
fuzz-seconds: 600
29+
fuzz-seconds: 400
3030

3131
- name: Upload Crash
3232
uses: actions/upload-artifact@v4

.github/workflows/hil_test.yml

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,9 +66,11 @@ jobs:
6666
cmake-build/cmake-build-*/*/*/*.bin
6767
6868
# ---------------------------------------
69-
# Build Espressif
69+
# Build Espressif (skipped since CP210x cause USB bus issue)
70+
# cp210x ttyUSB0: usb_serial_generic_write_bulk_callback - nonzero urb status: -71
7071
# ---------------------------------------
7172
build-esp:
73+
if: false
7274
runs-on: ubuntu-latest
7375
outputs:
7476
BOARDS_LIST: ${{ steps.parse_hil_json.outputs.BOARDS_LIST }}
@@ -121,10 +123,10 @@ jobs:
121123
if: github.repository_owner == 'hathach'
122124
needs:
123125
- build
124-
- build-esp
126+
#- build-esp
125127
runs-on: [self-hosted, ARM64, rpi, hardware-in-the-loop]
126128
env:
127-
BOARDS_LIST: "${{ needs.build.outputs.BOARDS_LIST }} ${{ needs.build-esp.outputs.BOARDS_LIST }}"
129+
BOARDS_LIST: "${{ needs.build-esp.outputs.BOARDS_LIST }} ${{ needs.build.outputs.BOARDS_LIST }}"
128130
steps:
129131
- name: Clean workspace
130132
run: |
@@ -135,9 +137,9 @@ jobs:
135137
# USB bus on rpi is not stable, reset it before testing
136138
# - name: Reset USB bus
137139
# run: |
138-
# # reset VIA Labs 2.0 hub
139-
# sudo usbreset 001/002
140-
# lsusb -t
140+
# echo "1-2" | sudo tee /sys/bus/usb/drivers/usb/unbind
141+
# sleep 5
142+
# echo "1-2" | sudo tee /sys/bus/usb/drivers/usb/bind
141143

142144
- name: Checkout TinyUSB
143145
uses: actions/checkout@v4
@@ -147,14 +149,8 @@ jobs:
147149
- name: Download Artifacts
148150
uses: actions/download-artifact@v4
149151
with:
150-
name: hil_rpi
151-
path: cmake-build
152-
153-
- name: Download Artifacts
154-
uses: actions/download-artifact@v4
155-
with:
156-
name: hil_rpi_esp
157152
path: cmake-build
153+
merge-multiple: true
158154

159155
- name: Test on actual hardware
160156
run: |

hw/bsp/family_support.cmake

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,19 @@ function(family_flash_stlink TARGET)
428428
endfunction()
429429

430430

431+
# Add flash st-flash target
432+
function(family_flash_stflash TARGET)
433+
if (NOT DEFINED ST_FLASH)
434+
set(ST_FLASH st-flash)
435+
endif ()
436+
437+
add_custom_target(${TARGET}-stflash
438+
DEPENDS ${TARGET}
439+
COMMAND ${ST_FLASH} write $<TARGET_FILE_DIR:${TARGET}>/${TARGET}.bin 0x8000000
440+
)
441+
endfunction()
442+
443+
431444
# Add flash openocd target
432445
function(family_flash_openocd TARGET)
433446
if (NOT DEFINED OPENOCD)
@@ -449,6 +462,7 @@ function(family_flash_openocd TARGET)
449462
)
450463
endfunction()
451464

465+
452466
# Add flash openocd-wch target
453467
# compiled from https://github.com/hathach/riscv-openocd-wch or https://github.com/dragonlock2/miscboards/blob/main/wch/SDK/riscv-openocd.tar.xz
454468
function(family_flash_openocd_wch TARGET)
@@ -459,6 +473,7 @@ function(family_flash_openocd_wch TARGET)
459473
family_flash_openocd(${TARGET})
460474
endfunction()
461475

476+
462477
# Add flash with https://github.com/ch32-rs/wlink
463478
function(family_flash_wlink_rs TARGET)
464479
if (NOT DEFINED WLINK_RS)
@@ -471,6 +486,7 @@ function(family_flash_wlink_rs TARGET)
471486
)
472487
endfunction()
473488

489+
474490
# Add flash pycod target
475491
function(family_flash_pyocd TARGET)
476492
if (NOT DEFINED PYOC)
@@ -483,6 +499,7 @@ function(family_flash_pyocd TARGET)
483499
)
484500
endfunction()
485501

502+
486503
# Flash with UF2
487504
function(family_flash_uf2 TARGET FAMILY_ID)
488505
add_custom_target(${TARGET}-uf2
@@ -491,6 +508,7 @@ function(family_flash_uf2 TARGET FAMILY_ID)
491508
)
492509
endfunction()
493510

511+
494512
# Add flash teensy_cli target
495513
function(family_flash_teensy TARGET)
496514
if (NOT DEFINED TEENSY_CLI)
@@ -503,6 +521,7 @@ function(family_flash_teensy TARGET)
503521
)
504522
endfunction()
505523

524+
506525
# Add flash using NXP's LinkServer (redserver)
507526
# https://www.nxp.com/design/software/development-software/mcuxpresso-software-and-tools-/linkserver-for-microcontrollers:LINKERSERVER
508527
function(family_flash_nxplink TARGET)

hw/bsp/stm32f0/FreeRTOSConfig/FreeRTOSConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#define configCPU_CLOCK_HZ SystemCoreClock
5959
#define configTICK_RATE_HZ ( 1000 )
6060
#define configMAX_PRIORITIES ( 5 )
61-
#define configMINIMAL_STACK_SIZE ( 128 )
61+
#define configMINIMAL_STACK_SIZE ( 200 )
6262
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
6363
#define configMAX_TASK_NAME_LEN 16
6464
#define configUSE_16_BIT_TICKS 0

hw/bsp/stm32g0/FreeRTOSConfig/FreeRTOSConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#define configCPU_CLOCK_HZ SystemCoreClock
5959
#define configTICK_RATE_HZ ( 1000 )
6060
#define configMAX_PRIORITIES ( 5 )
61-
#define configMINIMAL_STACK_SIZE ( 128 )
61+
#define configMINIMAL_STACK_SIZE ( 200 )
6262
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
6363
#define configMAX_TASK_NAME_LEN 16
6464
#define configUSE_16_BIT_TICKS 0

hw/bsp/stm32g0/family.cmake

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ set(CMAKE_SYSTEM_PROCESSOR cortex-m0plus CACHE INTERNAL "System Processor")
1515
set(CMAKE_TOOLCHAIN_FILE ${TOP}/examples/build_system/cmake/toolchain/arm_${TOOLCHAIN}.cmake)
1616

1717
set(FAMILY_MCUS STM32G0 CACHE INTERNAL "")
18-
18+
set(OPENOCD_OPTION "-f interface/stlink.cfg -f target/stm32g0x.cfg")
1919

2020
#------------------------------------
2121
# BOARD_TARGET
@@ -112,6 +112,7 @@ function(family_configure_example TARGET RTOS)
112112
target_link_libraries(${TARGET} PUBLIC board_${BOARD} ${TARGET}-tinyusb)
113113

114114
# Flashing
115-
family_flash_stlink(${TARGET})
116115
family_flash_jlink(${TARGET})
116+
family_flash_stlink(${TARGET})
117+
#family_flash_openocd(${TARGET})
117118
endfunction()

hw/bsp/stm32h5/FreeRTOSConfig/FreeRTOSConfig.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
#define configCPU_CLOCK_HZ SystemCoreClock
5959
#define configTICK_RATE_HZ ( 1000 )
6060
#define configMAX_PRIORITIES ( 5 )
61-
#define configMINIMAL_STACK_SIZE ( 128 )
61+
#define configMINIMAL_STACK_SIZE ( 200 )
6262
#define configTOTAL_HEAP_SIZE ( configSUPPORT_DYNAMIC_ALLOCATION*4*1024 )
6363
#define configMAX_TASK_NAME_LEN 16
6464
#define configUSE_16_BIT_TICKS 0

src/device/usbd.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1201,7 +1201,7 @@ TU_ATTR_FAST_FUNC void dcd_event_handler(dcd_event_t const* event, bool in_isr)
12011201
break;
12021202

12031203
case DCD_EVENT_SETUP_RECEIVED:
1204-
// TU_ASSERT(event->setup_received.bRequest != 0,);
1204+
// TU_ASSERT(event->setup_received.bRequest != 0,); // for catching issue with ch32v203 and windows with -O0/-Og
12051205
_usbd_queued_setup++;
12061206
send = true;
12071207
break;

test/hil/hil_test.py

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
pass
4444

4545

46-
ENUM_TIMEOUT = 10
46+
ENUM_TIMEOUT = 30
4747

4848

4949
# get usb serial by id
@@ -138,10 +138,15 @@ def flash_jlink(board, firmware):
138138

139139

140140
def flash_stlink(board, firmware):
141-
#ret = run_cmd(f'st-flash --serial {board["flasher_sn"]} write {firmware}.bin 0x08000000')
142141
ret = run_cmd(f'STM32_Programmer_CLI --connect port=swd sn={board["flasher_sn"]} --write {firmware}.elf --go')
143142
return ret
144143

144+
145+
def flash_stflash(board, firmware):
146+
ret = run_cmd(f'st-flash --serial {board["flasher_sn"]} write {firmware}.bin 0x8000000')
147+
return ret
148+
149+
145150
def flash_openocd(board, firmware):
146151
ret = run_cmd(f'openocd -c "adapter serial {board["flasher_sn"]}" {board["flasher_args"]} -c "program {firmware}.elf reset exit"')
147152
return ret
@@ -378,7 +383,8 @@ def main():
378383
if not os.path.exists(fw_dir):
379384
fw_dir = f'examples/cmake-build-{name}/device/{test}'
380385
fw_name = f'{fw_dir}/{test}'
381-
print(f' {test} ...', end='')
386+
print(f' {test} ... ', end='')
387+
sys.stdout.flush()
382388

383389
if not os.path.exists(fw_dir):
384390
print('Skip')

test/hil/rpi.json

Lines changed: 37 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
{
22
"boards": [
3-
{
4-
"name": "raspberry_pi_pico",
5-
"uid": "E6614C311B764A37",
6-
"flasher": "openocd",
7-
"flasher_sn": "E6614103E72C1D2F",
8-
"flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\""
9-
},
103
{
114
"name": "feather_nrf52840_express",
125
"uid": "1F0479CD0F764471",
@@ -21,23 +14,20 @@
2114
"flasher_sn": "E6614C311B597D32",
2215
"flasher_args": "-f interface/cmsis-dap.cfg -f target/atsame5x.cfg -c \"adapter speed 5000\""
2316
},
24-
{
25-
"name": "espressif_s3_devkitm",
26-
"uid": "84F703C084E4",
27-
"tests": [
28-
"cdc_msc_freertos", "hid_composite_freertos"
29-
],
30-
"flasher": "esptool",
31-
"flasher_sn": "3ea619acd1cdeb11a0a0b806e93fd3f1",
32-
"flasher_args": "-b 921600"
33-
},
3417
{
3518
"name": "metro_m7_1011",
3619
"uid": "9CE8715DD71137363E00005002004200",
3720
"flasher": "jlink",
3821
"flasher_sn": "000611000000",
3922
"flasher_args": "-device MIMXRT1011xxx5A"
4023
},
24+
{
25+
"name": "lpcxpresso11u37",
26+
"uid": "17121919",
27+
"flasher": "jlink",
28+
"flasher_sn": "000724441579",
29+
"flasher_args": "-device LPC11U37/401"
30+
},
4131
{
4232
"name": "ra4m1_ek",
4333
"uid": "152E163038303131393346E46F26574B",
@@ -48,11 +38,37 @@
4838
"flasher_args": "-device R7FA4M1AB"
4939
},
5040
{
51-
"name": "lpcxpresso11u37",
52-
"uid": "17121919",
41+
"name": "raspberry_pi_pico",
42+
"uid": "E6614C311B764A37",
43+
"flasher": "openocd",
44+
"flasher_sn": "E6614103E72C1D2F",
45+
"flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\""
46+
},
47+
{
48+
"name": "stm32f072disco",
49+
"uid": "3A001A001357364230353532",
5350
"flasher": "jlink",
54-
"flasher_sn": "000724441579",
55-
"flasher_args": "-device LPC11U37/401"
51+
"flasher_sn": "779541626",
52+
"flasher_args": "-device stm32f072rb"
53+
},
54+
{
55+
"name": "stm32g0b1nucleo",
56+
"uid": "4D0038000450434E37343120",
57+
"flasher": "openocd",
58+
"flasher_sn": "066FFF495087534867063844",
59+
"flasher_args": "-f interface/stlink.cfg -f target/stm32g0x.cfg"
60+
}
61+
],
62+
"boards-skip": [
63+
{
64+
"name": "espressif_s3_devkitm",
65+
"uid": "84F703C084E4",
66+
"tests": [
67+
"cdc_msc_freertos", "hid_composite_freertos"
68+
],
69+
"flasher": "esptool",
70+
"flasher_sn": "3ea619acd1cdeb11a0a0b806e93fd3f1",
71+
"flasher_args": "-b 921600"
5672
}
5773
]
5874
}

0 commit comments

Comments
 (0)