armcc

Why I got error A1616E when compile in DS-5 with embedded assembly


I got below error message when compile a simple c file with an __asm function. It seems "MSP" is not recognized. I can build after comment out "MRS R0, MSP". What I am missing here? Thanks.

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

My main.c:

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

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

Solution

  • I received below answer from ARM forum/community (Thanks to Ronan), and verified it (I am having a system with mixed Cortex-M/R cores). To quote

    "You are building for Cortex-R5, which does not support MSP (Main Stack Pointer). MSP is only provided on Cortex-M processors."

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