diff --git a/.idea/cmake.xml b/.idea/cmake.xml index fec01a08e5..96ff19c89d 100644 --- a/.idea/cmake.xml +++ b/.idea/cmake.xml @@ -2,7 +2,9 @@ - + + + diff --git a/hw/bsp/rp2040/boards/feather_rp2040_max3421/board.cmake b/hw/bsp/rp2040/boards/feather_rp2040_max3421/board.cmake index b8e5890f3f..2afe0f2649 100644 --- a/hw/bsp/rp2040/boards/feather_rp2040_max3421/board.cmake +++ b/hw/bsp/rp2040/boards/feather_rp2040_max3421/board.cmake @@ -1,3 +1,4 @@ +set(PICO_PLATFORM rp2040) set(PICO_BOARD adafruit_feather_rp2040) # Enable MAX3421E USB Host diff --git a/hw/bsp/rp2040/boards/raspberry_pi_pico/board.cmake b/hw/bsp/rp2040/boards/raspberry_pi_pico/board.cmake index f9887c09c4..804cdb50a5 100644 --- a/hw/bsp/rp2040/boards/raspberry_pi_pico/board.cmake +++ b/hw/bsp/rp2040/boards/raspberry_pi_pico/board.cmake @@ -1 +1,2 @@ +set(PICO_PLATFORM rp2040) set(PICO_BOARD pico) diff --git a/hw/bsp/rp2040/boards/raspberry_pi_pico2/board.cmake b/hw/bsp/rp2040/boards/raspberry_pi_pico2/board.cmake new file mode 100644 index 0000000000..3482e2674e --- /dev/null +++ b/hw/bsp/rp2040/boards/raspberry_pi_pico2/board.cmake @@ -0,0 +1,2 @@ +set(PICO_PLATFORM rp2350-arm-s) +set(PICO_BOARD pico2) diff --git a/hw/bsp/rp2040/family.cmake b/hw/bsp/rp2040/family.cmake index d91821ffae..8f01eac749 100644 --- a/hw/bsp/rp2040/family.cmake +++ b/hw/bsp/rp2040/family.cmake @@ -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}) diff --git a/test/hil/hil_test.py b/test/hil/hil_test.py index 52ec5ae1db..a569e76665 100644 --- a/test/hil/hil_test.py +++ b/test/hil/hil_test.py @@ -43,6 +43,8 @@ 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): diff --git a/test/hil/rpi.json b/test/hil/rpi.json index 36376a8733..77919f3460 100644 --- a/test/hil/rpi.json +++ b/test/hil/rpi.json @@ -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",