Elektor Internet Radio

Development Environment on Linux

Requirenments

Some essential tools are required to build the binaries. The following commands can be used on Debian / Ubuntu, to make sure that these tools are available:

$ sudo apt-get install build-essential
$ sudo apt-get install automake
$ sudo apt-get install autoconf

Installing wxWidgets

Currently the GUI of Nut/OS Configurator has still problems with GTK. To avoid them, we will use the command line version in this tutorial. Because of that, the installation of wxWidgets is not mandatory, but still recommended to create another GUI tool, the Nut/OS Discoverer. At least wxWidgets version 2.8 is required.

Use the following command to install wxWidgets.

$ sudo apt-get install libwxgtk2.8-0 libwxgtk2.8-dev wx2.8-headers wx-common

Installing Lua

Note, that we use Lua version 5.0. Whether any later version may work hasn't been tested yet.

The following command installs the necessary packages:

$ sudo apt-get install lua50 liblua50 liblua50-dev liblualib50 liblualib50-dev

Installing Doxygen and GraphViz

These packages are only needed to create the API documentation and can be left out. To install them, use:

$ apt-get install doxygen doxygen-doc graphviz

Installing GNU arm-elf toolchain

Unfortunatly, recent binary packages are rare. The following instructions are kept brief and may not lead to success. You will probably find more detailed instructions or complete installations in the web.

At best, create a new folder first and change to it:

$ mkdir toolchain
$ cd toolchain

Now get the required source packages. You can find them in the CD folder tools/unix as well.

$ wget ftp://gcc.gnu.org/pub/binutils/releases/binutils-2.18.tar.bz2
$ wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.2.2/gcc-core-4.2.2.tar.bz2
$ wget ftp://gcc.gnu.org/pub/gcc/releases/gcc-4.2.2/gcc-g++-4.2.2.tar.bz2
$ wget ftp://sources.redhat.com/pub/newlib/newlib-1.16.0.tar.gz

Unpack the packages with:

$ tar -xjf binutils-2.18.tar.bz2
$ tar -xjf gcc-core-4.2.2.tar.bz2
$ tar -xjf gcc-g++-4.2.2.tar.bz2
$ tar -xzf newlib-1.16.0.tar.gz

Now we set two useful environment variables and create a bin/ folder in advance, which we add to the PATH variable:

$ export target=arm-elf
$ export prefix=/usr/local/$target
$ sudo mkdir -p $prefix/bin
$ export PATH=$prefix/bin:$PATH

Start with installing the binutils:

$ cd binutils-2.18
$ mkdir build-$target
$ cd build-$target/
$ ../configure --target=$target --prefix=$prefix --enable-interwork --enable-multilib \
    --disable-nls --disable-shared --disable-threads --with-gcc --with-gnu-as --with-gnu-ld
$ make
$ sudo make install
$ cd ../..

Next, create a so called bootstrap compiler:

$ cd gcc-4.2.2
$ mkdir build-$target
$ cd build-$target/
$ sudo ../configure --target=$target --prefix=$prefix \
    --disable-nls --disable-shared --disable-threads \
    --with-gcc --with-gnu-ld --with-gnu-as --with-dwarf2 \
    --enable-languages=c,c++ --enable-interwork \
    --enable-multilib --with-newlib \
    --with-headers=../../newlib-1.16.0/newlib/libc/include \
    --disable-libssp --disable-libstdcxx-pch \
    --disable-libmudflap --disable-libgomp -v
$ mkdir -p libiberty libcpp fixincludes    
$ make all-gcc
$ sudo make install-gcc
$ cd ../..

With this compiler you can create the runtime library:

$ cd newlib-1.16.0
$ mkdir build-$target
$ cd build-$target/
$ ../configure --target=$target --prefix=$prefix --enable-interwork --enable-multilib
$ make
$ sudo make install
$ cd ../..

In a last step we create the final cross-compiler:

$ cd gcc-4.2.2/build-$target
$ make
$ sudo make install
$ cd ../..

Installing Nut/OS

The Nut/OS Source Code Package is in the CD folder firmware/.

»ethernut-4.5.2.tar.bz2

To keep it simple, create a folder ethernut in your home directory. Copy the package to this directory, then unpack, configure and install it. It's highly recommended to use a symbolic link to the source code directory, as shown below.

$ tar xjf ethernut-4.5.2.tar.bz2
$ ln -s ethernut-4.5.2 nut
$ cd nut/
$ ./configure
$ make
$ sudo make install
$ cd ..

Configuring Nut/OS

If you built the GUI version of the Nut/OS Configurator, you may try it now by following the instructions

»Installing on Windows.

As mentiond before, there are still problems with this GUI on Linux/GTK and we will use the commandline version here.

$ nutconfigure -bnutbld -cnut/conf/eir10b.conf -lnutbld/lib \
  -marm-gcc create-buildtree

Building the Nut/OS Libraries

Change to the build directory and create the libraries with:

$ cd nutbld/
$ make clean
$ make install
$ cd ..

Installing the Webradio Source Code

You now can create an application sample directory with the Nut/OS Configurator:

$ nutconfigure -anutapp -bnutbld -cnut/conf/eir10b.conf \
  -lnutbld/lib -marm-gcc create-apptree
$ echo "# Elektor Internet Radio" >nutapp/UserConf.mk  

When done, unpack the source code of the webradio application in the newly created directory nutapp/.

»webradio-1.2.0.zip

Building the Webradio Firmware

Change to the directory nutapp/webradio and enter the following commands:

> make clean
> make install

The latter will build the firmware binary webradio.bin and copy it to nut/bin/arm7tdmi within the Nut/OS installation directory. You need to run these two commands each time after modifying the source code.

Copyright 2008 egnite GmbH