modified on 20 July 2010 at 14:33 ••• 21,441 views

Eagle enet tftpd Example

From Manuals

Jump to: navigation, search

Ethernet TFTPD Server (enet_tftpd)

Compatibility Eagle 50E, 100


TFTP Overview


TFTP (Trivial File Transfer Protocol) is a very simple file transfer protocol commonly implemented on top of UDP (User Datagram Protocol) using port number 69. Its purpose is to move files between machines on different networks and is designed to be small and easily implemented. It's only features the reading and writing of files and does not offer any other advanced features or security. TFTP currently supports two different modes, "netascii" (ASCII) and "octet" (binary) with a third "mail" mode being made obsolete in 1992 by RFC1350.

Common uses for TFTP

Data downloads

Data collected and stored on the Eagle can be easily accessed and downloaded remotely via TFTP. The board does not have to be physically accessed or taken offline.

Script uploads

New and updated scripts which control your embedded application can be uploaded remotely from a network machine. Again, this can be done without physically accessing the board and without interruption.

Firmware updates

Applications can be developed so that uploaded data will be used to reprogram the firmware in flash memory. A soft reset can then allow the board to boot with the new firmware in place.

enet_tftpd example

microSD filesystem

This application uses the FatFs FAT file system for embedded systems. This allows the data on the microSD to be read with other FAT compatible systems (including Windows, Linux, Mac OSX). The FatFs file system limits file sizes to 4GB, volume size to 2TB, cluster size to 64KB, and sector size to 4KB. The FAT sub-type is also required to be either FAT12, FAT16, or FAT32. A virtually unlimited number of new files can be uploaded via TFTP, dependent on memory space. Uploading an existing file will overwrite the old file.

Internal filesystem

The enet_tftpd example uses a standard ROMFS filesystem for supporting read operations from files included at compile time. These files are included as lmi-fsdata.h and occupy a part of the object code. Use the makefs.bat utility in the enet_tftpd directory to convert the files in the enet_tftpd\fs\ directory to the lmi-fsdata.h header file. Remember, these files will be read only and must share the 256KB flash memory with the application and bootloader.

For write operations to internal flash memory, enet_tftpd uses a non-standard ROMFS filesystem. Storage capacity is limited to the remaining flash memory that is not occupied by the bootloader, application, and existing ROMFS. The amount of memory used for ROMFS writing must be specified at compile time and has a default of 16KB.

See filesystem limitations for more details.

Compile options

Firmware update mode

Firmware update mode is set by defining BL_UPDATE as a compiler pre-processor option. With this option, any file uploaded to the board will be flashed to memory address 0x00 and board will be reset. This data can not be downloaded later by a GET request as no file system information is recorded.

TFTP port

The TFTP port can be specified by defining TFTP_PORT as a compiler pre-processor option. For example, to set the port as 6969, use TFTP_PORT=6969. If no port is specified, enet_tftpd will use the default port, 69.

TFTP clients

Command line TFTP


A TFTP command line client is included with Windows 2000, XP, Vista, and 7 licenses. You will need to make sure this utility is installed by checking the installed components in the Control Panel.

To learn about the TFTP client usage, enter tftp at a command prompt. To download a file from the board in ASCII mode, enter tftp hostname GET filename. Alternatively, to upload an ASCII file to the board, enter tftp hostname PUT filename. To specify a binary mode transfer, specify the -i option before the hostname, i.e. tftp -i hostname GET filename.

Windows Command Line


A TFTP command line client is included in most Linux distributions. If not, it can easily be installed by entering sudo apt-get install tftp at the terminal.

To learn about the TFTP client usage, enter man tftp at the terminal. To begin a new session, enter tftp hostname. To download or upload a file, enter GET filename or PUT filename respectively. Entering the tftp command each time in Linux is unnecessary. To switch to binary mode, enter mode binary (ASCII mode is default). To end the TFTP session, enter quit.

Linux Command Line



Tftpd32 is a small utility that offers DHCP, TFTP, DNS, SNTP and Syslog servers as well a TFTP client. It's compatible with all modern Window's versions and does not require an installation.

To begin a new TFTP session, execute Tftpd32.exe and click the Tftp Client tab. Enter the hostname and port of the TFTP server that you wish to connect to. For GET requests, specify the source file in the Remote File text box and the destination on your machine in the Local File text box. For PUT requests, specify the source file in Local File and the destination in Remote File.

Tftp32 GUI

TFTP Limitations


No password

TFTP has no provisions for access authorization. Anyone with network access to the application's TFTP port will have full read and write permissions. Thus, it is only recommended for use on private, local networks.

No firewall

Because of the lack of security provisions, it is strongly recommended that the service should be placed behind a firewall to prevent outside network access.

File size

The original TFTP specification allowed for file sizes up to 32MB but has been extended by RFC 2347 which allows for file sizes up to 4GB.


The enet_tftpd example implements a non-standard ROMFS filesystem for writing to flash memory which only supports the storage of a single file. Any time data is written to the ROMFS filesystem, any previous data will be overwritten. This filesystem must also be share the 256KB of available flash memory with the bootloader and application.

The FatFs filesystem used on the microSD card only supports short (8.3) file names and file sizes up to 4GB.


The TFTP protocol is small and simple enough for embedded applications and allows developers to add functionality for basic remote file accessibility. The enet_tftpd example demonstrates how data logs can be downloaded from the board, how application controlling scripts can be uploaded, and even how remote firmware updates are possible. Developers can choose to use the FatFs filesystem on a microSD card for relatively robust file storage or choose to use internal flash memory for basic operations. TFTP clients are available for any system and are easy for users to find and use. Since the TFTP protocol lacks any security provision, care must be taken so that boards are deployed safely to prevent unauthorized access. For any questions regarding this application, please contact Micromint support at