Difference between revisions of "Bare metal RISC-V GCC 9.3.0 cross compiler instructions"
(→Build and install bare metal gcc) |
(→Get GCC and binutils) |
||
Line 10: | Line 10: | ||
mkdir -p src obj/{binutils-build,gcc-build,newlib-build} | mkdir -p src obj/{binutils-build,gcc-build,newlib-build} | ||
− | == Get GCC and binutils == | + | == Get GCC, GDB and binutils == |
curl https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz | tar -C $HOME/src -xf - | curl https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz | tar -C $HOME/src -xf - | ||
+ | curl https://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.gz | tar -C $HOME/src -xf - | ||
curl https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz | tar -C $HOME/src -xf - | curl https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz | tar -C $HOME/src -xf - | ||
curl ftp://sourceware.org/pub/newlib/newlib-3.1.0.tar.gz | tar -C $HOME/src -xf - | curl ftp://sourceware.org/pub/newlib/newlib-3.1.0.tar.gz | tar -C $HOME/src -xf - |
Revision as of 15:49, 12 November 2019
Contents
Introduction
We'll build a GCC 9.2.0 targeting bare metal RISC-V.
Create directories
cd $HOME mkdir -p src obj/{binutils-build,gcc-build,newlib-build}
Get GCC, GDB and binutils
curl https://ftp.gnu.org/gnu/binutils/binutils-2.33.1.tar.gz | tar -C $HOME/src -xf - curl https://ftp.gnu.org/gnu/gdb/gdb-8.3.tar.gz | tar -C $HOME/src -xf - curl https://ftp.gnu.org/gnu/gcc/gcc-9.2.0/gcc-9.2.0.tar.gz | tar -C $HOME/src -xf - curl ftp://sourceware.org/pub/newlib/newlib-3.1.0.tar.gz | tar -C $HOME/src -xf -
Download prerequisites
cd $HOME/src/gcc-9.2.0 ./contrib/download_prerequisites
Build and install binutils
cd $HOME/obj/binutils-build ../../src/binutils-2.33.1/configure --prefix $HOME/xgcc --bindir $HOME/bin --target riscv64-unknown-elf --enable-multilib make -j8 && make install
Build and install bare metal gcc
cd $HOME/obj/gcc-build ../../src/gcc-9.2.0/configure --prefix $HOME/xgcc --bindir $HOME/bin --target riscv64-unknown-elf --enable-multilib --enable-languages=c --with-gnu-as --with-gnu-ld --without-headers --with-newlib make -j8 all-gcc && make install-gcc
Build and install newlib
cd $HOME/obj/newlib-build ../../src/newlib-3.1.0/configure --prefix $HOME/xgcc --bindir $HOME/bin --target riscv64-unknown-elf --enable-multilib make -j8 all && make install
Build and install newlib gcc
rm -rf $HOME/obj/gcc-build && mkdir -p $HOME/obj/gcc-build cd $HOME/obj/gcc-build ../../src/gcc-9.2.0/configure --prefix $HOME/xgcc --bindir $HOME/bin --target riscv64-unknown-elf --enable-multilib --enable-languages=c --with-gnu-as --with-gnu-ld --with-newlib make -j8 all && make install