Skip to main content

ESP-IDF utility for generating VSCode tasks and LittleFS support

Project description

๐Ÿงฐ ESP-IDF LittleFS CLI Tool

This project provides a modern Python CLI tool to quickly configure LittleFS partitions in ESP-IDF projects, including:

  • โœ… Automatic creation of partition data folders
  • โœ… Generation of tasks.json for Visual Studio Code
  • โœ… Safe insertion of LittleFS support in CMakeLists.txt
  • โœ… ๐Ÿง  Smart platform detection (Windows/Linux)

[!WARNING]
Requires Python 3.6+ and ESP-IDF installed in your system


๐Ÿ“ Project Structure

esp_littlefs_cli/
โ”œโ”€โ”€ littlefscli/
โ”‚   โ”œโ”€โ”€ enable_littlefs.py       # Main CLI logic (with def main())
โ”‚   โ”œโ”€โ”€ config.ini               # Example config
โ”‚   โ””โ”€โ”€ templates/
โ”‚       โ”œโ”€โ”€ tasks.base.template.json
โ”‚       โ””โ”€โ”€ task.partition.template.json
โ”œโ”€โ”€ setup.py                     # Installation config
โ”œโ”€โ”€ README.md                    # This file
โ””โ”€โ”€ MANIFEST.in                  # Includes templates in package

๐Ÿš€ Installation

๐Ÿ“ฆ Install globally with pip

git clone https://github.com/...
cd esp_littlefs_cli
pip install .

๐Ÿ’ก Or use pipx (recommended)

git clone https://github.com/...
cd esp_littlefs_cli
pipx install /.

โš™๏ธ Configuration (config.ini)

Create or edit a config file like this:

[LittleFS]
platform = windows
export_script = C:\Users\YOUR_USER\Espressif\v5.4\esp-idf\export.ps1

[LittleFS_interna]
partition_label = littlefs_chip
partition_dir = littlefs_data
tag = INTERNOS (chip)

[LittleFS_externa]
partition_label = littlefs_user
partition_dir = littlefs_user
tag = EXTERNOS (user)

Parameters

Key Description
platform windows or linux (affects VSCode task port)
export_script Absolute path to the ESP-IDF export script
partition_label Name of the partition (e.g., littlefs)
partition_dir Folder with files to flash
tag Friendly name for VSCode task label

[!IMPORTANT]
export_script should point to the ESP-IDF export script, usually located in the installation path (export.ps1 or export.sh).
partition_label and partition_dir must match your partitions.csv entries and your code's mount points.

[!CAUTION] Before it, don't forget execute install.ps1 or install.sh from your terminal


๐Ÿงช Usage

Once installed, simply run:

enable-littlefs /path/to/your/project [.vscode/partition.ini]

[!NOTE]
.vscode/partition.ini is optional. If not provided, the tool will use config.ini from the CLI script's directory.

What it does:

  • ๐Ÿ“ Creates missing littlefs_* directories

  • ๐Ÿง  Generates .vscode/tasks.json with correct build targets

  • ๐Ÿ“Œ Patches CMakeLists.txt only if needed (non-invasive)


๐Ÿ’ป Platform Support

โœ… Native Linux
โœ… Windows โœ… macOS


โ™ป๏ธ Idempotency

The CLI safely detects existing configurations:

  • Skips tasks.json if already configured

  • Avoids duplicate entries in CMakeLists.txt

  • Can be re-run without side effects


๐Ÿง  Real-world Example

Letโ€™s say you want to set this up in an existing ESP-IDF project:

cd ~/esp/myproject
enable-littlefs . .vscode/partition.ini

โš™๏ธ Expected output

Even enable-littlefs project/path or enable-littlefs project/path config/path

Case with archives folders already created

๐Ÿ“ Project directory: /.../
๐Ÿ“„ Config file: /.../xxxx.ini
๐Ÿง  Platform: /.../
๐Ÿ’ป Shell: /.../
๐Ÿ”— Export script: /.../

๐Ÿงฉ Checking LittleFS partitions...
๐Ÿ“ฆ Directory already exists: littlefs_data
๐Ÿ“ฆ Directory already exists: littlefs_user
โœ… All partitions processed.

๐Ÿงพ tasks.json written to: /.../
โœ… CMakeLists.txt already contains LittleFS logic.

๐Ÿ All done. You're ready to roll ๐Ÿš€

๐Ÿ“„ License

This project is licensed under the MIT License.

๐Ÿ™Œ Contributing

Contributions are welcome! Feel free to open issues or pull requests for bugs, features, or improvements. Just make sure you follow standard Python formatting and write clear commit messages.

๐Ÿง  Author

Created by PoleG97
Maintained as a CLI tool with โค๏ธ and Python power.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

enable-littlefs-1.0.2.tar.gz (7.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

enable_littlefs-1.0.2-py3-none-any.whl (9.0 kB view details)

Uploaded Python 3

File details

Details for the file enable-littlefs-1.0.2.tar.gz.

File metadata

  • Download URL: enable-littlefs-1.0.2.tar.gz
  • Upload date:
  • Size: 7.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.0.0 CPython/3.12.3

File hashes

Hashes for enable-littlefs-1.0.2.tar.gz
Algorithm Hash digest
SHA256 a5702ada2c9f8865a077c728d5d1c2bc654ff1844c492226bb167123f3d113e3
MD5 1d4c1c90c2b6a05ee8ea084cea28bad8
BLAKE2b-256 6aa9aaea6566ff17299527fd2c410fbcc191f564495bccebeacde06b7010295a

See more details on using hashes here.

File details

Details for the file enable_littlefs-1.0.2-py3-none-any.whl.

File metadata

File hashes

Hashes for enable_littlefs-1.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 796ab53130bfdc738162f4d85fa5eb44597d34cd38c5f50313a21b14f08fa434
MD5 cc4124ce40b04df50dd6e5f924988207
BLAKE2b-256 fb1cadbccbe181c1fe1965433579d3c230ddb5aff773d9243a755b362efe735a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page