Add pre-default-start-trap feature - #337
Conversation
romancardenas
left a comment
There was a problem hiding this comment.
LGTM! Could you include a sample example in the docs to illustrate how to implement the new routine?
|
I tried to come up with a more or less interesting and realistic example - but it might not be brief enough, let me know if I should reduce it to a minimum |
|
Usually, we just include an empty implementation with a comment like |
Makes sense - will change it 👍 |
romancardenas
left a comment
There was a problem hiding this comment.
LGTM! A few comments:
-
should the docs explicitly say that the new symbol must be in the .trap.start section?
-
currently, the new symbol is only used in direct mode and in exceptions with vectored mode. Do you need this to be included in the _continue_trap symbol for vectored interrupts?
|
Thanks for the quick reply!
It's probably worth to add a recommendation to avoid people running into linker errors later. I will add that 👍
For me at least it's only needed for exceptions (in vectored mode). I guess having it for everything in direct mode is fine but I can't think of a case where I need it for vectored interrupts. Should I note this in the docs? (i.e. that it won't get called for vectored interrupts) |
|
Sounds good to me. Let's document everything and leave it as it is |
In esp-hal we offer the "flip-link" feature.
When SP moves below RAM an exception is raised but we need a way to check that situation and move SP into RAM again before further processing.
One way would be to define our own
_default_start_trap- another way would be to have a way to execute custom code before_default_start_trapwhich this PR implements.Not sure if this is the best way to do it but it's simple and should work good enough.
This should be the last missing step to use riscv-rt in esp-hal. (see esp-rs/esp-hal#2390)
Let me know if you want me to change anything