add pico2 rp2350 (arm) board

add pico2 to hil ci
This commit is contained in:
hathach 2024-09-13 19:12:26 +07:00
parent 91c8700a9f
commit c419b1e7c5
No known key found for this signature in database
GPG Key ID: 26FAB84F615C3C52
7 changed files with 50 additions and 15 deletions

4
.idea/cmake.xml generated
View File

@ -2,7 +2,9 @@
<project version="4">
<component name="CMakeSharedSettings">
<configurations>
<configuration PROFILE_NAME="raspberry_pi_pico" ENABLED="false" CONFIG_NAME="MinSizeRel" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico2" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2 -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico2_riscv" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico2_riscv -DLOG=1" />
<configuration PROFILE_NAME="raspberry_pi_pico-pio_host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCFLAGS_CLI=&quot;-DCFG_TUH_RPI_PIO_USB=1&quot;" />
<configuration PROFILE_NAME="feather_rp2040" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=pico_sdk -DPICO_BOARD=adafruit_feather_rp2040 -DLOG=1" />
<configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=1" />

View File

@ -1,3 +1,4 @@
set(PICO_PLATFORM rp2040)
set(PICO_BOARD adafruit_feather_rp2040)
# Enable MAX3421E USB Host

View File

@ -1 +1,2 @@
set(PICO_PLATFORM rp2040)
set(PICO_BOARD pico)

View File

@ -0,0 +1,2 @@
set(PICO_PLATFORM rp2350-arm-s)
set(PICO_BOARD pico2)

View File

@ -6,21 +6,32 @@ if (NOT BOARD)
set(BOARD pico_sdk)
endif()
if (TOOLCHAIN STREQUAL "clang")
set(PICO_COMPILER "pico_arm_clang")
else()
set(PICO_COMPILER "pico_arm_gcc")
endif()
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
#if (TOOLCHAIN STREQUAL "clang")
# set(PICO_COMPILER "pico_arm_clang")
#else()
# set(PICO_COMPILER "pico_arm_gcc")
#endif()
# add the SDK in case we are standalone tinyusb example (noop if already present)
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
# include basic family CMake functionality
set(FAMILY_MCUS RP2040)
set(JLINK_DEVICE rp2040_m0_0)
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"")
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
if (PICO_PLATFORM STREQUAL "rp2040")
set(JLINK_DEVICE rp2040_m0_0)
set(OPENOCD_TARGET rp2040)
elseif (PICO_PLATFORM STREQUAL "rp2350-arm-s" OR PICO_PLATFORM STREQUAL "rp2350")
set(JLINK_DEVICE rp2350_m33_0)
set(OPENOCD_TARGET rp2350)
elseif (PICO_PLATFORM STREQUAL "rp2350-riscv")
set(JLINK_DEVICE rp2350_riscv_0)
set(OPENOCD_TARGET rp2350-riscv)
endif()
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/${OPENOCD_TARGET}.cfg -c \"adapter speed 5000\"")
if (NOT PICO_TINYUSB_PATH)
set(PICO_TINYUSB_PATH ${TOP})

View File

@ -43,6 +43,8 @@ STATUS_OK = "\033[32mOK\033[0m"
STATUS_FAILED = "\033[31mFailed\033[0m"
STATUS_SKIPPED = "\033[33mSkipped\033[0m"
verbose = False
# get usb serial by id
def get_serial_dev(id, vendor_str, product_str, ifnum):
if vendor_str and product_str:
@ -111,7 +113,6 @@ def read_disk_file(uid, lun, fname):
# Flashing firmware
# -------------------------------------------------------------
def run_cmd(cmd):
#print(cmd)
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
if r.returncode != 0:
title = f'COMMAND FAILED: {cmd}'
@ -123,6 +124,9 @@ def run_cmd(cmd):
else:
print(title)
print(r.stdout.decode("utf-8"))
elif verbose:
print(cmd)
print(r.stdout.decode("utf-8"))
return r
@ -260,14 +264,14 @@ def test_device_cdc_dual_ports(board):
str1 = b"test_no1"
ser1.write(str1)
ser1.flush()
assert ser1.read(100) == str1.lower(), 'Port1 wrong data'
assert ser2.read(100) == str1.upper(), 'Port2 wrong data'
assert ser1.read(len(str1)) == str1.lower(), 'Port1 wrong data'
assert ser2.read(len(str1)) == str1.upper(), 'Port2 wrong data'
str2 = b"test_no2"
ser2.write(str2)
ser2.flush()
assert ser1.read(100) == str2.lower(), 'Port1 wrong data'
assert ser2.read(100) == str2.upper(), 'Port2 wrong data'
assert ser1.read(len(str2)) == str2.lower(), 'Port1 wrong data'
assert ser2.read(len(str2)) == str2.upper(), 'Port2 wrong data'
def test_device_cdc_msc(board):
@ -279,7 +283,7 @@ def test_device_cdc_msc(board):
str = b"test_str"
ser.write(str)
ser.flush()
assert ser.read(100) == str, 'CDC wrong data'
assert ser.read(len(str)) == str, 'CDC wrong data'
# Block test
data = read_disk_file(uid,0,'README.TXT')
@ -447,13 +451,17 @@ def main():
"""
Hardware test on specified boards
"""
global verbose
parser = argparse.ArgumentParser()
parser.add_argument('config_file', help='Configuration JSON file')
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to test, all if not specified')
parser.add_argument('-v', '--verbose', action='store_true', help='Verbose output')
args = parser.parse_args()
config_file = args.config_file
boards = args.board
verbose = args.verbose
# if config file is not found, try to find it in the same directory as this script
if not os.path.exists(config_file):

View File

@ -52,6 +52,16 @@
"dual_attached": [{"vid_pid": "1a86_55d4", "serial": "52D2002470"}]
}
},
{
"name": "raspberry_pi_pico2",
"uid": "560AE75E1C7152C9",
"flasher": "openocd",
"flasher_sn": "E6633861A3978538",
"flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2350.cfg -c \"adapter speed 5000\"",
"tests": {
"dual_attached": [{"vid_pid": "1a86_55d4", "serial": "533D004242"}]
}
},
{
"name": "stm32f072disco",
"uid": "3A001A001357364230353532",