 |
simple FS
v0.1.0
|
Simple File System (sFS) is very simple file system for for embedded devices. Support fast append to file
operation. The type of FS is RA (Read-Append). It is optimized for FLASH-like types of memories, where write/erase operation is much time consuming that reading. Primary use of sFS is store data from connected sensors to external memory.
Properties of sFS:
- sFS is Read-Append oriented file system
- does not support extended info as file owner, protected access, file rights, ...
- Configurable for small (in kB) and large (in MB) memory capacity - it is possible to shring overhead, by reducing max. count of files and size of single file record (row).
Predefined variants
Simple File system predefine 4 variants of configurations. The configuration is tetermined only by "Files" and "Column per file" values. Other value depend on these basic setting.
| | | | HEADER | HEADER | HEADER | META | META | META | DATA |
| Variant | Files | Column per file | ADDRESS | RECORD_LENGTH | SIZE | ADDRESS | RECORD_LENGH | SIZE | ADDRESS |
Ultra small | U | 1 | 4 | 32 | 32 | 32 | 64 | 48 | 48 | 112 |
eXtra small | X | 2 | 8 | 32 | 32 | 64 | 96 | 96 | 192 | 288 |
Small | S | 8 | 16 | 32 | 32 | 256 | 288 | 192 | 1536 | 1824 |
Large | L | 22 | 42 | 32 | 32 | 704 | 736 | 504 | 11088 | 11824 |
Properties of files in sFS:
- binary format,
- CSV-like format: data are always stored in rows. Each row contains of set of columns, or data from external sensors,
- each file has limitted count of columns, depending on memory capacity,
- files is FS is self-descripted; there is stored also information how to interpret that file,
- only to last file if sFS can be append data; other files are locked (can't be extended))
- file name is automatically generated (depending on HW ID of used memory),
Supporting platforms:
- STM32
- ESP32 (in future)
- native C app (in simulation mode)
Supported memories:
- SPI-like: FLASH memory. Winbond W32 with high capacity
- 1-wire: EEPROM memory. E.g. Maxim integrated DS28EC20 with maximum 20kB of capacity
- RAM memory - as a dektop application (in SIMULATION mode)
Each class of memories has own limitations:
- normal size (FLASH): 1 - 16MB.
- limited size (EEPROM): 1 - 1024 kB
Technical documentation
SIMPLE_FS
sFS Memory map
Memory map for sfS v.1
- MAC - Manufacturer
- MT - Memory Type
- CAP - Capacity code
- CC - Size variant
- MF - Max files
- MS - Max. sensors per file
- NP - Number of parts (column) in file
- RL - Record length (length of one record in file [B])
Examples of use
Create instance of simpleFS
init_FS(NULL, NULL, 0);
uint8_t sensor_index = 0;
Fill file with data
if (FS) {
if (sd != NULL) {
}
}
}
Versions
[24.6.2021] v0.1.0, FW version: sFS
- first version,
- works with SPI FLASH memory
- data drivers:
- one-wire DS18B20,
- internal MCU peripherals: RTC clock, ADC converter
- primitive data types
Author
Juraj Dudak
uint8_t file_get_num_parts(SimpleFS_t *fileP)
Return number parts of opened file.
Definition: sensor_FS.c:249
Simple file system for application of sensoric and primitive data types .
SimpleFS_t * FS_open_last_file(void)
Open last file on sensorFS.
Definition: sensor_FS.c:226
FileDescriptor_t file
Detailed information about open file: FileDescriptor_t.
Definition: file_format.h:273
FS_state FS_commit_file_header(void)
Finish write information about created file.
Definition: sensor_FS.c:204
Describes internal structure of file.
Definition: file_format.h:228
The interface, that defines list of functions, tha have to be implemented for each type of value (or ...
Definition: sensor.h:66
Sensor value is stored as array of bytes.
Definition: sensor.h:42
SensorInterface_t * FS_sensor_driver(uint8_t sensor_part)
Return driver for attached sensor.
Definition: sensor_FS.c:287
Base structure for sFS.
Definition: file_format.h:271
void file_data_row_commit(SimpleFS_t *fs)
Write prepared measured values (by file_store_data} function) to FLASH.
Definition: sensor_FS.c:347
SensorValue_t *(* getValue)(void)
Read prepared value from sensor.
Definition: sensor.h:104
RecordDescriptor_t file_column_format(SimpleFS_t *fileP, uint8_t index_part)
Return format of i-th sensor inf datafile.
Definition: sensor_FS.c:259
SensorType_t sensor_type
Type of stored value.
Definition: file_format.h:232
FS_state file_add_sensor(uint8_t index, uint8_t index_in_driver, SensorInterface_t *sensor)
Add new sensor to created file.
Definition: sensor_FS.c:180
uint32_t file_data_row_begin(SimpleFS_t *fs)
Initialize internal data structures for new data record.
Definition: sensor_FS.c:321
void(* Init)(void *hw1, uint16_t hw2)
Initialization of sensor.
Definition: sensor.h:73
RecordTypeValue_t value_format
This information contain every sensor in his driver file.
Definition: file_format.h:234
SensorInterface_t adcSensor
Interface to ADC sensor.
Definition: module_adc.c:38
FS_state FS_write_preamble(void)
Write preamble aprt in sensorFS, if not exists.
Definition: sensor_FS.c:384
uint8_t FS_create_file()
Begin file creation procedure.
Definition: sensor_FS.c:114
RecordDescriptor_t format[MAXIMUM_FS_SENSORS_PER_FILE]
Format specification for each column in file.
Definition: file_format.h:258
FS_state file_store_data(SimpleFS_t *fs, uint8_t index, SensorValue_t *value)
Prepare measured value to file buffer.
Definition: sensor_FS.c:337
uint8_t get_sensor_data_length(ValueFormatMetaLength_t length_code)
Compute real data length (in bytes) from code length.
Definition: sensor.c:20