martedì 19 marzo 2013

ARM7 GNU Toolchain: GCC 4.3.3


Here are some updated (090615) informations for 4.3.3 GNU gcc arm-elf compilation; this time I want to rebuild the toolchain with strip dead code abilty enabled in newlib.
Please read the previous 4.2.2 compilation info before, because this is only an update.

ARM7 GNU Toolchain: GCC 4.3.3

Download all the archieves listed below in /home/your-home/gnu_arm_toolchain/

binutils-2.19.1.tar.bz2
gcc-4.3.3.tar.bz2
insight-6.8.tar.bz2
newlib-1.17.0.tar.gz


Then edit your/home/your-home/.bashrc file adding the following line:
export PATH=$PATH:/home/your-home/bin/arm-elf-newlib-4.3.3/bin

Open a console box, cd in the directory where you downloaded the archives and extract them:
tar -jxf binutils-2.19.1.tar.bz2
tar -jxf gcc-4.3.3.tar.bz2
tar -jxf insight-6.8.tar.bz2
tar -zxf newlib-1.17.0.tar.gz


I did a merge of the "t-arm-elf" file previously used for 4.2.2 toolchain and the one found in the gcc tree in /home/your-home/gnu_arm_toolchain/gcc-4.3.3/gcc/config/arm
You can find my own "t-arm-elf" file here. You have to rename it in "t-arm-elf" and copy it in ~/gcc-4.3.3/gcc/config/arm before use.

BINUTILS 2.19.1

cd binutils-2.19.1
./configure --target=arm-elf --prefix=/home/
your-home/bin/arm-elf-newlib-4.3.3 --enable-interwork --enable-multilib --with-float=soft
make all install
cd ..

GCC 4.3.3

Built into a separate directory than the sources (as suggested at http://gcc.gnu.org/install/configure.html)

mkdir gcc-4.3.3-obj
cd gcc-4.3.3-obj

../gcc-4.3.3/configure --target=arm-elf --prefix=/home/
your-home/bin/arm-elf-newlib-4.3.3 --enable-interwork --enable-multilib --with-float=soft --enable-languages="c,c++" --with-newlib --with-headers=/home/your-home/gnu_arm_toolchain/newlib-1.17.0/newlib/libc/include --disable-shared --with-gnu-as --with-gnu-ld

make all-gcc install-gcc
cd ..

NEWLIB 1.17.0

cd newlib-1.17.0
./configure --target=arm-elf --prefix=/home/
your-home/bin/arm-elf-newlib-4.3.3 --enable-interwork --enable-multilib --with-float=soft --disable-newlib-supplied-syscalls --with-gnu-ld --with-gnu-as --disable-shared

make CFLAGS_FOR_TARGET="-ffunction-sections -fdata-sections -DPREFER_SIZE_OVER_SPEED -D__OPTIMIZE_SIZE__ -Os -fomit-frame-pointer -D__BUFSIZ__=256"
make install
cd ..

GCC 4.3.3 Final

cd gcc-4.3.3-obj
make all install
cd ..

INSIGHT 6.8

cd insight-6.8
./configure --target=arm-elf --prefix=/home/
your-home/bin/arm-elf-newlib-4.3.3 --enable-interwork --enable-multilib --with-float=soft
make all install

Results

After compiling, I did a few test with some projects and I found that the 4.3.3 toolchain produce a slightly bigger (2% more) binary file than the previously used 4.2.2

Note: I know that some linux hosts (Ubuntu based, maybe) need to add the --disable-werror option to all the configure calls.

Note on the dead code stripping

In order to use dead code stripping you may have to update your linker files (.ld) adding an explicit reference to the start point, for example:
ENTRY(start)
You can find the start point symbol usually in your boot.s or crt0.s file, where are located the vector addresses.

Moreover, you must add in the linker file a deference for all the sectors with name:
        *(.text*)
        *(.rodata*)
        *(.glue_7t)
        *(.data*)
        *(.bss*)

References

http://openhardware.net/Embedded_ARM/Toolchain/
http://eluaproject.dreamhosters.com/en/Building_GCC_for_ARM

Nessun commento:

Posta un commento