SPIFFS: Selectable configuration of SPIFFS

This commit is contained in:
sheinz 2016-08-08 18:08:42 +03:00
parent 964a2f850a
commit 5051c5c528
10 changed files with 199 additions and 101 deletions

View file

@ -6,6 +6,8 @@ FLASH_SIZE = 32
SPIFFS_BASE_ADDR = 0x200000
SPIFFS_SIZE = 0x010000
# SPIFFS_SINGLETON = 0 # for run-time configuration
include ../../common.mk
$(eval $(call make_spiffs_image,files))

View file

@ -10,6 +10,14 @@
#include "spiffs.h"
#include "esp_spiffs.h"
/**
* This example shows the default SPIFFS configuration when SPIFFS is
* configured in compile-time (SPIFFS_SINGLETON = 1).
*
* To configure SPIFFS in run-time uncomment SPIFFS_SINGLETON in the Makefile
* and replace the commented esp_spiffs_init in the code below.
*
*/
static void example_read_file_posix()
{
@ -76,7 +84,13 @@ static void example_fs_info()
void test_task(void *pvParameters)
{
#if SPIFFS_SINGLETON == 1
esp_spiffs_init();
#else
// for run-time configuration when SPIFFS_SINGLETON = 0
esp_spiffs_init(0x200000, 0x10000);
#endif
if (esp_spiffs_mount() != SPIFFS_OK) {
printf("Error mount SPIFFS\n");
}