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

Add an "off-the-shelf" debugging panic handler #596

Open
Rahix opened this issue Nov 1, 2024 · 0 comments
Open

Add an "off-the-shelf" debugging panic handler #596

Rahix opened this issue Nov 1, 2024 · 0 comments

Comments

@Rahix
Copy link
Owner

Rahix commented Nov 1, 2024

During development, a panic handler that actually shows the panic message is very important. In practice, this usually means printing the message to serial/UART, as demonstrated in this example: uno-panic.rs

It would be nice to include a sane-default implementation of such a panic handler somewhere in our crates.

Some thoughts:

  • As a first step, just adding it to arduino-hal would serve most users.
  • It should be opt-in via a crate feature flag, so people can replace it with their own handler easily.
  • It should use the default serial device, as "specified" by arduino_hal::default_serial!()
  • It should not modify the serial settings that were configured by the user. I think the best solution would be to initialize the UART peripheral without changing any of the settings (needs additional support in avr-hal-generic).
  • At some point in the future, integration with the USB-serial for ATmega32U4, etc. should be considered...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant