OpenPiton Cross Compiler Installation Guide Paul Jackson and Jonathan Balkind Loosely following the following guides: http://wiki.osdev.org/GCC_Cross-Compiler https://wiki.linaro.org/WorkingGroups/ToolChain/BuildingGNUToolchains 0) Set up root directory $ mkdir cross $ cd cross $ export CROSSROOT=$PWD 1) Download and extract gcc-6.2.0 and binutils-2.27 http://ftp.gnu.org/gnu/binutils/ http://mirrors-usa.go-parts.com/gcc/releases/ $ wget http://ftp.gnu.org/gnu/binutils/binutils-2.27.tar.gz $ tar zxvf binutils-2.27.tar.gz $ wget http://mirrors-usa.go-parts.com/gcc/releases/gcc-6.2.0/gcc-6.2.0.tar.gz $ tar zxvf gcc-6.2.0.tar.gz 2) Set up environment $ export PREFIX="$CROSSROOT" $ export TARGET=sparc64-linux-gnu $ export PATH="$PREFIX/bin:$PATH" $ export CFLAGS="-fPIC $CFLAGS" $ export CPPFLAGS="-fPIC $CPPFLAGS" $ export LDFLAGS="-fPIC $LDFLAGS" 3) Install binutils $ mkdir spar64-sysroot $ mkdir build-binutils $ cd build-binutils $ ../binutils-2.27/configure --target=$TARGET --prefix=$PREFIX --with-sysroot= --disable-nls --disable-werror --enable-shared 4) Set up GCC $ cd $CROSSROOT/gcc-6.2.0/ $ ./contrib/download_prerequisites $ cd $CROSSROOT $ mkdir build-gcc $ cd build-gcc $ ../gcc-6.2.0/configure --target=$TARGET --prefix="$PREFIX" --disable-nls --enable-languages=c --without-headers --disable-threads --disable-libmudflap -disable-libatomic --disable-shared --enable-static --disable-decimal-float --disable-libgomp --disable-libitm --enable-static --disable-decimal-float --disable-libgomp --disable-libitm 5) Install GCC $ make all-gcc -j20 $ make all-target-libgcc -j20 $ make install-gcc $ make install-target-libgcc The compiler can be found at $CROSSROOT/bin/sparc64-linux-gnu-gcc To use the cross compiler, simply set the PITON_GCC environment variable. Follow the example below with the factorial benchmark to ensure it is set up correctly: $ cd $PITON_ROOT $ source piton/piton_settings.bash $ export PITON_GCC=$CROSSROOT/bin/sparc64-linux-gnu-gcc $ cd build/ $ sims -sys=manycore -x_tiles=1 -y_tiles=1 -vcs_build $ sims -sys=manycore -x_tiles=1 -y_tiles=1 -vcs_run factorial.s In the simulation output, you should see the pass message (Simulation -> PASS (HIT GOOD TRAP)) . To further verify the correct compiler is being used, you can check the contents of the sims.log file. Near the beginning the file, just before the ASSEMBLY PHASE section, you should see the following lines: midas: Compiling C code factorial.c to generate factorial.s midas: <$CROSSROOT>/bin/sparc64-linux-gnu-gcc -m64 -fno-common -I. -I.. -I/home/pjj/openpiton/piton/verif/diag/c/include -O2 -S factorial.c -o factorial.s Ensure that it is using the version of gcc located in the $CROSSROOT/bin/ folder. Now you can get custom C benchmarks running on OpenPiton!