-
Notifications
You must be signed in to change notification settings - Fork 0
Development documentation for scripts for ARC‐V GNU toolchain
Yuriy Kolerov edited this page Dec 12, 2025
·
6 revisions
riscv64-snps-elf-buildlib is a Python script which helps a user to build Picolibc, libgcc and libstdc++ for a custom target configuration.
To build and link an application with a custom library, you need to pass extra arguments:
-
-specs=./buildlib/buildlib.specs- include a.specsfile which turns off default multilib rules. -
-isystem ./buildlib/riscv64-snps-elf/sys-include -isystem ./buildlib/riscv64-snps-elf/include- use included from a custom Picolibc. -
-B./buildlib/lib/gcc -B./buildlib/riscv64-snps-elf/lib- use custom libraries by default instead of original.
Consider this example:
int main()
{
printf("Hello, World!\n");
return 0;
}How to link an application with custom libraries (also, we pass -Wl,-t to ensure that custom libraries are linked with our application):
$ riscv64-snps-elf-gcc \
-march=rv32imac \
-mabi=ilp32 \
-mtune=arc-v-rmx-100-series \
-mcmodel=medlow \
-isystem ./buildlib/riscv64-snps-elf/sys-include \
-isystem ./buildlib/riscv64-snps-elf/include \
-B./buildlib/lib/gcc \
-B./buildlib/riscv64-snps-elf/lib \
-specs=picolibc.specs \
-specs=buildlib.specs \
--oslib=semihost \
--crt0=semihost \
hello.c -o hello.elf \
-Wl,-t
./buildlib/riscv64-snps-elf/lib/crt0-semihost.o
/tmp/ccUptbxg.o
./buildlib/lib/gcc/riscv64-snps-elf/15.2.0/libgcc.a
./buildlib/lib/gcc/riscv64-snps-elf/15.2.0/libgcc.a
./buildlib/riscv64-snps-elf/lib/libc.a
./buildlib/riscv64-snps-elf/lib/libsemihost.a
./buildlib/lib/gcc/riscv64-snps-elf/15.2.0/libgcc.a
./buildlib/riscv64-snps-elf/lib/libc.a
./buildlib/riscv64-snps-elf/lib/libsemihost.a
./buildlib/lib/gcc/riscv64-snps-elf/15.2.0/libgcc.a
Now we can run the example:
$ nsimdrv -p nsim_isa_family=rv32 -p nsim_isa_ext=-all.i.m.a.c.zicsr -p nsim_semihosting=1 -p enable_exceptions=0 hello.elf
Hello, World!