Open playduck opened 1 year ago
this PR adds a short reminder if a load command with a force flag fails.
It actually appears to be any command that uses the force flag, not just the load command? IMHO the behaviour you've implemented is what I'd expect, it's just that the PR description is a bit misleading :wink:
Added both missing dashes, must've missed them the first time around.
It actually appears to be any command that uses the force flag
Yes, I've just been testing it with load only, but other commands behave the same:
./picotool info -f
No accessible RP2040 devices in BOOTSEL mode were found.
To force a device into BOOTSEL mode, make sure the RP2040 is configured to use USB-CDC (USB stdio).
I subtracted the current string length from the maximum allowed length of the snprintf
calls.
This still produces the same output but is now more robust against buffer-overflows.
it isn't strictly limited to USB stdio (though may be in practice as no one else implements the interface)
Perhaps "Force a device not in BOOTSEL mode but running compatible code (e.g. USB stdio)"
You probably want to change this to be based against develop
instead of master
? And whilst doing that, be aware of the change introduced in #72 :wink:
This PR is in response to issue #56.
Using
-f
or-F
requires the RP2040 to have enabled USB-CDC. As this isn't immediately obvious this PR adds a short reminder if a load command with a force flag fails. This also adds a small sentence to thehelp load
text.Running
./picotool load binary.elf -f
with no responding device now outputs:The help load text now reads (note the last sentence):
I've also modified the the printing routine for the error message to use
snprintf
andstrncpy
to avoid potential string-length issues as is good practice.