Ethernut 1.3 H
On this page you will learn how to setup an Ethernet 1.3 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.
Additionally all major topics are also covered in screencasts (Win only).
- Screencast Part 1 The Nut/OS Configurator
- Screencast Part 2 Preparations
- Screencast Part 3 Compiling and Burning
- Screencast Part 4 Serial Communications / TeraTerm
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:
Note: All paths in this guide refer to that location and will be referred to as "ethernut folder/directory" or "/ethernut-4.6.4"
Tera Term is a so called terminal emulator. We use it to communicate via COM with the board.
WinAVR (pronounced "whenever") is a suite of executable, open source software development tools for the Atmel AVR series of RISC microprocessors hosted on the Windows platform.
It includes the GNU GCC compiler for C and C++.
It is recommended to install the WinAVR folder directly on the root directory:
Note: All paths in this guide refer to that location!
You can use any text editor you want. Some recommended ones include:
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
AVR 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 AVR
- GNU Binary Utilities for AVR
- AVRDUDE programmer software
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 create a new folder named "ethernut" in your home directory and copy the source code package in to this directory before unpacking it. The complete sequence of shell command for installing Nut/OS is:
mkdir ~/ethernut cp ethernut-4.6.4.tar.bz2 ~/ethernut cd ~/ethernut tar -xjf ethernut-4.6.4.tar.bz2 ln -s ethernut-4.6.4 nut cd nut/ ./configure make sudo make install
Note: All paths in this guide refer to that location and will be referred to as "ethernut folder/directory" or "/ethernut"
http://www.ethernut.de/en/documents/debian.html provides more informations about installing Nut/OS on Linux.
Minicom is a so called terminal emulator. We use it to communicate via COM with the board.
The Nut/OS Configurator
In order to build an optimized Nut/OS for you needs you have to configure it.
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:
Start > Programs > Ethernut 4.6.4 > Configurator
cd ~/ethernut nutconf
2. Select and open the configuration file for your board:
ethernut103.conf for old Ethernuts with ATmega103 ethernut13f.conf for Ethernut 1.3 Rev-F and earlier ethernut13g.conf for Ethernut 1.3 Rev-G and later
3. Click on Menubar: Edit > Settings
- Goto Tab: Build
- Choose Platform: avr-gcc
- Choose Build Directory: nutbld_enut13
- Goto Tab: Tools
- Goto Tab: Samples
- Choose Application Directory: nutapp_enut13
- Choose Programmer: avr-dude
- Click OK
4. Click on Menubar: Build > Build Nut/OS
- Say OK 2 times.
5. 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
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:
Additionally it created an associated Sample Application Directory with source codes ready to compile:
First of all we need a home for our application.
Create a new directory "testcode" in
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
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,
PROJ = testcode
has to be identical to the name of your application's
PROJ = testcode include ../Makedefs SRCS = $(PROJ).c OBJS = $(SRCS:.c=.o) LIBS = $(LIBDIR)/nutinit.o -lnutpro -lnutos -lnutnet -lnutfs -lnutcrt -lnutdev -lnutarch TARG = $(PROJ).hex all: $(OBJS) $(TARG) $(ITARG) $(DTARG) include ../Makerules clean: -rm -f $(OBJS) -rm -f $(TARG) $(ITARG) $(DTARG)
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.
Makefile (Without any file extension) and save it to:
are essential. By building a new Nut/OS and a new sample directory (nutapp_enut13) 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_enut13" as recommended) every time you build a new Nut/OS!
Path environment (Win only)
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:
%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:
2. Name it
AVR.bat and save it to:
This is called a Batch file.
Everytime you type in
AVR in the
testcode directory now, the PATH variable gets set.
You have to execute
AVR 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 1.3
- Connect the SP DUO to Ethernut's JTAG connector
- Connect the SP DUO to an available COM port of your computer using the serial 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 Burning
Now its time to compile.
2. Change to
3. Enter: Windows only!
if you are using a batch file.
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 testcode.map
rm -f testcode.lst
rm -f testcode.bak
rm -f testcode.i
If not, you maybe left out step 3.
1. Connect your Ethernut 1.3. (for further details take a look at the Hardware Manual)
- Power Supply
- COM to SP DUO to JTAG
This compiles the necessary files for you and a tool called avr-dude burns the binaries onto your Ethernut board's flash storage.
To configure avr-dude, please edit the following file:
Serial Communications / Tera Term
Done. All you have to do now, is to connect the serial cable to the Ethernut's COM Port and start TeraTerm or any other serial communications tool.
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
Now reset your Ethernut board and you will (hopefully) see the output.
Important things to remember
In order to not get frustrated remember:
- 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
- Update the PATH variable every time you open a new command line prompt! Write a batch 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!
- To configure avr-dude and toggle the COM port for example, please edit the following file:
 Ethernut 1.3 Rev-G Hardware Manual (November 2005)
 Ethernut Software Manual (November 2005)