Some of the instructions make it harder than it needs to be. I made something awhile ago where you can just copy and paste it into a bash file and run it. All you need to do is this:
First in your $HOME directory create a folder called casio-gcc.
Then download the latest version of GCC and binutils into it.
At the time of writting that is:
binutils-2.32.tar.xz
gcc-8.3.0.tar.xz
Then paste everything below from the code block and run it:
Code:
#!/bin/bash
set -e
set -o pipefail
TMPDIR=/tmp
tar -xf binutils* -C $TMPDIR
tar -xf gcc* -C $TMPDIR
cd $TMPDIR
export PREFIX=$HOME/casio-gcc
export PATH=$PATH:$PREFIX/bin
export TARGET=sh3eb-elf
export CFLAGS="-O2 -pipe -s -fomit-frame-pointer -ffunction-sections -fdata-sections"
export CXXFLAGS=$CFLAGS && export LDFLAGS="-Wl,--gc-sections"
mkdir -p build-binutils
cd build-binutils
../binutils-*/configure --disable-werror --target=$TARGET --prefix=$PREFIX --disable-nls --disable-tls --disable-libssp --enable-plugin --enable-plugins --enable-gold=yes
make -j8
make -j8 install
cd ..
mkdir -p build-gcc
cd build-gcc
../gcc-*/configure --target=$TARGET --prefix=$PREFIX --without-headers --enable-plugin --enable-plugins --enable-gold=yes --enable-sjlj-exceptions --disable-hosted-libstdcxx --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --disable-nls --disable-tls --disable-libssp --disable-threads --disable-shared --enable-static --disable-__cxa_atexit --disable-libvtv --disable-libada --with-endian=big
make -j8 all-gcc
make -j8 install-gcc
make -j8 all-target-libgcc
make -j8 install-target-libgcc
Here are some helpful commands. Don't try and run the lines that start with a pound symbol. Those are comments.
Code:
# Create the casio-gcc folder.
mkdir -p $HOME/casio-gcc
# Go into the newly create directory.
cd $HOME/casio-gcc
# Run the script that you pasted (assuming you called it compile-gcc.sh)
bash ./compile-gcc.sh
After you are done clone this: https://github.com/Jonimoose/libfxcg and run make to build the examples.
Also you will need to run:
Code:
export PATH=$PATH:$HOME/casio-gcc/bin
so that the makefiles you find online work without modification because otherwise you would need to specify the entire path every-time you want sh3eb-elf-gcc.