Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"Over The Air" updates for Pico-w #4341

Open
nickaxgit opened this issue Jul 16, 2024 · 3 comments
Open

"Over The Air" updates for Pico-w #4341

nickaxgit opened this issue Jul 16, 2024 · 3 comments
Labels
question Question about usage of TinyGo

Comments

@nickaxgit
Copy link

Hi Chaps

With some direction from Patricio, I have implemented the UDP stack in seqs.. I can now pull binary files with a naïve, "reliable" protocol on top. (Yes, I know I could have done that with TCP !).
I made it for camera images, but the next challenge is to be able to update the running program - I'm not sure I need anything as complex as a bootloader - if I can get a new .ELF (or UF2) file onto the Pico, and invoke machine.CPUReset() ... ??
I also just discovered machine.BlockDevice

I'm sure this is not as straightforward as I am hoping, but I'd welcome any pointers.

Is self-updating for TinyGo apps already elsewhere on the radar ?
My needs are simple, it doesn't need to be totally robust or secure, bricking a Pico would just mean a short drive - but I could perhaps explore a Proof of Concept that might develop into something more universally useful.

@nickaxgit
Copy link
Author

nickaxgit commented Jul 16, 2024

Notes to self (just gathering potentially helpful stuff)
https://kevinboone.me/pico_run_ram2.html

https://forums.raspberrypi.com/viewtopic.php?t=322858

This is starting to look very non-trivial

Wondering about using a mem-copy, or possibly DMA to (re)place the running image (unpacked from a UF2/elf file)..
https://github.com/raspberrypi/pico-examples/blob/master/dma/hello_dma/hello_dma.c

A watchdog timer could be set, prior to the copy to reboot the device when it (inevitably) crashes (but hopefully by the the copy would have completed)

https://www.raspberrypi.com/documentation/pico-sdk/hardware.html#flash_example

https://kevinboone.me/picoflash.html

@b0ch3nski
Copy link

ESPhome has a support for both OTA updates and RP2040 - you could take a look how they are doing it:

  1. https://esphome.io/components/ota
  2. https://esphome.io/components/safe_mode
  3. https://esphome.io/components/rp2040

IMO for a reliable solution, this would require some sort of bootloader and A/B partitions switchover 🤔

@nickaxgit
Copy link
Author

nickaxgit commented Jul 17, 2024 via email

@deadprogram deadprogram added the question Question about usage of TinyGo label Jul 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Question about usage of TinyGo
Projects
None yet
Development

No branches or pull requests

3 participants