A file system which can mount, read, and enumerate a file system image which has been appended to the compiled .bin code file before being uploaded to the mbed device.

FLASH File System

This file system can mount, read, and enumerate a file system image which has been appended to the compiled .bin code file before being uploaded to the mbed device. I wrote a utility called fsbld to create images that can be used with this file system. This GitHub repository contains the sources for that utility.

To get the file system image onto the mbed device, you need to concatenate your binary from the compiler with the file system image binary.

  • On *nix this can be done with the cat command. For example:
    cat Test_LPC1768.bin FileImage.bin >/Volumes/MBED/test.bin
  • On Windows this can be done with the copy command. For example:
    copy Test_LPC1768.bin + FileImage.bin e:\test.bin
Committer:
AdamGreen
Date:
Fri Jul 29 01:23:53 2011 +0000
Revision:
0:5ea6e74c35f7
Child:
1:a3cb118c4f6e
Initial version of FLASH File System

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AdamGreen 0:5ea6e74c35f7 1 /*
AdamGreen 0:5ea6e74c35f7 2 Copyright (c) 2011 Adam Green http://mbed.org/users/AdamGreen/
AdamGreen 0:5ea6e74c35f7 3
AdamGreen 0:5ea6e74c35f7 4 Permission is hereby granted, free of charge, to any person obtaining a copy
AdamGreen 0:5ea6e74c35f7 5 of this software and associated documentation files (the "Software"), to deal
AdamGreen 0:5ea6e74c35f7 6 in the Software without restriction, including without limitation the rights
AdamGreen 0:5ea6e74c35f7 7 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
AdamGreen 0:5ea6e74c35f7 8 copies of the Software, and to permit persons to whom the Software is
AdamGreen 0:5ea6e74c35f7 9 furnished to do so, subject to the following conditions:
AdamGreen 0:5ea6e74c35f7 10
AdamGreen 0:5ea6e74c35f7 11 The above copyright notice and this permission notice shall be included in
AdamGreen 0:5ea6e74c35f7 12 all copies or substantial portions of the Software.
AdamGreen 0:5ea6e74c35f7 13
AdamGreen 0:5ea6e74c35f7 14 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
AdamGreen 0:5ea6e74c35f7 15 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
AdamGreen 0:5ea6e74c35f7 16 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AdamGreen 0:5ea6e74c35f7 17 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
AdamGreen 0:5ea6e74c35f7 18 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
AdamGreen 0:5ea6e74c35f7 19 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
AdamGreen 0:5ea6e74c35f7 20 THE SOFTWARE.
AdamGreen 0:5ea6e74c35f7 21 */
AdamGreen 0:5ea6e74c35f7 22 /* Specifies constants and structures used within the FLASH File System. The
AdamGreen 0:5ea6e74c35f7 23 header is used by both the runtime and the tool which builds the image on
AdamGreen 0:5ea6e74c35f7 24 the PC.
AdamGreen 0:5ea6e74c35f7 25 */
AdamGreen 0:5ea6e74c35f7 26 #ifndef _FFSFORMAT_H_
AdamGreen 0:5ea6e74c35f7 27 #define _FFSFORMAT_H_
AdamGreen 0:5ea6e74c35f7 28
AdamGreen 0:5ea6e74c35f7 29
AdamGreen 0:5ea6e74c35f7 30 /* The signature to be placed in SFileSystemHeader::FileSystemSignature.
AdamGreen 0:5ea6e74c35f7 31 Only the first 8 bytes are used and the NULL terminator discarded. */
AdamGreen 0:5ea6e74c35f7 32 #define FILE_SYSTEM_SIGNATURE "FFileSys"
AdamGreen 0:5ea6e74c35f7 33
AdamGreen 0:5ea6e74c35f7 34 /* The size of the FLASH on the device to search through for the file
AdamGreen 0:5ea6e74c35f7 35 system signature. */
AdamGreen 0:5ea6e74c35f7 36 #define FILE_SYSTEM_FLASH_SIZE (512 * 1024)
AdamGreen 0:5ea6e74c35f7 37
AdamGreen 0:5ea6e74c35f7 38
AdamGreen 0:5ea6e74c35f7 39 /* Header stored at the beginning of the file system image. */
AdamGreen 0:5ea6e74c35f7 40 typedef struct _SFileSystemHeader
AdamGreen 0:5ea6e74c35f7 41 {
AdamGreen 0:5ea6e74c35f7 42 /* Signature should be set to FILE_SYSTEM_SIGNATURE. */
AdamGreen 0:5ea6e74c35f7 43 char FileSystemSignature[8];
AdamGreen 0:5ea6e74c35f7 44 /* Number of entries in this file system image. */
AdamGreen 0:5ea6e74c35f7 45 unsigned int FileCount;
AdamGreen 0:5ea6e74c35f7 46 /* The SFileSystemEntry[SFileSystemHeader::FileCount] array will start here.
AdamGreen 0:5ea6e74c35f7 47 These entries are to be sorted so that a binary search can be performed
AdamGreen 0:5ea6e74c35f7 48 at file open time. */
AdamGreen 0:5ea6e74c35f7 49 } SFileSystemHeader;
AdamGreen 0:5ea6e74c35f7 50
AdamGreen 0:5ea6e74c35f7 51 /* Information about each file added to the file system image. */
AdamGreen 0:5ea6e74c35f7 52 typedef struct _SFileSystemEntry
AdamGreen 0:5ea6e74c35f7 53 {
AdamGreen 0:5ea6e74c35f7 54 /* The 2 following offsets are relative to the beginning of the file
AdamGreen 0:5ea6e74c35f7 55 image. */
AdamGreen 0:5ea6e74c35f7 56 unsigned int FilenameOffset;
AdamGreen 0:5ea6e74c35f7 57 unsigned int FileBinaryOffset;
AdamGreen 0:5ea6e74c35f7 58 unsigned int FileBinarySize;
AdamGreen 0:5ea6e74c35f7 59 } SFileSystemEntry;
AdamGreen 0:5ea6e74c35f7 60
AdamGreen 0:5ea6e74c35f7 61
AdamGreen 0:5ea6e74c35f7 62 #endif /* _FFSFORMAT_H_ */