This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

[参考译文] LP-MSP430FR2476:内联汇编

Guru**** 2387080 points
Other Parts Discussed in Thread: ENERGIA
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1131620/lp-msp430fr2476-inline-assembly

器件型号:LP-MSP430FR2476
主题中讨论的其他器件:Energia

使用 TI v20.2.27.LTS 在 CCS 中编译时遇到错误、但使用 GNU v4.6.3.3 (Energia)可以编译

此代码片段来自 Energia 的 wiring.c delayMicroseonds ()例程,我将其从 GNU 转换为 TI  

__asm________volatile___(

  "L1:NOP \n\t"

  "Dec.w %[us]\n\t"

 "jnz L1 \n\t"

 :[us]="r"(us):"[我们]"(us)

);

TI 编译器给出错误#18预期为")"

与(us)在末尾的直线

对于退货量、语法必须不同、但我找不到任何引用。

Andrew

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Andrew:

    TI 编译器不支持__ASM__。 要执行内联汇编、请使用 asm ("...")。 以下是取自 MSP430 编译器指南的代码段

    此致、

    Evan

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    我对 GCC 更熟悉、但我查看了 CCS 手册、找不到任何迹象表明它具有 GCC 向编译器告知副作用的任何功能。 因此、它会看到":"、它期望")"和抱怨。 我怀疑"[我们]"也会带来麻烦。