2

I want to reprogram the external flash of a raspberry Pico via SWD line. This feature must be implemented in a different microcontroller, not from a Linux computer so the OpenOCD library cannot be used.

I already wrote a C library that is able to read and write in RAM and in core registers via SWD and I'm able to put the Cortex-M0+ into halt state.

I read many tutorials and documentation and those that are useful are:

but unfortunately they aren't clear enough.

Can you explain the sequence of commands that I should send to RP2040 to correctly upload the new firmware? Should I use bootrom functions to implement this operation? How can I call them?

Thanks for your help!

Luca
  • 31
  • 3
  • 1
    have you looked at the relevant code in openocd for the Pico? I've not, but it is not uncommon to load a small piece of code that handles the flash reading/writing. If openocd can do it, then life the code fragment that it downloads and/or simply mimic the methods it uses as you code will have to do much the same. –  Nov 19 '21 at 11:00
  • openocd writes the memory with this function, but I don't understand which registers it uses and what it writes into them –  Nov 19 '21 at 11:13
  • 1
    looks like it calls the bootrom functions via a trampoline. https://github.com/raspberrypi/pico-sdk/blob/26653ea81e340cacee55025d110c3e014a252a87/src/common/boot_picoboot/include/boot/picoboot.h

    You'll have to do a bit of digging - I only found this with a cursory search

    –  Nov 19 '21 at 11:27
  • 1
    Not sure what you are trying to do, but note that J-Flash and Keil both seem to support external flash on the Pico: https://www.segger.com/news/segger-j-link-flasher-and-embedded-studio-now-support-raspberry-pi-rp2040/ , https://github.com/GorgonMeducer/Pico_Template – Dmitry Grigoryev Nov 20 '21 at 15:59

0 Answers0