Main Page   Modules   Alphabetical List   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

Setting the Compiler Environment

The first decision that has to be made, is to select the development platform you want to use. The commercial ImageCraft Compiler offers an advanced IDE and is the first choice of most professional developers using a Windows PC. The GNU compiler AVR-GCC is available for Linux and Windows (WinAVR).

In order to start with your own Embedded Ethernet Application, take one of the samples like TCPS and add some modifications. Then recompile and link it with the Nut/OS library by using the prepared Makefile for the GNU compiler or simply press the "Build" button of the ImageCraft IDE. The ImageCraft IDE comes with an integrated tool to upload the resulting binary into your Ethernut Board. The GNU archive provides a command line utility named usip, which takes over this task. Also note, that Ethernut applications are linked to the Nut/OS operating system and its TCP/IP Stack. The resulting binary file contains all three parts, the application, Nut/OS and Nut/Net. The advantage is, that only those parts of the operating system are included, which your application really needs, leaving more room for application code.

The next chapters will provide more detailed instructions.

Configuring the Nut/OS Development for Linux.

Linux users are relieved of the burden choosing a compiler, but the installation is a bit different from the dumb click and clack being required under Windows.

There is no all round packet like WinAVR, you need collect all required parts first. These are

The next problem will arise, if your Linux system doesn't provide rpm support. The following steps had been tested on Redhat 9 and should work under Suse too. Different steps may be required for Debian.

To install the compiler, change to the directory where all packets have been downloaded to. When using the Ethernut Starter Kit, they are located on the CDROM. Then install the rpms. Note, that the filenames may differ, if you got newer releases.

 cd /cdrom/gnu-c/gcc_linux/
 rpm -Uvh \
 avr-binutils-2.13.90.030512-1.i386.rpm \
 avr-gcc-3.2.90.20030512-1.i386.rpm \
 avr-gcc-c++-3.2.90.20030512-1.i386.rpm \
 avr-libc-20030512cvs-1.i386.rpm \
 avr-libc-docs-20030512cvs-1.i386.rpm 

If not done previously you may install uisp now.

 cd /cdrom/tools/linux/
 tar -zxvf uisp-20030618.tar.gz -C ~/
 cd ~/uisp-20030618/
 ./configure
 make
 make install 

Finally install the Nut/OS and Nut/Net sources.

 cd /cdrom/ethernut/unix/
 tar -zxvf ethernut-3.3.2.tar.gz -C ~/
 cd ~/ethernut-3.3.2/nut/
 ./configure 

The configure script will guide you through the final steps, selecting the right CPU and the type of your programming adapter.

You may now rebuild the Nut/OS libraries by entering

 make clean
 make install 

This step should be passed without any errors or even warning. If not, you may have used the wrong compiler or library version.

Now you can check, if you are able to compile the http daemon sample and upload the resulting binary to your Ethernut board.

 cd app/httpd/
 make burn 

Configuring the Nut/OS Development for Windows.

After having choosen the compiler, you are ready to configure the development environment. You should have installed your compiler and Nut/OS. Open a command line window (DOS window) and change to the Nut/OS installation directory.

Now you need to set the correct path to the subdirectory, where all the binaries of your compiler are installed.

For ICCAVR you may enter something like

 SET PATH=C:\icc\bin;%PATH% 

The typical WinAVR installation may require

 SET PATH=C:\WinAVR\bin;C:\WinAVR\utils\bin;%PATH% 

Next enter

 nutconf 

which will start the configuration tool. Again select the right compiler, the type of CPU and the programming adapter you are using and press the Configure button. Confirm to rebuild the libraries. Nut/OS comes with ready build libraries, but when using ICCAVR, these libraries need to be copied to the compiler's lib directory. For AVRGCC there's no need to rebuild them, but it didn't hurt.

If you want to change the compiler or in case you modified any part of the system, you can call nutconf again later to change your settings and create a new library version.

Using the ImageCraft IDE.

The ImageCraft IDE should be used for your application code only. Compiling the Nut/OS libraries requires a command line environment (see next section).

Executing nutconf as described above copies all Nut/OS libraries to the ImageCraft library directory.

Before creating Nut/OS applications, you have to enter some special settings in the ImageCraft Project. On the first page of the Compiler Options Dialog you need to add the Nut/OS include file path. Note, that the path of your ImageCraft directory may differ.

 ..\..\include\;C:\icc\include\ 

On the second page the macro define

  _MCU_enhanced 

has to be added if you are developing for the ATmega128.

On the last page you must add the following additional libs.

 nutpro nutnet nutfs nutos nutdev nutcrt 

On the same page enter

 -ucrtnut.o c:\icc\lib\nutinit.o 

in the field named Other Options. Again, your path to the ImageCraft directory may differ. Please refer to the ICCAVR Online Manuals for further assistance.

Command Line Environment for ICCAVR

In case you avoid IDEs in general or if you want to make your own modifications to Nut/OS libraries, then you must use a shell, also known as the DOS window or command line.

Change to the Nut/OS installation directory and make sure, that your PATH includes the ICCAVR bin directory.

To rebuild the complete library, enter

 make clean 

followed by

 make install 

All Nut/OS and Nut/Net libraries should compile and link without problem and will be copied to the Nut/OS lib directory. The configure tool will then copy these libraries to the ImageCraft lib directory.

Get yourself familiar with the GNU make utility.

Most applications written for AVR-GCC will not run properly when compiled by ICCAVR. Specifically the macro PSTR() will not work with ICCAVR. For porting, refer to the samples in subdirectory appicc.

Command Line Environment for WinAVR

Open a shell and change to the directory, which contains your application source code. Make sure, that your PATH includes the AVRGCC bin directory. WinAVR users must include two directories in their path.

 SET PATH=C:\WinAVR\bin;C:\WinAVR\utils\bin;%PATH% 

To build you application's hex file, simply enter

 make 

If you are using uisp for uploading the hex file to the target system, you can enter

 make burn 

This will build your application and, if successful, automatically program your target.

To rebuild the complete Nut/OS library, change to the Nut/OS installation directory and enter

 make clean 

followed by

 make install 

If successful, the new libraries will be copied to the Nut/OS lib directory.


© 2000-2003 by egnite Software GmbH - visit http://www.ethernut.de/