Working version

Dependents:   PUB_RA8875_Bitmap

This version of the FlashFileSystem is directly derived from a library of the same name by Adam Green. See Adam's original at Flash File System.

Important in the use of this library is the generation of the embedded resource. For this there is a companion tool - rofs.exe. Adam provided a link to the source in github. I used that but found I wanted a few more features, so I made a large number of changes.

ROFS.exe Features

  • Bidirectional:
    • Create flash file system from folder of resources
    • Extract resources from flash file system [.h/.bin]
  • w/reduced warnings
  • faster file system building
  • more internal documentation in the generated .h file
  • additional help information added

Windows EXE

  • Contact me by Private Email for a copy - the mbed site is not letting me upload it as a zip.
Revision:
1:689c997b57bb
Parent:
0:6339b3e34014
--- a/FlashFileSystem.cpp	Sat Jul 29 12:45:09 2017 +0000
+++ b/FlashFileSystem.cpp	Thu Apr 30 14:27:05 2020 +0000
@@ -27,9 +27,9 @@
 // INFO("Stuff to show %d", var); // new-line is automatically appended
 //
 #if (defined(DEBUG) && !defined(TARGET_LPC11U24))
-#define INFO(x, ...) std::printf("[INF %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
-#define WARN(x, ...) std::printf("[WRN %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
-#define ERR(x, ...)  std::printf("[ERR %s %4d] "x"\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
+#define INFO(x, ...) std::printf("[INF %s %4d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
+#define WARN(x, ...) std::printf("[WRN %s %4d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
+#define ERR(x, ...)  std::printf("[ERR %s %4d] " x "\r\n", DEBUG, __LINE__, ##__VA_ARGS__);
 static void HexDump(const char * title, const uint8_t * p, int count)
 {
     int i;
@@ -166,7 +166,7 @@
 */
 off_t FlashFileSystemFileHandle::lseek(off_t offset, int whence)
 {
-    INFO("lseek(%d, %d)", offset, whence);
+    INFO("lseek(%ld, %d)", offset, whence);
     switch(whence) {
         case SEEK_SET:
             m_pCurr = m_pFileStart + offset;
@@ -372,7 +372,7 @@
 
     assert ( NULL != pLocation &&
              pLocation > m_pFirstFileEntry &&
-             (pLocation - m_pFirstFileEntry) < m_FileEntriesLeft );
+             (unsigned int)(pLocation - m_pFirstFileEntry) < m_FileEntriesLeft );
     m_pCurrentFileEntry = pLocation;
 }
 
@@ -453,7 +453,7 @@
         pCurr = (char *)pFlashDrive;
     }
     if (((unsigned int)pCurr & 0x3) != 0) {
-        INFO("File system image at address %08X isn't 4-byte aligned.", pCurr);
+        INFO("File system image at address %p isn't 4-byte aligned.", pCurr);
         return;
     }