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.

[参考译文] TMS570LS3137:如何使变量不被优化

Guru**** 2564565 points


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

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1137202/tms570ls3137-how-to-make-a-variable-not-be-optimized

器件型号:TMS570LS3137

大家好、

CCS 中定义了以下变量。 程序中似乎不会引用此变量、但需要此变量。 它将由编译器进行优化。 如何防止对该变量进行优化?

const struct soft_info_t softinfo __attribute__((used, section(".softinfo_head_section")))=
{
( unsigned int)app_entry,
( unsigned int)&dataLoadStart,
( unsigned int)&dataRunStart,
( unsigned int)&dataLoadSize
};

谢谢、此致

耶鲁李

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

    您好 Yale Li、

    我已开始处理您的问题、我将很快向您提供更新。

    --

    谢谢、此致、

    Jagadish。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [引用 userid="514648" url="~/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1137202/tms570ls3137-how-to-make-a-variable-not-be-optimized "]如何防止优化此变量?

    如果您使用的是 TI ARM 编译器、请尝试 ARM 优化 C/C++编译器 v20.2.0.LTS 用户指南中的 RETAIN pragma