mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
add pico2 rp2350 (arm) board
add pico2 to hil ci
This commit is contained in:
parent
91c8700a9f
commit
c419b1e7c5
4
.idea/cmake.xml
generated
4
.idea/cmake.xml
generated
@ -2,7 +2,9 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="CMakeSharedSettings">
|
<component name="CMakeSharedSettings">
|
||||||
<configurations>
|
<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="-DCFG_TUH_RPI_PIO_USB=1"" />
|
<configuration PROFILE_NAME="raspberry_pi_pico-pio_host" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=raspberry_pi_pico -DLOG=1 -DCFLAGS_CLI="-DCFG_TUH_RPI_PIO_USB=1"" />
|
||||||
<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" 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" />
|
<configuration PROFILE_NAME="feather_rp2040_max3421" ENABLED="false" CONFIG_NAME="Debug" GENERATION_OPTIONS="-DBOARD=feather_rp2040_max3421 -DLOG=1" />
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
set(PICO_PLATFORM rp2040)
|
||||||
set(PICO_BOARD adafruit_feather_rp2040)
|
set(PICO_BOARD adafruit_feather_rp2040)
|
||||||
|
|
||||||
# Enable MAX3421E USB Host
|
# Enable MAX3421E USB Host
|
||||||
|
@ -1 +1,2 @@
|
|||||||
|
set(PICO_PLATFORM rp2040)
|
||||||
set(PICO_BOARD pico)
|
set(PICO_BOARD pico)
|
||||||
|
2
hw/bsp/rp2040/boards/raspberry_pi_pico2/board.cmake
Normal file
2
hw/bsp/rp2040/boards/raspberry_pi_pico2/board.cmake
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
set(PICO_PLATFORM rp2350-arm-s)
|
||||||
|
set(PICO_BOARD pico2)
|
@ -6,21 +6,32 @@ if (NOT BOARD)
|
|||||||
set(BOARD pico_sdk)
|
set(BOARD pico_sdk)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (TOOLCHAIN STREQUAL "clang")
|
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
|
||||||
set(PICO_COMPILER "pico_arm_clang")
|
|
||||||
else()
|
#if (TOOLCHAIN STREQUAL "clang")
|
||||||
set(PICO_COMPILER "pico_arm_gcc")
|
# set(PICO_COMPILER "pico_arm_clang")
|
||||||
endif()
|
#else()
|
||||||
|
# set(PICO_COMPILER "pico_arm_gcc")
|
||||||
|
#endif()
|
||||||
|
|
||||||
# add the SDK in case we are standalone tinyusb example (noop if already present)
|
# add the SDK in case we are standalone tinyusb example (noop if already present)
|
||||||
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
|
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
|
||||||
|
|
||||||
# include basic family CMake functionality
|
# include basic family CMake functionality
|
||||||
set(FAMILY_MCUS RP2040)
|
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)
|
if (NOT PICO_TINYUSB_PATH)
|
||||||
set(PICO_TINYUSB_PATH ${TOP})
|
set(PICO_TINYUSB_PATH ${TOP})
|
||||||
|
@ -43,6 +43,8 @@ STATUS_OK = "\033[32mOK\033[0m"
|
|||||||
STATUS_FAILED = "\033[31mFailed\033[0m"
|
STATUS_FAILED = "\033[31mFailed\033[0m"
|
||||||
STATUS_SKIPPED = "\033[33mSkipped\033[0m"
|
STATUS_SKIPPED = "\033[33mSkipped\033[0m"
|
||||||
|
|
||||||
|
verbose = False
|
||||||
|
|
||||||
# get usb serial by id
|
# get usb serial by id
|
||||||
def get_serial_dev(id, vendor_str, product_str, ifnum):
|
def get_serial_dev(id, vendor_str, product_str, ifnum):
|
||||||
if vendor_str and product_str:
|
if vendor_str and product_str:
|
||||||
@ -111,7 +113,6 @@ def read_disk_file(uid, lun, fname):
|
|||||||
# Flashing firmware
|
# Flashing firmware
|
||||||
# -------------------------------------------------------------
|
# -------------------------------------------------------------
|
||||||
def run_cmd(cmd):
|
def run_cmd(cmd):
|
||||||
#print(cmd)
|
|
||||||
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
if r.returncode != 0:
|
if r.returncode != 0:
|
||||||
title = f'COMMAND FAILED: {cmd}'
|
title = f'COMMAND FAILED: {cmd}'
|
||||||
@ -123,6 +124,9 @@ def run_cmd(cmd):
|
|||||||
else:
|
else:
|
||||||
print(title)
|
print(title)
|
||||||
print(r.stdout.decode("utf-8"))
|
print(r.stdout.decode("utf-8"))
|
||||||
|
elif verbose:
|
||||||
|
print(cmd)
|
||||||
|
print(r.stdout.decode("utf-8"))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
|
||||||
@ -260,14 +264,14 @@ def test_device_cdc_dual_ports(board):
|
|||||||
str1 = b"test_no1"
|
str1 = b"test_no1"
|
||||||
ser1.write(str1)
|
ser1.write(str1)
|
||||||
ser1.flush()
|
ser1.flush()
|
||||||
assert ser1.read(100) == str1.lower(), 'Port1 wrong data'
|
assert ser1.read(len(str1)) == str1.lower(), 'Port1 wrong data'
|
||||||
assert ser2.read(100) == str1.upper(), 'Port2 wrong data'
|
assert ser2.read(len(str1)) == str1.upper(), 'Port2 wrong data'
|
||||||
|
|
||||||
str2 = b"test_no2"
|
str2 = b"test_no2"
|
||||||
ser2.write(str2)
|
ser2.write(str2)
|
||||||
ser2.flush()
|
ser2.flush()
|
||||||
assert ser1.read(100) == str2.lower(), 'Port1 wrong data'
|
assert ser1.read(len(str2)) == str2.lower(), 'Port1 wrong data'
|
||||||
assert ser2.read(100) == str2.upper(), 'Port2 wrong data'
|
assert ser2.read(len(str2)) == str2.upper(), 'Port2 wrong data'
|
||||||
|
|
||||||
|
|
||||||
def test_device_cdc_msc(board):
|
def test_device_cdc_msc(board):
|
||||||
@ -279,7 +283,7 @@ def test_device_cdc_msc(board):
|
|||||||
str = b"test_str"
|
str = b"test_str"
|
||||||
ser.write(str)
|
ser.write(str)
|
||||||
ser.flush()
|
ser.flush()
|
||||||
assert ser.read(100) == str, 'CDC wrong data'
|
assert ser.read(len(str)) == str, 'CDC wrong data'
|
||||||
|
|
||||||
# Block test
|
# Block test
|
||||||
data = read_disk_file(uid,0,'README.TXT')
|
data = read_disk_file(uid,0,'README.TXT')
|
||||||
@ -447,13 +451,17 @@ def main():
|
|||||||
"""
|
"""
|
||||||
Hardware test on specified boards
|
Hardware test on specified boards
|
||||||
"""
|
"""
|
||||||
|
global verbose
|
||||||
|
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('config_file', help='Configuration JSON file')
|
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('-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()
|
args = parser.parse_args()
|
||||||
|
|
||||||
config_file = args.config_file
|
config_file = args.config_file
|
||||||
boards = args.board
|
boards = args.board
|
||||||
|
verbose = args.verbose
|
||||||
|
|
||||||
# if config file is not found, try to find it in the same directory as this script
|
# if config file is not found, try to find it in the same directory as this script
|
||||||
if not os.path.exists(config_file):
|
if not os.path.exists(config_file):
|
||||||
|
@ -52,6 +52,16 @@
|
|||||||
"dual_attached": [{"vid_pid": "1a86_55d4", "serial": "52D2002470"}]
|
"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",
|
"name": "stm32f072disco",
|
||||||
"uid": "3A001A001357364230353532",
|
"uid": "3A001A001357364230353532",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user