EasyManuals Logo

Espressif ESP32-S2 User Manual

Espressif ESP32-S2
1695 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #777 background imageLoading...
Page #777 background image
Chapter 2. API Reference
SPIFFS_IMAGE_FLASH_IN_PROJECT := 1
$(eval $(call spiffs_create_partition_image,<partition>,<base_dir>))
in CMake:
spiffs_create_partition_image(my_spiffs_partition my_folder FLASH_IN_PROJECT)
If FLASH_IN_PROJECT/SPIFFS_IMAGE_FLASH_IN_PROJECT is not specified, the image will still be gener-
ated, but you will have to flash it manually using esptool.py, parttool.py, or a custom build system target.
There are cases where the contents of the base directory itself is generated at build time. Users can use DE-
PENDS/SPIFFS_IMAGE_DEPENDS to specify targets that should be executed before generating the image.
in Make:
dep:
...
SPIFFS_IMAGE_DEPENDS := dep
$(eval $(call spiffs_create_partition_image,<partition>,<base_dir>))
in CMake:
add_custom_target(dep COMMAND ...)
spiffs_create_partition_image(my_spiffs_partition my_folder DEPENDS dep)
For an example, see storage/spiffsgen.
mkspiffs Another tool for creating SPIFFS partition images is mkspis. Similar to spiffsgen.py, it can be
used to create an image from a given folder and then flash that image using esptool.py
For that, you need to obtain the following parameters:
Block Size: 4096 (standard for SPI Flash)
Page Size: 256 (standard for SPI Flash)
Image Size: Size of the partition in bytes (can be obtained from a partition table)
Partition Offset: Starting address of the partition (can be obtained from a partition table)
To pack a folder into a 1-Megabyte image, run:
mkspiffs -c [src_folder] -b 4096 -p 256 -s 0x100000 spiffs.bin
To flash the image onto ESP32-S2 at offset 0x110000, run:
python esptool.py --chip esp32s2 --port [port] --baud [baud] write_flash -z
,0x110000 spiffs.bin
Notes on which SPIFFS tool to use The two tools presented above offer very similar functionality. However,
there are reasons to prefer one over the other, depending on the use case.
Use spiffsgen.py in the following cases:
1. If you want to simply generate a SPIFFS image during the build. spiffsgen.py makes it very convenient
by providing functions/commands from the build system itself.
2. If the host has no C/C++ compiler available, because spiffsgen.py does not require compilation.
Use mkspiffs in the following cases:
1. If you need to unpack SPIFFS images in addition to image generation. For now, it is not possible with spiff-
sgen.py.
Espressif Systems 766
Submit Document Feedback
Release v4.4

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Espressif ESP32-S2 and is the answer not in the manual?

Espressif ESP32-S2 Specifications

General IconGeneral
BrandEspressif
ModelESP32-S2
CategorySingle board computers
LanguageEnglish