During development, I often need to re-flash my code on the Pico. To save me from having to unplug/replug the USB plug while holding the BOOTSEL button, I use the "picotool load -f" command instead.
However, I found that if the program stops unexpectedly (crash), or even just returns from main(), picotool can't reset it.
First off, I wonder why, if main() returns, the Pico doesn't reset into disk mode on its own. What else is it doing once main returns? Does it shut off? Where can I find docs on what happens before and after the call to main()?
Next, is there a way to get the PicoW into the disk mode from C code?
Lastly, is there an easy way to catch most crashes (out of memory, bus error etc) so that I can then reboot it as well?
However, I found that if the program stops unexpectedly (crash), or even just returns from main(), picotool can't reset it.
First off, I wonder why, if main() returns, the Pico doesn't reset into disk mode on its own. What else is it doing once main returns? Does it shut off? Where can I find docs on what happens before and after the call to main()?
Next, is there a way to get the PicoW into the disk mode from C code?
Lastly, is there an easy way to catch most crashes (out of memory, bus error etc) so that I can then reboot it as well?
Statistics: Posted by tem_pi — Fri Jul 26, 2024 12:13 pm