The TCP/IP protocol stack of single chip microcomputer is described in this article. We all know that single-chip microcomputer is embedded. As more and more embedded networking devices are deployed, tcp ip protocol stacks must be implemented on embedded devices. However, embedded devices are different from PCs, generally, they use MCU, that is, single-chip microcomputer rather than CPU, as the core processor. This requires the TCP/IP protocol stack on single-chip microcomputer. for high-end 32-bit single-chip microcomputer, because its performance is close to that of the low-end pc cpu (such as Pentium II series), it is not much different from the implementation of the tcp ip protocol stack on the PC. Here we mainly describe the low-end 8-bit (such as 51 Single-Chip Microcomputer), 16-bit mcu tcp ip protocol stack 。
Characteristics of MCU TCP/IP
The realization of TCP/IP on a single-chip microcomputer is different from that on a PC. Its features are as follows:
1. slow speed: the fastest network transmission speed of 51 single-chip microcomputer of 12 m crystal oscillator is 25KB/s. The key is that TCP/IP needs to verify and calculate each transmitted byte, and the necessary copy. The processing speed of the 51 single-chip microcomputer is not enough. To improve the speed of the TCP/IP of the single-chip microcomputer, the general method is to streamline the protocol stack 。
2. program storage space and external RAM space are not large: Generally, the maximum program and data space of single-chip microcomputer is 64 KB. tcp ip protocol generally needs to cache the sent data, the maximum packet size is about B. When the network speed is very high, the memory consumption will be very high. For non-embedded TCP/IP protocol stacks, 64 KB of programs and data space is not enough 。
3. single-Chip Microcomputer System Structure: 51 single-chip microcomputer is an 8-bit machine, so for the same data operation, 32-bit PC may only need 10 instructions, 51 Single-Chip Microcomputer may require several hundred commands 。
Existing single-chip TCP/IP protocol stack
The procedure of the TCP protocol stack is complicated, because the program needs to process the data sent to the method and initiate connections, and we do not know when the other party will perform any operations, this makes the protocol processing more complex. Another reason is that the stability of the single-chip tcp ip protocol stack is a very important issue. A stable protocol stack needs to be tested for too long in practical applications, therefore, it is more difficult to compile a stable TCP/IP protocol stack for single-chip microcomputer. Another option is to use the existing TCP/IP protocol stack 。
1. eCos mcu tcp ip protocol stack (http://ecos.sourceware.org/getstart.html ):
ECos TCP/IP stack is related to running together with the eCos operating system/kernel. eCos (and TCP/IP stack) supported by a large amount of processing of its structure. The eCos TCP/IP stack is currently released as a test version, as a separate module 。
2. ZLIP 51 TCP/IP protocol stack (http://www.zlmcu.com/ZLIP/zlip_introduction.htm ):
ZLIP is an embedded TCP/IP protocol stack specially designed for 51 single-chip microcomputer. It can run in the operating system and without the operating system, it features moderate code volume, fast operation speed, simple user interfaces, and compatibility with BSD socket interfaces. It implements TCP, UDP, ICMP, and ARP protocols, ZLWeb implements the HTTP protocol. It supports multiple TCP connections and multiple UDP connections to run simultaneously, supports multi-task data transmission and receiving in the uc/OS-II operating system. It can be used for 51 Single-Chip TCP/IP Internet access solutions 。
3. uc/ip MCU TCP/IP protocol stack (http://ucip.sourceforge.net /):
UC/IP (mew-kip) is a tcp ip protocol stack designed to control it. The Code is based on BSD (similar to all other stacks) however, the very small coverage function is reduced. It is currently built for Linux and DOS targets 。
4. bsd mcu tcp ip protocol stack (http://www.freebsd.org/internet.html ):
BSD stack is the beginning of other commercial stacks in history. Most professional TCP/IP stacks (such as those with Wind-River VxWorks kernels) is derived from the BSD stack. This is because BSD provides their stack under the BSD license agreement, their permits allow you to combine their code in a modified or unmodified form without having to pay royalties to the creator. Compared with GPL permits, if you combine GPL source code, the latter requires your GPL to disclose your source code 。
5. lwIP mcu tcp ip protocol stack (http://www.sics.se /~ Adam/lwip /):
LwIP (lightweight) the TCP/IP stack is a small Implementation of the TCP/IP protocol stack. It includes the TCP and UDP Transport layers with IP and ICMP. It also provides an optional BSD set of seed APIs, it also includes a zero copy API. The LwIP protocol stack is designed for embedded systems and is suitable for 40 kb ROM and several hundred bytes of RAM. It is written in C for portability 。
6. uIP MCU TCP/IP protocol stack (http://www.sics.se /~ Adam/uip/index. php/Main_Page ):
UIP is a very small TCP/IP protocol stack specially designed for 8-bit and 16-bit single-chip microcomputer. uIP is completely written in C, this can be transplanted to a variety of structures and operating systems. A compiled stack can run in several kb rom or several hundred bytes of RAM. uIP also includes an HTTP server as the service content 。
7. TinyTCP mcu tcp protocol stack (http://www.unusualresearch.com/tinytcp/tinytcp.htm ):
TinyTCP stack is a very small and simple implementation of TCP/IP, it includes an FTP client. TinyTCP was designed to burn in ROM and now it seems useful for large-end structures (initially with a 68000 chip) tinyTCP also includes a simple Ethernet driver for 3Com multi-bus cards 。
8. wattcp mcu tcp protocol stack (http://www.erickengelke.com/wattcp ):
WATTCP is a small TCP/IP stack designed to embed a DOS-based system. It includes a Real Mode DOS version and a 32-bit extended Environment version 。