summaryrefslogtreecommitdiff
path: root/doc/toolchain.txt
diff options
context:
space:
mode:
authorcheapie <cheapiephp@gmail.com>2026-06-26 23:34:38 -0500
committercheapie <cheapiephp@gmail.com>2026-06-26 23:34:38 -0500
commit338a12a1382afebc6c82e0b40768d87bcab3d8d1 (patch)
tree445a6dc22c2c9ddb99b0f831d68fb1999f0ceebc /doc/toolchain.txt
parent3a46ab5b8691e72098e3c43f5e25ca84385a5de6 (diff)
downloadrvcontroller-338a12a1382afebc6c82e0b40768d87bcab3d8d1.tar
rvcontroller-338a12a1382afebc6c82e0b40768d87bcab3d8d1.tar.gz
rvcontroller-338a12a1382afebc6c82e0b40768d87bcab3d8d1.tar.bz2
rvcontroller-338a12a1382afebc6c82e0b40768d87bcab3d8d1.tar.xz
rvcontroller-338a12a1382afebc6c82e0b40768d87bcab3d8d1.zip
Move documentation out of the program and into separate filesHEADmain
Diffstat (limited to 'doc/toolchain.txt')
-rw-r--r--doc/toolchain.txt72
1 files changed, 72 insertions, 0 deletions
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.