I've noticed an odd issue on RP2040: if the chip is currently booted into the ROM bootloader (either by pressing the BOOTSEL button when resetting the chip, or due to having no valid program to execute), PyOCD cannot successfully flash code. It appears that only FFs and 00s get written to flash.
Steps to reproduce:
- Boot into ROM bootloader
- Erase the chip via
picotool erase:
Erasing: [==============================] 100%
Erased 2097152 bytes
- Flash any valid program via PyOCD:
0000669 I Target type is rp2040_core0 [board]
0000718 I DP IDR = 0x0bc12477 (v2 MINDP rev0) [dap]
0000722 I AHB-AP#0 IDR = 0x04770031 (AHB-AP var3 rev0) [discovery]
0000724 I AHB-AP#0 Class 0x1 ROM table #0 @ 0xe00ff000 (designer=43b:Arm part=4c0) [rom_table]
0000725 I [0]<e000e000:SCS v6-M class=14 designer=43b:Arm part=008> [rom_table]
0000726 I [1]<e0001000:DWT v6-M class=14 designer=43b:Arm part=00a> [rom_table]
0000727 I [2]<e0002000:BPU v6-M class=14 designer=43b:Arm part=00b> [rom_table]
0000729 I CPU core #0: Cortex-M0+ r0p1, v6.0-M architecture [cortex_m]
0000729 I Extensions: [MPU] [cortex_m]
0000730 I 2 hardware watchpoints [dwt]
0000731 I 4 hardware breakpoints, 0 literal comparators [fpb]
0000847 I Loading test-mbed-hal-stack-size-unification.bin at 0x10000000 [load_cmd]
0000848 I Erasing... [loader]
[---|---|---|---|---|---|---|---|---|----]
[========================================]
[---|---|---|---|---|---|---|---|---|----]
[0001082 I Programming... [loader]
========================================]
0002547 I Erased 57344 bytes (14 sectors), programmed 56576 bytes (221 pages), skipped 0 bytes (0 pages) at 32.53 kB/s [loader]
- Observe that the chip boots back into ROM bootloader due to the program passing checksum
- Dump the flash via
picotool save -r 0x10000000 0x10200000 flash-contents.bin:
Saving file: [==============================] 100%
Wrote 2097152 bytes to flash-contents.bin
- Observe that the dumped bin file contains a block of FFs at the start, then 00s, rather than the intended program data.
I'll attach the program I used and the resulting bin file to this post:
test-mbed-hal-stack-size-unification.zip
flash-contents.zip
I've noticed an odd issue on RP2040: if the chip is currently booted into the ROM bootloader (either by pressing the BOOTSEL button when resetting the chip, or due to having no valid program to execute), PyOCD cannot successfully flash code. It appears that only FFs and 00s get written to flash.
Steps to reproduce:
picotool erase:picotool save -r 0x10000000 0x10200000 flash-contents.bin:I'll attach the program I used and the resulting bin file to this post:
test-mbed-hal-stack-size-unification.zip
flash-contents.zip