wiki:sysace/FAT

Implementing a FAT file system

Before reading further, please note that detailed information on this may be found in your “OS and Libraries Reference Guide.” Located in:
EDK\doc\oslib_rm.pdf
Compact Flash may also be used on WARP for implementing a simple FAT File system. If reconfiguration is not a required ability for the system, the card may also be formatted in FAT12 format. For information on how to properly format the flash card, please refer to the first section of this document, Formatting and Loading Systems on to a Compact Flash. To implement the FAT system in hardware, the procedure is as follows:

  1. Instantiate the SystemACE controller when building the system
  2. Modify the MSS to include the FATFS library (can be added and modified in “Software”->”Software Platform Settings…”)
  3. Add the required libraries

An example MSS modification is as follows – simply add the following code to the bottom of the system MSS file:

BEGIN LIBRARY
 PARAMETER LIBRARY_NAME = xilfatfs
 PARAMETER LIBRARY_VER = 1.00.a
# # add write capabilities
 PARAMETER CONFIG_WRITE = true
# # add make/change dir support needed for the libs to work correctly.
 PARAMETER CONFIG_DIR_SUPPORT = true
# don't not work with FAT12 systems. Use 16 and/or 32
 PARAMETER CONFIG_FAT12 = false
# max files alloted
 PARAMETER CONFIG_MAXFILES = 5
# buffer size
 PARAMETER CONFIG_BUFCACHE_SIZE = 10240
 PARAMETER PROC_INSTANCE = ppc405_0
END

This code can be tweaked according to the needs of the user. More detailed information on twekable parameters can be found in:
EDK\doc\oslib_rm.pdf The final step to this procedure is to add the required libraries:

  • sysace_stdio.h (does not require the user to manually add the *.c & *.h files)
    • Contains the core FATFS functions. Detailed in
      EDK\doc\oslib_rm.pdf
  • sysace_l.h (does not require the user to manually add the *.c & *.h files)
    • Contains core SysACE controller functions needed for warpsysace.h
  • sysace.h (does not require the user to manually add the *.c & *.h files)
    • Contains core SysACE controller functions needed for warpsysace.h
  • warpsysace.h (requires the user to manually add the *.c & *.h files)
    • Contains the necessary lock function for SysACE to work
    • Provides extra functionality, such as a file-logging system
  • warplib.h (requires the user to add the library files manually)
    • Required for warpsysace to function

Once these items have been implemented, the user must apply the WarpSysace_GetLock(base_addr) function, as detailed in section of this document entitled, Reconfiguring On Flash Using Software. Once this function has been called, the user is free to utilize the FAT-file functionality as detailed in:
EDK\doc\oslib_rm.pdf . This includes opening/closing and creating/deleting files, and making/removing directories. There are some IMPORTANT items to note, however, that will ensure the user gets the desired functionality of the system:

  • to make files, user only needs to use “sysace_fopen”
    • the file must return a defined type int for use in other sysace functions, (such as sysace_fread)
  • The largest string size that can be written is defined by the buffer size of the library in the system MSS file
  • To append data to a file, simply do not close it and perform more writes
  • When done modifying a file, always close it. This may otherwise result in a corrupt file.
  • If things freeze (can happen after lots of changes) – reformat the card again with mkdosfs


PREV: Reconfiguring on Flash Using Software
| HOME | NEXT: References
Last modified 16 years ago Last modified on Jul 19, 2006, 10:21:13 PM