Skip to content

Picoprobe upload issues through platformio #571

Closed
@tkanarsky

Description

@tkanarsky

Hi! Trying to setup my platformio workflow: target Pico connected via USB for power, other Pico flashed with latest Picoprobe firmware connected to SWD headers on target Pico.

I'm having issues with uploading via picoprobe, so I haven't gotten to testing the debugging part.

My platformio.ini is as follows:

[env:pico]
platform = https://github.com/maxgerhardt/platform-raspberrypi.git
board = pico
framework = arduino
board_build.core = earlephilhower
board_build.filesystem_size = 1m
lib_deps = 
	; adafruit/Adafruit SSD1306@^2.5.3
	; adafruit/Adafruit BusIO@^1.11.4
	; jandrassy/WiFiEspAT@^1.3.2
	https://github.com/tkanarsky/Pico-PIO-USB.git
platform_packages =
    maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git
    maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/x86_64-linux-gnu.arm-none-eabi-ed6d983.220212.tar.gz
    platformio/tool-openocd-raspberrypi@https://gitee.com/flyboard2040/pio-openocd-picoprobe-linux.git
debug_tool = picoprobe
upload_protocol = picoprobe
monitor_speed = 115200

The other parts of the platformio.ini, other than the line platformio/tool-openocd-raspberrypi@https://gitee.com/flyboard2040/pio-openocd-picoprobe-linux.git and debug_tool/upload_protocol, work fine and result in properly uploaded firmware. I wanted to bite the bullet and set up a proper debugger because printf'ing everything was driving me mad.

I get the following output when starting an upload (verbose):

tim@tim-latitude:~/study-orders/firmware/order_tracker$ platformio run --target upload --verbose
Processing pico (platform: https://github.com/maxgerhardt/platform-raspberrypi.git; board: pico; framework: arduino; board_build.core: earlephilhower; board_build.filesystem_size: 1m; lib_deps: https://github.com/tkanarsky/Pico-PIO-USB.git; platform_packages: maxgerhardt/framework-arduinopico@https://github.com/earlephilhower/arduino-pico.git, maxgerhardt/toolchain-pico@https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/x86_64-linux-gnu.arm-none-eabi-ed6d983.220212.tar.gz, platformio/tool-openocd-raspberrypi@https://gitee.com/flyboard2040/pio-openocd-picoprobe-linux.git; debug_tool: picoprobe; upload_protocol: picoprobe; monitor_speed: 115200)
----------------------------------------------------------------------------------------------------------------------------
CONFIGURATION: https://docs.platformio.org/page/boards/raspberrypi/pico.html
PLATFORM: Raspberry Pi RP2040 (1.6.0+sha.d20e2ed) (git+https://github.com/maxgerhardt/platform-raspberrypi.git) > Raspberry Pi Pico
HARDWARE: RP2040 133MHz, 264KB RAM, 2MB Flash
DEBUG: Current (picoprobe) External (cmsis-dap, jlink, picoprobe, raspberrypi-swd)
PACKAGES: 
 - framework-arduinopico 1.20000.0+sha.55394a7 (git+https://github.com/earlephilhower/arduino-pico.git) 
 - tool-mklittlefs 1.203.210628 (2.3) 
 - tool-openocd-raspberrypi 2.1100.0+sha.af6aec9 (git+https://gitee.com/flyboard2040/pio-openocd-picoprobe-linux.git) 
 - tool-rp2040tools 1.0.2 
 - toolchain-pico 5.100300.220212 (10.3.0, https://github.com/earlephilhower/pico-quick-toolchain/releases/download/1.3.3-a/x86_64-linux-gnu.arm-none-eabi-ed6d983.220212.tar.gz)
Flash size: 2.00MB
Sketch size: 1.00MB
Filesystem size: 1.00MB
Maximium size: 1044480 Flash Length: 1044480 EEPROM Start: 270528512 Filesystem start 269479936 Filesystem end 270528512
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Ignored library /home/tim/.platformio/packages/framework-arduinopico/libraries/Adafruit_TinyUSB_Arduino
More details about "Library Compatibility Mode": https://docs.platformio.org/page/librarymanager/ldf.html#ldf-compat-mode
Found 19 compatible libraries
Scanning dependencies...
Dependency Graph
|-- <Pico-PIO-USB> 0.0.0+20220502022230.sha.1d60795 [git+https://github.com/tkanarsky/Pico-PIO-USB.git] (/home/tim/study-orders/firmware/order_tracker/.pio/libdeps/pico/Pico-PIO-USB)
Building in release mode
<lambda>(["checkprogsize"], [".pio/build/pico/firmware.elf"])
Flash size: 2.00MB
Sketch size: 1.00MB
Filesystem size: 1.00MB
Maximium size: 1044480 Flash Length: 1044480 EEPROM Start: 270528512 Filesystem start 269479936 Filesystem end 270528512
MethodWrapper(["checkprogsize"], [".pio/build/pico/firmware.elf"])
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.2% (used 11044 bytes from 262144 bytes)
Flash: [=         ]   7.2% (used 75652 bytes from 1044480 bytes)
.pio/build/pico/firmware.elf  :
section                  size        addr
.boot2                    256   268435456
.text                   64952   268435712
.rodata                  3268   268500664
.ARM.extab                188   268503932
.ARM.exidx                520   268504120
.ram_vector_table         192   536870912
.data                    6656   536871104
.uninitialized_data         0   536877760
.scratch_x                  0   537133056
.scratch_y                  0   537137152
.bss                     4388   536877760
.heap                    2048   536882148
.stack1_dummy            2048   537133056
.stack_dummy             2048   537137152
.ARM.attributes            45           0
.comment                   18           0
.debug_info            509504           0
.debug_abbrev           85410           0
.debug_loc             243026           0
.debug_aranges          10056           0
.debug_ranges           44904           0
.debug_line            203508           0
.debug_str              80219           0
.debug_frame            24652           0
Total                 1287906
<lambda>(["upload"], [".pio/build/pico/firmware.elf"])
AVAILABLE: cmsis-dap, jlink, picoprobe, picotool, raspberrypi-swd
CURRENT: upload_protocol = picoprobe
openocd -d2 -s /home/tim/.platformio/packages/tool-openocd-raspberrypi/share/openocd/scripts -f interface/picoprobe.cfg -f target/rp2040.cfg -c "program {.pio/build/pico/firmware.elf} 0x10000000 verify reset; shutdown;"
Open On-Chip Debugger 0.11.0+dev-g0628da7-dirty (2021-10-29-19:23)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : only one transport option; autoselect 'swd'
Warn : Transport "swd" was already selected
adapter speed: 5000 kHz

Info : Hardware thread awareness created
Info : Hardware thread awareness created
Info : clock speed 5000 kHz
Info : SWD DPIDR 0x0bc12477
Info : SWD DLPIDR 0x00000001
Info : SWD DPIDR 0x0bc12477
Info : SWD DLPIDR 0x10000001
Info : rp2040.core0: hardware has 4 breakpoints, 2 watchpoints
Info : rp2040.core1: hardware has 4 breakpoints, 2 watchpoints
Info : starting gdb server for rp2040.core0 on 3333
Info : Listening on port 3333 for gdb connections
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
target halted due to debug-request, current mode: Thread 
xPSR: 0xf1000000 pc: 0x000000ee msp: 0x20041f00
** Programming Started **
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000012a msp: 0x20041f00
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000012a msp: 0x20041f00
Info : Found flash device 'win w25q16jv' (ID 0x001540ef)
Info : RP2040 B0 Flash Probe: 2097152 bytes @0x10000000, in 32 sectors

Warn : no flash bank found for address 0x20000000
Warn : no flash bank found for address 0x20010e40
** Programming Finished **
** Verify Started **
target halted due to debug-request, current mode: Thread 
xPSR: 0x01000000 pc: 0x0000012a msp: 0x20041f00
Error: checksum mismatch - attempting binary compare
embedded:startup.tcl:542: Error: ** Verify Failed **
in procedure 'program' 
in procedure 'program_error' called at file "embedded:startup.tcl", line 603
at file "embedded:startup.tcl", line 542
*** [upload] Error 1
================================================ [FAILED] Took 2.46 seconds ================================================

It seems like it's having issues finding the proper offset to write the firmware to, which causes the checksum to fail

I'm not well-versed in this toolchain, so apologies in advance if the error is completely unrelated to your efforts. If so, could you point me in the right direction?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions