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.

[参考译文] MSP-EXP430FR5994:GCC 链接问题*。o 使用 MSP430指令、但 crt0.o 使用 MSP430X

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

https://e2e.ti.com/support/microcontrollers/msp-low-power-microcontrollers-group/msp430/f/msp-low-power-microcontroller-forum/801982/msp-exp430fr5994-gcc-linking-problems-o-uses-msp430-instructions-but-crt0-o-uses-msp430x

器件型号:MSP-EXP430FR5994
主题中讨论的其他器件:MSP430FR5994

设置:  

处理器:MSP430-FR5994

操作系统:Windows/ MinGW

兼容:使用 MSP430 gcc 工具链7.3.2进行 CMake

我正在努力解决以下错误

C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:错误:C:/ti/msp430-gcc/msp430-elf/lib/430 libcrt.a (crt_Bss.o)使用 MSP430指令、但 c:/ti/msp430-gcc/msp430-elf/lib/crt0.o 使用 MSP430X
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:无法合并文件 C:/ti/msp430-gcc/msp430-elf/lib/430的目标特定数据 libcrt.a (crt_Bss.o)
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:错误:C:/ti/msp430-gcc/msp430-elf/lib/430 libcrt.a (crt_movedata.o)使用 MSP430指令、但 c:/ti/msp430-gcc/msp430-elf/lib/crt0.o 使用 MSP430X
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:无法合并文件 C:/ti/msp430-gcc/msp430-elf/lib/430的目标特定数据 libcrt.a (crt_movedata.o)
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:错误:C:/ti/msp430-gcc/msp430-elf/lib/430 libcrt.a (crt_main.o)使用 MSP430指令、但 cc:/ti/msp430-gcc/msp430-elf/lib/crt0.o 使用 MSP430X
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:无法合并文件 C:/ti/msp430-gcc/msp430-elf/lib/430的目标特定数据 libcrt.a (crt_main.o)
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:错误:C:/ti/msp430-gcc/msp430-elf/lib/430 libc.a (lib_a-memmove.o)使用 MSP430指令、但 c:/ti/msp430-gcc/msp430-elf/lib/crt0.o 使用 MSP430X
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:无法合并文件 C:/ti/msp430-gcc/msp430-elf/lib/430的目标特定数据\libc.a (lib_a-memmove.o)
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:错误:C:/ti/msp430-gcc/msp430-elf/lib/430 libc.a (lib_a-memset.o)使用 MSP430指令、但 c:/ti/msp430-gcc/msp430-elf/lib/crt0.o 使用 MSP430X
C:/ti/msp430-gcc/msp430-elf/bin/ld.exe:无法合并文件 C:/ti/msp430-gcc/msp430-elf/lib/430的目标特定数据\libc.a (lib_a-memset.o)

我已确定 gcc 出于某种原因首先搜索错误的库目录。

使用命令  

C:/ti/msp430-gcc/bin/msp430-elf-gcc.exe -ic:/ti/msp430-gcc/msp430-elf/lib/430 -print-search-dirs -v | sed^^lib/b 1;d;:1;s、/[^/.][^/]*/\.\。/、;t 1;s、:[=]*=、;;、;、g '| tr;\012
使用内置规格。
collect_gcc=C:\ti\msp430-gcc\bin\msp430-elf-gcc.exe
Collect_LTO_wraper=c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2/lto-wrapper.exe
库:
C:/ti/msp430-gcc/lib/gcc/msp430-elf/7.3.2
C:/ti/msp430-gcc/lib/gcc
C:/ti/msp430-gcc/msp430-elf/lib/msp430-elf/7.3.2
C:/ti/msp430-gcc/msp430-elf/lib

您可以看到、它没有将430特定搜索文件夹放入其库搜索路径中。 因此,为什么它链接错误的 crt0文件。

我单独运行了特定的 gcc 链接命令以进一步查找问题

C:/ti/msp430-gcc/bin/msp430-elf-gcc.exe -g -T C:/ti/msp430-gcc/include/msp430fr5994.ld "my_prog.c.obj""my_lib.c.obj"-o 输出-lc:/ti/msp430-gcc/include -lc:/ti/msp430-gcc/msp430-elf/lib/430 -lc:/ti/msp430-gcc/lib/gcc/msp430-elf/7.3.2/430 -v
使用内置规格。
collect_gcc=C:\ti\msp430-gcc\bin\msp430-elf-gcc.exe
Collect_LTO_wraper=c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2/lto-wrapper.exe
目标:MSP430-elf
配置为:./../gcc/configure --target=MSP430-elf --enable-languages=c、c++--disable-NLS --build=x86_64-PC-Linux-GNU --host=i686-w64-mingw32 --enable-target-optspace --enable-newlib-nano-formatted_io --with-version=2.154-smtidmsp430-mc.cc-mctran-systems'
Thread 模型:单个
GCC 版本7.3.2 (Mitto Systems Limited - MSP430-gcc 7.3.2.154)
编译器_path=c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2;c:/ti/msp430-gcc/bin/../libexec/gcc;c:/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/bin
library_path=c:/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2;c:/ti/msp430-gcc/bin/../lib/gcc;c:/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/lib
collect_gcc_options='-g''-t' C:/ti/msp430-gcc/include/msp430fr5994.ld '-o''output''-LC:/ti/msp430-gcc/include '-LC:/ti/msp430-gcc/msp430-elf/lib/430 '-LC:/ti/msp430-gcc/lib/gcc/msp430-elf/7.3.2/430 '-v''-mdevices-csv-loc=C:/ti/msp430-gcc/include/devices.csv
c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2/collect2.exe -plugin c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2/liblto_plugin-0.dll -plugin-opt=c:/ti/msp430-gcc/bin/../libexec/gcc/msp430-elf/7.3.2/lto-wrapper.exe  /ti/msp430-gcc/include /ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2 /ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/crtend.o -plugin-opt=-fresolution=C:\msys64\tmp\ccGlcxi.res -plugin-opt=-lgcc -opt=-pass-through -lcc-lc-pinc-lcc=-pinc-lc-lcc-lc-lcc=-lcc-lcc-lcc-lpg-lc-ldiso=/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/crtbegin.o /ti/msp430-gcc/lib/gcc/msp430-elf/7.3.2/430 /ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/lib /ti/msp430-gcc/include/msp430fr5994.ld -lc-lcc-lcc-lcc-lcc-out-lcc-lc-lc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lf-napprove=/ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/lib/crt0.o /ti/msp430-gcc/msp430-elf/lib/430 /ti/msp430-gcc/bin/../lib/gcc /ti/msp430-gcc/bin/../lib/gcc/msp430-elf/7.3.2/../../../../msp430-elf/lib/crtn.o -lcc-lc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-lcc-l

这证实了不在正确的目录中搜索的问题。 为什么 将粗体参数添加到选项中、以及如何确保它在 gcc 目录中显示。

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

    请参阅:

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

    您好!

     MSP430-GCC 用户指南(slau646)中的第4.7.2节"使用 GCC 手动编译" 介绍了如何构建 MSP430-elf-gcc 的基本命令行调用。

    您需要使用-mmcu 选项来指定器件。 因此、无论何时调用 MSP430-elf-gcc、-mmcu=msp430fr5994都应位于命令行上。

    MSP430FR5994使用"430X" ISA。 默认情况下、此 ISA 设置为1、因此它没有特定的文件夹。 GCC 的"--print-multi-lib"选项介绍了包含库的子目录中 multilibs 的布局。

    $μ C/MSP430-gcc-7.3.2.154_linux64/bin/MSP430-elf-gcc --print-multi-lib
    ;
    430;@mcpu=MSP430
    large;~@mlarge
    

    这意味着在传递-mcpu=MSP430选项时使用"430"库目录(这在选择具有-mmcu=device 的430 ISA 器件时自动处理)。

    传递-mlarge 选项时使用"large"子目录。

    基本目录(".") 未指定这些多库选项时使用。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。
    谢谢你。 我误解了 FR5994器件的架构! 它是一个430X