Skip to content

Empty default exception handler #15

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

Closed
robamu opened this issue Mar 10, 2025 · 4 comments
Closed

Empty default exception handler #15

robamu opened this issue Mar 10, 2025 · 4 comments

Comments

@robamu
Copy link
Contributor

robamu commented Mar 10, 2025

The current default handlers use semihosting.
What do you think about making them as simple as possible by just doing a nop loop?
Semihosting support might not work for all use-cases. For example, I am not fully sure whether I can make it
work for my Zynq7000 based board.

@jonathanpallant
Copy link
Contributor

That's a fair point - semihosting isn't a good default for everyone. They should be empty by default, but we should have examples of how to write better ones.

@jonathanpallant
Copy link
Contributor

I think we also want a default Rust handler for all exceptions, rather than just asm ones. I think we discussed this somewhere ... Matrix?

@robamu
Copy link
Contributor Author

robamu commented Mar 12, 2025

They should be empty by default, but we should have examples of how to write better ones.

Maybe recommending crates like https://docs.rs/panic_rtt/latest/panic_rtt/ or https://crates.io/crates/panic-dcc in addition to more general recommendation like persistent logging mechanism + (soft) reboot for production apps in the docs?

I think we also want a default Rust handler for all exceptions, rather than just asm ones. I think we discussed this somewhere ... Matrix?

I implemented ASM handlers which can be overriden for Cortex-A. They can probably be used for Cortex-R as well, but I still need to test them. The default handlers for UND, ABT and Prefetch ABT will still be the same empty default handler with a permanent loop. I implemented the ASM handler to be conformant to the ARM exception return recommendations. I don't think think they help much on a system without a full OS, but I assumed if exception return is somethin the user does not require, they will have an appropriate Rust fault handler.

@robamu
Copy link
Contributor Author

robamu commented Mar 13, 2025

Good news, I managed to test all the exception handlers for both Cortex-R and Cortex-A using the QEMU examples. I want to go one step further and also print the exception related registers (IFSR/DFSR) in the exception handlers inside the QEMU examples. It also builds on top of #8

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

2 participants