A DMF application that converts a directory structure into a single binary file with DMFFS file system.
make_dmffs is a DMOD application that scans a directory tree and converts it into a binary file using the TLV (Type-Length-Value) format defined by the DMFFS file system. This binary can then be placed in the microcontroller's memory by the linker and read by the dmffs library.
The application takes two arguments:
- Input directory path
- Output binary file path
make_dmffs ./flashfs ./out/flash-fs.binThis will:
- Scan all files in
./flashfsdirectory - Create a binary file at
./out/flash-fs.binwith the TLV structure - The binary can be linked into firmware and mounted using dmffs
Since this is a DMF application, it needs to be run using:
- dmod_loader on a development system
- Directly on embedded target with DMOD system
dmod_loader make_dmffs.dmf --args "./flashfs ./out/flash-fs.bin"The generated binary file uses the following TLV structure:
- VERSION (optional) - File system version
- FILE entries:
- NAME - File name
- DATA - File content
- DIR entries (for subdirectories):
- NAME - Directory name
- FILE entries within directory
- END - End marker
- Read-only file system (no attributes like permissions, timestamps, or ownership are preserved)
The application is built as part of the dmffs project:
mkdir -p build
cd build
cmake .. -DDMOD_MODE=DMOD_MODULE
cmake --build .The output will be build/_deps/dmod-build/dmf/make_dmffs.dmf
The generated binary file can be:
- Linked into firmware at a specific flash address
- Mounted using dmffs library with configuration:
FLASH_FS_ADDR- Address where the binary is locatedFLASH_FS_SIZE- Size of the flash region
Example:
// Set environment variables
Dmod_SetEnv("FLASH_FS_ADDR", "0x08080000");
Dmod_SetEnv("FLASH_FS_SIZE", "0x80000");
// Mount the file system
dmfsi_context_t ctx = dmfsi_dmffs_init(NULL);
// Open files
void* fp;
dmfsi_dmffs_fopen(ctx, &fp, "test.txt", DMFSI_O_RDONLY, 0);Patryk Kubiak
0.1