Skip to content

Commit 33a538a

Browse files
authored
Merge pull request ARMmbed#13593 from LDong-Arm/platform_storage_default_requirements
STM32F: skip LittleFileSystem default instance and TDBStore tests
2 parents 75544a7 + 8910ec6 commit 33a538a

File tree

4 files changed

+29
-1
lines changed

4 files changed

+29
-1
lines changed

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_1/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ static void kvstore_init()
101101
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
102102

103103
if (kv_setup == TDBStoreSet) {
104+
#if COMPONENT_FLASHIAP && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
105+
// TDBStore requires two areas of equal size, do the check for FlashIAP
106+
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
107+
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
108+
#endif
104109
if (erase_val == -1) {
105110
flash_bd = new FlashSimBlockDevice(bd);
106111
kvstore = new TDBStore(flash_bd);

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_2/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ static void kvstore_init()
9696
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
9797

9898
if (kv_setup == TDBStoreSet) {
99+
#if COMPONENT_FLASHIAP && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
100+
// TDBStore requires two areas of equal size
101+
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
102+
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
103+
#endif
99104
if (erase_val == -1) {
100105
flash_bd = new FlashSimBlockDevice(bd);
101106
kvstore = new TDBStore(flash_bd);

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

targets/targets.json

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@
8484
"default-adc-vref": {
8585
"help": "Default reference voltage for ADC (float)",
8686
"value": "NAN"
87+
},
88+
"internal-flash-uniform-sectors": {
89+
"help": "Target's internal flash has uniform sector sizes",
90+
"value": true
8791
}
8892
}
8993
},
@@ -1344,6 +1348,9 @@
13441348
"macro_name": "CLOCK_SOURCE"
13451349
}
13461350
},
1351+
"overrides": {
1352+
"internal-flash-uniform-sectors": false
1353+
},
13471354
"device_has_add": [
13481355
"ANALOGOUT",
13491356
"CAN",
@@ -1495,6 +1502,9 @@
14951502
"macro_name": "CLOCK_SOURCE"
14961503
}
14971504
},
1505+
"overrides": {
1506+
"internal-flash-uniform-sectors": false
1507+
},
14981508
"device_has_add": [
14991509
"SERIAL_ASYNCH",
15001510
"FLASH",
@@ -2109,7 +2119,8 @@
21092119
}
21102120
},
21112121
"overrides": {
2112-
"lpticker_delay_ticks": 0
2122+
"lpticker_delay_ticks": 0,
2123+
"internal-flash-uniform-sectors": false
21132124
},
21142125
"macros_add": [
21152126
"MBED_TICKLESS",

0 commit comments

Comments
 (0)