As you've discovered, essentially all that's required is to link the
FATFS functions to read a block to and from the device to the
Dataflash block functions in DataflashManager.c. The FAT library
processes the raw blocks from the device (which can be a dataflash,
hard disk, SD card or anything else that can store data) and allows
you to read and write files.
For it to work, you need to do two things. First, you *must* use the
latest WIP code here in the downloads section of this list. The
current MassStorage demo has a few flaws in it which I've only just
found and caught, due to the OS being too smart for its own good and
hiding them from me. No doubt those flaws will play havoc on an
embedded simple FAT driver.
Second, you probably only want one single LUN (logical disk). Out of
the box the demo is designed to appear as two disks of half the total
capacity each. You should recompile with TOTAL_LUNS in MassStorage.c
set to 1 to make the dataflash a single logical disk.
Third, you need to format the dataflash on the PC to the appropriate
FAT filesystem. If your FAT library is FAT16 only, ensure that the
disk is formatted to FAT16, or it will be unable to read the
filesystem off the dataflash correctly.
- Dean