Hi ,
我这边从贵司拿到wch 的openocd源码,尝试编译的时候遇到下面的错误,看起来好像是wchricv.c引用了部分没有定义的函数,想确认下是否是还需要添加一些文件或者做哪些配置修改。谢谢!
Hi ,
我这边从贵司拿到wch 的openocd源码,尝试编译的时候遇到下面的错误,看起来好像是wchricv.c引用了部分没有定义的函数,想确认下是否是还需要添加一些文件或者做哪些配置修改。谢谢!
/bin/sh ./libtool --tag=CC --mode=link gcc -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Wpointer-arith -Wundef -Wno-error=deprecated-declarations -DFD_SETSIZE=128 -g -O2 -o src/openocd.exe src/main.o src/libopenocd.la -lws2_32 ./jimtcl/libjim.a
libtool: link: gcc -Wall -Wstrict-prototypes -Wformat-security -Wshadow -Wextra -Wno-unused-parameter -Wbad-function-cast -Wcast-align -Wredundant-decls -Wpointer-arith -Wundef -Wno-error=deprecated-declarations -DFD_SETSIZE=128 -g -O2 -o src/openocd.exe src/main.o src/.libs/libopenocd.a -lftdi1 -lhidapi -lusb-1.0 -lcapstone -lws2_32 ./jimtcl/libjim.a
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(interfaces.o):interfaces.c:(.data+0x98): undefined reference to `wlinke_adapter_driver'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(interfaces.o):interfaces.c:(.data+0xa0): undefined reference to `ch347_adapter_driver'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(lt3-tcl.o): in function `handle_flash_protect_check_command':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/tcl.c:418:(.text+0x2c62): undefined reference to `wlnik_protect_check'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/tcl.c:416:(.text+0x2d01): undefined reference to `wlink_softreset'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(lt3-tcl.o):tcl.c:(.rdata$.refptr.riscvchip[.refptr.riscvchip]+0x0): undefined reference to `riscvchip'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(libtarget_la-target.o): in function `handle_wlink_reset_resume_command':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/target/target.c:3362:(.text+0x655): undefined reference to `wlink_softreset'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(libtarget_la-wch_riscv.o):wch_riscv.c:(.rdata$.refptr.chip_type[.refptr.chip_type]+0x0): undefined reference to `chip_type'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(gdb_server.o): in function `gdb_v_packet':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/server/gdb_server.c:3425:(.text+0x3c97): undefined reference to `wlink_quitreset'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o): in function `ch32vx_write':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:150:(.text+0xc0): undefined reference to `wlink_clean'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:139:(.text+0x171): undefined reference to `wlnik_protect_check'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:171:(.text+0x1b7): undefined reference to `wlink_write'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:166:(.text+0x206): undefined reference to `wlink_write'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:173:(.text+0x20d): undefined reference to `wlink_chip_reset'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o): in function `ch32x_protect':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:84:(.text+0x2b1): undefined reference to `wlink_flash_protect'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o): in function `ch32vx_erase':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:112:(.text+0x3bf): undefined reference to `wlnik_protect_check'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:122:(.text+0x3e1): undefined reference to `wlink_erase'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o): in function `ch32vx_probe':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/flash/nor/wchriscv.c:262:(.text+0x552): undefined reference to `wlink_getromram'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o):wchriscv.c:(.rdata$.refptr.wlink_address[.refptr.wlink_address]+0x0): undefined reference to `wlink_address'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o):wchriscv.c:(.rdata$.refptr.pageerase[.refptr.pageerase]+0x0): undefined reference to `pageerase'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(wchriscv.o):wchriscv.c:(.rdata$.refptr.noloadflag[.refptr.noloadflag]+0x0): undefined reference to `noloadflag'
D:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/13.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: src/.libs/libopenocd.a(libtarget_la-wch_riscv-013.o): in function `write_flash_data':
D:\msys64\home\openocdwch\riscv-openocd\build/../src/target/wch_riscv-013.c:309:(.text+0x42b7): undefined reference to `WriteNonFullPage'
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:3072: src/openocd.exe] Error 1
make[2]: Leaving directory '/home/openocdwch/riscv-openocd/build'
make[1]: *** [Makefile:4900: all-recursive] Error 1
make[1]: Leaving directory '/home/openocdwch/riscv-openocd/build'
make: *** [Makefile:2030: all] Error 2
您好,参考一下配置参数
./configure --prefix=输出路径 --disable-doxygen-html --disable-doxygen-pdf --disable-gccwarnings --disable-wextra --enable-stlink --disable-ti-icdi --disable-ulink --disable-usb-blaster-2 --disable-ft232r --disable-vsllink --disable-xds110 --disable-osbdm --disable-opendous --disable-jlink --disable-aice --disable-ftdi --disable-internal-libjaylink --disable-jtag_vpi --enable-wlinke --disable-cmsis-dap --disable-ch347 CFLAGS=' -O0'