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

Branch to a label in inline assembly

Hi All,

I have a label, say "XXX" in the startup assembly code.

Later if I want to jump to label "XXX" in the inline assembly by using

__asm{ B XXX }

The ARMCC compile in Keil MDK complains "the label XXX is referred but not defined".

How should I work around this problem? Thanks a lot.

Best regards Teddy

Parents Reply Children
  • Dear Joe,

    Thanks a lot for your reply!

    I am aware of the solution you referred. However, in my case, the problem is that the label, to which the inline assembly code intends to jump to, is not defined within the same function.

    Image that you have some startup code written in assembly, which eventually jumps to C code "main". After that in the C code, you would like to jump back to a certain label in the startup code. Right now, I work around by defining a assembly function in the startup code and call this function, then jumps to any label I want. I was just wondering if there is better solution than this sort of "indirect jumping".