-
Notifications
You must be signed in to change notification settings - Fork 165
Hard fault on debug compilation #583
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
Comments
Even if The conclusion may be that you can't change the stack using |
Needs a macro, sounds like. |
Hm, yea, maybe a macro-by-example could emit the inline asm needed. That's probably nicer than just saying everyone has to use asm directly. It would still have to be used pretty carefully though. Certainly I don't see how we can usefully have this method as a normal function today, and now that inline asm is stable the justification from the time ("it's impossible to do this otherwise in stable rust; at least the function works in release mode") doesn't hold up. |
I need this to run a particular proprietary RTOS. I suspect the correct solution is an argument given to the Edit: That or a macro! that takes a function to call as an argument. |
Hello all,
I am experimenting with an STM32F303 and try to enter unprivileged mode with program stack pointer set. I use the following minimal example:
On a debug build this causes a hard fault at control::write(). On release build it works fine. I guess this is because the compiler does not inline the call on debug and the function crashes on return as it fails to pop the return address from the stack, which changed from MSP to PSP.
Maybe #[inline(always)] is necessary for control::write()?
The text was updated successfully, but these errors were encountered: