diff --git a/README.md b/README.md index d5e4798..6c2a82c 100644 --- a/README.md +++ b/README.md @@ -38,7 +38,7 @@ mkdir build-binutils build-gcc sysroot ```bash cd build-binutils ../binutils-*/configure \ - --prefix="$(pwd)/../sysroot" \ + --prefix="$(pwd)/../sysroot" \ --target="sh3eb-elf" \ --with-multilib-list="m3,m4-nofpu" \ --program-prefix="sh-elf-" \ @@ -66,8 +66,6 @@ make -j$(nproc) make install-strip ``` -%TODO: What does configure-host do? why install-strip? - We now configure and install `gcc` using the same steps but with different flags. ### Configuring GCC (Part 1) @@ -111,30 +109,39 @@ make -j$(nproc) all-gcc all-target-libgcc make install-strip-gcc install-strip-target-libgcc # TODO: may need to add Ada stuff? ``` -### Adding libc - -We will now install a libc implementation that works on the CG50. For that we will use [OpenLibm](https://git.planet-casio.com/Lephenixnoir/OpenLibm) and [fxlibc](https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc/) +We now have successfully corss compiled gcc. However we still need to add a libc and compile gnat. +For that we will have to install the required headers into the correct coresponding direcotry ```bash -COMPILER_DIR="$(sh-elf-gcc --print-file-name=.)" #TODO: maybe more elegant way to search for path? -LIBDIR="$COMPILER_DIR" -INCDIR="$COMPILER_DIR/include" -git clone https://git.planet-casio.com/Lephenixnoir/OpenLibm.git -cd OpenLibm -make USEGCC=1 TOOLPREFIX=sh-elf- AR=sh-elf-ar CC=sh-elf-gcc libdir="$(pwd)/../sysroot/lib/gcc/sh3eb-elf/15.2.0/" includedir="$(pwd)/../sysroot/lib/gcc/sh3eb-elf/15.2.0/include" install-static-superh install-headers-superh -# make USEGCC=1 TOOLPREFIX=sh-elf- AR=sh-elf-ar CC=sh-elf-gcc \ -# libdir="$LIBDIR" includedir="$INCDIR" \ -# install-static-superh install-headers-superh +cd .. +export PATH="$PATH:$(pwd)/sysroot/bin" +PREFIX="$(sh-elf-gcc --print-file-name=.)" +``` + +The `PREFIX` directory is where gcc is going to look for all the system headers. + +### Adding libc + +We will now install a libc implementation that works on the CG50. For that we will use [OpenLibm](https://git.planet-casio.com/Lephenixnoir/OpenLibm) and [libfxcg](https://github.com/Jonimoose/libfxcg.git) + +```bash +git clone https://github.com/Jonimoose/libfxcg.git +cd libfxcg/libc +``` +replace all the `sh3eb-` with `sh-elf` +```bash +make +cp the lib files to gcc dir ``` Now we install the actual libc ```bash -git clone https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git -cd fxlibc -cmake -B build-gint -DFXLIBC_TARGET=gint -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sh.cmake -DCMAKE_INSTALL_PREFIX="$SYSROOT" #instead of Sysroot use lib/gcc/15.2.0 -make -C build-casiowin-cg -make -C build-casiowin-cg install +# git clone https://git.planet-casio.com/Vhex-Kernel-Core/fxlibc.git +# cd fxlibc +# cmake -B build-gint -DFXLIBC_TARGET=gint -DCMAKE_TOOLCHAIN_FILE=cmake/toolchain-sh.cmake -DCMAKE_INSTALL_PREFIX="$PREFIX" #instead of Sysroot use lib/gcc/15.2.0 +# make -C build-casiowin-cg #casiowin-cg does not work? using gint instead +# make -C build-casiowin-cg install ``` > [!NOTE] @@ -152,6 +159,20 @@ make install-strip-target-libstdc++-v3 --- +## packaging the binary + +We will need to build `mkg3a` to package the binary. + +```bash +git clone https://gitlab.com/taricorp/mkg3a.git +mkdir build +cd build +cmake .. +make +make install/local +``` + + ## Adding our custom compiler to GPRBuild TODO: look into ironclad gprbuild integration @@ -162,6 +183,7 @@ Sources used: - https://www.planet-casio.com/Fr/forums/topic12970-1-tutoriel-installation-manuelle-de-gcc-et-du-fxsdk.html - https://gcc.gnu.org/install/configure.html - https://git.planet-casio.com/Lephenixnoir/fxsdk + - https://prizm.cemetech.net/Mkg3a/ --- Copyright (c) 2026 Ada Orbit. All Rights Reserved. diff --git a/clean.sh b/clean.sh index 05dc495..8a10e6e 100755 --- a/clean.sh +++ b/clean.sh @@ -3,3 +3,7 @@ rm -rf build-binutils rm -rf sysroot rm -rf OpenLibm rm -rf fxlibc +rm -rf binutils-*/ +rm -rf gcc-*/ +rm -rf libfxcg +rm -rf mkg3a