I created a gist outlining my problem here: https://gist.github.com/uberscientist/baa627f9779d2d08ca87
I'll summarize:
I create an ISR, attempt to use __bic_SR_register_on_exit inside it and I get an error saying:
This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
I created a gist outlining my problem here: https://gist.github.com/uberscientist/baa627f9779d2d08ca87
I'll summarize:
I create an ISR, attempt to use __bic_SR_register_on_exit inside it and I get an error saying:
Thanks for the reply, I tried that and still get the same error:
main.c:150:28: error: MSP430 builtin functions only work inside interrupt handlers
[solved]
on another forum someone said "Seems like you are using the wrong vector name for that chip." -- yep it should've been "TIMER0_A0_VECTOR"
Yep, using a vector name that doesn’t exist will lead to a linker error. Or, maybe, a compile rerror (depends on the toolchain) tellign you that the symbol is unknown.
However, the error you got was a compiler error. The compiler was telling you that the function in which you are using the _on_exit intrinsic is no ISR at all. And this intrinsic can only be used directly inside the ISR, not in any function that is called form the ISR, as it requires information about the stack usage that isn’t available anywhere else but while compiling this specific ISR.
The reason is that this intrinsic does not manipulate the SR itself, but a copy of SR that is stored on the stack at ISR entry (and restored, including the LPM bits, on ISR exit). Where on the stack it is, at the current code line, is only known to the compiler while it is compiling this specific ISR.
I agree that the error message could be more ‘telling’, as most intrinsic work everywhere. Only the two _on_exit intrinsics (and their alter egos like EXIT_LPM0) are limited to ISRs
**Attention** This is a public forum