Filesystems

SDK provide in-built filesystem support for various storage device like onboard flash, external SPI flash and SD Card. Flash filesystem are optimized and with wear leveling support. This prevents storage media from damaging because of excessive write/erase operations.

For GSM systems, internal 315KB of flash memory available for storage. There is also provision for RAM filesystem with file size limit of 1KB per file, for temporary storage RAM filesystem can be used.

Internal flash is mounted on /fs and ram filesystem is mounted on /ram. Application can read write files using standard system calls.

If system has SD card connected and initialization is success, it will be mounted on /sd.

SPI Flash memory can be enabled and will be mounted on /sf.

See application example for more information.

SPI Flash

Header File

Functions

int spifs_enable(int port, int gpio_cs, unsigned long speed_hz, int mode)

Enable SPI Flash and mount LFS filesystem

Return

0 on success, negative value on failure

Parameters
  • port: [in] SPI Port to use

  • gpio_cs: [in] GPIO number connected to SPI chip select

  • speed_hz: [in] SPI Speed in Hz (max 10MHz)

  • mode: [in] SPI mode

int spifs_disable(void)

Disable SPI Flash and unmount LFS filesystem

Return

0 on success, negative value on failure

int spifs_getstatus(void)

Get status of SPI Flash

Return

SPI Flash status see sfstat_e

Enumerations

enum sfstat_e

SPI Flash status

Values:

enumerator SF_STAT_NOTENABLED

SPI Flash not enabled (Either not found or Initialization error)

enumerator SF_STAT_ENABLED

SPI Flash enabled but not mounted (Filesystem mount issue, Try spifs_enable() again

enumerator SF_STAT_MOUNTED

SPI Flash enabled and filesystem is mounted successfully