Toolchain for ARM Cortex M3 on Ubuntu 10.04

This tutorial is based on a German article. Please note, that I had to install various packages on my Ubuntu workstation.

sudo apt-get install texi2html make-doc texinfo bison flex byacc libgmpada1-dev gnat-4.4 gnat-4.4-base libgmpada1 libgnat-4.4 libgnatprj4.4 libgnatvsn4.4  sudo apt-get install libmpfr-dev libmpc-dev libgmp3-dev libgmpxx4ldbl libmpc2

Get the latest binutils (password is anoncvs)

cd ~/repo/binutils
cvs -z 9 -d login
cvs -z 9 -d co binutils

Compile binutils

cd ~/repo/binutils/src
./configure --prefix=/usr/local/toolchain --target=arm-elf
make all
sudo make install

I ran into some errors “XY has changed since the previous run:” and was not able to fix it. Neither make clean nor make distclean were of any help. However, a clean checkout from the CVS did the trick. Looks like the Makefile is broken.

Get the latest gcc from the repository

cd ~/repo/gcc
svn checkout svn://

Get the latest newlib (password is anoncvs)

cd ~/repo/newlib
cvs -z 9 -d login
cvs -z 9 -d co newlib

Lets’ compile a bootstrap gcc. Please mind, we actually do not compile gcc within the src or trunk folder. It does not seem to like it.

cd ~/repo/gcc/trunk
ln -s ~/repo/newlib/src/newlib newlib
ln -s ~/repo/newlib/src/libgloss libgloss

mkdir -p ~/repo/gcc/build
cd ~/repo/gcc/build
../trunk/configure --target=arm-elf --enable-languages=c --disable-nls --disable-shared --disable-threads --with-newlib --prefix=/usr/local/toolchain --with-gnu-as --with-gnu-ld --disable-multilib --disable-libssp --disable-libmudflap --disable-libgomp --with-dwarf2 --with-newlib -v --disable-werror --with-cpu=cortex-m3 --with-tune=cortex-m3 --with-mode=thumb --enable-target-optspace --with-float=soft --enable-languages=c,c++ --without-headers --with-local-prefix=/usr/local/toolchain/arm-elf


make all-gcc

Go get a coffe… it will take some time. Afterwards, install gcc within the toolchain folder.

sudo make install-gcc
export PATH=$PATH:/usr/local/toolchain/bin
gcc-arm-elf --version

You hopefully got the version displayed. Let’s compile newlib

cd ~/repo/newlib/src
./configure --with-newlib --disable-newlib-io-float --disable-newlib-supplied-syscalls --prefix=/usr/local/toolchain --target=arm-elf
make all
sudo PATH=$PATH:/usr/local/toolchain/bin make install

Finally go back to gcc and continue make

cd ~/repo/gcc/build
make all
sudo make install

I ran into troubles during “make all”. The gcc trunk does have an issue with lib1funcs.asm which breaks the build process. However, the mail archive on gcc and the gcc bugzilla led me to the right patch

Hope, this would be of help for some other embedded freaks


A resume issue is chasing me since I upgraded to Ubuntu 10.04

The machine is not properly resuming since I upgraded to Ubuntu 10.04. Folks seem to have the same issue but it always takes me an hour to get the right fix from the Ubuntu forums. Therfore, my personal entry.

It looks like the new kernels have an issue with old Radeon or ATI graphics cards such as those built into the IBM Thinkpad R50 or R51. However, adding a simple “nomodeset” to /boot/grub/menu.lst does the trick.

title Ubuntu 10.04.1 LTS, kernel 2.6.32-25-generic root (hd0,0)
kernel /boot/vmlinuz-2.6.32-25-generic ... nomodeset
initrd /boot/initrd.img-2.6.32-25-generic quiet