From 338a12a1382afebc6c82e0b40768d87bcab3d8d1 Mon Sep 17 00:00:00 2001 From: cheapie Date: Fri, 26 Jun 2026 23:34:38 -0500 Subject: Move documentation out of the program and into separate files --- doc/toolchain.txt | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 doc/toolchain.txt (limited to 'doc/toolchain.txt') diff --git a/doc/toolchain.txt b/doc/toolchain.txt new file mode 100644 index 0000000..720d209 --- /dev/null +++ b/doc/toolchain.txt @@ -0,0 +1,72 @@ +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 +nano activate.sh # Edit the paths to match your installation +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 +nano activate-be.sh # Edit the paths to match your installation +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. -- cgit v1.2.3