0

使用 __asm 函数编译一个简单的 c 文件时,我收到以下错误消息。似乎无法识别“MSP”。我可以在注释掉“MRS R0,MSP”后构建。我在这里缺少什么?谢谢。

Invoking: Arm C Compiler for Embedded 5.6.6'

armcc.exe --cpu=Cortex-R5 --arm --apcs=interwork -O0 -g --md --depend_format=unix_escaped -c -o "main.o" "main.c"

"main.c", line 26: Error: A1616E: Instruction, offset, immediate or register combination is not supported by the current instruction set
   26 00000000  MRS R0, MSP

我的main.c

__asm uint32_t A( void )
{
    MRS R0, MSP
    LDR R0, [R0,#8]
    BX  lr
}

int main()
{
    A();
    return 0;
}
4

1 回答 1

0

我从 ARM 论坛/社区收到了以下答案(感谢 Ronan),并对其进行了验证(我有一个混合 Cortex-M/R 内核的系统)。去引用

“您正在为不支持 MSP(主堆栈指针)的 Cortex-R5 构建。MSP 仅在 Cortex-M 处理器上提供。”

https://community.arm.com/support-forums/f/armds-forum/52130/a1616e-armcc-compile-error/175598#175598

于 2022-01-17T19:40:43.400 回答