Skip to content

Commit 40f40ac

Browse files
authored
Merge pull request #9407 from offirko/offir_direct_access_handle_default_config
DirectAccess DeviceKey: add support for default storage type
2 parents 46bb754 + e996b7f commit 40f40ac

File tree

2 files changed

+24
-1
lines changed

2 files changed

+24
-1
lines changed

features/storage/TESTS/kvstore/direct_access_devicekey_test/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -245,7 +245,7 @@ void test_direct_access_to_device_inject_root()
245245
uint32_t key[DEVICE_KEY_16BYTE / sizeof(uint32_t)];
246246
KVMap &kv_map = KVMap::get_instance();
247247
KVStore *inner_store = kv_map.get_internal_kv_instance(NULL);
248-
TEST_ASSERT_NOT_EQUAL(NULL, inner_store);
248+
TEST_SKIP_UNLESS_MESSAGE(inner_store != NULL, "Test skipped. No KVStore Internal");
249249

250250
BlockDevice *flash_bd = kv_map.get_internal_blockdevice_instance("");
251251
TEST_ASSERT_NOT_EQUAL(NULL, flash_bd);
@@ -271,6 +271,20 @@ void test_direct_access_to_device_inject_root()
271271
internal_start_address = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS;
272272
internal_rbp_size = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE;
273273
is_conf_tdb_internal = true;
274+
} else if (strcmp(STR(MBED_CONF_STORAGE_STORAGE_TYPE), "default") == 0) {
275+
#if COMPONENT_QSPIF || COMPONENT_SPIF || COMPONENT_DATAFLASH
276+
internal_start_address = MBED_CONF_STORAGE_TDB_EXTERNAL_INTERNAL_BASE_ADDRESS;
277+
internal_rbp_size = MBED_CONF_STORAGE_TDB_EXTERNAL_RBP_INTERNAL_SIZE;
278+
#elif COMPONENT_SD
279+
internal_start_address = MBED_CONF_STORAGE_FILESYSTEM_INTERNAL_BASE_ADDRESS;
280+
internal_rbp_size = MBED_CONF_STORAGE_FILESYSTEM_RBP_INTERNAL_SIZE;
281+
#elif COMPONENT_FLASHIAP
282+
internal_start_address = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS;
283+
internal_rbp_size = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE;
284+
is_conf_tdb_internal = true;
285+
#else
286+
TEST_SKIP_UNLESS_MESSAGE(false, "Test skipped. No KVStore Internal");
287+
#endif
274288
} else {
275289
TEST_SKIP_UNLESS_MESSAGE(false, "Test skipped. No KVStore Internal");
276290
}

features/storage/kvstore/direct_access_devicekey/DirectAccessDevicekey.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,15 @@ int get_expected_internal_TDBStore_position(uint32_t *out_tdb_start_offset, uin
123123
} else if (strcmp(STR(MBED_CONF_STORAGE_STORAGE_TYPE), "TDB_EXTERNAL") == 0) {
124124
*out_tdb_start_offset = MBED_CONF_STORAGE_TDB_EXTERNAL_INTERNAL_BASE_ADDRESS;
125125
tdb_size = MBED_CONF_STORAGE_TDB_EXTERNAL_RBP_INTERNAL_SIZE;
126+
} else if (strcmp(STR(MBED_CONF_STORAGE_STORAGE_TYPE), "default") == 0) {
127+
#if COMPONENT_QSPIF || COMPONENT_SPIF || COMPONENT_DATAFLASH
128+
*out_tdb_start_offset = MBED_CONF_STORAGE_TDB_EXTERNAL_INTERNAL_BASE_ADDRESS;
129+
tdb_size = MBED_CONF_STORAGE_TDB_EXTERNAL_RBP_INTERNAL_SIZE;
130+
#elif COMPONENT_SD
131+
tdb_size = MBED_CONF_STORAGE_FILESYSTEM_RBP_INTERNAL_SIZE;
132+
#else
133+
return MBED_ERROR_UNSUPPORTED;
134+
#endif
126135
} else {
127136
return MBED_ERROR_UNSUPPORTED;
128137
}

0 commit comments

Comments
 (0)