platform-raspberrypi icon indicating copy to clipboard operation
platform-raspberrypi copied to clipboard

Add support for Picoprobe

Open lorenzgeisser opened this issue 4 years ago • 7 comments

Could you include the Picoprobe as a debugging option in PlatformIO? It would be very useful if we could debug and program the Raspberry Pi Pico (with the RP2040 MCU) projects with an under $5 device.

lorenzgeisser avatar Jul 04 '21 10:07 lorenzgeisser

+1 for this. Sadly the RaspberryPi OpenOCD version (https://github.com/raspberrypi/openocd/) seems very fragemented as of now. Looking at the branch picoprobe it does have the interface config file (and C code) to support the picoprobe (https://github.com/raspberrypi/openocd/tree/picoprobe/tcl/interface), but this code is missing from the default rp2040 (maseter) branch (https://github.com/raspberrypi/openocd/tree/rp2040/tcl/interface). So, compiling one OpenOCD version only gives you one set of features and not some others.

I've opened https://github.com/raspberrypi/openocd/pull/41 as a question (and possible fix) for that.

Once we have a better OpenOCD version, then this package

https://github.com/platformio/platform-raspberrypi/blob/3c6cc84610e7004eed5980510862a38aa987a7c2/platform.json#L45-L50

can get an update and the needed Python platform.py / main.py code can be added to allow running OpenOCD with the picoprobe.cfg interface file, which shouldn't be too hard.

If someone wanted to work with it right-right now one could also use debug_server and related commands to point to a custom OpenOCD version (compiled from the picoprobe branch) with the appropriate flags, this would very likely work, given that the OpenOCD version in that branch is functional with respect to the picoprobe.

maxgerhardt avatar Jul 04 '21 20:07 maxgerhardt

I managed to get this working on my own using a custom platform fork and with OpenOCD compiled from the picoprobe branch.

grafik

See the second environment in my https://github.com/maxgerhardt/pio-pico-core-earlephilhower-test project. Only works on Windows as of now because of a precompiled OpenOCD version with Picoprobe support.

Together with the other improvements in that platform fork (Earle Philhower's Pico core support) I'm planning to PR it back soon.

maxgerhardt avatar Aug 08 '21 13:08 maxgerhardt

I took your sample project and was able to compile it successfully (see image 1). But when i test the upload function i get the error "embedded:startup.tcl:26: Error: Can't find interface/picoprobe.cfg" (see picture 2). Can you help?

2021-08-09_09h29_15

2021-08-09_09h28_57

lorenzgeisser avatar Aug 09 '21 07:08 lorenzgeisser

Since the file is in my repo here, can you check whether it exists in C:\Users\<user>\.platformio\packages\tool-openocd-raspberrypi\share\openocd\scripts\interface? The output show it's using the OpenOCD version from the Git so it should be there :/

maxgerhardt avatar Aug 09 '21 10:08 maxgerhardt

now it works... Thx! I am looking forward to the picoprobe being officially supported.

lorenzgeisser avatar Aug 09 '21 17:08 lorenzgeisser

@maxgerhardt looks like they've combined the two versions in the current rp2040 branch, since there's both raspberrypi* and picoprobe scripts: https://github.com/raspberrypi/openocd/tree/rp2040/tcl/interface

What would be the next step to getting this implemented? I think it might be to cut a new release onto https://registry.platformio.org/tools/platformio/tool-openocd-raspberrypi, but I'm not sure what needs to be done for that to happen.

I'd be happy to help out if someone would point me in the right direction/do the stuff I don't have permissions for.

flaviut avatar Mar 15 '22 02:03 flaviut

I've created Picoprobe support in https://github.com/platformio/platform-raspberrypi/pull/36, this is finally working for both the ArduinoCore-mbed core and Arduino-Pico.

maxgerhardt avatar Jun 09 '22 20:06 maxgerhardt