在汇编宏中创建循环 - IAR ARM

时间:2016-12-14 11:35:49

标签: assembly arm iar cortex-m

我正在尝试在IAR Arm汇编宏中创建一个循环,但无法弄清楚如何制作本地标签,如果多次调用宏,我会从汇编器中获得重复的标签错误。我的代码如下:

myMacro MACRO
     MOV R1, #0
label:  enter code here
     do some stuff here
     ADD R1, R1, #1         
     CMP R1, #10
     BLE label
     ENDM

1 个答案:

答案 0 :(得分:1)

解决方案如下:

myMacro MACRO
         LOCAL label
         MOV R1, #0
    label:  enter code here
         do some stuff here
         ADD R1, R1, #1         
         CMP R1, #10
         BLE label
         ENDM