uIP (micro IP) is an open-source implementation of the TCP/IP network protocol stack intended for use with tiny 8- and 16-bit microcontrollers in embedded systems. It was initially developed by Adam Dunkels of the Networked Embedded Systems group at the Swedish Institute of Computer Science (SICS), licensed under a BSD-style license, and further developed by a wide group of contributors.
Overview
The uIP stack is designed to provide TCP/IP connectivity to small embedded microcontrollers while maintaining interoperability and RFC standards compliance. Its code size is on the order of a few kilobytes, and RAM usage can be configured to be minimal, making it suitable for resource-constrained devices.
The stable release version 1.0 was published on March 27, 2013.
Design and Implementation
uIP makes several unusual design choices to reduce resource requirements:
-
Single packet buffer: Unlike most IP stacks that keep multiple copies of different IP packets, uIP uses only one packet buffer in a half-duplex manner, using it in turn for transmission and reception. When retransmission is needed, uIP calls the application code to reproduce the previous data.
-
No multitasking required: uIP does not assume an operating system. Connections are held in an array, and on each call, uIP serves a connection by making a subroutine call to the application code.
-
Event-loop API: The native software interface is designed for small systems with no OS. It can be called in a timed loop, managing all retries and network behavior.
uIP is fully compliant with RFCs defining TCP, UDP, and IP, and also implements the ICMP protocol.
IPv6 Extension
In October 2008, Cisco, Atmel, and SICS announced a fully compliant IPv6 extension to uIP, called uIPv6.
Versions
uIP 0.9 is the version with the least dependence on operating systems, the smallest resource use, and a pure event-loop API. It supports IPv4 but not IPv6. It includes example implementations of HTTP (web server), SMTP, FTP, telnet, and others. However, it can be difficult to apply because it does not use any form of socket API.
Later versions of uIP, including the reference version of uIPv6, are integrated with Contiki, an operating system that uses coroutines for cooperative multitasking.
Limitations
- The single packet buffer can cause throughput problems, as PC hosts typically delay ACK packets while waiting for more data.
- 16-bit software timers (common on small microcontrollers) can overflow and cause defective operation.
- Some PCs do not correctly respond to a fast uIP system on a local Ethernet because the uIP system can start a response before the PC is ready.
- Typical implementations of uIP have a fixed IP address, which can be impractical in real networks, though some implementations have added DHCP support.
Relationship to lwIP
Adam Dunkels also created lwIP (lightweight IP), another open-source TCP/IP stack for embedded systems. lwIP is more fully featured and aimed at more capable hardware compared to uIP.
External Links
- GitHub repository: github.com/adamdunkels/uip