The last 3 years I have been chief architect and developer of an advanced weather radar network for the baltic sea region called baltrad (
Finally we have released 1.0 of the baltrad software and it seems like we managed to produce a decently stable release even though we did quite a few huge changes in the end. It still has a number of issues but we have had it running for a couple of months now without any big surprises. You can find the software here or
Posted in baltrad, weather radar | Comments Off

LPC2478 Hello World

It is time to setup the basic development environment so that it is possible to compile a simple hello world program. The Olimex LPC2478 stk comes with a cdrom containing most of the necessary software but if you feel like experimenting you can always find other versions at Snapgear or uClinux.

You will need to extract two different tar balls, either the ones provided on the cdrom or else by downloading them. When writing this post, I tried to use arm-linux-tools-20080623.tar.gz to build uClinux but ran into some unexpected behaviours. The objcopy generated extremly large vmlinux.bin files so if this happens, try the provided arm tools instead (arm-linux-tools-20061213.tar.gz).
NOTE: The uClinix dist delivered with the olimex board comes patched so it might be a good idea using it initially.

I assume that the development environment should be placed under /opt/arm so let’s start by creating that directory.
%> mkdir /opt/arm
%> cd /opt/arm

Extract the necessary tarballs.
%> tar -xvzf .../Utils/arm-linux-tools-20061213.tar.gz
%> tar -xvzf .../uClinux/uClinux-dist-lpc_2478_stk-20081007.tgz

For some reason, genromfs was not included with the tools chain delivered with the Olimex development board so if you can’t locate it, fetch it and build it like this.

%> wget
%> tar -xvzf genromfs-0.5.1.tar.gz
%> cd genromfs-0.5.1
%> make
%> cd ..

Before building uClinux we need to setup the PATH,
%> export PATH=/opt/arm/usr/local/bin:/opt/arm/genromfs-0.5.1:$PATH
%> cd uClinux-dist-lpc_2478_stk

and clean it before building.

%> make distclean
%> \rm -f tools/ucfront-g++
%> \rm -f tools/ucfront-gcc
%> \rm -f tools/ucfront-ld
%> \rm -f tools/cksum

Finally, it is time to build uClinux.
%> make menuconfig


Menu config

Now, just set Vendor/Product to NXP/LPC2468 by choosing Vendor/Product Selection —> Vendor -> NXP. LPC2468 will automatically be choosen since it is the only alternative.

NXP and LPC2468

NXP and LPC2468

Select Exit->Exit->Yes.

%> make dep
%> make

Hopefully everything went well and you probably have got a couple of images directly under the subdirectory images. Most likely romfs_5.img and vmlinux.bin. We need to add the uClinux tools directory to our path as well.
%> export PATH=/opt/arm/uClinux-dist-lpc_2478_stk/tools:$PATH

The new image files that we have created might be a good idea to use so you probably should copy them to tftps home catalogue so that you can boot from them instead.
%> cp images/romfs_5.img /home/tftp/romfs_new.img
%> cp images/vmlinux.bin /home/tftp/vmlinux_new.bin

Finally it is time to create our hello world program and the associated makefile for building it. Create some work directory, like /projects/Olimex/HelloWorld.

Create helloworld.c and the Makefile (or download them from here).

#include <stdio.h>
int main(int argc, char** argv) {
printf("\r\nHello world!\r\n");
return 0;

and create the Makefile

CC=ucfront-gcc arm-linux-gcc
LD=ucfront-gcc arm-linux-gcc

CFLAGS=-msoft-float -D__PIC__ -fpic -msingle-pic-base -Dlinux -D__linux__ -Dunix -D__uClinux__
LDFLAGS=-Wl,--fatal-warnings -Wl,-elf2flt -msoft-float -L/opt/arm/uClinux-dist-lpc_2478_stk/uClibc/lib

all: $(TARGET)

%.o : %.c
 $(CC) $(CFLAGS) -c $<

 $(LD) $(LDFLAGS) -o $@ $(OBJECTS) -lc

 \rm -f *.o
 \rm -f *~

Remember that Makefiles are very obnoxious when it comes to whitespacing, all commands must start with a tab character and not spaces so if you get an error about missing separator, check that line if it contains leading spaces instead of a tab.

Try compiling the hello world application.
%> make

Hopefully the output will look something like this:

ucfront-gcc arm-linux-gcc -msoft-float -D__PIC__ -fpic -msingle-pic-base -Dlinux -D__linux__ -Dunix -D__uClinux__ -c helloworld.c
ucfront-gcc arm-linux-gcc -Wl,--fatal-warnings -Wl,-elf2flt -msoft-float -L/opt/arm/uClinux-dist-lpc_2478_stk/uClibc/lib -o helloworld helloworld.o -lc

Since we are going to use tftp to get the helloworld application to the dev-board, copy the program to tftps home directory.
%> cp helloworld /home/tftp/

Let’s try to get it over to our development board, so first we need to do a short recap on what was done in “Getting started with Olimex LPC2478″ but the short version is:

  • Connect ethernet and rs232 cable to development board
  • Write ‘picocom -b 115200 /dev/ttyUSB0′ in a terminal
  • Add power to the development board and hit any key while beeing in the picocom terminal within 3 seconds.
  • tftpboot 0xa0800000
  • tftpboot 0xa0008000
  • go a0008000

Since we are going to use tftp to get helloworld to the development board we need to start the eth0.
# /sbin/ifconfig eth0 up

You can test if ethernet is working by typing
# ping -c 1

Almost everything is read only so change directory to /var and fetch the helloworld application from the tftp server
# cd /var
# tftp -g -r helloworld
# chmod +x helloworld
# ./helloworld

Hello world!

That’s about it.

As I wrote previously, I had some problems with the tools chain and extremely large images. I still haven’t figured out why it occured and I can not find any bug reported on objcopy but this is how it looked when listing the size.
%> ls -la images/
-rw-r--r-- 1 anders anders 2686629728 2011-02-13 19:53 vmlinux.bin

As you can see, vmlinux.bin is quite huge.

Another odd problem I had when writing this post was that printf only sent garbage characters to the console. After a lot of searching I found out that the CFLAGS in the Makefile needed -D__PIC__ -fpic -msingle-pic-base.

Posted in LPC2478 | Comments Off

Getting started with Olimex LPC2478

Have you ever wanted to develop your first embedded application but always felt that the initial work assembling a complete development board would take too long time or just felt that it isn’t your cup of tea. Then you maybe should take a look at the Olimex LPC2478 development board.

The Olimex LPC2478 development board is fully packed with nice features and it even has a nice steel cover and it is quite easy to get it up and running.

You will need the following items.

  • Olimex LPC2478 development board (obviously)
  • A transformator (I use a 12V DC)
  • Null modem cable (and probably an USB to RS232 adaptor)
Olimex 2478

Since the development board does not have sufficient non-volatile memory it is necessary to transfer the uClinix kernel and file system from an external resource every time the system is started. There are quite a few ways to do that but for now we will just do it over the network to get an easy start.

We will need to setup the development environment somewhat before we do anything else, my examples will be for ubuntu but it shouldn’t be much different to do it in other linuxes.

TFTP server

We are going to use the tftpboot method on the development board so we will have to install a tftp server.

# Install necessary packages
%> sudo apt-get install xinetd tftpd tftp
# Create some directory to store the boot images in
%> sudo mkdir /home/tftp
# Copy the images from the olimex CD to the tftp directory
%> sudo cp /media/cdrom0/Images/romfs_5.img /home/tftp/
%> sudo cp /media/cdrom0/Images/vmlinux.bin /home/tftp/
%> sudo chmod -R a+rwx /home/tftp
%> sudo chown -R nobody /home/tftp
# Create the tftp xinetd file
%> cat <<EOF > /tmp/dummytftp
service tftp {
socket_type = dgram
protocol = udp
wait = yes
user = nobody
server = /usr/sbin/in.tftpd
server_args = /home/tftp
disable = no
%> sudo cp /tmp/dummytftp /etc/xinetd.d/tftp
%> sudo /etc/init.d/xinetd restart


We will have to communicate with the development board through a serial terminal so let’s install picocom.

%> sudo apt-get install picocom

  1. Connect null modem cable between PC and LPC2478
  2. Connect a ethernet cable to the LPC2478
  3. Run ‘picocom -b 115200 /dev/ttyUSB0′ in a terminal
  4. Add power to LPC2478
  5. Within 3 seconds hit any key in the active picocom terminal.

If everything looks like

u booted

you are still on track and it is time to load the images. You will have to figure out if the preset network parameters that are in the olimex development board will work with your network or not. The preset network information is / I am using 192.168.1.X network and have quite a lot of reserved addresses so I will use the following configuration.

  • Olimex development board ip address:
  • Gateway:
  • Tftp server ip address:

Now we should just store a couple of environment variables in the flash memory on the LPC2478.

lpc-2478-stk # setenv serverip
lpc-2478-stk # setenv ipaddr
lpc-2478-stk # setenv gatewayip
lpc-2478-stk # saveenv

First we load the file system and then the kernel.

lpc-2478-stk # tftpboot 0xa0800000
lpc-2478-stk # tftpboot 0xa0008000

The result will hopefully look like this

images loaded

Finally we hope that everything will boot.

lpc-2478-stk # go a0008000

uClinux loaded

The display will look something like

System booted

That’s it, you have got a running uClinux and you got the world at your feets…

I will post more posts about the olimex development board in the future so drop in now and then.

Posted in LPC2478 | Comments Off


Finally I have had the time to setup the site for my company. In the future various technical related posts will be posted here but now the standard sell pitch.

With a solid track record in software development I can offer you assistance in several areas. I have more than 15 years of experience in software development, mostly C, Python and Java in various unices. Seven years has been in the mobile industry where half of the time was the service provisioning side and the other half was handset development. Six years has been various research and development projects in nowcasting systems.

Posted in Uncategorized | Comments Off