Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

On top of the SMART MTD layer is the Smart Filesystem code. The SmartFS code uses the logical sector services of the SMART MTD layer to provide file and directory level management, such as creating new files, chaining logical sectors together to create files, creating directories and file / directory search and management routines.

Smart FSfs / smartfs / *
SMART MTDdrivers / mtd / smart.c
MTD Driverm25pxsst25filmtdetc.
HW Driverspi devspi devVFS

Example SmartFS Device Setup

...

An example 128K Byte Flash with 32K and 4K Erase Block sizes and 256 byte page read/write sizes:

Bulk EraseEntire Device
Sector Erase32K32K32K32K
Sector Erase4K4K4K4K4K4K4K4K
Page read/write256256256256256256
Logical Sector (FS)512512


In the example above, a SMART MTD logical sector size of 512 bytes was chosen. On the 128K Byte FLASH represented in the table above, this means there would be:

...

  • 128K / 256 = 512 Logical Sectors Total
  • {{ 4K / 256 = 16 Logical Sectors per Erase Block}}
  • {{ 256 / 256 = 1 MTD Read/Write Block per SMART Logical Sector}}
  • {{ 10 / 256 = 3.9% Overhead for logical sector headers}}
  • A maximum of about 506 files / directories supported (considering format overhead)
  • Allocations to files in 256 byte chunks (a zero-length file consumes 256 bytes)

...

The cache always contains the format and root-directory logical to physical mapping entries, and then stores additional mappings of recently used logical sectors. When a logical sector is requested that is not contained in the cache, then the MTD device is scanned front-to-back until it's physical location on the device is located. Additionally, if the number of logical sectors per erase block is 16 or less, then the "free count" and "release count" can be packed into a single byte per erase block.

_CONFIG_MTD_SMART_MINIMIZE_RAM=y,
CONFIG_MTD_SMART_SECTOR_CACHE_SIZE=64_

Item

RAM Requirement

1MB / 256 Logical

8MB / 1024 Logical

dev struct

368-400 (approx)

392

392

Logical sector cache

cache entries * 6

384

384

Free sector bitmap

total sectors / 8

512

1024

Erase block free count

total erase blocks

16

128

Erase block release count

total erase blocks

16

128

Wear status

total erase blocks / 2

8

64

MTD sector R/W buffer

logical sector size

256

1024

FS sector R/W buffer

logical sector size

256

1024

Total


1,832

4,168

...