sipeed / M1s_BL808_example

M1s_BL808_example
Apache License 2.0
65 stars 14 forks source link

编译时undefined reference to `main' #3

Closed maojxsir closed 1 year ago

maojxsir commented 1 year ago

根据https://github.com/sipeed/M1s_BL808_example/readme 走到./build.sh hello_world,提示如下错误,请问我哪里配置有问题吗?

: mis-matched ISA version 1.0 for 'v' extension, the output version is 2.0
/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/rv64imafdcv_zfh_zvamo_zvlsseg_xtheadc/lp64d/libc.a(lib_a-fclose.o): mis-matched ISA version 1.0 for 'v' extension, the output version is 2.0
/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: warning: /home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/lib/rv64imafdcv_zfh_zvamo_zvlsseg_xtheadc/lp64d/libgloss.a(sys_gettimeofday.o): mis-matched ISA version 1.0 for 'v' extension, the output version is 2.0
/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: /home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/m1s_start/libm1s_start.a(start_main.o): in function `main_warpper':
/home/jason/media/bl808/M1s_BL808_SDK/components/sipeed/c906/m1s_start/src/start_main.c:155: undefined reference to `main'
collect2: error: ld returned 1 exit status
../M1s_BL808_SDK/make_scripts_thead_riscv/project.mk:443: recipe for target '/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf' failed
make: *** [/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf] Error 1
maojxsir commented 1 year ago

我尝试编译其他example提示了一如下错误。请帮解答一下,刚买了个M1S Dock, 第一次使用这个平台。

/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: cannot open map file /home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/gpio_demo/.map: No such file or directory
taorye commented 1 year ago

你好,请分别提供你当前使用的M1s_BL808_example和M1s_BL808_SDK的HEAD对应的commit,我们尝试复现一下。 如果未保持两个仓库最新,请分别git pull同步到最新。

maojxsir commented 1 year ago

SDK:28e6cf28648dcba32723db4cd1e23fb550186b08 example:c072c57466851337964b627bc05101542dfbd591

编译器信息:

riscv64-unknown-elf-gcc (Xuantie-900 elf newlib gcc Toolchain V2.6.0 B-20220715) 10.2.0
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

我都刚更新了,还是如下错误

AR build_out/lvgl/liblvgl.a
AR build_out/freetype/libfreetype.a
LD build_out/hello_world/.elf
/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: cannot open map file /home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.map: No such file or directory
collect2: error: ld returned 1 exit status
../../M1s_BL808_SDK//make_scripts_thead_riscv/project.mk:443: recipe for target '/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf' failed
make: *** [/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf] Error 1
cp: cannot stat 'build_out/hello_world/.bin': No such file or directory
maojxsir commented 1 year ago

@taorye 你们有啥论坛或者群吗,推荐一下,GitHub的issue 回复周期太长,板子拿到一周hello word 都还编译过~~~ 😭

taorye commented 1 year ago

你好,请使用2.2.4版本的gnu工具链编译,因为2.6.0版本的工具链还存在一些待修复的问题。 然后上面是sipeed的下载站地址,这也有平头哥的下载地址。 我们是有QQ交流群的,592731168,欢迎来交流。 最后非常抱歉,因为文档存在一些误导链接,导致使用了不支持的工具链,我会尽快更新的。

maojxsir commented 1 year ago

你好,请使用2.2.4版本的gnu工具链编译,因为2.6.0版本的工具链还存在一些待修复的问题。 然后上面是sipeed的下载站地址,这也有平头哥的下载地址。 我们是有QQ交流群的,592731168,欢迎来交流。 最后非常抱歉,因为文档存在一些误导链接,导致使用了不支持的工具链,我会尽快更新的。

我换成2.2.4 版本后还是提示找不到.map文件。 riscv64-unknown-elf-gcc (Xuantie-900 elf newlib gcc Toolchain V2.2.4 B-20211227) 10.2.0

错误信息:

/home/test/Media/bl808/M1s_BL808_SDK/toolchain/Linux_x86_64/bin/../lib/gcc/riscv64-unknown-elf/10.2.0/../../../../riscv64-unknown-elf/bin/ld: cannot open map file /home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.map: No such file or directory
collect2: error: ld returned 1 exit status
/home/test/Media/bl808/M1s_BL808_SDK/make_scripts_thead_riscv/project.mk:443: recipe for target '/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf' failed
make: *** [/home/test/Media/bl808/M1s_BL808_example/c906_app/build_out/hello_world/.elf] Error 1
cp: cannot stat 'build_out/hello_world/.bin': No such file or directory
taorye commented 1 year ago
hello_world/.map: No such file or directory
./build.sh hello_world

NOT ./build.sh hello_world/

maojxsir commented 1 year ago

./build.sh hello_world

这个解决了~~喜极而泣