0

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.

cafce25
  • 15,907
  • 4
  • 25
  • 31
Bibibou
  • 11
  • 4
  • 1
    maybe that question is better suited for raspberrypi.stackexchange.com – Ingo Leonhardt Aug 01 '23 at 11:22
  • 1
    @Bibibou Welcome to SF. Although I didn't get what your mean is about `pointer`, your question is so general, and no one can help in details except you. I can just give you some suggestions. You need to write your own bootloader. You must modify your linker script to dedicate the first section of Flash to your bootloader. So, you can write your program through your bootloader with the `flash_range_program` function. AFAIK, this function doesn't have any restrictions (your bootloader can fetch new firmware and store it in RAM, then BL can write the new one to the flash). – HamidReza Aug 01 '23 at 11:39
  • @HamidReza I'm gonna start searching on the raspberry stack exchange about writing my own bootloader, thanks for your reply ! – Bibibou Aug 01 '23 at 12:02

0 Answers0