Ethernut 3.0 E

From Nutwiki
Jump to: navigation, search
Ethernut 3.0 E

Test Environments

Board Nut/OS YAGARTO Tera Term TFTP32
3.0 E 2.6.4 20080928 4.61 3.28


On this page you will learn how to setup an Ethernet 3.0 development and testing environment.

You will learn the easiest way on how to use the examples from nutwiki and your own applications. This Guide is not supposed to be a complete manual but as a Quick Start Guide, teaching one of the many methods to get an application running on your Ethernut board.

Immediatly after working through this document, you have the competence to test the examples featured by nutwiki.


  1. 16px Screencast Part 1 The Nut/OS Configurator
  2. 16px Screencast Part 2 Preparations
  3. 16px Screencast Part 3 Compiling the source code
  4. 16px Screencast Part 4 Utilizing the bootloader
  5. 16px Screencast Part 5 Serial Communications / TeraTerm

24px Required Tools for Windows


Of course you need the latest version of Nut/OS.

Visit this page to download the latest version for Win32:

Nut/OS for Windows features an installer which will do most of the work for you.

It is recommended to install the ethernut folder directly on the root directory:

24px C:/ethernut-4.6.4/ 

Note: All paths in this guide refer to that location!

Tera Term

Tera Term is a so called terminal emulator. We use it to communicate via COM with the board.



WinAVR is a very fast, self-contained GCC toolchain for ARM for Windows.

It includes Binutils, Newlib, GCC compiler, and the Insight debugger.

An installation guide can be found here


It is recommended to install the YAGARTO folder directly on the root directory:

24px C:/yagarto/

Note: All paths in this guide refer to that location!


TFTP32 is an opensource TFTP Server. We will use this protocol, to upload our apllications to the Ethernut 3.0 via Ethernet in just a few seconds.

Download :

Text Editor

You can use any text editor you want. Some recommended ones include:

24px Required Tools for Linux

Essential Tools

The following GNU tools are required to configure and build a minimal Nut/OS development environment:

  • C compiler 4.1 or later
  • Binutils 2.18 or later
  • Autoconf 2.61
  • Automake 1.10

ARM-ELF cross toolchain

Furthermore, you need a so called cross toolchain, which allows us to create binaries on a Linux host, which will later run on our target board. When developing for 8-bit AVR, we need

  • GNU Compiler Collection for ARM-ELF
  • GNU Binary Utilities for ARM-ELF
  • newlib C library


wxWidgets is a cross-platform C++ GUI framework, required for Nut/OS configurator GUI.


Lua is an embeddable scripting language, which is used here to specify the configuration rules. This is also required for Nut/OS configurator to run.


Of course you need the latest version of Nut/OS.

Visit this page to download the latest source code package for Linux (Debian):

It is recommended to install the ethernut folder directly in your home directory:

24px $ ~/ethernut-4.6.4/ 

Note: All paths in this guide refer to that location and will be referred to as "ethernut folder/directory" or "/ethernut-4.6.4"


Minicom is a so called terminal emulator. We use it to communicate via COM with the board.

The Nut/OS Configurator

64px Screencast Part 1

In order to build an optimized Nut/OS for you needs you have to configure one.

In some examples from nutwiki you are asked to setup something in the Nut/OS configurator. This is the time and place to do so.

In general the workflow is as following:

1. Start the Nut/OS Configurator:

24px C:\ethernut-4.6.4\nutconf.exe

2. Select and open the configuration file:

24px C:\ethernut-4.6.4\nut\conf\ethernut30e.conf

3. Click on Menubar: Edit > Settings

  • Goto Tab: Build
    • Choose Platform: arm-gcc
    • Choose Build Directory: nutbld_30e
  • Goto Tab: Tools
    • Enter Tool Paths: c:\ethernut-4.6.4\nut\tools\win32;c:\yagarto\bin;
      (Do not forget the last semicolon and modify paths if you used other locations as described above.)
  • Goto Tab: Samples
    • Choose Application Directory: nutapp_30e
    • Choose Programmer: arm-jom
  • Click OK

4. In the Nut/OS Components tree (left)

  • Expand Tools
    • Expand GCC Settings
      • Click on ARM Linker Script
        • Choose 'at91_ram' from the dropdown menu.

By choosing the Linker Script, you specify, in which kind of memory your application will run. We are using 'at91ram' here, because we are going to upload the
application via the Bootloader directly into RAM and run it in there.

5. Click on Menubar: Build > Build Nut/OS

  • Say OK 2 times.

6. Click on Menubar: Build > Create Sample Directory

  • Say OK

Note: You should create a new sample directory every time you build a new system, even if you do not want to use the samples. There are two files named

  • Makerules
  • Makedefs

in that directory, that are necessary for every application to compile.

Nut/OS Configurator built a customized version for your needs and put it in:

24px C:\ethernut-4.6.4\nutbld_30e\

Additionally it created an Sample Application Directory with source codes ready to compile:

24px C:\ethernut-4.6.4\nutapp_30e\


64px Screencast Part 2

Application Directory

First of all we need a home for our application.

Create a new directory "testcode" in

24px C:\ethernut-4.6.4\nutapp_30e\

You can, of course, use any names you want.


1. Write your application code, or for testing purposes, paste in an example code from nutwiki in a plain text file.

2. Save it as testcode.c in:

24px C:\ethernut-4.6.4\nutapp_30e\testcode\

Note: Make sure, that in your Windows folder options, the setting 'Hide file extensions for unknown file types' is deactivated! If not, you will create .txt files instead of .c or Makefiles, when saving in the Editor!


For our applications to compile, we need a makefile.

This is used and interpreted by a tool called GNU Make, which we will use later.

Makefiles may differ from application to application, but the following is a general purpose one, which will work for basic applications.
Later, when you are familiar with Nut/OS and makefiles you can create your own ones.

Note, that in this example makefile, the project name, <source lang="text"> PROJ = testcode </source> has to be identical to the name of your application's .c file!

<source lang="text"> PROJ = testcode

include ../Makedefs

SRCS = $(PROJ).c OBJS = $(SRCS:.c=.o) LIBS = $(LIBDIR)/nutinit.o -lnutpro -lnutos -lnutarch -lnutdev -lnutarch -lnutnet -lnutfs -lnutcrt TARG = $(PROJ).hex PARM = $(PROJ).eep

all: $(OBJS) $(TARG) $(ITARG) $(DTARG)

include ../Makerules

clean: -rm -f $(OBJS) -rm -f $(TARG) $(ITARG) $(DTARG) -rm -f $(PROJ).eep -rm -f $(PROJ).obj -rm -f $(PROJ).map -rm -f $(SRCS:.c=.lst) -rm -f $(SRCS:.c=.bak) -rm -f $(SRCS:.c=.i) </source> Note, when copy and pasting the above Makefile: the spaces before -rm... have to be tabs instead of normal spaces!

Create a plain text file and paste in the code above.

Call it Makefile (Without any file extension) and save it to:

24px C:\ethernut-4.6.4\nutapp_30e\testcode\

Configuration Files

The files

  • Makedefs
  • Makerules


24px C:\ethernut-4.6.4\nutapp_30e\

are essential. By building a new Nut/OS and a new sample directory (nutapp_30e) these files get updated. Your application directory (testcode) will remain untouched.

(If you used different paths, note, that the configuration files have to be located in the top directory of the apllication directory.)

Note: You have to build a new sample directory and move 'Makedefs' and 'Makerules' to your application's parent directory (if your app directory is not already a subfolder of "nutapp_30e" as recommended) every time you build a new Nut/OS!

Path environment

Every command line session has its own PATH variable.

Applications like GNU Make look up paths in that variable.

We need to add to the path variable our tools:


To do so, we could enter in the command line prompt:

SET PATH=c:/ethernut-4.6.4/nut/tools/win32;c:/yagarto/bin;%PATH%

(The %PATH% at the end appends the original content of the PATH variable to the newly set.
By leaving that out the PATH gets overwritten.)

Because every time you close the command line prompt your PATH variable gets lost,
there is a better way to handle it.

1. Create a plain text file and enter:

SET PATH=c:/ethernut-4.6.4/nut/tools/win32;c:/yagarto/bin;%PATH%

2. Name it ARM.bat and save it to:

24px C:\ethernut-4.6.4\nutapp_30e\testcode\

This is called a Batch file.
Everytime you type in ARM in the testcode directory now, the PATH variable gets set.
You have to execute ARM every time after you open a new command line window.
If you do not, GNU Make will not find the tools.


To connect your Ethernut 3.0

  • Connect Ethernut`s DB-9 RS232 port to an available COM port using the serial cable.
  • Use one twisted pair cable to connect Ethernut's RJ-45 connector to the hub / switch / router and the other twisted pair cable to connect the hub / switch / router with the

network adapter in the PC. If you are not using a hub or switch, then directly connect the Ethernut board with the PC’s network adapter using a twisted pair cross cable.

  • Connect the power supply to the barrel connector on the Ethernut board. The

Ethernut board is equipped with its own rectifier bridge and voltage regulator. Therefore the polarity of the barrel connector isn't important.

  • Apply power to the Ethernut board by connecting the power supply to an

electrical outlet. When the board is powered up, the red power LED should go on.

For further details have a look at the Hardware Manual

Compiling and Using the Bootloader

Basically, the workflow is as following.

  1. Compiling the source code.
  2. Setting up a TFTP server, which 'serves' with all files in a certain directory on your computer.
  3. Utilizing the Bootloader, to connect via LAN to the TFTP Server on your computer and download the binaries from there.

64px Screencast Part 3 64px Screencast Part 4


1. Open a command line window.

2. Change to

24px C:\ethernut-4.6.4\nutapp_30e\testcode\

3. Enter:

24px SET PATH=c:/ethernut-4.6.4/nut/tools/win32;c:/yagarto/bin;%PATH%


24px ARM

if you are using a batch file.

4. Enter:

make clean

This tells "Make" to clean up the directory with respect to the rules made in the Makefile

You should get something like:

rm -f testcode.o
rm -f testcode.hex testcode.bin testcode.elf
rm -f testcode.eep
rm -f testcode.obj
rm -f
rm -f testcode.lst
rm -f testcode.bak
rm -f testcode.i

If not, you maybe left out step 3.

5. Enter:

make install

This should get you something like:

arm-elf-gcc -c -mcpu=arm7tdmi -Os -mthumb-interwork -fomit-frame-pointer
-Wall -Wstrict-prototypes -fverbose-asm -Wa,-ahlms=testcode.lst 
-DETHERNUT3 -I../../nutbld_30e/include  -I../../nut/include  testcode.c -o  testcode.o
testcode.c: In function 'main':
testcode.c:11: warning: implicit declaration of function '_ioctl'
arm-elf-gcc testcode.o -mcpu=arm7tdmi -nostartfiles 
-T../../nut/arch/arm/ldscripts/at91_ram.ld -Wl,,--cref,
--no-warn-mismatch -L../../nutbld_30e/lib -Wl,--start-group ../../nutbld_30e/lib/nutinit.o 
-lnutpro -lnutos -lnutarch -lnutdev -lnutarch -lnutnet -lnutfs -lnutcrt  
-Wl,--end-group -o testcode.elf
arm-elf-objcopy -O ihex testcode.elf testcode.hex
arm-elf-objcopy -O binary testcode.elf testcode.bin
cp testcode.hex ../../nut/bin/arm7tdmi/testcode.hex
cp testcode.bin ../../nut/bin/arm7tdmi/testcode.bin

This command compiled the source code and generated the binary files beside some other files in

24px C:\ethernut-4.6.4\nutapp_30e\testcode\

What it also did is to copy the .hex and .bin files to

24px C:\ethernut-4.6.4\nut\bin\arm7tdmi

This is the location from where the bootloader will download the binaries, as you will see in the next step.

Setting up the TFTP Server

1. Launch TFTP32

2. For the Current Directory browse to

24px C:\ethernut-4.6.4\nut\bin\arm7tdmi

this is the directory, the TFTP Server will serve with.

3. The Server interface field is set to your computers network IP.

4. That was it. Don't close the window.

Using the Bootloader

1. Start TeraTerm or any other serial communications tool.

2. Configure TeraTerm with the follwing settings:

  • Menubar > Setup > Serial port...
    • Baud rate: 115200
    • Data: 8Bit
    • Parity: None
    • Stop: 1bit
    • Flow control: none
    • Transmit delay: 0;0

3. In the main window: Hold down the space bar -> Push the reset switch on your Ethernut 3.0 -> Release space bar

4. Now you should see the output of 'BootMon', the Bootloader.

To be exact, this is the configuration mode of BootMon.

To configurate BootMon, just type in the information and press Enter to proceed to the next field.

If you leave a field blank and press Enter, the last setting (displayed in brackets) will be used.

  • MAC Adress: Leave blank > Enter
  • IP Adress: This is the IP adress of the board. Use a free IP of your network, or type in to use DHCP. > Enter
  • Net Mask: for most cases. Generally the same as your computer's > Enter
  • TFTP Adress: Server interface of TFTP (Your computers network IP)
  • TFTP Image: This is the binary file we are going to download. In our case, type in testcode.bin

BootMon now downlods your application. TFTP should put out some log information.

5. After a few secounds you should see the output of your application!

To upload the same file (maybe an updated version of it) again, just push the reset button on your board. This causes BootMon to use the last settings made again and to download the binaries whithout entering the configuration mode.

By using
for the TFTP directory to download from, you just have to configure the TFTP file in BootMon, if you want to upload another application, as by using make install, every compiled application's binaries get stored in that directory.

Important things to remember

In order to not get frustrated remember:

  • When entering the tool paths in the Configurator, do not forget the semicolon at the end of the line!
  • Make sure, that the setting 'Hide file extensions for unknown file types' is deactivated in you Windows folder options. Otherwise, 'Editor' won't create proper .c or Makefiles.
  • In the Makefile, make sure, that the project name is identical to your .c file's name!
  • Update the PATH variable every time you open a new command line prompt! Write a bash file for that.
  • You have to build a new sample directory and move 'Makedefs' and 'Makerules' from there to your application's parent directory every time you build a new Nut/OS with the Configurator!
  • Use 'at91_ram' as ARM Linker Script (Nut/OS Configurator), when using the Bootloader method.

See also

External Links

[1] Ethernut 3.0 Hardware Manual (November 2005)

[2] Document on Ethernut 3 JTAG featuring a guide on how to restore the Bootloader, when destroyed.

[3] This document presents detailed informations about the different possibilities to boot Ethernut 3.

[4] Ethernut Software Manual (November 2005)

[5] Ethernut 3.0 section on