spiffs_pgobj_ndxheader_s: Add a missing alignment

Withtout this change, I was not able to read images built
with the following tools:

    * https://github.com/igrr/mkspiffs
    * spiffsgen.py from ESP-IDF

Introduce a new Kconfig option, SPIFFS_COMPAT_OLD_NUTTX,
for those who prefer to keep the on-disk (bug-to-bug?) compatibility
with the older NuttX.
This commit is contained in:
YAMAMOTO Takashi 2020-12-21 15:55:48 +09:00 committed by Xiang Xiao
parent e38463ffff
commit 9b7e7efeb8
2 changed files with 13 additions and 0 deletions

View File

@ -176,4 +176,13 @@ config SPIFFS_COPYBUF_STACK
value generates more read/writes. No meaning having it bigger
than logical page size.
config SPIFFS_COMPAT_OLD_NUTTX
bool "Compatibility with older NuttX SPIFFS"
default n
---help---
Enable the compatiblilty with older NuttX versions.
(Older than NuttX 11.0.0, where this option was introduced.)
Note: This config affects the on-flash structure.
endif # FS_SPIFFS

View File

@ -400,6 +400,10 @@ begin_packed_struct struct spiffs_page_header_s
begin_packed_struct struct spiffs_pgobj_ndxheader_s
{
struct spiffs_page_header_s phdr; /* common page header */
#ifndef CONFIG_SPIFFS_COMPAT_OLD_NUTTX
uint8_t _align[4 - ((sizeof(struct spiffs_page_header_s) & 3) ==
0 ? 4 : (sizeof(struct spiffs_page_header_s) & 3))];
#endif
uint32_t size; /* size of object */
uint8_t type; /* type of object */
uint8_t name[CONFIG_SPIFFS_NAME_MAX]; /* name of object */