Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

LINK is setted to riscv64-unknown-elf-gcc, but env.Program execute use ld #4587

Closed
zhajio1988 opened this issue Aug 13, 2024 · 21 comments
Closed

Comments

@zhajio1988
Copy link

LINK is setted to riscv64-unknown-elf-gcc, but env.Program execute use ld.
I use env.Dump()get below outputs:
'LINK': 'riscv64-unknown-elf-gcc', 'LINKCOM': '$LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS ' '$_LIBFLAGS', 'LINKFLAGS': ' ' '-march=rv64imafdcv_zicbom_zicbop_zicboz_zicond1p0_zihintntl0p2_zihintpause_zawrs_zfa0p1_zfbfmin0p8_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin0p8_zvfbfwma0p8_svinval_svpbmt_xtheadc_xtheadvdot ' '-mabi=lp64d -mtune=c920 -nostartfiles -lc -lgcc -lm -T ' '/ssd_fes/jiongz/desktop/github/diff_ip_vv/pc801_c920_ip_vv/smart_run/tests/lib/init/linker.lcf ' '-L ' '/ssd_fes/jiongz/desktop/github/diff_ip_vv/pc801_c920_ip_vv/smart_run/tests/lib/init',
Could anyone help me about this issue?

@mwichmann
Copy link
Collaborator

Curious why your target arch spec looks so odd? I'd expect just rv64i? Is this including all the build options or something?

-march=rv64imafdcv_zicbom_zicbop_zicboz_zicond1p0_zihintntl0p2_zihintpause_zawrs_zfa0p1_zfbfmin0p8_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin0p8_zvfbfwma0p8_svinval_svpbmt_xtheadc_xtheadvdot

While most builds using a gcc toolcchain use the special variable $SMARTLINK it should certainly be possible to set $LINK to something more specific - we do it in many tests in the regression test suite. The smart link concept is to basically use the same program as is being used for compilation (so the same as $CC if it's C code, $CXX if it's C++, etc). Have you tried that?

It's not SCons executing ld: it issues the expanded version of the $LINKCOM command. If the program you invoke there goes on and calls other programs, that's it's business. Sounds like possibly the gcc build (presumably this is a cross-build toolchain?) isn't configured in a way that it's picking up the linker binary you expect. Based on the naming from above, would be expecting it to look for riscv64-unknown-elf-ld.

@bdbaddog
Copy link
Contributor

@zhajio1988 base questions first

  1. Which version of SCons?
  2. Which version of Python?
  3. Which operating system are you on?
  4. Can you provide a small reproducer?

@bdbaddog
Copy link
Contributor

Can you run scons --debug=presub and paste the debug information just prior to your build failure (don't build in parallel for this)?

@zhajio1988
Copy link
Author

Curious why your target arch spec looks so odd? I'd expect just rv64i? Is this including all the build options or something?

-march=rv64imafdcv_zicbom_zicbop_zicboz_zicond1p0_zihintntl0p2_zihintpause_zawrs_zfa0p1_zfbfmin0p8_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin0p8_zvfbfwma0p8_svinval_svpbmt_xtheadc_xtheadvdot

While most builds using a gcc toolcchain use the special variable $SMARTLINK it should certainly be possible to set $LINK to something more specific - we do it in many tests in the regression test suite. The smart link concept is to basically use the same program as is being used for compilation (so the same as $CC if it's C code, $CXX if it's C++, etc). Have you tried that?

It's not SCons executing ld: it issues the expanded version of the $LINKCOM command. If the program you invoke there goes on and calls other programs, that's it's business. Sounds like possibly the gcc build (presumably this is a cross-build toolchain?) isn't configured in a way that it's picking up the linker binary you expect. Based on the naming from above, would be expecting it to look for riscv64-unknown-elf-ld.

@mwichmann The -march option is copied from T-head‘s makefile. ld command finally point to ”/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld”

@zhajio1988
Copy link
Author

Hi @bdbaddog
Thanks for your replay.

  1. Which version of SCons?
    SCons: v4.8.0.7c688f694c644b61342670ce92977bf4a396c0d4, Sun, 07 Jul 2024 16:52:07 -0700, by bdbaddog on M1Dog2021
  2. Which version of Python?
    Python 3.11.4 (main, Jul 5 2023, 13:45:01) [GCC 11.2.0] on linux
  3. Which operating system are you on?
    Linux lushan 3.10.0-957.el7.x86_64 ParseConfig doesn't understand -Wl flags. #1 SMP Thu Nov 8 23:39:32 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  4. Can you provide a small reproducer?
    I will try to do this.

@zhajio1988
Copy link
Author

zhajio1988 commented Aug 15, 2024

Can you run scons --debug=presub and paste the debug information just prior to your build failure (don't build in parallel for this)?

Building build/arch/t-head/barrier.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/arch/t-head/barrier.o
Building build/arch/t-head/cache.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/arch/t-head/cache.o
Building build/lib/clib/fputc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/clib/fputc.o
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/riscv64-unknown-elf/include/stdio.h: In function 'fputc':
tests/lib/clib/fputc.c:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
Building build/lib/clib/intc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/clib/intc.o
tests/lib/clib/intc.c: In function 'ck_intc_init':
tests/lib/clib/intc.c:9:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9 | #define APB_BASE                 0x10000000
      |                                  ^~~~~~~~~~
tests/lib/clib/intc.c:15:17: note: in expansion of macro 'APB_BASE'
   15 |     int *picr = APB_BASE;
      |                 ^~~~~~~~
tests/lib/clib/intc.c:10:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   10 | #define INTC_BASE                0x10010000
      |                                  ^~~~~~~~~~
tests/lib/clib/intc.c:19:22: note: in expansion of macro 'INTC_BASE'
   19 |         int *piser = INTC_BASE + 0x10;
      |                      ^~~~~~~~~
Building build/lib/clib/uart.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/clib/uart.o
tests/lib/clib/uart.c: In function 'ck_uart_status':
tests/lib/clib/uart.c:203:18: warning: 'uart_lsr' is used uninitialized in this function [-Wuninitialized]
  203 |     if (uart_lsr & CK_LSR_TEMT)
      |                  ^
Building build/lib/clib/vtimer.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/clib/vtimer.o
tests/lib/clib/vtimer.c: In function 'sim_end':
tests/lib/clib/vtimer.c:21:12: warning: assignment to 'int *' from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
   21 |   END_ADDR = 0xA001FF48;
      |            ^
tests/lib/clib/vtimer.c:24:13: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '18324075042' to '1144205858' [-Woverflow]
   24 |   END_DATA= 0x444333222;
      |             ^~~~~~~~~~~
Building build/lib/init/core_cp0.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_cp0.o
Building build/lib/init/core_ifu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_ifu.o
Building build/lib/init/core_l2c.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_l2c.o
Building build/lib/init/core_lsu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_lsu.o
Building build/lib/init/core_mmu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_mmu.o
Building build/lib/init/core_plic.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_plic.o
Building build/lib/init/core_t_extension.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_t_extension.o
Building build/lib/init/core_vec.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/core_vec.o
Building build/lib/init/crt0.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/crt0.o
Building build/lib/init/stress_inst.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
AS build/lib/init/stress_inst.o
Building build/lib/newlib_wrap/__dtostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__dtostr.o
Building build/lib/newlib_wrap/__isinf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__isinf.o
Building build/lib/newlib_wrap/__isnan.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__isnan.o
Building build/lib/newlib_wrap/__lltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__lltostr.o
Building build/lib/newlib_wrap/__ltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__ltostr.o
Building build/lib/newlib_wrap/__v_printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/__v_printf.o
Building build/lib/newlib_wrap/fprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/fprintf.o
Building build/lib/newlib_wrap/getc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/getc.o
Building build/lib/newlib_wrap/getchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/getchar.o
Building build/lib/newlib_wrap/printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/printf.o
Building build/lib/newlib_wrap/putc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/putc.o
Building build/lib/newlib_wrap/putchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/putchar.o
Building build/lib/newlib_wrap/puts.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/puts.o
Building build/lib/newlib_wrap/snprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/snprintf.o
Building build/lib/newlib_wrap/sprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/sprintf.o
Building build/lib/newlib_wrap/vfprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/vfprintf.o
Building build/lib/newlib_wrap/vprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/vprintf.o
Building build/lib/newlib_wrap/vsnprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/vsnprintf.o
Building build/lib/newlib_wrap/vsprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/lib/newlib_wrap/vsprintf.o
Building build/tests/hello_world/hello_world.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
CC build/tests/hello_world/hello_world.o
tests/cases/hello_world/hello_world.c: In function 'main':
tests/cases/hello_world/hello_world.c:39:1: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   39 | else
      | ^~~~
tests/cases/hello_world/hello_world.c:41:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   41 |   printf("after ASM c is changed to %d!\n",c);
      |   ^~~~~~
Building hello_world.elf with action:
  $LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS
LINK hello_world.elf
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: /opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/lib/rv64imafdcv_zfh_xtheadc/lp64d/crt0.o: in function `_start':
(.text+0x0): undefined reference to `__global_pointer$'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x8): undefined reference to `_edata'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x10): undefined reference to `_end'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x32): undefined reference to `__libc_init_array'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x44): undefined reference to `exit'
collect2: error: ld returned 1 exit status
scons: *** [hello_world.elf] Error 1

@zhajio1988
Copy link
Author

zhajio1988 commented Aug 15, 2024

@bdbaddog
scons_demo.tar.gz
Attached is a small example, please help to look at it thanks.
Below is the log:

Building lib/clib/fputc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/fputc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/fputc.c
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/riscv64-unknown-elf/include/stdio.h: In function 'fputc':
lib/clib/fputc.c:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
Building lib/clib/intc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/intc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/intc.c
lib/clib/intc.c: In function 'ck_intc_init':
lib/clib/intc.c:9:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9 | #define APB_BASE                 0x10000000
      |                                  ^~~~~~~~~~
lib/clib/intc.c:15:17: note: in expansion of macro 'APB_BASE'
   15 |     int *picr = APB_BASE;
      |                 ^~~~~~~~
lib/clib/intc.c:10:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   10 | #define INTC_BASE                0x10010000
      |                                  ^~~~~~~~~~
lib/clib/intc.c:19:22: note: in expansion of macro 'INTC_BASE'
   19 |         int *piser = INTC_BASE + 0x10;
      |                      ^~~~~~~~~
Building lib/clib/uart.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/uart.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/uart.c
lib/clib/uart.c: In function 'ck_uart_status':
lib/clib/uart.c:203:18: warning: 'uart_lsr' is used uninitialized in this function [-Wuninitialized]
  203 |     if (uart_lsr & CK_LSR_TEMT)
      |                  ^
Building lib/clib/vtimer.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/vtimer.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/vtimer.c
lib/clib/vtimer.c: In function 'sim_end':
lib/clib/vtimer.c:21:12: warning: assignment to 'int *' from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
   21 |   END_ADDR = 0xA001FF48;
      |            ^
lib/clib/vtimer.c:24:13: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '18324075042' to '1144205858' [-Woverflow]
   24 |   END_DATA= 0x444333222;
      |             ^~~~~~~~~~~
Building lib/newlib_wrap/__dtostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__dtostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__dtostr.c
Building lib/newlib_wrap/__isinf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__isinf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__isinf.c
Building lib/newlib_wrap/__isnan.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__isnan.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__isnan.c
Building lib/newlib_wrap/__lltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__lltostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__lltostr.c
Building lib/newlib_wrap/__ltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__ltostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__ltostr.c
Building lib/newlib_wrap/__v_printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__v_printf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__v_printf.c
Building lib/newlib_wrap/fprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/fprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/fprintf.c
Building lib/newlib_wrap/getc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/getc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/getc.c
Building lib/newlib_wrap/getchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/getchar.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/getchar.c
Building lib/newlib_wrap/printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/printf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/printf.c
Building lib/newlib_wrap/putc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/putc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/putc.c
Building lib/newlib_wrap/putchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/putchar.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/putchar.c
Building lib/newlib_wrap/puts.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/puts.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/puts.c
Building lib/newlib_wrap/snprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/snprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/snprintf.c
Building lib/newlib_wrap/sprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/sprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/sprintf.c
Building lib/newlib_wrap/vfprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vfprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vfprintf.c
Building lib/newlib_wrap/vprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vprintf.c
Building lib/newlib_wrap/vsnprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vsnprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vsnprintf.c
Building lib/newlib_wrap/vsprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vsprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vsprintf.c
Building hello_world.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o hello_world.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init hello_world.c
hello_world.c: In function 'main':
hello_world.c:39:1: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   39 | else
      | ^~~~
hello_world.c:41:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   41 |   printf("after ASM c is changed to %d!\n",c);
      |   ^~~~~~
Building lib/init/core_cp0.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -o lib/init/core_cp0.o lib/init/core_cp0.s
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: /opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/lib/rv64imafdc_zfh_xtheadc/lp64d/crt0.o: in function `.L0 ':
(.text+0x38): undefined reference to `main'
collect2: error: ld returned 1 exit status
scons: *** [lib/init/core_cp0.o] Error 1

@mwichmann
Copy link
Collaborator

mwichmann commented Aug 15, 2024

At a first glance, the setting of AS seems dodgy - you normally don't want to use gcc as "the assembler". At least in the snip just above, you have:

Building lib/init/core_cp0.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
LONGPREFIX/bin/riscv64-unknown-elf-gcc -g -o lib/init/core_cp0.o lib/init/core_cp0.s

and then an error from the linker, indicating it's trying to make a program out of it, rather than an object:

ZZZ/lp64d/crt0.o: in function `.L0 ':
(.text+0x38): undefined reference to `main'
collect2: error: ld returned 1 exit status

I'd expect the line from building this object file from assembly to look like:

LONGPREFIX/bin/riscv64-unknown-elf-as -g -o lib/init/core_cp0.o lib/init/core_cp0.s

Maybe if you try that change first, we can see if there are other issues.

EDITED: that is, in the SConstruct, make a change like:

-AS      = PREFIX + 'gcc'
+AS      = PREFIX + 'as'

@zhajio1988
Copy link
Author

zhajio1988 commented Aug 15, 2024

Thanks for your help. @mwichmann
After EDITED AS = PREFIX + 'as'
Report below logs:

> Building lib/init/core_cp0.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_cp0.o lib/init/core_cp0.s
Building lib/init/core_ifu.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_ifu.o lib/init/core_ifu.s
Building lib/init/core_l2c.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_l2c.o lib/init/core_l2c.s
Building lib/init/core_lsu.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_lsu.o lib/init/core_lsu.s
Building lib/init/core_mmu.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_mmu.o lib/init/core_mmu.s
Building lib/init/core_plic.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_plic.o lib/init/core_plic.s
Building lib/init/core_t_extension.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_t_extension.o lib/init/core_t_extension.s
Building lib/init/core_vec.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/core_vec.o lib/init/core_vec.s
Building lib/init/crt0.o with action:
  $AS $ASFLAGS -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/crt0.o lib/init/crt0.s
lib/init/crt0.s: Assembler messages:
lib/init/crt0.s:9: Error: can't open core_init.h for reading: No such file or directory
lib/init/crt0.s:136: Error: unrecognized opcode `sync'
lib/init/crt0.s:147: Error: unrecognized opcode `sync'
scons: *** [lib/init/crt0.o] Error 1

@bdbaddog
Copy link
Contributor

Try running this command manually

opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/crt0.o lib/init/crt0.s

Is there a core_init.h header file anywhere in your tree or in your toolchain's tree?

@mwichmann
Copy link
Collaborator

Definitely making progress, a header-include problem should just require adding to the right SCons construction variable. @bdbaddog - is $CPPATH applied to assembler, too?

@zhajio1988
Copy link
Author

zhajio1988 commented Aug 16, 2024

@bdbaddog

(myenv) lushan: /ssd_fes/jiongz/desktop/github/sifive/scons_demo$ /opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-as -g -o lib/init/crt0.o lib/init/crt0.s
lib/init/crt0.s: Assembler messages:
lib/init/crt0.s:9: Error: can't open core_init.h for reading: No such file or directory
lib/init/crt0.s:136: Error: unrecognized opcode `sync'
lib/init/crt0.s:147: Error: unrecognized opcode `sync'

Actually, I've been using gcc to compile .s files, and I don't have this problem with gcc.

@zhajio1988
Copy link
Author

I changed to scons flow from an old makefile that had the following code in it.

CC      = ${TOOL_EXTENSION}/riscv64-unknown-elf-gcc
AS      = ${TOOL_EXTENSION}/riscv64-unknown-elf-as
LINK    = ${TOOL_EXTENSION}/riscv64-unknown-elf-ld
OBJDUMP = ${TOOL_EXTENSION}/riscv64-unknown-elf-objdump
OBJCOPY = ${TOOL_EXTENSION}/riscv64-unknown-elf-objcopy
CONVERT	=../tests/bin/Srec2vmem
%.o : %.c
	${CC} -c ${CFLAGS} -o $@ $<

%.o : %.s
	${CC} -c ${CFLAGS} -o $@ $<

%.o : %.S
	${CC} -c ${CFLAGS} -o $@ $<

${FILE}.elf : ${OBJECTS} linker.lcf
	${CC} ${LINKFLAGS} ${LINKLIBS} ${OBJECTS} -o $@ -lm 

What you can look at is the .s file compiled with riscv64-unknown-elf-gcc

@bdbaddog
Copy link
Contributor

bdbaddog commented Aug 16, 2024

Try adding this at line 160 in your SConstruct
env['ASCOM'] = env['ASPPCOM']

That should change the crt0.s compile line to:
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/crt0.o lib/init/crt0.s

Which I think should work..

For files named .s, .asm, .ASM SCons will run assembler without specifying preprocessor directives on the command line.
For files named .S, .spp, .SPP, .sx SCons will specify those flags including -I's

The change above tells SCons to apply the preprocessing flags (defines, include paths) to the .s, .asm, .ASM suffixed files.

Note if you're on a case-insensitve filesystem remove the .S file from the list which would be preprocessed.

@zhajio1988
Copy link
Author

zhajio1988 commented Aug 16, 2024

@bdbaddog

> Building lib/clib/fputc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/fputc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/fputc.c
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/riscv64-unknown-elf/include/stdio.h: In function 'fputc':
lib/clib/fputc.c:19:1: warning: control reaches end of non-void function [-Wreturn-type]
   19 | }
      | ^
Building lib/clib/intc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/intc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/intc.c
lib/clib/intc.c: In function 'ck_intc_init':
lib/clib/intc.c:9:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
    9 | #define APB_BASE                 0x10000000
      |                                  ^~~~~~~~~~
lib/clib/intc.c:15:17: note: in expansion of macro 'APB_BASE'
   15 |     int *picr = APB_BASE;
      |                 ^~~~~~~~
lib/clib/intc.c:10:34: warning: initialization of 'int *' from 'int' makes pointer from integer without a cast [-Wint-conversion]
   10 | #define INTC_BASE                0x10010000
      |                                  ^~~~~~~~~~
lib/clib/intc.c:19:22: note: in expansion of macro 'INTC_BASE'
   19 |         int *piser = INTC_BASE + 0x10;
      |                      ^~~~~~~~~
Building lib/clib/uart.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/uart.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/uart.c
lib/clib/uart.c: In function 'ck_uart_status':
lib/clib/uart.c:203:18: warning: 'uart_lsr' is used uninitialized in this function [-Wuninitialized]
  203 |     if (uart_lsr & CK_LSR_TEMT)
      |                  ^
Building lib/clib/vtimer.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/clib/vtimer.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/clib/vtimer.c
lib/clib/vtimer.c: In function 'sim_end':
lib/clib/vtimer.c:21:12: warning: assignment to 'int *' from 'unsigned int' makes pointer from integer without a cast [-Wint-conversion]
   21 |   END_ADDR = 0xA001FF48;
      |            ^
lib/clib/vtimer.c:24:13: warning: unsigned conversion from 'long int' to 'unsigned int' changes value from '18324075042' to '1144205858' [-Woverflow]
   24 |   END_DATA= 0x444333222;
      |             ^~~~~~~~~~~
Building lib/newlib_wrap/__dtostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__dtostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__dtostr.c
Building lib/newlib_wrap/__isinf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__isinf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__isinf.c
Building lib/newlib_wrap/__isnan.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__isnan.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__isnan.c
Building lib/newlib_wrap/__lltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__lltostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__lltostr.c
Building lib/newlib_wrap/__ltostr.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__ltostr.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__ltostr.c
Building lib/newlib_wrap/__v_printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/__v_printf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/__v_printf.c
Building lib/newlib_wrap/fprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/fprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/fprintf.c
Building lib/newlib_wrap/getc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/getc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/getc.c
Building lib/newlib_wrap/getchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/getchar.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/getchar.c
Building lib/newlib_wrap/printf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/printf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/printf.c
Building lib/newlib_wrap/putc.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/putc.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/putc.c
Building lib/newlib_wrap/putchar.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/putchar.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/putchar.c
Building lib/newlib_wrap/puts.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/puts.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/puts.c
Building lib/newlib_wrap/snprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/snprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/snprintf.c
Building lib/newlib_wrap/sprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/sprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/sprintf.c
Building lib/newlib_wrap/vfprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vfprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vfprintf.c
Building lib/newlib_wrap/vprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vprintf.c
Building lib/newlib_wrap/vsnprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vsnprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vsnprintf.c
Building lib/newlib_wrap/vsprintf.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o lib/newlib_wrap/vsprintf.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init lib/newlib_wrap/vsprintf.c
Building hello_world.o with action:
  $CC -o $TARGET -c $CFLAGS $CCFLAGS $_CCCOMCOM $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o hello_world.o -c -O1 -g -Wall -Ilib/clib -Ilib/newlib_wrap -Ilib/init hello_world.c
hello_world.c: In function 'main':
hello_world.c:39:1: warning: this 'else' clause does not guard... [-Wmisleading-indentation]
   39 | else
      | ^~~~
hello_world.c:41:3: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'else'
   41 |   printf("after ASM c is changed to %d!\n",c);
      |   ^~~~~~
Building lib/init/core_cp0.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_cp0.o lib/init/core_cp0.s
Building lib/init/core_ifu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_ifu.o lib/init/core_ifu.s
Building lib/init/core_l2c.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_l2c.o lib/init/core_l2c.s
Building lib/init/core_lsu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_lsu.o lib/init/core_lsu.s
Building lib/init/core_mmu.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_mmu.o lib/init/core_mmu.s
Building lib/init/core_plic.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_plic.o lib/init/core_plic.s
Building lib/init/core_t_extension.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_t_extension.o lib/init/core_t_extension.s
Building lib/init/core_vec.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/core_vec.o lib/init/core_vec.s
Building lib/init/crt0.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/crt0.o lib/init/crt0.s
Building lib/init/stress_inst.o with action:
  $CC $ASPPFLAGS $CPPFLAGS $_CPPDEFFLAGS $_CPPINCFLAGS -c -o $TARGET $SOURCES
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -g -Ilib/clib -Ilib/newlib_wrap -Ilib/init -c -o lib/init/stress_inst.o lib/init/stress_inst.s
Building build/main.elf with action:
  $LINK -o $TARGET $LINKFLAGS $__RPATH $SOURCES $_LIBDIRFLAGS $_LIBFLAGS
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/riscv64-unknown-elf-gcc -o build/main.elf -nostartfiles -lc -lgcc -lm -T ./lib/init/linker.lcf -march=rv64imafdcv_zicbom_zicbop_zicboz_zicond1p0_zihintntl0p2_zihintpause_zawrs_zfa0p1_zfbfmin0p8_zfh_zca_zcb_zcd_zba_zbb_zbc_zbs_zvfbfmin0p8_zvfbfwma0p8_svinval_svpbmt_xtheadc_xtheadvdot -mabi=lp64d -mtune=c920 lib/clib/fputc.o lib/clib/intc.o lib/clib/uart.o lib/clib/vtimer.o lib/newlib_wrap/__dtostr.o lib/newlib_wrap/__isinf.o lib/newlib_wrap/__isnan.o lib/newlib_wrap/__lltostr.o lib/newlib_wrap/__ltostr.o lib/newlib_wrap/__v_printf.o lib/newlib_wrap/fprintf.o lib/newlib_wrap/getc.o lib/newlib_wrap/getchar.o lib/newlib_wrap/printf.o lib/newlib_wrap/putc.o lib/newlib_wrap/putchar.o lib/newlib_wrap/puts.o lib/newlib_wrap/snprintf.o lib/newlib_wrap/sprintf.o lib/newlib_wrap/vfprintf.o lib/newlib_wrap/vprintf.o lib/newlib_wrap/vsnprintf.o lib/newlib_wrap/vsprintf.o hello_world.o lib/init/core_cp0.o lib/init/core_ifu.o lib/init/core_l2c.o lib/init/core_lsu.o lib/init/core_mmu.o lib/init/core_plic.o lib/init/core_t_extension.o lib/init/core_vec.o lib/init/crt0.o lib/init/stress_inst.o
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: /opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/lib/rv64imafdcv_zfh_xtheadc/lp64d/crt0.o: in function `_start':
(.text+0x0): undefined reference to `__global_pointer$'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x8): undefined reference to `_edata'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x10): undefined reference to `_end'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x32): undefined reference to `__libc_init_array'
/opt/picocom/ThirdParty_Libs/T-head/C920_R2S0P21/C920_R2S0_manuals_and_tools/manuals_and_tools/08_toolchain_900_series_cpu_toolchain/V2.8.0/Xuantie-900-gcc-elf-newlib-x86_64-V2.8.0/bin/../lib/gcc/riscv64-unknown-elf/10.4.0/../../../../riscv64-unknown-elf/bin/ld: (.text+0x44): undefined reference to `exit'
collect2: error: ld returned 1 exit status
scons: *** [build/main.elf] Error 1

@bdbaddog
Copy link
Contributor

@zhajio1988 - Please skip including the whole build log, and just include the failed command and it's errors/warnings.. much easier to read..

Also now your issue is no longer SCons related I think.
A quick google of the __global_pointer$ error above finds this.
https://stackoverflow.com/questions/62198590/riscv32-unknown-elf-linker-error-after-reading-linker-script-undefined-referen

@zhajio1988
Copy link
Author

@bdbaddog
Yes, It does have nothing to do with scons anymore, I'm seeing what's going on, thanks a lot!

@bdbaddog
Copy link
Contributor

I'm going to close this issue as it was really about your usage of SCons and not a defect with SCons itself.

In the future it's preferred to bring such issues to our mailing list or our discord server, and not file a bug until the maintainers have determined it's not a user issue.

You can find how to get to the mailing list or discord server here: https://scons.org/contact.html

@zhajio1988
Copy link
Author

@bdbaddog
Finally,my SCons can work now, thank you very much.

@bdbaddog
Copy link
Contributor

@zhajio1988 glad @mwichmann and I could help.

@mwichmann
Copy link
Collaborator

I'll move it over to Conversations (will have the same number but won't be listed in issues)

@SCons SCons locked and limited conversation to collaborators Aug 16, 2024
@mwichmann mwichmann converted this issue into discussion #4588 Aug 16, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants