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!

4
  • 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.
    – Kartman
    Commented Nov 19, 2021 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
    – dima.91
    Commented Nov 19, 2021 at 11:13
  • 1
    looks like it calls the bootrom functions via a trampoline. github.com/raspberrypi/pico-sdk/blob/… You'll have to do a bit of digging - I only found this with a cursory search
    – Kartman
    Commented Nov 19, 2021 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: segger.com/news/… , github.com/GorgonMeducer/Pico_Template Commented Nov 20, 2021 at 15:59

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.