cmemory-managementfirmwareraspberry-pi-picorp2040

Is there a way to flash a Raspberry Pi Pico with firmware contained in a pointer inside it?


I'm using a Raspberry Pi Pico for a personal project (written in the C language) and my problem is that my Raspberry Pi Pico is unreachable once it's installed, so I have to take it out every time I want to update my software which takes forever.

My Raspberry Pi Pico is linked to a Raspberry Pi CM3 with a dedicated protocol (that's not USB). I cannot add another wire for another protocol neither (USB or SWD).

My CM3 is connected in Wi-Fi, so far I can remotely send my update firmware to the Raspberry Pi Pico, doing that I have my firmware stocked in a pointer in the Raspberry Pi Pico (the firmware can be the .hex, .bin or .uf2 file).

How can I use this pointer to reprogram my Raspberry Pi Pico?

On the Raspberry Pi Pico SDK kit, I have found out the functions flash_range_erase() and flash_range_program, but it seems like it’s only to edit smalls part of memory and not the program itself. I know that I have to stop interrupts in order to do that and to stop my second core to avoid problems.

I also found the function reset_usb_boot() that allows me to reboot on boot USB mode without having to press the Bootsel button, which is really convenient. The problem I have is that once in this mode, I cannot use my pointer containing the firmware, because I just_ rebooted my Raspberry Pi Pico, and I cannot send the firmware that the Raspberry Pi Pico is waiting, because I don't have any USB connection to it.

I would like to know if there is a way of programmatically reflashing the Raspberry Pi Pico.


Solution

  • Following HamidReza's advice, I've posted my question on the Raspberry Pi Stack Exchange site and got an answer that worked!

    I'm now closing this question.