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.

[参考译文] MSP430FR6047:如何通过 GCC 链接器删除未使用的 MSP430 driverlib 函数

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1328240/msp430fr6047-how-to-get-rid-of-unused-msp430-driverlib-functions-by-the-linker-with-gcc

器件型号:MSP430FR6047

您好!

我使用 ti driverlib 编写了一些测试。 Im 与 GCC 9.3相结合。 我看到的是、例如、如果我使用 cs.h 中的某个函数、所有函数都将链接到我的最终二进制文件中、即使我不使用它们也是如此。 有人知道如何让链接器删除未使用的内容吗?

此致

克里斯蒂安

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

    -- GC 部分

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

    尊敬的 Tunguskar:

    正如 David 提到的,您应该考虑使用--gc-sections。 此页面 提供了有关它的一些更多信息。