zephyrproject-rtos / zephyr

Primary Git Repository for the Zephyr Project. Zephyr is a new generation, scalable, optimized, secure RTOS for multiple hardware architectures.
https://docs.zephyrproject.org
Apache License 2.0
10.88k stars 6.63k forks source link

west flash on pico: incorrect syntax to openocd #57621

Closed graeme-winter closed 1 year ago

graeme-winter commented 1 year ago

Going through the getting started guide, west flash with pico / picoprobe combination fails with

(.venv) silver-surfer-2 pico :) [main] $ west flash
-- west flash: rebuilding
[1/14] Performing build step for 'second_stage_bootloader'
ninja: no work to do.
[3/3] Completed 'second_stage_bootloader'
-- west flash: using runner openocd
-- runners.openocd: Flashing file: /Users/graeme/C/zephyr/zephyr/pico/build/zephyr/zephyr.hex
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
set_adapter_speed_if_not_set
Can't find interface/picoprobe.cfg
FATAL ERROR: command exited with status 1: /usr/local/bin/openocd -s /Users/graeme/C/zephyr/zephyr/boards/arm/rpi_pico/support -s /Users/graeme/.local/zephyr-sdk-0.16.0/sysroots/x86_64-pokysdk-linux/usr/share/openocd/scripts -f /Users/graeme/C/zephyr/zephyr/boards/arm/rpi_pico/support/openocd.cfg -c 'source [find interface/picoprobe.cfg]' -c 'transport select swd' -c 'source [find target/rp2040.cfg]' -c 'set_adapter_speed_if_not_set 2000' '-c init' '-c targets' -c 'reset init' -c 'flash write_image erase /Users/graeme/C/zephyr/zephyr/pico/build/zephyr/zephyr.hex' -c 'reset run' -c shutdown

Documentation for openocd with picoprobe indicates that this config is obsolete. The correct syntax for flash appears to be

openocd -f interface/cmsis-dap.cfg -f target/rp2040.cfg -c "adapter speed 5000" -c "program zephyr.elf verify reset exit"

which worked fine.

Two key differences:

Issue raised more because the getting started guide did not work on this platform and I had expected it to. I will have a look myself

(.venv) silver-surfer-2 zephyr :) [main] $ which west 
/Users/graeme/C/zephyr/.venv/bin/west
(.venv) silver-surfer-2 zephyr :) [main] $ west --version
West version: v1.0.0

Followed the Zephyr OS getting started guide from current documentation.

github-actions[bot] commented 1 year ago

Hi @graeme-winter! We appreciate you submitting your first issue for our open-source project. 🌟

Even though I'm a bot, I can assure you that the whole community is genuinely grateful for your time and effort. πŸ€–πŸ’™

mbolivar-nordic commented 1 year ago

@graeme-winter this is a zephyr bug since west flash is a west extension command implemented in the zephyr repo. transferred accordingly