-
Notifications
You must be signed in to change notification settings - Fork 237
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
Panic reporting over USB example for Resberry Pi pico #851
Comments
Your example defers all of the hardware initialisation to the panic handler, which means most of the code is running at the boot-up clock speed without the PLLs initialised. Users also won't be able to use any hardware within the main thread because creating the mutable references within the panic handler would then be UB. In general, doing something as complex as talking over USB is difficult to do in a panic handler, because a panic indicates an invalid state has been detected and yet the USB driver has to assume that the system state is valid in order to function correctly. It's probably a better idea to write the panic message to a non-initialised piece of RAM, reboot, and pick it up from RAM after the reboot. The panic-persist crate can help with this. |
@thejpster Can you please provide an example code how to do that with, if possible, ability to backtrace and unwind the panic over USB? It will be very helpful in the development process. Another request for an example of how to keep the USB connection open when the thread is doing something else like some calculation. Like I should be able to write or read the serial port when I want without polling it all the time, like we can do in C++ in Arduino IDE. Now the computer thinks the connection is dead if I don't poll all the time and does not read the data if I send without polling. Thank you. |
I don't have capacity at the moment to write bespoke examples free of charge. If you require support, there are several Rust consultancies that can provide this on a commercial basis. If you wish to run the USB at the same time as running application logic, I recommend looking at ether Embassy or RTIC. I'm sure Embassy has good USB examples for the RP2040. |
My keyboard firmware optionnaly does that (feature gated). The gist of it is:
|
I was looking for an example which will guide me to report panics to the host PC over USB. I count not find one, so I wrote mine. I know it's not good as I am not a professional developer. Still like to post it here if somehow it helps someone. If it's good enough please add it to the examples after modifying if required. If possible add facility for unwinding and back-trace. I don't know why but I am not getting the message like out of bound.
`
`
The text was updated successfully, but these errors were encountered: