Monday, March 22, 2010

ARM-Cortex cross compiler on MAC

Use MacPorts and add:
  • gmp (GNU multiple precision arithmetic library)
  • mpfr (C library for multiple-precision floating-point computations)
Download latest versions of gcc, binutils, and newlib. Note that GCC has to be of version 4.3 or newer to include support for newer Cortex CPU's.

$ cd binutils-2.20
$ mkdir build
$ cd build/
$ ../configure --target=arm-none-eabi --prefix=/opt/arm-none-eabi --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls --disable-werror
…
$ make -j2
…
$ sudo make install
…
$ cd ../..
$ PATH=/opt/arm-none-eabi/bin/:$PATH
$ cd gcc-4.4.3
$ mkdir build
$ cd build/
$ ../configure --with-libiconv-prefix=/opt/local --target=arm-none-eabi --prefix=/opt/arm-none-eabi --enable-interwork --enable-multilib --enable-languages="c" --with-newlib --without-headers --disable-shared --with-gnu-as --with-gnu-ld --with-gmp=/opt/local --with-mpfr=/opt/local --disable-werror
…
$ make -j2 all-gcc
…
$ sudo make install-gcc
…
$ cd ../..
$ cd newlib-1.18.0
$ mkdir build
$ cd build/
$ ../configure --target=arm-none-eabi --prefix=/opt/arm-none-eabi --enable-interwork --enable-multilib --with-gnu-as --with-gnu-ld --disable-nls
…
$ make -j2
…
$ sudo make install
…
$ cd ../..
$ cd gcc-4.4.3
$ cd build
$ ../configure --with-libiconv-prefix=/opt/local --target=arm-none-eabi --prefix=/opt/arm-none-eabi --enable-interwork --enable-multilib --enable-languages="c" --with-newlib --disable-shared --with-gnu-as --with-gnu-ld --with-gmp=/opt/local --with-mpfr=/opt/local --disable-werror
…
$ make
 -j2
…
$ sudo make install

…

No comments: