Skip to content

Commit 577d450

Browse files
committed
PlatformStorage: skip LittleFileSystem on internal flash with non-uniform sectors
1 parent 84f3444 commit 577d450

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

storage/platform/source/PlatformStorage.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,10 +156,17 @@ MBED_WEAK FileSystem *FileSystem::get_default_instance()
156156

157157
#elif COMPONENT_FLASHIAP
158158

159+
// To avoid alignment issues, initialize a filesystem if all sectors have the same size
160+
// OR the user has specified an address range
161+
#if MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS || \
162+
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF)
159163
static LittleFileSystem flash("flash", BlockDevice::get_default_instance());
160164
flash.set_as_default();
161165

162166
return &flash;
167+
#else
168+
return NULL;
169+
#endif
163170

164171
#else
165172

0 commit comments

Comments
 (0)