请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
器件型号:MSP430FR6047 您好!
我必须将这一呼吁抽象出来、
__ BIC_SR_REGISTER_ON_EXIT
我的问题是:我从一个中断例程中调用这个例程、但是在一个子例程中。 遗憾的是、编译器无法识别这一点、因此我收到一个编译器错误。
有可能获得这个例程的汇编代码吗?
此致
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.
您好!
我必须将这一呼吁抽象出来、
此致
也许可以用一个位代码来了解我想要实现的目标:
template <typename Derived>
class ITest
{
public:
static constexpr inline void wakeup()
{
Derived::wakeupImpl();
}
};
class Test : public ITest<Test>
{
protected:
friend class ITest<Test>;
static constexpr inline void wakeupImpl()
{
__bic_SR_register_on_exit(LPM3_bits);
}
};
void __attribute__((interrupt(USCI_A0_VECTOR))) USCI_A0_ISR(void)
{
WakeState wakeState;
MyUart::intByteReceived(wakeState);
if(wakeState == WakeState::Wakeup)
{
Test::wakeup();
}
}
导致此错误:
这必须在 ISR 中使用、因为编译器必须准确知道 SR 寄存器在栈上的保存位置。 它知道在 ISR 中、但不在 ISR 调用的函数中。
鉴于其显示"on_exit"、我假设这通常但并非总是延迟到 RTI 指令之前。
使用的指令是"BIC #LMP3_BITS、OFFSET (SP)"。 当然,您可以使用 asm ()语句插入该语句,并使用您确定要使用的偏移量。 今天。 当然、当你明天更新编译器时、这可能会中断。 或更改优化级别。