Skip to content

Commit 04f0cd5

Browse files
authored
Merge pull request hathach#2209 from HiFiPhile/hitl
Enhance HITL test
2 parents 51a0889 + 8e690df commit 04f0cd5

File tree

22 files changed

+884
-259
lines changed

22 files changed

+884
-259
lines changed

.github/workflows/build_iar.yml

Lines changed: 77 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
# Alphabetical order
3333
# Note: bundle multiple families into a matrix since there is only one self-hosted instance can
3434
# run IAR build. Too many matrix can hurt due to setup/teardown overhead.
35-
- 'stm32f0 stm32f1 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
35+
- 'stm32f0 stm32f1 stm32f4 stm32f7 stm32g0 stm32g4 stm32h7 stm32l4'
3636
steps:
3737
- name: Clean workspace
3838
run: |
@@ -49,82 +49,85 @@ jobs:
4949
- name: Build
5050
run: python3 tools/build_cmake.py ${{ matrix.family }} -DTOOLCHAIN=iar -DCMAKE_BUILD_TYPE=MinSizeRel
5151

52-
# Upload binaries for hardware test with self-hosted
53-
- name: Prepare stm32l412nucleo Artifacts
54-
if: contains(matrix.family, 'stm32l4')
55-
working-directory: ${{github.workspace}}/cmake-build/cmake-build-stm32l412nucleo
52+
- name: Test on actual hardware (hardware in the loop)
5653
run: |
57-
find device/ -name "*.elf" -exec mv {} ../../ \;
58-
59-
- name: Upload Artifacts for stm32l412nucleo
60-
if: contains(matrix.family, 'stm32l4') && github.repository_owner == 'hathach'
61-
uses: actions/upload-artifact@v3
62-
with:
63-
name: stm32l4
64-
path: |
65-
*.elf
54+
python3 test/hil/hil_test.py hil_hfp.json
55+
56+
# # Upload binaries for hardware test with self-hosted
57+
# - name: Prepare stm32l412nucleo Artifacts
58+
# if: contains(matrix.family, 'stm32l4')
59+
# working-directory: ${{github.workspace}}/cmake-build/cmake-build-stm32l412nucleo
60+
# run: |
61+
# find device/ -name "*.elf" -exec mv {} ../../ \;
62+
#
63+
# - name: Upload Artifacts for stm32l412nucleo
64+
# if: contains(matrix.family, 'stm32l4') && github.repository_owner == 'hathach'
65+
# uses: actions/upload-artifact@v3
66+
# with:
67+
# name: stm32l4
68+
# path: |
69+
# *.elf
6670

6771
# ---------------------------------------
6872
# Hardware in the loop (HIL)
6973
# Current self-hosted instance is running on an EPYC 7232 server hosted by HiFiPhile user
70-
# - STM32L412 Nucleo with on-board jlink as ttyACM0
7174
# ---------------------------------------
72-
hw-stm32l412nucleo-test:
73-
needs: cmake
74-
runs-on: [self-hosted, Linux, X64, hifiphile]
75-
76-
steps:
77-
- name: Clean workspace
78-
run: |
79-
echo "Cleaning up previous run"
80-
rm -rf "${{ github.workspace }}"
81-
mkdir -p "${{ github.workspace }}"
82-
83-
- name: Download stm32l4 Artifacts
84-
uses: actions/download-artifact@v3
85-
with:
86-
name: stm32l4
87-
88-
- name: Create flash.sh
89-
run: |
90-
echo > flash.sh 'echo halt > flash.jlink'
91-
echo >> flash.sh 'echo r >> flash.jlink'
92-
echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
93-
echo >> flash.sh 'echo r >> flash.jlink'
94-
echo >> flash.sh 'echo go >> flash.jlink'
95-
echo >> flash.sh 'echo exit >> flash.jlink'
96-
echo >> flash.sh 'cmdout=$(JLinkExe -USB 774470029 -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
97-
echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
98-
chmod +x flash.sh
99-
100-
- name: Test cdc_dual_ports
101-
run: |
102-
./flash.sh cdc_dual_ports.elf
103-
while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
104-
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
105-
test -e /dev/ttyACM2 && echo "ttyACM2 exists"
106-
107-
# Debian does not auto mount usb drive. skip this test for now
108-
- name: Test cdc_msc
109-
if: false
110-
run: |
111-
./flash.sh cdc_msc.elf
112-
readme='/media/pi/TinyUSB MSC/README.TXT'
113-
while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
114-
test -e /dev/ttyACM1 && echo "ttyACM1 exists"
115-
test -f "$readme" && echo "$readme exists"
116-
cat "$readme"
117-
118-
- name: Test dfu
119-
run: |
120-
./flash.sh dfu.elf
121-
while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
122-
dfu-util -d cafe -a 0 -U dfu0
123-
dfu-util -d cafe -a 1 -U dfu1
124-
grep "TinyUSB DFU! - Partition 0" dfu0
125-
grep "TinyUSB DFU! - Partition 1" dfu1
126-
127-
- name: Test dfu_runtime
128-
run: |
129-
./flash.sh dfu_runtime.elf
130-
while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done
75+
# hw-stm32l412nucleo-test:
76+
# needs: cmake
77+
# runs-on: [self-hosted, Linux, X64, hifiphile]
78+
#
79+
# steps:
80+
# - name: Clean workspace
81+
# run: |
82+
# echo "Cleaning up previous run"
83+
# rm -rf "${{ github.workspace }}"
84+
# mkdir -p "${{ github.workspace }}"
85+
#
86+
# - name: Download stm32l4 Artifacts
87+
# uses: actions/download-artifact@v3
88+
# with:
89+
# name: stm32l4
90+
#
91+
# - name: Create flash.sh
92+
# run: |
93+
# echo > flash.sh 'echo halt > flash.jlink'
94+
# echo >> flash.sh 'echo r >> flash.jlink'
95+
# echo >> flash.sh 'echo loadfile $1 >> flash.jlink'
96+
# echo >> flash.sh 'echo r >> flash.jlink'
97+
# echo >> flash.sh 'echo go >> flash.jlink'
98+
# echo >> flash.sh 'echo exit >> flash.jlink'
99+
# echo >> flash.sh 'cmdout=$(JLinkExe -USB 774470029 -device stm32l412kb -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink)'
100+
# echo >> flash.sh 'if (( $? )) ; then echo $cmdout ; fi'
101+
# chmod +x flash.sh
102+
#
103+
# - name: Test cdc_dual_ports
104+
# run: |
105+
# ./flash.sh cdc_dual_ports.elf
106+
# while (! ([ -e /dev/ttyACM1 ] && [ -e /dev/ttyACM2 ])) && [ $SECONDS -le 10 ]; do :; done
107+
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
108+
# test -e /dev/ttyACM2 && echo "ttyACM2 exists"
109+
#
110+
# # Debian does not auto mount usb drive. skip this test for now
111+
# - name: Test cdc_msc
112+
# if: false
113+
# run: |
114+
# ./flash.sh cdc_msc.elf
115+
# readme='/media/pi/TinyUSB MSC/README.TXT'
116+
# while (! ([ -e /dev/ttyACM1 ] && [ -f "$readme" ])) && [ $SECONDS -le 10 ]; do :; done
117+
# test -e /dev/ttyACM1 && echo "ttyACM1 exists"
118+
# test -f "$readme" && echo "$readme exists"
119+
# cat "$readme"
120+
#
121+
# - name: Test dfu
122+
# run: |
123+
# ./flash.sh dfu.elf
124+
# while (! (dfu-util -l | grep "Found DFU")) && [ $SECONDS -le 10 ]; do :; done
125+
# dfu-util -d cafe -a 0 -U dfu0
126+
# dfu-util -d cafe -a 1 -U dfu1
127+
# grep "TinyUSB DFU! - Partition 0" dfu0
128+
# grep "TinyUSB DFU! - Partition 1" dfu1
129+
#
130+
# - name: Test dfu_runtime
131+
# run: |
132+
# ./flash.sh dfu_runtime.elf
133+
# while (! (dfu-util -l | grep "Found Runtime")) && [ $SECONDS -le 10 ]; do :; done

.idea/cmake.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CONTRIBUTORS.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,8 @@ Notable contributors
200200
- Add new DCD port for Microchip SAMx7x
201201
- Add IAR compiler support
202202
- Improve UAC2, CDC, DFU class driver
203+
- Improve stm32_fsdev, chipidea_ci_hs, lpc_ip3511 DCD
204+
- Host IAR Build CI & hardware in the loop (HITL) test
203205

204206

205207
`Full contributors list <https://github.com/hathach/tinyusb/contributors>`__

examples/device/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ family_add_subdirectory(cdc_uac2)
1717
family_add_subdirectory(dfu)
1818
family_add_subdirectory(dfu_runtime)
1919
family_add_subdirectory(dynamic_configuration)
20+
family_add_subdirectory(hid_boot_interface)
2021
family_add_subdirectory(hid_composite)
2122
family_add_subdirectory(hid_composite_freertos)
2223
family_add_subdirectory(hid_generic_inout)
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
/*
2+
* The MIT License (MIT)
3+
*
4+
* Copyright (c) 2021, Ha Thach (tinyusb.org)
5+
*
6+
* Permission is hereby granted, free of charge, to any person obtaining a copy
7+
* of this software and associated documentation files (the "Software"), to deal
8+
* in the Software without restriction, including without limitation the rights
9+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
* copies of the Software, and to permit persons to whom the Software is
11+
* furnished to do so, subject to the following conditions:
12+
*
13+
* The above copyright notice and this permission notice shall be included in
14+
* all copies or substantial portions of the Software.
15+
*
16+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22+
* THE SOFTWARE.
23+
*
24+
* This file is part of the TinyUSB stack.
25+
*/
26+
27+
#ifndef BOARD_LPCXPRESSO54608_H_
28+
#define BOARD_LPCXPRESSO54608_H_
29+
30+
#ifdef __cplusplus
31+
extern "C" {
32+
#endif
33+
34+
// LED
35+
#define LED_PORT 2
36+
#define LED_PIN 2
37+
#define LED_STATE_ON 0
38+
39+
// WAKE button
40+
#define BUTTON_PORT 1
41+
#define BUTTON_PIN 1
42+
#define BUTTON_STATE_ACTIVE 0
43+
44+
// UART
45+
#define UART_DEV USART0
46+
#define UART_RX_PINMUX 0, 29, IOCON_PIO_DIG_FUNC1_EN
47+
#define UART_TX_PINMUX 0, 30, IOCON_PIO_DIG_FUNC1_EN
48+
49+
// USB0 VBUS
50+
#define USB0_VBUS_PINMUX 0, 22, IOCON_PIO_DIG_FUNC7_EN
51+
52+
// XTAL
53+
//#define XTAL0_CLK_HZ (16 * 1000 * 1000U)
54+
55+
#ifdef __cplusplus
56+
}
57+
#endif
58+
59+
#endif
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
MCU_VARIANT = LPC54608
2+
MCU_CORE = LPC54608
3+
4+
PORT ?= 1
5+
6+
CFLAGS += -DCPU_LPC54608J512ET180
7+
CFLAGS += -Wno-error=double-promotion
8+
9+
LD_FILE = $(MCU_DIR)/gcc/LPC54608J512_flash.ld
10+
11+
LIBS += $(TOP)/$(MCU_DIR)/gcc/libpower_hardabi.a
12+
13+
JLINK_DEVICE = LPC54608J512
14+
PYOCD_TARGET = LPC54608
15+
16+
#flash: flash-pyocd
17+
18+
flash: flash-jlink
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
set(MCU_VARIANT LPC54628)
2+
set(MCU_CORE LPC54628)
3+
4+
set(JLINK_DEVICE LPC54628J512)
5+
set(PYOCD_TARGET LPC54628)
6+
set(NXPLINK_DEVICE LPC54628:LPCXpresso54628)
7+
8+
set(LD_FILE_GNU ${SDK_DIR}/devices/${MCU_VARIANT}/gcc/LPC54628J512_flash.ld)
9+
10+
# Device port default to PORT1 Highspeed
11+
if (NOT DEFINED PORT)
12+
set(PORT 1)
13+
endif()
14+
15+
function(update_board TARGET)
16+
target_compile_definitions(${TARGET} PUBLIC
17+
CPU_LPC54628J512ET180
18+
)
19+
target_link_libraries(${TARGET} PUBLIC
20+
${SDK_DIR}/devices/${MCU_VARIANT}/gcc/libpower_hardabi.a
21+
)
22+
endfunction()

hw/bsp/lpc54/boards/lpcxpresso54628/board.mk

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
MCU_VARIANT = LPC54628
22
MCU_CORE = LPC54628
33

4-
PORT ?= 0
4+
PORT ?= 1
55

66
CFLAGS += -DCPU_LPC54628J512ET180
77
CFLAGS += -Wno-error=double-promotion

hw/bsp/lpc54/family.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,11 @@
7070
//--------------------------------------------------------------------+
7171
// Forward USB interrupt events to TinyUSB IRQ Handler
7272
//--------------------------------------------------------------------+
73-
void USB0_IRQHandler(void)
74-
{
73+
void USB0_IRQHandler(void) {
7574
tud_int_handler(0);
7675
}
7776

78-
void USB1_IRQHandler(void)
79-
{
77+
void USB1_IRQHandler(void) {
8078
tud_int_handler(1);
8179
}
8280

0 commit comments

Comments
 (0)