diff --git a/lib/ResourcesFS/ResourcesFS.cpp b/lib/ResourcesFS/ResourcesFS.cpp index 393d26ea..00eeaf06 100644 --- a/lib/ResourcesFS/ResourcesFS.cpp +++ b/lib/ResourcesFS/ResourcesFS.cpp @@ -1,5 +1,3 @@ -#pragma once - #include "ResourcesFS.h" #include @@ -35,7 +33,6 @@ bool ResourcesFS::begin(bool remount) { spi_flash_mmap_handle_t map_handle; // unused size_t len = impl->partition->size; if (len > MAX_ALLOC_SIZE) { - // FIXME: cannot mmap too large region at once, why? len = MAX_ALLOC_SIZE; } diff --git a/lib/ResourcesFS/ResourcesFS.h b/lib/ResourcesFS/ResourcesFS.h index e3a0bc24..6adbe582 100644 --- a/lib/ResourcesFS/ResourcesFS.h +++ b/lib/ResourcesFS/ResourcesFS.h @@ -11,11 +11,14 @@ class ResourcesFS { ResourcesFS() = default; ~ResourcesFS() = default; + // FIXME: true MAX_ALLOC_SIZE = ~3.5MB but not enough pages to do mmap + // See: spi_flash_mmap_get_free_pages() --> ~31 free pages on real device + static constexpr size_t MAX_FILES = 32; static constexpr size_t MAX_FILE_NAME_LENGTH = 32; - static constexpr size_t MAX_ALLOC_SIZE = 3 * 1024 * 1024; // 3 MB - static constexpr size_t ALIGNMENT = 4; // bytes - static constexpr uint32_t MAGIC = 0x46535631; // "FSV1" + static constexpr size_t MAX_ALLOC_SIZE = 28 * 64 * 1024; // 28 pages == ~1.8 MB + static constexpr size_t ALIGNMENT = 4; // bytes + static constexpr uint32_t MAGIC = 0x46535631; // "FSV1" enum FileType { FILETYPE_INVALID = 0,