This is my new playground: it’s an NXP LPC2148 development board from Futurlec and quite a nice one with the only missing part being Ethernet, but USB is ok too. The best part about their microcontroller boards are the additional miniboards they have like this or those or that which all can be connected without soldering.
They provide a CD with some sample programs, the most important one is a demo program which connects to a Windows machine and let you light LEDs, push buttons, make sound etc. A good test to make sure everything works fine.
Everything worked fine.
Now the next step is to build gcc/gdb and have a program which can download to the flash memory of the LPC2148.
Toolchain:
binutils 2.18, gcc 4.2.3, newlib 1.16, gdb 6.71, insight 6.1
Get them all and untar them.
binutils:
mkdir build-binutils
cd build-binutils
../binutils-2.18/configure --target=arm-elf
make
sudo make install
Make a simple gcc for compiling newlib:
mkdir build-gcc
cd build-gcc
cp -r ../newlib-1.16.0/newlib .
cp -r ../newlib-1.16.0/libgloss .
../gcc-4.2.3/configure --target=arm-elf --with-gnu-as --with-gnu-ld --with-newlib --enable-languages=c --disable-libssp
make
sudo make install
newlib:
mkdir build-newlib
.../newlib-1.16.0/configure --target=arm-elf
make
sudo make install
So far I can compile C into ARM assembler and object code and it can link it too, but the resulting code includes some rather large library stuff.
A sample program like this non-sensical one:
int main() { int i, j; int *mem=0x12345678; for (i=*mem, j=0; i<100; ++i) { if (i & 0x0001) { j+=i; } else { j+=j*2; } } return j; }
compiles into a 148kByte a.out via
arm-elf-gcc test.c
Obviously there is still something to be optimized.
GDB and Insight follow.
UPDATE: CodeSourcery is working on GCC in partnership with ARM (see http://www.codesourcery.com/gnu_toolchains/arm) and thus I’ll simply use that tested GNU toolchain.
UPDATE2:See here for why I use now a self compiled gcc again.