This is an old revision of the document!
Table of Contents
Deploy PIC32MX gcc toolchain on Ubuntu 24.04.2 LTS
- tool chain has been built based on binutils 2.36, gcc 10.3.0, newlib 4.1.0.
install prerequisites
$ sudo apt install libgmp3-dev libmpfr-dev libmpc-dev
binutils 2.36
$ mkdir -p ~/projects/gcc-mips-10.3.0/ $ cd ~/projects/gcc-mips-10.3.0/ $ wget http://ftp.gnu.org/gnu/binutils/binutils-2.36.tar.gz -O ~/Downloads/binutils-2.36.tar.gz $ tar xvpf /tmp/binutils-2.36.tar.gz $ mkdir build-binutils-el-2.36 $ cd build-binutils-el-2.36 $ ../binutils-2.36/configure --target=mipsel --prefix=/opt/mipsel-10.3.0 $ make $ sudo make install
gcc 10.3.0 with newlib 4.1.0
- prepare working area
$ cd ~/projects/gcc-mips-10.3.0/ $ mkdir build-gcc-el-10.3.0 $ mkdir build-newlib-el-4.1.0
- download and unpack
$ wget http://ftp.gnu.org/gnu/gcc/gcc-10.3.0/gcc-10.3.0.tar.gz -O /tmp/gcc-10.3.0.tar.gz $ tar xvpf /tmp/gcc-10.3.0.tar.gz $ wget ftp://sourceware.org/pub/newlib/newlib-4.1.0.tar.gz -O /tmp/newlib-4.1.0.tar.gz $ tar xvpf /tmp/newlib-4.1.0.tar.gz
- build and install (tools will be installed into /opt/mipsel-10.3.0/ directory). Building gcc with newlib is done in three steps.
Stage 1 - build bootstrap gcc
$ cd build-gcc-el-10.3.0 $ ../gcc-10.3.0/configure --target=mipsel --prefix=/opt/mipsel-10.3.0 --without-headers --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c --with-local-prefix=/opt/mipsel-10.3.0 --with-native-system-header-dir=/opt/mipsel-10.3.0/include/ --disable-nls --disable-shared --enable-multilib --disable-decimal-float -disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath $ make $ sudo make install
- –enable-multilib - builds several variants of libraries (big-endian, little-endian hard-float and soft-float). Default is little-endian hard-float.
$ /opt/mipsel-10.3.0/bin/mipsel-gcc -print-multi-lib .; soft-float;@msoft-float eb;@EB soft-float/eb;@msoft-float@EB $
Stage 2 - deploy newlib
- newlib requires mips-cc
# cd /opt/mipsel-10.3.0/bin # ln -s mipsel-gcc mipsel-cc
- build and install
$ export PATH=/opt/mipsel-10.3.0/bin:$PATH $ cd ~/projects/gcc-mips-10.3.0/build-newlib-el-4.1.0 $ ../newlib-4.1.0/configure --target=mipsel --prefix=/opt/mipsel-10.3.0 $ make ; echo $? $ sudo make install
Stage 3 - deploy gcc and g++ with newlib suport
$ cd ~/projects/gcc-mips-10.3.0/build-gcc-el-10.3.0 $ ../gcc-10.3.0/configure --target=mipsel --prefix=/opt/mipsel-10.3.0 --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c,c++ --with-local-prefix=/opt/mipsel-10.3.0 --with-native-system-header-dir=/opt/mipsel-10.3.0/include --disable-nls --disable-shared --enable-multilib --disable-decimal-float -disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath $ make -j 10 ; echo $? $ sudo make install
binutils 2.22
- prepare working area
$ mkdir ~/projects/gcc-mips/ $ cd ~/projects/gcc-mips/ $ mkdir build-binutils-el
- download and unpack
$ wget http://ftp.gnu.org/gnu/binutils/binutils-2.22.tar.gz -O /tmp/binutils-2.22.tar.gz $ tar xvpf /tmp/binutils-2.22.tar.gz
- build and install (all tools will be installed into /opt/mipsel/ directory)
$ cd build-binutils-el $ ../binutils-2.22/configure --target=mipsel --prefix=/opt/mipsel $ make $ sudo make install
gcc 4.5.2 with newlib 1.20.0
- prepare working area
$ cd ~/projects/gcc-mips/ $ mkdir build-gcc-el $ mkdir build-newlib-el
- download and unpack
$ wget http://ftp.gnu.org/gnu/gcc/gcc-4.5.2/gcc-4.5.2.tar.gz -O /tmp/gcc-4.5.2.tar.gz $ tar xvpf /tmp/gcc-4.5.2.tar.gz $ wget ftp://sources.redhat.com/pub/newlib/newlib-1.20.0.tar.gz -O /tmp/newlib-1.20.0.tar.gz $ tar xvpf /tmp/newlib-1.20.0.tar.gz
- build and install (tools will be installed into /opt/mipsel/ directory). Building gcc with newlib is done in three steps.
Stage 1 - build bootstrap gcc
$ cd build-gcc-el $ ../gcc-4.5.2/configure --target=mipsel --prefix=/opt/mipsel --with-gmp-include=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr --without-headers --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c --with-local-prefix=/opt/mipsel --with-native-system-header-dir=/opt/mipsel/include/ --disable-nls --disable-shared --enable-multilib --disable-decimal-float -disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath $ make $ sudo make install
- –enable-multilib - builds several variants of libraries (big-endian, little-endian hard-float and soft-float). Default is little-endian hard-float.
$ /opt/mipsel/bin/mipsel-gcc -print-multi-lib .; soft-float;@msoft-float eb;@EB soft-float/eb;@msoft-float@EB $
Stage 2 - deploy newlib
- build and install
$ cd ~/projects/gcc-mips/build-newlib-el $ ../newlib-1.20.0/configure --target=mipsel --prefix=/opt/mipsel $ make $ sudo make install
Stage 3 - deploy gcc with newlib suport
$ cd ~/projects/gcc-mips/build-gcc-el $ ../gcc-4.5.2/configure --target=mipsel --prefix=/opt/mipsel --with-gmp-include=/usr/include/gmp --with-mpfr-include=/usr/include/mpfr --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c --with-local-prefix=/opt/mipsel --with-native-system-header-dir=/opt/mipsel/include --disable-nls --disable-shared --enable-multilib --disable-decimal-float -disable-threads --disable-libmudflap --disable-libssp --disable-libgomp --disable-libquadmath $ make $ sudo make install