A powerful Python script to generate fsdata.c for the LwIP HTTP server. It recursively processes a directory of web files (HTML, CSS, JS, images, etc.) and converts them into C source structures.
- Gzip Compression: Automatically compresses file content using gzip (level 9) for efficient storage on MCUs.
- Recursive Processing: Handles subdirectories (e.g.,
css/,js/,img/) automatically.
Run the script by providing the source directory and the desired output path:
python makeFSdata.py --fs-dir "path/to/web_files" --out "path/to/output/dir"| Flag | Description | Default |
|---|---|---|
--fs-dir |
Required. Directory containing your web files. | - |
--out |
Required. Directory where fsdata.c will be created. |
- |
--line-size |
Number of hex bytes per line in the C arrays. | 16 |
--no-gzip |
Disable gzip compression (embed raw file bytes). | False |
To generate data for the included test folder:
python makeFSdata.py --fs-dir "test_fs" --out "."You can check the STM32H7_WebServer project for a complete example of how to integrate these generated files into an MCU-hosted web server.