Skip to content
This repository was archived by the owner on Jan 24, 2022. It is now read-only.

default_handler no longer includes _e #52

Closed
LunNova opened this issue Jan 7, 2018 · 2 comments
Closed

default_handler no longer includes _e #52

LunNova opened this issue Jan 7, 2018 · 2 comments

Comments

@LunNova
Copy link

LunNova commented Jan 7, 2018

In cortex-m, default_handler had a local variable for the exception for convenience when debugging:

rust-embedded/cortex-m@8394581#diff-86a9d5942521ed33df4dccb8dbf23016R164

It's missing now that default_handler is in cortex-m-rt:

https://github.com/japaric/cortex-m-rt/blob/8842d0efd7863c2dc23edd75548a658af59afe6b/src/lib.rs#L458

Is this intentional?

@japaric
Copy link
Member

japaric commented Jan 7, 2018

Is this intentional?

Yes, I don't recall the exact reason but the load operation was not elidable in release mode (because it's a volatile load) yet the variable was not inspectable (in release mode) because of inlining / optimization. This might have been related to the bloating we used to have due to repeated exception / interrupt handlers. (cf. rust-embedded/cortex-m#19)

I think we could provide GDB (Python script) helpers for this debugging stuff since the involved registers are available on all devices and always have the same addresses / semantics. I'm not familiar with GDB scripting though.

If you do want to perform some logic based on the current exception / interrupt in the default handler then you can always override the default handler using the default_handler! macro.

@japaric
Copy link
Member

japaric commented May 13, 2018

DefaultHandler now includes an irqn argument which is the IRQ number of the exception being serviced (negative = core exception, zero or positive = device specific interrupt).

@japaric japaric closed this as completed May 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants