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:
Wed Aug 03 22:29:40 2011 +0000
Revision:
1:a3cb118c4f6e
Parent:
0:5ea6e74c35f7
Child:
2:ca35ecd2fae6
Changed license.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
AdamGreen 1:a3cb118c4f6e 1 /* Copyright 2011 Adam Green (http://mbed.org/users/AdamGreen/)
AdamGreen 1:a3cb118c4f6e 2
AdamGreen 1:a3cb118c4f6e 3 Licensed under the Apache License, Version 2.0 (the "License");
AdamGreen 1:a3cb118c4f6e 4 you may not use this file except in compliance with the License.
AdamGreen 1:a3cb118c4f6e 5 You may obtain a copy of the License at
AdamGreen 1:a3cb118c4f6e 6
AdamGreen 1:a3cb118c4f6e 7 http://www.apache.org/licenses/LICENSE-2.0
AdamGreen 1:a3cb118c4f6e 8
AdamGreen 1:a3cb118c4f6e 9 Unless required by applicable law or agreed to in writing, software
AdamGreen 1:a3cb118c4f6e 10 distributed under the License is distributed on an "AS IS" BASIS,
AdamGreen 1:a3cb118c4f6e 11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
AdamGreen 1:a3cb118c4f6e 12 See the License for the specific language governing permissions and
AdamGreen 1:a3cb118c4f6e 13 limitations under the License.
AdamGreen 0:5ea6e74c35f7 14 */
AdamGreen 0:5ea6e74c35f7 15 /* Specifies constants and structures used within the FLASH File System. The
AdamGreen 0:5ea6e74c35f7 16 header is used by both the runtime and the tool which builds the image on
AdamGreen 0:5ea6e74c35f7 17 the PC.
AdamGreen 0:5ea6e74c35f7 18 */
AdamGreen 0:5ea6e74c35f7 19 #ifndef _FFSFORMAT_H_
AdamGreen 0:5ea6e74c35f7 20 #define _FFSFORMAT_H_
AdamGreen 0:5ea6e74c35f7 21
AdamGreen 0:5ea6e74c35f7 22
AdamGreen 0:5ea6e74c35f7 23 /* The signature to be placed in SFileSystemHeader::FileSystemSignature.
AdamGreen 0:5ea6e74c35f7 24 Only the first 8 bytes are used and the NULL terminator discarded. */
AdamGreen 0:5ea6e74c35f7 25 #define FILE_SYSTEM_SIGNATURE "FFileSys"
AdamGreen 0:5ea6e74c35f7 26
AdamGreen 0:5ea6e74c35f7 27 /* The size of the FLASH on the device to search through for the file
AdamGreen 0:5ea6e74c35f7 28 system signature. */
AdamGreen 0:5ea6e74c35f7 29 #define FILE_SYSTEM_FLASH_SIZE (512 * 1024)
AdamGreen 0:5ea6e74c35f7 30
AdamGreen 0:5ea6e74c35f7 31
AdamGreen 0:5ea6e74c35f7 32 /* Header stored at the beginning of the file system image. */
AdamGreen 0:5ea6e74c35f7 33 typedef struct _SFileSystemHeader
AdamGreen 0:5ea6e74c35f7 34 {
AdamGreen 0:5ea6e74c35f7 35 /* Signature should be set to FILE_SYSTEM_SIGNATURE. */
AdamGreen 0:5ea6e74c35f7 36 char FileSystemSignature[8];
AdamGreen 0:5ea6e74c35f7 37 /* Number of entries in this file system image. */
AdamGreen 0:5ea6e74c35f7 38 unsigned int FileCount;
AdamGreen 0:5ea6e74c35f7 39 /* The SFileSystemEntry[SFileSystemHeader::FileCount] array will start here.
AdamGreen 0:5ea6e74c35f7 40 These entries are to be sorted so that a binary search can be performed
AdamGreen 0:5ea6e74c35f7 41 at file open time. */
AdamGreen 0:5ea6e74c35f7 42 } SFileSystemHeader;
AdamGreen 0:5ea6e74c35f7 43
AdamGreen 0:5ea6e74c35f7 44 /* Information about each file added to the file system image. */
AdamGreen 0:5ea6e74c35f7 45 typedef struct _SFileSystemEntry
AdamGreen 0:5ea6e74c35f7 46 {
AdamGreen 0:5ea6e74c35f7 47 /* The 2 following offsets are relative to the beginning of the file
AdamGreen 0:5ea6e74c35f7 48 image. */
AdamGreen 0:5ea6e74c35f7 49 unsigned int FilenameOffset;
AdamGreen 0:5ea6e74c35f7 50 unsigned int FileBinaryOffset;
AdamGreen 0:5ea6e74c35f7 51 unsigned int FileBinarySize;
AdamGreen 0:5ea6e74c35f7 52 } SFileSystemEntry;
AdamGreen 0:5ea6e74c35f7 53
AdamGreen 0:5ea6e74c35f7 54
AdamGreen 0:5ea6e74c35f7 55 #endif /* _FFSFORMAT_H_ */