This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

ARMCompiler6.18 armasm inline assembly syntax

I tried to switch my compiler from ARM V5 to V6, and I faced a inline assembly funciton conversion issue:

[Original]

DATA_RAM_FUNCTION __asm void prvEnableVFP_RTT(void)
{
    PRESERVE8
    
    /* The FPU enable bits are in the CPACR. */
    ldr.w r0, = 0xE000ED88
    ldr r1, [r0]
    
    /* Enable CP10 and CP11 coprocessors, then save back. */
    // orr r1, r1, #( 0xf << 20 )
    orr r1, r1, #0xf00000
    str r1, [r0]
    bx r14
    nop
}

[After Conversion]

DATA_RAM_FUNCTION void prvEnableVFP_RTT(void)
{
    __asm volatile(
    ".eabi_attribute Tag_ABI_align_preserved, 1 \n"
    "ldr.w r0, = %0 \n"
    "ldr r1, [r0] \n"
    "orr r1, r1, #0xf00000 \n"
    "str r1, [r0] \n"
    "bx r14 \n"
    "nop \n"
    : /* no outputs */ : "r"(0xE000ED88) : "r0", "r1", "r14"
    );
}

There is a error:

./.rtt-studio/Debug\rtthread.axf: Error: L6218E: Undefined symbol r2 (referred from lto-llvm-293411.o).

What's going wrong?

Parents
  • After converting, I could compile with AC6 but some bugs existed.

    I have checked out the Disassembly window in Keil MDK v5.37:

    [result in my original AC5 project]

    0x00208400 F8DF000C  LDR.W         r0,[pc,#12]  ; @0x00208410
    0x00208404 6801      LDR           r1,[r0,#0x00]
    0x00208406 F4410170  ORR           r1,r1,#0xF00000
    0x0020840A 6001      STR           r1,[r0,#0x00]
    0x0020840C 4770      BX            lr
    0x0020840E BF00      NOP           

    [result in AC6 converted compilable project]

    0x0020844E F8DF02DC  LDR.W         r0,[pc,#732]  ; @0x0020872E
    0x00208452 6801      LDR           r1,[r0,#0x00]
    0x00208454 F4410170  ORR           r1,r1,#0xF00000
    0x00208458 6001      STR           r1,[r0,#0x00]
    0x0020845A 4770      BX            lr
    0x0020845C BF00      NOP           

    There is a different part at the first line between the two results, it lead to the different address for getting data between AC5 and AC6 project.

Reply
  • After converting, I could compile with AC6 but some bugs existed.

    I have checked out the Disassembly window in Keil MDK v5.37:

    [result in my original AC5 project]

    0x00208400 F8DF000C  LDR.W         r0,[pc,#12]  ; @0x00208410
    0x00208404 6801      LDR           r1,[r0,#0x00]
    0x00208406 F4410170  ORR           r1,r1,#0xF00000
    0x0020840A 6001      STR           r1,[r0,#0x00]
    0x0020840C 4770      BX            lr
    0x0020840E BF00      NOP           

    [result in AC6 converted compilable project]

    0x0020844E F8DF02DC  LDR.W         r0,[pc,#732]  ; @0x0020872E
    0x00208452 6801      LDR           r1,[r0,#0x00]
    0x00208454 F4410170  ORR           r1,r1,#0xF00000
    0x00208458 6001      STR           r1,[r0,#0x00]
    0x0020845A 4770      BX            lr
    0x0020845C BF00      NOP           

    There is a different part at the first line between the two results, it lead to the different address for getting data between AC5 and AC6 project.

Children