About Ethernut
Ethernut is an Open Source Hardware and Software Project for building tiny Embedded Ethernet Devices.
Hardware
Five Open Source Reference Designs are currently available:
-
Ethernut 1
Minimal low cost version, initially using the ATmega103 CPU, which had been later replaced by the ATmega128. The on-chip 128 kBytes of Flash and an external 32 kByte SRAM provide enough memory even for advanced applications. The 10 MBit Ethernet interface is based on the RTL8019AS. -
Ethernut 2
This enhanced version is equipped with the same CPU as its predecessor Ethernut 1, but comes with extra memory, like external 512 kBytes serial Flash and 512 kBytes banked SRAM. Its 100 MBit Ethernet interface is based on the LAN91C111. Recently this board had been successfully tested with the new ATmega2561 CPU, which offers 256 kByte on-chip program memory. With an additional RS485 interface and the availability of all parts for industrial temperature ranges, this board design is predestined for industrial applications. -
Ethernut 3
The first 32 bit version of the Ethernut Family is packed with features like 8 MBytes Flash and 256 kBytes linear SRAM, MMC/SD-Card Socket, three programmable PLLs etc. Due to the 32-Bit AT91R40008 CPU (ARM7TDMI) running at 73.728 MHz, it is mainly targeted at performance intensive processing like real-time coding and decoding applications. A DM9000E controller is used for the 100 MBit Ethernet Interface . -
EIR 1
The Elektor Internet Radio plays MP3 and Ogg Vorbis streams from SHOUTcast radio stations, using the new AT91SAM7SE CPU and 64 MBytes of RAM. -
Ethernut 5
The latest member of the Ethernut Family provides an ARM9 CPU with integrated Ethernet MAC, 128 MBytes SDRAM, 1 GByte NAND Flash, USB Host and Device Interface, MMC/SD-Card Socket, CCD Camera Connector and very flexible power management. This board is also able to run Linux.
Beside these reference designs, the accompanied software can run on many other hardware platforms, including the Gameboy Advance, Atmel's SAM7X and SAM9260 evaluation kits or the ELEKTOR Internet Radio.
Software
The software is an Open Source implementation of a Real Time Operating System called Nut/OS and a TCP/IP protocol suite named Nut/Net. Several application examples are provided, including an embedded Webserver, a simple RS232 to TCP/IP gateway and an Internet Radio playing MP3 streams.
Application Development
A well documented API including most standard C functions is available to easily implement custom applications. The source code is written almost only in C and available for download. The BSD license allows its use in Open and Closed Source Projects without paying royalities, even not in commercial applications. The developer can choose between two different development environments, the freely available GNU Compiler Collection for Linux and Windows and the commercially supported ImageCraft Compiler for Windows.
Why Nut/OS Is A Good Choice
To forclose the result of this and the next chapter: Nut/OS is quite easy to use for small applications and requires responsible and experienced developers, when used in large projects. If you intend to implement a complex application with a bunch of idiots as developers, then don't touch it, it may explode. In political incorrect words: Nut/OS is made for squaws and chiefs, normal Indians will hate it. ;-)
If you bear this in mind, Nut/OS will enable you to create very smart applications, running blindingly fast on almost no hardware.
Small Footprint
One of the most significant advantages is its size. Nut/OS is a modular system, which means, that only those parts add to the final application code, which are required by the application. The most simple application occupies less than 5 kBytes of memory on the AVR and about 12 kBytes on the ARM7. A full blown HTTP server including DHCP and DNS clients will need about 50 to 70 kBytes, leaving enough room for web pages or CGIs.
Standard C Libraries
Nut/OS provides an almost complete C standard library. Most notable the stdio API implementation, which can be used with files, TCP sockets and most devices. This way your applications are quite portable, except for a few API calls they do not need to know much about the underlying OS.
Cooperative Multithreading
Finally Nut/OS uses cooperative multithreading, which is very easy to use and creates very copact and responsive code. In opposite to pre-emptive multithreading, there is not need to declare shared resources volatile and there is typically no need to handle a large number of semaphores for mutual exclusion. However, cooperative multithreading may be also a good argument for choosing a different OS (see below).
Open Source
Did you ever run into the problem, that your project was delayed because the supplier of a commercially supported, but closed source operating system wasn't able to fix a bug in time or refused to add a needed feature?
Beside that, the code is well documented and beginners may use it to learn a lot about operating systems and network communications. Last not least it may serve as a basis to roll your own OS (which we think is a bad idea <grin>).
Acceptable License
If you intend to create a commercial product based on Open Source, then you will probably look to license issues with special care. Note, that all code published under GPL forces you to publish all derived code and all modifications. No question, the spirit of Open Source is to share. But you may not like to share the code of your latest cool product with all your competitors. The BSD license allows you, to use all the code free of charge without the need to publish any of your enhancements. You still may decide to contribute some of your changes to make sure they will be included in and maintained for future distributions.
Why Nut/OS May Be A Bad Choice
Even if you are the most responsible and most experienced embedded system programmer in our galaxy, we have to admit that there are a few reasons for selecting a different OS.
Single Application Only
Nut/OS is not Linux. There is no fixed kernel which is able to dynamically load a number of concurrently running applications. Instead, Nut/OS consists of a number of libraries, which are statically linked to an application at compile time. Concurrency is provided by multithreading. A tool named Configurator can be used to configure the Nut/OS libraries for the specific target hardware.
No Memory Protection
Newbies as well as large projects face the same problem. Due to the lack of hardware memory management support, the whole memory space is unprotected. Nut/OS uses a flat memory model, where the application code runs within the same address space as the kernel. In other words, any part of the code may corrupt any memory location.
Cooperative Multithreading
A similar problem exists with response times. While a pre-emptive RTOS guarantees a minimum time to switch to a woken-up thread with higher priority than the currently running one, Nut/OS leaves this to the application code. Any endless loop not waiting for any event will freeze the schedular.
In general, realtime support is quite limited. Because of its cooperative nature, the operating system can't guarantee minimum context switching time except for interrupts. In turn, interrupt latency may depend on driver implementations and is difficult to calculate. However, this is true for many pre-emptive system too.
Too Smart For Me
If you are looking for a lightweight kernel, you found it. But you will get a bunch of extra freebies, which you are not looking for. There are a number of minimal operating systems out there, which make Nut/OS look like a Tyrannosaurus Rex. You should finally make up your mind, if you need an OS at all. Most compiler packages for embedded systems include or support rich API libraries.
Bad Support
This is simply a lie. Though, it is true, that Open Source developers tend to reply to support requests with the phrase Use the source, Luke or tend to reply to feature request with Roll your own. You do good to ignore such responses. Further, it is true, that Open Source Contributors set priorities on projects, for which they get money. Understandable, but if you are willing to pay them like you pay for commercial support, then your request will gain priority. At least, over the years Nut/OS had become well known for its active and helpful community. That's why the the headline above is simply a lie.
Getting Started
Hardware
The hardware design is free, but typically the hardware itself costs money. If you are a professional developer, we'd recommend to buy the Ethernut Starter Kit from one of its distributors. Because the hardware design is Open Source as well, some of them and several other companies offer Ethernut compatible clones.
The starter kit will also be the best choice unless you are quite experienced in building boards with fine pitch SMD chips. The cheapest solution for experienced hardware cracks will be to order a PCB (4-layer), get the parts and heat up your solder iron. Last not least all CAD files are available in the download area for those extremists, who want to make their own PCB.
The Ethernut board provides In-System-Programming, which means, that you can load the application software into the flash ROM of the processor without removing any chip from the board. There is also no need for an external programming device, but you need an adapter, which connects your PC with the Ethernut Board. Such an ISP adapter for the PC serial port is included in the Starter Kit. As an alternative, schematics of very simple adapters for the PC parallel port are published in the Web. You can easily build such an adapter yourself.
Software
If you ordered the Ethernut Starter Kit, you will find all required software on the included CD. The Ethernut board in the Starter Kit comes with the preloaded BaseMon application. You simply connect the board to a power supply (9-12 VDC, not included in the Kit), a serial port on your PC and your Ethernet LAN and follow the steps in the printed manual.
All required software is also available in the download area and frankly, this is often more complete and up-to-date than the CD contents. However, 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 is available for Linux and Windows. For the first start however, you can upload one of the precompiled binaries to the Ethernut, which are included in the software archive.
In order to start with your own Embedded Ethernet Application, take one of the samples like TCPS and add some modifications. The recompile it 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.
After uploading the application, simply press the reset button on the Ethernut Board and enjoy your first Embedded Ethernet Application. Before going any further, it is a good idea to check the software section for additional documents. You may also consider to subscribe to the Ethernut discussion mailing list and exchange emails with other Ethernut developers.