Skip to content

Commit 3ff128b

Browse files
authored
Merge pull request hathach#2799 from hathach/add-pico2
add pico2 rp2350 (arm) board
2 parents 91c8700 + c419b1e commit 3ff128b

File tree

7 files changed

+50
-15
lines changed

7 files changed

+50
-15
lines changed

.idea/cmake.xml

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

hw/bsp/rp2040/boards/feather_rp2040_max3421/board.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
set(PICO_PLATFORM rp2040)
12
set(PICO_BOARD adafruit_feather_rp2040)
23

34
# Enable MAX3421E USB Host
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
set(PICO_PLATFORM rp2040)
12
set(PICO_BOARD pico)
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
set(PICO_PLATFORM rp2350-arm-s)
2+
set(PICO_BOARD pico2)

hw/bsp/rp2040/family.cmake

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,32 @@ if (NOT BOARD)
66
set(BOARD pico_sdk)
77
endif()
88

9-
if (TOOLCHAIN STREQUAL "clang")
10-
set(PICO_COMPILER "pico_arm_clang")
11-
else()
12-
set(PICO_COMPILER "pico_arm_gcc")
13-
endif()
9+
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
10+
11+
#if (TOOLCHAIN STREQUAL "clang")
12+
# set(PICO_COMPILER "pico_arm_clang")
13+
#else()
14+
# set(PICO_COMPILER "pico_arm_gcc")
15+
#endif()
1416

1517
# add the SDK in case we are standalone tinyusb example (noop if already present)
1618
include(${CMAKE_CURRENT_LIST_DIR}/pico_sdk_import.cmake)
1719

1820
# include basic family CMake functionality
1921
set(FAMILY_MCUS RP2040)
20-
set(JLINK_DEVICE rp2040_m0_0)
21-
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/rp2040.cfg -c \"adapter speed 5000\"")
2222

23-
include(${CMAKE_CURRENT_LIST_DIR}/boards/${BOARD}/board.cmake)
23+
if (PICO_PLATFORM STREQUAL "rp2040")
24+
set(JLINK_DEVICE rp2040_m0_0)
25+
set(OPENOCD_TARGET rp2040)
26+
elseif (PICO_PLATFORM STREQUAL "rp2350-arm-s" OR PICO_PLATFORM STREQUAL "rp2350")
27+
set(JLINK_DEVICE rp2350_m33_0)
28+
set(OPENOCD_TARGET rp2350)
29+
elseif (PICO_PLATFORM STREQUAL "rp2350-riscv")
30+
set(JLINK_DEVICE rp2350_riscv_0)
31+
set(OPENOCD_TARGET rp2350-riscv)
32+
endif()
33+
34+
set(OPENOCD_OPTION "-f interface/cmsis-dap.cfg -f target/${OPENOCD_TARGET}.cfg -c \"adapter speed 5000\"")
2435

2536
if (NOT PICO_TINYUSB_PATH)
2637
set(PICO_TINYUSB_PATH ${TOP})

test/hil/hil_test.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@
4343
STATUS_FAILED = "\033[31mFailed\033[0m"
4444
STATUS_SKIPPED = "\033[33mSkipped\033[0m"
4545

46+
verbose = False
47+
4648
# get usb serial by id
4749
def get_serial_dev(id, vendor_str, product_str, ifnum):
4850
if vendor_str and product_str:
@@ -111,7 +113,6 @@ def read_disk_file(uid, lun, fname):
111113
# Flashing firmware
112114
# -------------------------------------------------------------
113115
def run_cmd(cmd):
114-
#print(cmd)
115116
r = subprocess.run(cmd, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
116117
if r.returncode != 0:
117118
title = f'COMMAND FAILED: {cmd}'
@@ -123,6 +124,9 @@ def run_cmd(cmd):
123124
else:
124125
print(title)
125126
print(r.stdout.decode("utf-8"))
127+
elif verbose:
128+
print(cmd)
129+
print(r.stdout.decode("utf-8"))
126130
return r
127131

128132

@@ -260,14 +264,14 @@ def test_device_cdc_dual_ports(board):
260264
str1 = b"test_no1"
261265
ser1.write(str1)
262266
ser1.flush()
263-
assert ser1.read(100) == str1.lower(), 'Port1 wrong data'
264-
assert ser2.read(100) == str1.upper(), 'Port2 wrong data'
267+
assert ser1.read(len(str1)) == str1.lower(), 'Port1 wrong data'
268+
assert ser2.read(len(str1)) == str1.upper(), 'Port2 wrong data'
265269

266270
str2 = b"test_no2"
267271
ser2.write(str2)
268272
ser2.flush()
269-
assert ser1.read(100) == str2.lower(), 'Port1 wrong data'
270-
assert ser2.read(100) == str2.upper(), 'Port2 wrong data'
273+
assert ser1.read(len(str2)) == str2.lower(), 'Port1 wrong data'
274+
assert ser2.read(len(str2)) == str2.upper(), 'Port2 wrong data'
271275

272276

273277
def test_device_cdc_msc(board):
@@ -279,7 +283,7 @@ def test_device_cdc_msc(board):
279283
str = b"test_str"
280284
ser.write(str)
281285
ser.flush()
282-
assert ser.read(100) == str, 'CDC wrong data'
286+
assert ser.read(len(str)) == str, 'CDC wrong data'
283287

284288
# Block test
285289
data = read_disk_file(uid,0,'README.TXT')
@@ -447,13 +451,17 @@ def main():
447451
"""
448452
Hardware test on specified boards
449453
"""
454+
global verbose
455+
450456
parser = argparse.ArgumentParser()
451457
parser.add_argument('config_file', help='Configuration JSON file')
452458
parser.add_argument('-b', '--board', action='append', default=[], help='Boards to test, all if not specified')
459+
parser.add_argument('-v', '--verbose', action='store_true', help='Verbose output')
453460
args = parser.parse_args()
454461

455462
config_file = args.config_file
456463
boards = args.board
464+
verbose = args.verbose
457465

458466
# if config file is not found, try to find it in the same directory as this script
459467
if not os.path.exists(config_file):

test/hil/rpi.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,16 @@
5252
"dual_attached": [{"vid_pid": "1a86_55d4", "serial": "52D2002470"}]
5353
}
5454
},
55+
{
56+
"name": "raspberry_pi_pico2",
57+
"uid": "560AE75E1C7152C9",
58+
"flasher": "openocd",
59+
"flasher_sn": "E6633861A3978538",
60+
"flasher_args": "-f interface/cmsis-dap.cfg -f target/rp2350.cfg -c \"adapter speed 5000\"",
61+
"tests": {
62+
"dual_attached": [{"vid_pid": "1a86_55d4", "serial": "533D004242"}]
63+
}
64+
},
5565
{
5666
"name": "stm32f072disco",
5767
"uid": "3A001A001357364230353532",

0 commit comments

Comments
 (0)