diff options
author | alexsifivetw <alex.chiang@sifive.com> | 2023-06-12 01:38:24 -0700 |
---|---|---|
committer | alexsifivetw <alex.chiang@sifive.com> | 2023-06-13 03:08:30 -0700 |
commit | 9027b5a78ddf9c9279618674f67186c1bb636825 (patch) | |
tree | 9a32eeed2ca66dd46c4ba9bf5329babe8819a35a /README.md | |
parent | 89f3238e9dfd9630741b543cf608a8dd5a8cea16 (diff) | |
download | riscv-gnu-toolchain-9027b5a78ddf9c9279618674f67186c1bb636825.zip riscv-gnu-toolchain-9027b5a78ddf9c9279618674f67186c1bb636825.tar.gz riscv-gnu-toolchain-9027b5a78ddf9c9279618674f67186c1bb636825.tar.bz2 |
Add newlib toolchain with llvm build flow
Update readme about newlib toolchain flow
Co-authored-by: Yun Hsiang <yun.hsiang@sifive.com>
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 20 |
1 files changed, 16 insertions, 4 deletions
@@ -260,12 +260,12 @@ can be used: Note, that a combination of `--enable-llvm` and multilib configuration flags is not supported. -Also note, that building LLVM is only supported in combination with building -a Linux toolchain. -Below is an example how to build a rv64gc Linux toolchain with LLVM support, +Below are examples how to build a rv64gc Linux/newlib toolchain with LLVM support, how to use it to build a C and a C++ application using clang, and how to -execute the generated binaries using QEMU: +execute the generated binaries using QEMU. + +Build Linux toolchain and run examples: # Build rv64gc toolchain with LLVM ./configure --prefix=$RISCV --enable-llvm --enable-linux --with-arch=rv64gc --with-abi=lp64d @@ -277,6 +277,18 @@ execute the generated binaries using QEMU: $RISCV/bin/clang++ -march=rv64imafdc -stdlib=libc++ -o hello_world_cpp hello_world_cpp.cxx $RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world_cpp +Build newlib toolchain and run examples (don't work with `--with-multilib-generator=`): + + # Build rv64gc bare-metal toolchain with LLVM + ./configure --prefix=$RISCV --enable-llvm --disable-linux --with-arch=rv64gc --with-abi=lp64d + make -j$(nproc) all build-sim SIM=qemu + # Build C application with clang + $RISCV/bin/clang -march=rv64imafdc -o hello_world hello_world.c + $RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world + # Build C++ application with clang using static link + $RISCV/bin/clang++ -march=rv64imafdc -static -o hello_world_cpp hello_world_cpp.cxx + $RISCV/bin/qemu-riscv64 -L $RISCV/sysroot ./hello_world_cpp + ### Development This section is only for developer or advanced user, or you want to build |