How to upload littlefs.bin to esp32
How to upload littlefs.bin to esp32
I want to upload my code to esp32 without using any ide. As far as I have understood I am suppose to upload bin files to my esp32 but the question is how? I coded my project in PlatformIO. The bin files that are generated are bootloader.bin, firmware.bin, littlefs.bin and partitions.bin. Yes I am using LittleFS file system however i have not made any changes to the partitions table nor do I know how to do it so I am assuming its set to default. I saw that the bin files could be uploaded using command line or Flash Download Tools however both of them require addresses of where the bin files needs to be. Can someone help me with a step by step guide on what should i do. Thank you!
-
- Posts: 200
- Joined: Sun Jun 23, 2024 6:18 pm
Re: How to upload littlefs.bin to esp32
@aliarifat794 The links that you have mentioned gives information on how to upload the code using PlatformIO or Arduino Ide. However I want the method on how to upload the same thing using command line or Flash Download Tools
-
- Posts: 52
- Joined: Thu Jun 22, 2023 12:50 pm
Re: How to upload littlefs.bin to esp32
Hello.
You can use esptool. Install it using pip Python package manager: `pip install esptool` or `pip3 install esptool` or `python -m pip install esptool`, depending on your system. In case you want to use virtual environment, please follow these instructions: https://docs.espressif.com/projects/esp ... to-install.
Do you use arduino or esp-idf core in PlatformIO? Do you know how does the partition table looks like (sizes and offsets of partitions)?
This is how a partition table looks by default in ESP-IDF (your partition table will look different though):
The bootloader has offset of 0x1000 and size of 0x7000 (usually), so the partition table should start at 0x8000. Other partition specified in the partition table can be placed at offset of 0x9000 and higher.
This is a command ESP-IDFs idf.py generates to flash hello_world example to the device:
This is a partition table for LittleFS example in ESP-IDF :
And a command generated by idf.py flash to flash the LittleFS example:
So this is probably how the command you need to use would look like (I am omitting few flags which have some default value to make it more readable):
You can use esptool. Install it using pip Python package manager: `pip install esptool` or `pip3 install esptool` or `python -m pip install esptool`, depending on your system. In case you want to use virtual environment, please follow these instructions: https://docs.espressif.com/projects/esp ... to-install.
Do you use arduino or esp-idf core in PlatformIO? Do you know how does the partition table looks like (sizes and offsets of partitions)?
This is how a partition table looks by default in ESP-IDF (your partition table will look different though):
Code: Select all
# ESP-IDF Partition Table
# Name, Type, SubType, Offset, Size, Flags
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
This is a command ESP-IDFs idf.py generates to flash hello_world example to the device:
Code: Select all
esptool.py --chip esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 hello_world.bin 0x8000 partition_table/partition-table.bin
Code: Select all
# Name, Type, SubType, Offset, Size, Flags
# Note: if you have increased the bootloader size, make sure to update the offsets to avoid overlap
nvs, data, nvs, 0x9000, 0x6000,
phy_init, data, phy, 0xf000, 0x1000,
factory, app, factory, 0x10000, 1M,
storage, data, littlefs, 0x110000, 0xF0000,
Code: Select all
esptool.py --chip esp32 -p /dev/ttyUSB0 -b 460800 --before=default_reset --after=hard_reset write_flash --flash_mode dio --flash_freq 40m --flash_size 2MB 0x1000 bootloader/bootloader.bin 0x10000 littlefs_example.bin 0x8000 partition_table/partition-table.bin 0x110000 storage.bin
Code: Select all
esptool.py --chip <esp chip type> -p <port> write_flash 0x1000 <path to the bootloader .bin> 0x10000 <path to your application .bin> 0x8000 <path to the partition table .bin> 0x110000 <path to the littlefs partiton .bin>
Who is online
Users browsing this forum: No registered users and 82 guests