ccs汇编编译错误

ccs汇编引用编译错误:

"C:\Users\gm_je\AppData\Local\Temp\{19179DF3-B1B5-4C9A-93D9-0A0443C89BD7}", ERROR!   at line 507: [E0002] Illegal mnemonic specified

CLR &01000h

编译截图如下:

ccs汇编编译错误

根据warning提示:

warning: "../Hardware/src/flash.c", line 67: Assembly statement "CLR &01000h" creates a label, which may not be what was intended. Use a colon after a label or a space before a non-label to silence the warning.

定位到问题原因是汇编部分出错:

  if(1 == segment)

  {

    asm("CLR &01000h");

  }

调用汇编时,汇编前需要一个空格:

  if(1 == segment)

  {

    asm(" CLR &01000h");

  }

这样就可以编译通过了。