Choose the files before compiling. The PC will see these fixed names and sizes each time the device starts.

Each virtual file has a name, fixed length and write setting. This picture uses DEVICE.TXT; for the worked example below, use DEMO.TXT at 64 bytes with writing enabled, as shown in the table.
The minimum 12-character serial is a requirement of the USB Mass Storage Bulk-Only Transport specification, sections 4.1.1 and 4.1.2. It lets the host distinguish devices sharing a VID/PID. It is an identifier, not a password.
Use the following setup for the three-file walkthrough:
|
Tool slot |
Filename |
Length |
Writable |
Firmware index |
Contents in this example |
|
1 |
DEMO.TXT |
64 bytes |
Yes |
0 |
Text in RAM |
|
2 |
STATUS.CSV |
128 bytes |
No |
1 |
A measurement snapshot in RAM |
|
3 |
SETTINGS.BIN |
64 bytes |
Yes |
2 |
Binary settings in RAM |
All files appear in the drive's root directory; folders are not supported. Names use the 8.3 format: up to eight characters before the dot and up to three after it. Use letters, digits, underscore or hyphen. Names are case-insensitive and normalized to uppercase. Avoid Windows reserved names such as CON and COM1. The tool converts STATUS.CSV to the padded descriptor text "STATUS CSV"; you do not type that padding in the filename field.
The generated definitions for this layout include:
$define USB_MSC_ENABLE 1
$define USB_MSC_FILES 3
$define USB_MSC_NAME_1 "DEMO TXT"
$define USB_MSC_SIZE_1 64
$define USB_MSC_WRITE_1 1
$define USB_MSC_NAME_2 "STATUS CSV"
$define USB_MSC_SIZE_2 128
$define USB_MSC_WRITE_2 0
$define USB_MSC_NAME_3 "SETTINGSBIN"
$define USB_MSC_SIZE_3 64
$define USB_MSC_WRITE_3 1
These are an excerpt, not a replacement for the complete generated header. Do not define them twice. Each file length is 1–1,041,408 bytes, subject to the combined limit of 2034 sectors for all files. File length is separate from USB packet size and RAM allocation. For example, a 100 KiB file can be read from external storage in small pieces without a 100 KiB RAM array. The tool rounds each file's allocation up to 512-byte sectors and checks the volume limit.
Created with the Personal Edition of HelpNDoc: Modernize your help files with HelpNDoc's WinHelp HLP to CHM conversion tool