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.

[参考译文] 使用内联汇编将变量加载到寄存器中。

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/1219782/load-a-variable-into-a-register-using-inline-assembly

您好!

我正在尝试在寄存器中加载一个 C 变量。

我尝试了下面的白话成功。

    register const uint32_t test = 0x10000;

    __asm__ volatile ("MOV R10, %[input]"
        : // no C variable outputs
        : [input] "r" (test)
        : "R10"      // tell the compiler R10 is modified
        );

背景:目标是使 此变通办法 更有效。

此致、
加布里埃尔

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

    假设您使用通常调用的 TI 专有 Arm 编译器 armcl 或简称 DPP。  遗憾的是、此编译器不支持这种扩展形式的 ASM 语句。   

    谢谢。此致、

    -George.