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

MDK-ARM: Importing labels into inline assembler

Hi,

I'm attempting to jump to the address of a specific assembler label from within my C code, so I thought I'd try some embedded assembler;

For example;

void JumpToAsm(void)
{
    __asm
    {
        IMPORT __asmlabel
        B      __asmlabel
    }
}

When I try to compile this code, I get the following error, referring to the IMPORT __asmlabel line. error: #3061: unrecognized instruction opcode

How do I import an external label into the inline assembler? I can't find any documentation on this specific point.

TIA, Jon Mills.

Parents
  • so I thought I'd try some embedded assembler
    That reasoning is quite badly wrong.

    There's no reason to jump to embedded asm just to jump to a given address. You'll be much better off just declaring that external label as a C function and calling that. If the label has the wrong form, change the existing asm, or create a correctly named alias in a separate asm file --- don't throw a monkey wrench into your C code just because the assembly code doesn't fit.

Reply
  • so I thought I'd try some embedded assembler
    That reasoning is quite badly wrong.

    There's no reason to jump to embedded asm just to jump to a given address. You'll be much better off just declaring that external label as a C function and calling that. If the label has the wrong form, change the existing asm, or create a correctly named alias in a separate asm file --- don't throw a monkey wrench into your C code just because the assembly code doesn't fit.

Children