more fsdev clean up
hil test boards in parallel
This commit is contained in:
@@ -114,8 +114,6 @@
|
|||||||
#include "device/dcd.h"
|
#include "device/dcd.h"
|
||||||
|
|
||||||
#if defined(TUP_USBIP_FSDEV_STM32)
|
#if defined(TUP_USBIP_FSDEV_STM32)
|
||||||
// Undefine to reduce the dependence on HAL
|
|
||||||
#undef USE_HAL_DRIVER
|
|
||||||
#include "fsdev_stm32.h"
|
#include "fsdev_stm32.h"
|
||||||
#elif defined(TUP_USBIP_FSDEV_CH32)
|
#elif defined(TUP_USBIP_FSDEV_CH32)
|
||||||
#include "fsdev_ch32.h"
|
#include "fsdev_ch32.h"
|
||||||
@@ -125,12 +123,6 @@
|
|||||||
|
|
||||||
#include "fsdev_type.h"
|
#include "fsdev_type.h"
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
// Configuration
|
|
||||||
//--------------------------------------------------------------------+
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// MACRO CONSTANT TYPEDEF
|
// MACRO CONSTANT TYPEDEF
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
|
@@ -54,22 +54,8 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define FSDEV_PMA_SIZE (512u)
|
#define FSDEV_PMA_SIZE (512u)
|
||||||
#define FSDEV_REG_BASE 0x40005C00UL
|
#define FSDEV_REG_BASE (APB1PERIPH_BASE + 0x00005C00UL)
|
||||||
|
#define FSDEV_PMA_BASE (APB1PERIPH_BASE + 0x00006000UL)
|
||||||
#define USB_BASE (APB1PERIPH_BASE + 0x00005C00UL) /*!< USB_IP Peripheral Registers base address */
|
|
||||||
#define USB_PMAADDR (APB1PERIPH_BASE + 0x00006000UL) /*!< USB_IP Packet Memory Area base address */
|
|
||||||
#define USB ((USB_TypeDef *)USB_BASE)
|
|
||||||
|
|
||||||
/******************************************************************************/
|
|
||||||
/* */
|
|
||||||
/* USB Device General registers */
|
|
||||||
/* */
|
|
||||||
/******************************************************************************/
|
|
||||||
#define USB_CNTR (USB_BASE + 0x40U) /*!< Control register */
|
|
||||||
#define USB_ISTR (USB_BASE + 0x44U) /*!< Interrupt status register */
|
|
||||||
#define USB_FNR (USB_BASE + 0x48U) /*!< Frame number register */
|
|
||||||
#define USB_DADDR (USB_BASE + 0x4CU) /*!< Device address register */
|
|
||||||
#define USB_BTABLE (USB_BASE + 0x50U) /*!< Buffer Table address register */
|
|
||||||
|
|
||||||
/**************************** ISTR interrupt events *************************/
|
/**************************** ISTR interrupt events *************************/
|
||||||
#define USB_ISTR_CTR ((uint16_t)0x8000U) /*!< Correct TRansfer (clear-only bit) */
|
#define USB_ISTR_CTR ((uint16_t)0x8000U) /*!< Correct TRansfer (clear-only bit) */
|
||||||
|
@@ -82,12 +82,9 @@
|
|||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32G0
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32G0
|
||||||
#include "stm32g0xx.h"
|
#include "stm32g0xx.h"
|
||||||
#define FSDEV_BUS_32BIT
|
|
||||||
#define FSDEV_PMA_SIZE (2048u)
|
#define FSDEV_PMA_SIZE (2048u)
|
||||||
#undef USB_PMAADDR
|
#define USB USB_DRD_FS
|
||||||
#define USB_PMAADDR USB_DRD_PMAADDR
|
|
||||||
#define USB_TypeDef USB_DRD_TypeDef
|
|
||||||
#define EP0R CHEP0R
|
|
||||||
#define USB_EP_CTR_RX USB_EP_VTRX
|
#define USB_EP_CTR_RX USB_EP_VTRX
|
||||||
#define USB_EP_CTR_TX USB_EP_VTTX
|
#define USB_EP_CTR_TX USB_EP_VTTX
|
||||||
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
||||||
@@ -100,7 +97,6 @@
|
|||||||
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
||||||
#define USB_EPRX_STAT USB_CH_RX_VALID
|
#define USB_EPRX_STAT USB_CH_RX_VALID
|
||||||
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
||||||
#define USB USB_DRD_FS
|
|
||||||
#define USB_CNTR_FRES USB_CNTR_USBRST
|
#define USB_CNTR_FRES USB_CNTR_USBRST
|
||||||
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
||||||
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
||||||
@@ -110,17 +106,9 @@
|
|||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32H5
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32H5
|
||||||
#include "stm32h5xx.h"
|
#include "stm32h5xx.h"
|
||||||
#define FSDEV_BUS_32BIT
|
|
||||||
|
|
||||||
#if !defined(USB_DRD_BASE) && defined(USB_DRD_FS_BASE)
|
|
||||||
#define USB_DRD_BASE USB_DRD_FS_BASE
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define FSDEV_PMA_SIZE (2048u)
|
#define FSDEV_PMA_SIZE (2048u)
|
||||||
#undef USB_PMAADDR
|
#define USB USB_DRD_FS
|
||||||
#define USB_PMAADDR USB_DRD_PMAADDR
|
|
||||||
#define USB_TypeDef USB_DRD_TypeDef
|
|
||||||
#define EP0R CHEP0R
|
|
||||||
#define USB_EP_CTR_RX USB_EP_VTRX
|
#define USB_EP_CTR_RX USB_EP_VTRX
|
||||||
#define USB_EP_CTR_TX USB_EP_VTTX
|
#define USB_EP_CTR_TX USB_EP_VTTX
|
||||||
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
||||||
@@ -133,7 +121,6 @@
|
|||||||
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
||||||
#define USB_EPRX_STAT USB_CH_RX_VALID
|
#define USB_EPRX_STAT USB_CH_RX_VALID
|
||||||
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
||||||
#define USB USB_DRD_FS
|
|
||||||
#define USB_CNTR_FRES USB_CNTR_USBRST
|
#define USB_CNTR_FRES USB_CNTR_USBRST
|
||||||
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
||||||
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
||||||
@@ -144,9 +131,8 @@
|
|||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32WB
|
||||||
#include "stm32wbxx.h"
|
#include "stm32wbxx.h"
|
||||||
#define FSDEV_PMA_SIZE (1024u)
|
#define FSDEV_PMA_SIZE (1024u)
|
||||||
/* ST provided header has incorrect value */
|
/* ST provided header has incorrect value of USB_PMAADDR */
|
||||||
#undef USB_PMAADDR
|
#define FSDEV_PMA_BASE USB1_PMAADDR
|
||||||
#define USB_PMAADDR USB1_PMAADDR
|
|
||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32L4
|
||||||
#include "stm32l4xx.h"
|
#include "stm32l4xx.h"
|
||||||
@@ -162,13 +148,9 @@
|
|||||||
|
|
||||||
#elif CFG_TUSB_MCU == OPT_MCU_STM32U5
|
#elif CFG_TUSB_MCU == OPT_MCU_STM32U5
|
||||||
#include "stm32u5xx.h"
|
#include "stm32u5xx.h"
|
||||||
#define FSDEV_BUS_32BIT
|
|
||||||
|
|
||||||
#define FSDEV_PMA_SIZE (2048u)
|
#define FSDEV_PMA_SIZE (2048u)
|
||||||
#undef USB_PMAADDR
|
#define USB USB_DRD_FS
|
||||||
#define USB_PMAADDR USB_DRD_PMAADDR
|
|
||||||
#define USB_TypeDef USB_DRD_TypeDef
|
|
||||||
#define EP0R CHEP0R
|
|
||||||
#define USB_EP_CTR_RX USB_EP_VTRX
|
#define USB_EP_CTR_RX USB_EP_VTRX
|
||||||
#define USB_EP_CTR_TX USB_EP_VTTX
|
#define USB_EP_CTR_TX USB_EP_VTTX
|
||||||
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
#define USB_EP_T_FIELD USB_CHEP_UTYPE
|
||||||
@@ -181,7 +163,6 @@
|
|||||||
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
#define USB_EPRX_DTOG2 USB_CHEP_RX_DTOG2
|
||||||
#define USB_EPRX_STAT USB_CH_RX_VALID
|
#define USB_EPRX_STAT USB_CH_RX_VALID
|
||||||
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
#define USB_EPKIND_MASK USB_EP_KIND_MASK
|
||||||
#define USB USB_DRD_FS
|
|
||||||
#define USB_CNTR_FRES USB_CNTR_USBRST
|
#define USB_CNTR_FRES USB_CNTR_USBRST
|
||||||
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
#define USB_CNTR_RESUME USB_CNTR_L2RES
|
||||||
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
#define USB_ISTR_EP_ID USB_ISTR_IDN
|
||||||
@@ -194,6 +175,10 @@
|
|||||||
// This includes U0
|
// This includes U0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
// Register and PMA Base Address
|
||||||
|
//--------------------------------------------------------------------+
|
||||||
|
#ifndef FSDEV_REG_BASE
|
||||||
#if defined(USB_BASE)
|
#if defined(USB_BASE)
|
||||||
#define FSDEV_REG_BASE USB_BASE
|
#define FSDEV_REG_BASE USB_BASE
|
||||||
#elif defined(USB_DRD_BASE)
|
#elif defined(USB_DRD_BASE)
|
||||||
@@ -203,6 +188,17 @@
|
|||||||
#else
|
#else
|
||||||
#error "FSDEV_REG_BASE not defined"
|
#error "FSDEV_REG_BASE not defined"
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef FSDEV_PMA_BASE
|
||||||
|
#if defined(USB_PMAADDR)
|
||||||
|
#define FSDEV_PMA_BASE USB_PMAADDR
|
||||||
|
#elif defined(USB_DRD_PMAADDR)
|
||||||
|
#define FSDEV_PMA_BASE USB_DRD_PMAADDR
|
||||||
|
#else
|
||||||
|
#error "FSDEV_PMA_BASE not defined"
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
// This checks if the device has "LPM"
|
// This checks if the device has "LPM"
|
||||||
#if defined(USB_ISTR_L1REQ)
|
#if defined(USB_ISTR_L1REQ)
|
||||||
|
@@ -49,17 +49,18 @@ TU_VERIFY_STATIC(FSDEV_BTABLE_BASE % 8 == 0, "BTABLE base must be aligned to 8 b
|
|||||||
|
|
||||||
// For purposes of accessing the packet
|
// For purposes of accessing the packet
|
||||||
#if FSDEV_PMA_SIZE == 512
|
#if FSDEV_PMA_SIZE == 512
|
||||||
#define FSDEV_PMA_STRIDE (2u) // 1x16 bit access scheme
|
// 1x16 bit / word access scheme
|
||||||
#define pma_aligned TU_ATTR_ALIGNED(4)
|
#define FSDEV_PMA_STRIDE 2
|
||||||
|
#define pma_access_scheme TU_ATTR_ALIGNED(4)
|
||||||
#elif FSDEV_PMA_SIZE == 1024
|
#elif FSDEV_PMA_SIZE == 1024
|
||||||
#define FSDEV_PMA_STRIDE (1u) // 2x16 bit access scheme
|
// 2x16 bit / word access scheme
|
||||||
#define pma_aligned
|
#define FSDEV_PMA_STRIDE 1
|
||||||
|
#define pma_access_scheme
|
||||||
#elif FSDEV_PMA_SIZE == 2048
|
#elif FSDEV_PMA_SIZE == 2048
|
||||||
#ifndef FSDEV_BUS_32BIT
|
// 32 bit access scheme
|
||||||
#warning "FSDEV_PMA_SIZE is 2048, but FSDEV_BUS_32BIT is not defined"
|
#define FSDEV_BUS_32BIT
|
||||||
#endif
|
#define FSDEV_PMA_STRIDE 1
|
||||||
#define FSDEV_PMA_STRIDE (1u) // 32 bit access scheme
|
#define pma_access_scheme
|
||||||
#define pma_aligned
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// The fsdev_bus_t type can be used for both register and PMA access necessities
|
// The fsdev_bus_t type can be used for both register and PMA access necessities
|
||||||
@@ -86,8 +87,8 @@ enum {
|
|||||||
typedef union {
|
typedef union {
|
||||||
// data is strictly 16-bit access (address could be 32-bit aligned)
|
// data is strictly 16-bit access (address could be 32-bit aligned)
|
||||||
struct {
|
struct {
|
||||||
volatile pma_aligned uint16_t addr;
|
volatile pma_access_scheme uint16_t addr;
|
||||||
volatile pma_aligned uint16_t count;
|
volatile pma_access_scheme uint16_t count;
|
||||||
} ep16[FSDEV_EP_COUNT][2];
|
} ep16[FSDEV_EP_COUNT][2];
|
||||||
|
|
||||||
// strictly 32-bit access
|
// strictly 32-bit access
|
||||||
@@ -99,13 +100,13 @@ typedef union {
|
|||||||
TU_VERIFY_STATIC(sizeof(fsdev_btable_t) == FSDEV_EP_COUNT*8*FSDEV_PMA_STRIDE, "size is not correct");
|
TU_VERIFY_STATIC(sizeof(fsdev_btable_t) == FSDEV_EP_COUNT*8*FSDEV_PMA_STRIDE, "size is not correct");
|
||||||
TU_VERIFY_STATIC(FSDEV_BTABLE_BASE + FSDEV_EP_COUNT*8 <= FSDEV_PMA_SIZE, "BTABLE does not fit in PMA RAM");
|
TU_VERIFY_STATIC(FSDEV_BTABLE_BASE + FSDEV_EP_COUNT*8 <= FSDEV_PMA_SIZE, "BTABLE does not fit in PMA RAM");
|
||||||
|
|
||||||
#define FSDEV_BTABLE ((volatile fsdev_btable_t*) (USB_PMAADDR+FSDEV_BTABLE_BASE))
|
#define FSDEV_BTABLE ((volatile fsdev_btable_t*) (FSDEV_PMA_BASE + FSDEV_PMA_STRIDE*(FSDEV_BTABLE_BASE)))
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
volatile pma_aligned fsdev_bus_t value;
|
volatile pma_access_scheme fsdev_bus_t value;
|
||||||
} fsdev_pma_buf_t;
|
} fsdev_pma_buf_t;
|
||||||
|
|
||||||
#define PMA_BUF_AT(_addr) ((fsdev_pma_buf_t*) (USB_PMAADDR + FSDEV_PMA_STRIDE*(_addr)))
|
#define PMA_BUF_AT(_addr) ((fsdev_pma_buf_t*) (FSDEV_PMA_BASE + FSDEV_PMA_STRIDE*(_addr)))
|
||||||
|
|
||||||
//--------------------------------------------------------------------+
|
//--------------------------------------------------------------------+
|
||||||
// Registers Typedef
|
// Registers Typedef
|
||||||
|
@@ -34,6 +34,7 @@ import subprocess
|
|||||||
import json
|
import json
|
||||||
import glob
|
import glob
|
||||||
import platform
|
import platform
|
||||||
|
from multiprocessing import Pool
|
||||||
|
|
||||||
# for RPI double reset
|
# for RPI double reset
|
||||||
if platform.machine() == 'aarch64':
|
if platform.machine() == 'aarch64':
|
||||||
@@ -130,10 +131,11 @@ def run_cmd(cmd):
|
|||||||
|
|
||||||
def flash_jlink(board, firmware):
|
def flash_jlink(board, firmware):
|
||||||
script = ['halt', 'r', f'loadfile {firmware}.elf', 'r', 'go', 'exit']
|
script = ['halt', 'r', f'loadfile {firmware}.elf', 'r', 'go', 'exit']
|
||||||
with open('flash.jlink', 'w') as f:
|
f_jlink = f'{board["name"]}_{os.path.basename(firmware)}.jlink'
|
||||||
|
with open(f_jlink, 'w') as f:
|
||||||
f.writelines(f'{s}\n' for s in script)
|
f.writelines(f'{s}\n' for s in script)
|
||||||
ret = run_cmd(f'JLinkExe -USB {board["flasher_sn"]} {board["flasher_args"]} -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile flash.jlink')
|
ret = run_cmd(f'JLinkExe -USB {board["flasher_sn"]} {board["flasher_args"]} -if swd -JTAGConf -1,-1 -speed auto -NoGui 1 -ExitOnError 1 -CommandFile {f_jlink}')
|
||||||
os.remove('flash.jlink')
|
os.remove(f_jlink)
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
|
||||||
@@ -327,6 +329,61 @@ def test_hid_composite_freertos(id):
|
|||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
# Main
|
# Main
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
|
# all possible tests: board_test is added last to disable board's usb
|
||||||
|
all_tests = [
|
||||||
|
'cdc_dual_ports',
|
||||||
|
'cdc_msc',
|
||||||
|
#'cdc_msc_freertos',
|
||||||
|
'dfu',
|
||||||
|
#'dfu_runtime',
|
||||||
|
'hid_boot_interface',
|
||||||
|
'board_test'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
def test_board(item):
|
||||||
|
name = item['name']
|
||||||
|
flasher = item['flasher'].lower()
|
||||||
|
|
||||||
|
# default to all tests
|
||||||
|
if 'tests' in item:
|
||||||
|
test_list = item['tests'] + ['board_test']
|
||||||
|
else:
|
||||||
|
test_list = list(all_tests)
|
||||||
|
|
||||||
|
# remove skip_tests
|
||||||
|
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:
|
||||||
|
fw_dir = f'cmake-build/cmake-build-{name}/device/{test}'
|
||||||
|
if not os.path.exists(fw_dir):
|
||||||
|
fw_dir = f'examples/cmake-build-{name}/device/{test}'
|
||||||
|
fw_name = f'{fw_dir}/{test}'
|
||||||
|
print(f'{name:20} {test:20} ... ', end='')
|
||||||
|
|
||||||
|
if not os.path.exists(fw_dir):
|
||||||
|
print('Skip')
|
||||||
|
continue
|
||||||
|
|
||||||
|
# flash firmware. It may fail randomly, retry a few times
|
||||||
|
for i in range(3):
|
||||||
|
ret = globals()[f'flash_{flasher}'](item, fw_name)
|
||||||
|
if ret.returncode == 0:
|
||||||
|
break
|
||||||
|
else:
|
||||||
|
print(f'Flashing failed, retry {i+1}')
|
||||||
|
time.sleep(1)
|
||||||
|
|
||||||
|
assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode()
|
||||||
|
|
||||||
|
# run test
|
||||||
|
globals()[f'test_{test}'](item['uid'])
|
||||||
|
print('OK')
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
"""
|
"""
|
||||||
Hardware test on specified boards
|
Hardware test on specified boards
|
||||||
@@ -345,66 +402,13 @@ def main():
|
|||||||
with open(config_file) as f:
|
with open(config_file) as f:
|
||||||
config = json.load(f)
|
config = json.load(f)
|
||||||
|
|
||||||
# all possible tests: board_test is added last to disable board's usb
|
|
||||||
all_tests = [
|
|
||||||
'cdc_dual_ports',
|
|
||||||
'cdc_msc',
|
|
||||||
'cdc_msc_freertos',
|
|
||||||
'dfu',
|
|
||||||
'dfu_runtime',
|
|
||||||
'hid_boot_interface',
|
|
||||||
'board_test'
|
|
||||||
]
|
|
||||||
|
|
||||||
if len(boards) == 0:
|
if len(boards) == 0:
|
||||||
config_boards = config['boards']
|
config_boards = config['boards']
|
||||||
else:
|
else:
|
||||||
config_boards = [e for e in config['boards'] if e['name'] in boards]
|
config_boards = [e for e in config['boards'] if e['name'] in boards]
|
||||||
|
|
||||||
for item in config_boards:
|
with Pool(processes=os.cpu_count()) as pool:
|
||||||
name = item['name']
|
pool.map(test_board, config_boards)
|
||||||
print(f'Testing board:{name}')
|
|
||||||
flasher = item['flasher'].lower()
|
|
||||||
|
|
||||||
# default to all tests
|
|
||||||
if 'tests' in item:
|
|
||||||
test_list = item['tests'] + ['board_test']
|
|
||||||
else:
|
|
||||||
test_list = list(all_tests)
|
|
||||||
|
|
||||||
# remove skip_tests
|
|
||||||
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:
|
|
||||||
fw_dir = f'cmake-build/cmake-build-{name}/device/{test}'
|
|
||||||
if not os.path.exists(fw_dir):
|
|
||||||
fw_dir = f'examples/cmake-build-{name}/device/{test}'
|
|
||||||
fw_name = f'{fw_dir}/{test}'
|
|
||||||
print(f' {test} ... ', end='')
|
|
||||||
sys.stdout.flush()
|
|
||||||
|
|
||||||
if not os.path.exists(fw_dir):
|
|
||||||
print('Skip')
|
|
||||||
continue
|
|
||||||
|
|
||||||
# flash firmware. It may fail randomly, retry a few times
|
|
||||||
for i in range(3):
|
|
||||||
ret = globals()[f'flash_{flasher}'](item, fw_name)
|
|
||||||
if ret.returncode == 0:
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print(f'Flashing failed, retry {i+1}')
|
|
||||||
time.sleep(1)
|
|
||||||
|
|
||||||
assert ret.returncode == 0, 'Flash failed\n' + ret.stdout.decode()
|
|
||||||
|
|
||||||
# run test
|
|
||||||
globals()[f'test_{test}'](item['uid'])
|
|
||||||
|
|
||||||
print('OK')
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Reference in New Issue
Block a user