Chapter 7: A Flash File System

At this point, the monitor design has enough features to complete a basic shell around the hardware. I have the boot-up, serial port, and flash drivers and a solid command-line interface. The next few chapters put icing on the cake. In this chaper, I will start work on a flash file system, called Tiny File System (TFS). Flash file systems in embedded systems are still a bit sparse, but as we see more and more use of higher-density flash parts and removable flash media, we will surely see more and more appearances of flash file systems. A flash file system is usually considered a frivolous luxury; hence, programmers must often interface their application to the flash device using some home grown set of primitives. A flash file system certainly makes the embedded system easier to manage, but writing one from scratch is likely to be more complicated than you first expected.

This chapter presents a mechanism that allows the programmer to treat the memory space allocated to flash as namespace instead of address space. TFS solves some of the basic problems of interfacing to flash. For instance, TFS provides an API that is independent of the underlying flash device yet does not inhibit the program from directly accessing the raw memory if necessary. TFS offers an efficient alternative for applications that need a flash file system but dont require a sophisticated implementation with wear-leveling, directory hierarchy, and DOS-file-format compatibility. TFS provides an API accessible to both MicroMonitor and the application loaded by MicroMonitor. The TFS API provides an interface for operations that let you read, write, open , close, seek, and assemble statistical information. MicroMonitors TFS command lets you list, delete, create, display, copy, decompress, load, execute, and clean up files on the flash device. TFS lets you automatically boot one or more application files and allows other portions of the boot platform to assume the existence of a flash file system.

The Role of TFS in the Platform

The platform I am constructing depends heavily on the presence of the TFS file system. Even the basic boot of MicroMonitor depends upon obtaining certain configuration parameters from a file. Execution of a monitor run control file monrc allows a file in TFS to configure various other parameters in the platform. Things like the IP and MAC addresses are established in this script file that automatically runs at startup. In the next chapter, I will show how TFS allows files to be scripts (similar to DOS batch files). The communication interfaces (Xmodem and TFTP) both interface with TFS for file transfer, and, after an application is transferred into TFS, it can be loaded from flash into RAM automatically by TFS autoboot at system startup. Then, when the application is running, it can access the TFS API to access files in flash. TFS is not just another interface; it is a major portion of the platform.



Embedded Systems Firmware Demystified
Embedded Systems Firmware Demystified (With CD-ROM)
ISBN: 1578200997
EAN: 2147483647
Year: 2002
Pages: 118
Authors: Ed Sutter

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net