Writing to the system with SFLASH requires consideration in the software design to maximize the SFLASH capabilities and expand the SFLASH life-time.
The following is a list of design recommendations:
- Minimum file updates: invoking of file system functions, which triggers erase or write storage commands, should be minimized. Such commands are triggered with each update of a file, and each system function has documentation about whether it triggers a file update.
- File allocation table: the file system allocation table resides on the SFLASH. New file creation and the deletion of existing files involves updating the allocation table. TI recommends rewriting a file rather than recreating (that is, deleting and creating) the file.
- System configuration and user file creation: the system configuration is stored on the SFLASH, and setting the system configuration triggers a file update operation. TI recommends setting the system configuration and user file creation as part of the programming image, and then programming the image. Setting these at programming saves the user from having to write these files at runtime, which can help keep the number of SFLASH accesses to a minimum. During the programming procedure, regardless of the number of the programmed files, the file system is written only twice.
- The SFLASH storage type that the SimpleLink Wi-Fi device supports has a minimal block (subsector) size of 4096 bytes; this is the minimal unit with which the file system can work. Thus, the file system software rounds the file sizes to a multiple of 4096 bytes. For example, creating a file with maximum size of 20 bytes results in a file of 4096 bytes. For optimal consumption of the SFLASH, create files where their maximum size is a multiple of 4096 minus 500 bytes (for each file the file system allocates a header of 500 bytes).
- The file system does not handle fragmentation; sometimes changing the order in which the files are created may result in more space. Also, changing the order of user file creation in the programming image may affect the SFLASH usage.
- To reduce SFLASH writes, create a file which requires frequent updates with the FAILSAFE flag; the number of SFLASH writes is reduced in half because the system switches between the file images.