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 9.3.1编译器错误。 代码模型不同

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/1421128/msp430fr6047-gcc-9-3-1-compiler-error-code-model-differs

器件型号:MSP430FR6047

工具与软件:

您好!

我有以下问题(示例):

[build] /opt/ti/msp430/gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: error: /opt/ti/msp430/gcc/msp430-elf/lib/libc.a(lib_a-fflush.o) uses the small code model whereas /opt/ti/msp430/gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/lib/large/crt0.o uses the large code model
[build] /opt/ti/msp430/gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/bin/ld: error: /opt/ti/msp430/gcc/msp430-elf/lib/libc.a(lib_a-fflush.o) uses the small data model whereas /opt/ti/msp430/gcc/bin/../lib/gcc/msp430-elf/9.3.1/../../../../msp430-elf/lib/large/crt0.o uses the large data model
我已设置-mload 标志  
但我不知道如何告诉编译器他应该使用大型代码模型库。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    尊敬的 Tunguskar:

    您尝试编译哪个库?

    mlarge 标志应设置为执行大型位寻址、这将是典型的"大型代码模型"。 我们可以通过设置这些区域来打开整个存储器空间。  

    可以将代码和数据区域设置为上限、下限、或者不设置。 上部是高64KB、而下部是低64KB、前者将数据放在任何其合适的位置、而如果未预定义、则不会添加任何段。

    如果将数据区域设置为任一区域、这将与处理大型数据模型的 MSP430编译器非常相似。

    此致、
    Luke

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

    问题是同时选择了大模型库和小模型库。 我不能告诉你如何做到这一点,因为-mload 告诉 gcc 使用大型库。 完整的命令行到 gcc 将会有所帮助。

    获得此错误的常用方法是编译带有"-c"和"-mlarge"的内容、然后在后面不使用"-mlarge"的链接。 这通常在更改 makefile 时发生。 "make -B"是如何处理的。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    [BUILD][1/1]链接 CXX 可执行测试/pin_target_tests
    [构建]失败:tests/pin_target_tests
    /opt/ti/msp430/gcc/bin/msp430-elf-g   src /opt/cmake/3.28.3/bin/cmake ++-O2 -g -DNDEBUG_-O2 -g -DNDEBUG -mhwmult=f5series -og -g -gdware-mcode-region=none -mlarge -wl、-gc-sections -mmcu=MSP430FR6047 -T /home/developer/repos/hal_drivers_msp430fr5xx_6xx_pin/build/msp430-gcc-ninja-rel-with-deb-info-local/tests /home/developer/repos/hal_drivers_msp430fr5xx_6xx_pin/build/msp430-gcc-ninja-rel-with-deb-info-local/tests tests/pin_target_tests /opt/ti/msp430/gcc/include/msp430fr6047.ld /opt/ti/msp430/gcc/bin/msp430-elf-objcopy /home/developer/repos/hal_drivers_msp430fr5xx_6xx_pin/build/msp430-gcc-ninja-rel-with-deb-info-local/tests /opt/ti/msp430/gcc/bin/msp430-elf-size /home/developer/repos/hal_drivers_msp430fr5xx_6xx_pin/build/msp430-gcc-ninja-rel-with-deb-info-local/tests/pin_target_tests
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    该错误主要发生在 libc.a. 我包含如下所示的库路径:  

    find_path(.

     toolchain_standard_libraries"libc.a"
     提示${toolchain_root_DIR}
     path_suffixes msp430-elf/lib
     需要 NO_DEFAULT_PATH)
    似乎找到了 lib、但没有使用大型模型。
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    GCC 无需帮助查找 libc、因此我不知道您在这里做什么。 在任何情况下、libc.a 的大型模型版本都位于另一个目录中。 我看到了8个不同版本的 libc.a、我不知道它们都是为了什么。 GCC 会让它跟踪它们。

    需要帮助查找器件标头(MSP430.h)和链接器脚本。