ch32v003f4p6, 编译报错:can't link RVE with other target

gcc选项如下:

image.png


编译日志:

ninja: Entering directory `output'
[1/3] LINK firmware
FAILED: firmware
riscv-none-embed-gcc -Wl,-TE:/RISC-V/CH32V003/Demo/Vendor/Ld/Link.ld --specs=nano.specs --specs=nosys.specs -nostartfiles -Xlinker --gc-sections -Wl,--print-memory-usage -Wl,--cref -lprintf -Wl,-Map,firmware.map obj/Application/libapp.a obj/Vendor/libvendor.a  -o firmware.elf
Memory region         Used Size  Region Size  %age Used
           FLASH:        8172 B        16 KB     49.88%
             RAM:         476 B         2 KB     23.24c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Application/libapp.a(libapp.main.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Application/libapp.a(libapp.main.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Application/libapp.a(libapp.system_ch32v00x.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Application/libapp.a(libapp.system_ch32v00x.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.debug.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.debug.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_dbgmcu.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_dbgmcu.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_dma.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_dma.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_gpio.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_gpio.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_i2c.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_i2c.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_misc.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_misc.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_rcc.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_rcc.o)
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: obj/Vendor/libvendor.a(libvendor.ch32v00x_usart.o): can't link RVE with other target
c:/mounriver/mounriver_studio/toolchain/risc-v embedded gcc/bin/../lib/gcc/riscv-none-embed/8.2.0/../../../../riscv-none-embed/bin/ld.exe: failed to merge target specific data of file obj/Vendor/libvendor.a(libvendor.ch32v00x_usart.o)
collect2.exe: error: ld returned 1 exit status
%

ninja: build stopped: subcommand failed.


求教下是什么原因?

您好,看报错信息应该是上图中用到的库不是同样参数编译的,您重新以同样参数生成库就可以了,如还有问题,请联系邮箱yangy@wch.cn


icon_rar.gifCH32V003_ninja.zip


并没有使用其他库。工程文件见附件,麻烦帮忙看下


您好,在ldflags里也加上-march=rv32ecxw -mabi=ilp32e


只有登录才能回复,可以选择微信账号登录