diff options
Diffstat (limited to 'cross-toolchain')
| -rw-r--r-- | cross-toolchain/SETUP.txt | 70 |
1 files changed, 70 insertions, 0 deletions
diff --git a/cross-toolchain/SETUP.txt b/cross-toolchain/SETUP.txt new file mode 100644 index 0000000..654c405 --- /dev/null +++ b/cross-toolchain/SETUP.txt @@ -0,0 +1,70 @@ +How to set up the cross-compilation toolchain +============================================= + +RVController can run in little-endian or big-endian mode. +If you don't know what this means, you want little-endian. + +These instructions are for Linux. Doing any of this on other OSes is left as an exercise for the reader. + +Little-endian (recommended) +--------------------------- + +Target triplet is riscv32-none-elf. activate.sh will set this for you. +See c/rrxing/Makefile for example commands to compile and link. + +Initial setup: +cd cross-toolchain +mkdir build target source +source activate.sh + +Binutils (required): +cd source +git clone git://sourceware.org/git/binutils-gdb.git +cd ../build +mkdir binutils +cd binutils +../../source/binutils-gdb/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror +make -j$(nproc) +make install # Do not use sudo! root access is not needed. +cd ../.. + +GCC (optional, needed if you want to use C but not Clang): +cd source +git clone https://gcc.gnu.org/git/gcc.git +cd ../build +mkdir gcc +cd gcc +../../source/gcc/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c,c++ --without-headers --disable-hosted-libstdcxx --with-arch=RV32I +make -j$(nproc) all-gcc all-target-libgcc all-target-libstdc++-v3 +make install-gcc install-target-libgcc install-target-libstdc++-v3 # Do not use sudo! root access is not needed. +cd ../.. + +Clang (recommended, needed if you want to use C but not GCC): +You can just use a copy of clang built for some other arch with "-target riscv32-none-elf". +If your distro ships a clang package, just install that. + +Big-endian +---------- + +Target triplet is riscv32be-none-elf. activate-be.sh will set this for you. +See c/rrxing-be/Makefile for example commands to compile and link. + +Initial setup: +cd cross-toolchain +mkdir build target source +source activate-be.sh + +Binutils (required): +cd source +git clone git://sourceware.org/git/binutils-gdb.git +cd ../build +mkdir binutils-be +cd binutils-be +../../source/binutils-gdb/configure --target=$TARGET --prefix="$PREFIX" --with-sysroot --disable-nls --disable-werror +make -j$(nproc) +make install # Do not use sudo! root access is not needed. +cd ../.. + +Clang (recommended, required if you want to use C): +You can just use a copy of clang built for some other arch with "-target riscv32be-none-elf". +If your distro ships a clang package, just install that. |
