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.

[参考译文] 编译器/TMS320F28377S:cl2000 --define=TMS320F2837X 在.cmd 文件中未知

Guru**** 2478325 points


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

https://e2e.ti.com/support/microcontrollers/c2000-microcontrollers-group/c2000/f/c2000-microcontrollers-forum/792366/compiler-tms320f28377s-cl2000---define-tms320f2837x-not-known-in-cmd-file

器件型号:TMS320F28377S

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

您好!

我创建了我的 cmd 文件、以便输出符合所使用的微控制器。 只有给定的参数在 cmd 文件中是未知的。 我可以更改它吗?

谢谢

示例:

我在我的 cmd 文件中得到了这个值

#ifdef TMS320F2837X

#define RAM_START          (0x8000)
#define RAM_END            (0x1BFFF)
#endif

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    是的、您可以更改它、您可能需要将符号定义为工程配置。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    我认为您不理解我的问题。
    我知道我可以更改--define=TMS320F2837X,但我需要在我的 cmd 文件中进行定义。 这是怎么可能的?
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    [引用 user="EV"]#ifdef TMS320F2837X[/引用]

    您需要使用 linker --define 选项为链接器定义该宏名称。 请参阅 《C2000汇编语言工具用户指南》的第8.4.11节(链接器命令文件预处理)。  

    如果这没有回答您的问题、请详细说明您要询问的内容。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    请查看我的问题的标题。 (cl2000 --define=TMS320F2837X)
    这对 cmd 文件不起作用。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    编译器和链接器都接受--define 选项。 要被链接器命令文件识别、需要将该选项传递给链接器、而不是编译器。 我在上一篇文章中提到的"用户指南"部分对此进行了说明。

    如果您使用的是 CCS、请确保在链接器选项下定义宏。 或者、如果使用命令行来构建、则在--run_linker (或-z)选项之后传递该命令。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    可能我不理解、但参数会传递给链接器。 从控制台查看这行代码:

    构建目标:"base.out"
    调用:C2000链接器
    "d:/ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/bin/cl2000 /ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/lib        /HAL/C2000/TI "-v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -tmu_support=tmu0 -vcu_support=vcu2 -O2 -advice:performance=all -define=HWBOARD=2180102 -define -define -intrack_info=tus.xml"-link_ram_ram_model -out_ram_ram_ram_infot.ategines-"-"-out_ram_ram_infot_isot.ature_isot-rom-content-content-display_infot_infot.htm"-display_ram_infot_infot_infot_infot.ature.ature.at_rom-rom-rom-rom-display_infot/infot_infot_infot.htm#-out./infot_display_infot_infot.htm#-display_infot.htm#-display_infot./infot_infot./infot_infot_display.htm#-display.//ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/include  


    完成的构建目标:"base.out"

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

    [报价用户="EV"]也许我不理解、但参数会传递给链接器。

    实际上不是。 "-z"之前的所有内容(如下突出显示)仅传递给编译器。 "-z"后的选项是传递给链接器的选项。  
    它可能会引起一些混淆、因为只有一个 shell 调用(cl2000)。 shell 在内部调用编译器和链接器、区分将哪些选项传递给每个可执行文件的方法是查看 z 前后的选项

    "d:/ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/bin/cl2000  /ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/lib        /HAL/C2000/TI "-v28 -ml -mt --cla_support=cla1 -float_support=fpu32 -tmu_support=tmu0 -vcu_support=vcu2 -O2 -advice:performance=all -define=HWBOARD=2180102 -define -define -intrack_info=tus.xml"-link_ram_ram_model -out_ram_ram_ram_infot.ategines-"-"-out_ram_ram_infot_isot.ature_isot-rom-content-content-display_infot_infot.htm"-display_ram_infot_infot_infot_infot.ature.ature.at_rom-rom-rom-rom-display_infot/infot_infot_infot.htm#-out./infot_display_infot_infot.htm#-display_infot.htm#-display_infot./infot_infot./infot_infot_display.htm#-display.//ti/ccsv8/tools/compiler/ti-cgt-c2000_18.1.5.LTS/include  

    要为链接器添加此选项、请转至 CCS 中的链接器选项、并将其添加到-define 中。