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.

[参考译文] _DELAY_CYCLES 未定义

Guru**** 2952510 points

Other Parts Discussed in Thread: C2000WARE

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

https://e2e.ti.com/support/tools/code-composer-studio-group/ccs/f/code-composer-studio-forum/961241/__delay_cycles-is-undefined

器件型号:MSP430F5529
主题中讨论的其他器件:C2000WARE

工具/软件:TI C/C++编译器

大家好、

我尝试使用__delay_cycles 编译器内在函数。 但它不会很紧凑。

#20标识符"__delay_cycles "未定义   EncoderTW29.cpp   /4AchsModul_CPU2/Source/Encoder   line 777   C/C++ problem




在同一个项目中、我使用的是__添加或__子项等内在函数。 这些都在工作。

我使用的是 TI v20.2.LTS 编译器。

如果不再支持__delay_cycles,是否有办法使用一条__asm()指令多次调用 nop?

谢谢、此致、

Marcel Kummer。

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

    我无法重现此行为。  对于源文件 EncoderTW29.cpp、 请按照文章 如何提交编译器测试用例中的说明进行操作。

    谢谢、此致、

    乔治

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

    e2e.ti.com/.../EncoderTW29.pp.txt

    "C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/bin/cl2000 -v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -include_path="C:/ti/ccs1011/ccs/tools/compiler/ti-cgt-c2000_20.2.2.LTS/include /Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung /Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung -include_path="C:/Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung auf Allen Components/common/source/tidriverlib-include_en_path="C:/Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung /Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung auf Allen Cores/sense/enuelines"/content/cpuen/source/en/source/en/source/en/source/en/sense/en/sensorine-ders/en/source/en/source/en/sensorine-ders/cpuen/sense/en/sense-ders/en/sense/en/sensorne-ders/en/sensorne-ders/en/sensorine-ders/en/sensor/en/sensor/en/sensor/en/sensornefines=/Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung /Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung include_path="C:/Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung auf Allen Cores/common/Source/Atomic "--include_path="C:/Users/marcel.kummer/Documents/Projects/Produktplatform_2020_Software/Taskverteilung auf Allen Cores/common/Source/Pinmuxing"--define=cpU2 --define=logging --define=load_monitor --define=task_guard -g --preproc_with_comment --preproc_with_error-out_redirectory=out_abi_error-/Source/Encoder/EncoderTW29.cpp -out_rebuilding_de=out_guide_abi_error-out_guide=out_guide_guide_abi_guide_guide=-out_abi_guide_ab

    TI-CGT-C2000_20.2.LTS


    我希望这是你的意思。

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

    您好!

    将该主题分配给 MSP 团队的专家。

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

    您好!

    如果您已安装 C2000ware SDK、请参阅以下文件以了解延迟功能。

    C:/ti/c2000/C2000Ware_3_03_00_00/device_support/f28004x/common/source/f28004x_usdelay.asm

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

    您好 Santosh Jha

    那么、基本而言、您说编译器内在函数__delay_cycles 不再受支持?

    如果我理解正确、我还可以执行几条 nop 指令来获得延迟。
    是否比 usdelay.asm 中的方法更准确? 由于使用 nops、我可以增加以1为增量而不是以5为增量的延迟周期?

    我从 f28004x_sysctrl.c 中获得了该结果:
    //用于在2个连续写入 CLKSRCCTL1之间添加延迟的宏
    //寄存器。
    //延迟= 300 NOP
    //
    #define SYSCTRL_CLKSRCCTL1_DELAY ASM (" RPT #250 || NOP \n RPT #50 || NOP")

    在本例中、我希望延迟40个周期、因此我会这样做
    asm (" RPT #40 || NOP");

    此致、

    Marcel Kummer。

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

    马塞尔

    关于内在函数、编译器专家正在研究它。 同时、您可以使用延迟宏。

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

    [引用 user="Marcel Kummer"]因此、基本而言、您会说编译器内在函数__delay_cycles 不再受支持?

    TI 的其他编译器、例如用于 MSP430的编译器、支持名为__delay_cycles 的内在函数。 但 C28x 编译器从未支持名为__delay_cycles 的内在函数。

    谢谢、此致、

    乔治

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

    哦、我看到、

    我想我在 ARM 编译器文档中找到了它。 由于我还在 C28x-Compiler docu 的示例中找到了使用的内在函数、我认为它也可以在那里使用。

    [引用文档="SPRU514U"]

    如果使用非易失性 RAM、则可以定义初始值为零且加载到 RAM 中的 persistent 变量。 程序可以随着时间的推移将该变量递增为计数器、并且该计数不会在器件断电并重新启动时消失、因为存储器是非易失性的、并且引导例程不会将 itback 初始化为零。 例如:
    #pragma PERSISTENT (x)
    #pragma LOCATION = 0xC200 // RAM 中的存储器地址
    int x = 0;
    void main (){
    run_init();
    while (1){
    run_actions (x);
    _DELAY_CYCLES (1000000);
    X++;
    }
    } 

    [/报价]

    关于我的另一个问题:
    我是否正确理解 asm (" RPT #40 || NOP");会延迟40个 CPU 周期?

    此致、

    Marcel Kummer。

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

    马塞尔

    [报价用户="Marcel Kummer"]我是否正确理解了 asm (" RPT #40 || NOP");会延迟40个 CPU 周期?[/报价]

    这将是41个 CPU 周期。

    请参阅以下文档中有关 C28x 指令集的第2.5.3节。

    www.ti.com/.../spru430f.pdf