I'm using a raspberry Pi Pico for a personnal project (written in C language) and my problem is that my Pico is unreachable once it's installed so I have to take it out everytime I want to update my Software which takes forever. My 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 Wifi, so far I can remotely send my update firmware to the pico, doing that I have my firmware stocked in a pointer in the pico (the firmware can be the .hex, .bin or .uf2 file).
My question is how can I use this pointer to reprogram my pico ?
On the pico SDK kit I have found out the functions flash_range_erase()
and flash_range_program
but it seems like its 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 realy convenient. The problem I have is that once in this mode, I cannot use my pointer containing the firmware because I juste rebooted my Pico and I cannot send the firmware that the pico is waiting because I have no USB connection to it.
I would like to know if there is any way of programmatically reflashing the Pico.
Thanks in advance for your help.
Following HamidReza advice, I've posted my question on the raspberry stack exchange and got an answer that worked!
I'm now closing this question.