Skip to content

Return proper error if internal storage configuration not given #11390

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions TESTS/psa/its_ps/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,11 @@ void pits_ps_test()

mbed::KVMap &kv_map = mbed::KVMap::get_instance();
mbed::KVStore *kvstore = kv_map.get_main_kv_instance(STR_EXPAND(MBED_CONF_STORAGE_DEFAULT_KV));
if (!kvstore) {
TEST_SKIP_MESSAGE("KVStore not configured");
return;
}

uint32_t kv_get_flags;

flags = PSA_STORAGE_FLAG_NO_REPLAY_PROTECTION;
Expand Down
8 changes: 4 additions & 4 deletions features/device_key/source/DeviceKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@
#include "stdint.h"
#include "platform/NonCopyable.h"

#define DEVICEKEY_ENABLED 1

// Whole class is not supported if entropy is not enabled
// Flash device is required as Device Key is currently depending on it
#if !DEVICE_FLASH || !defined(COMPONENT_FLASHIAP)
#undef DEVICEKEY_ENABLED
// and KVStore needs to be configured properly, as Device key lives inside it
#if DEVICE_FLASH && defined(COMPONENT_FLASHIAP) && MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE
#define DEVICEKEY_ENABLED 1
#else
#define DEVICEKEY_ENABLED 0
#endif

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@
* limitations under the License.
*/

#ifndef COMPONENT_FLASHIAP
#error [NOT_SUPPORTED] Target must have internal FlashIAP for this test
#include "mbed.h"
#include "DeviceKey.h"

#if !defined(COMPONENT_FLASHIAP) || !DEVICEKEY_ENABLED
#error [NOT_SUPPORTED] Target must have internal FlashIAP and Device Key configured for this test
#else

#include "mbed.h"
#include <stdio.h>
#include <string.h>
#include "DeviceKey.h"
#include "KVStore.h"
#include "KVMap.h"
#include "kv_config.h"
Expand Down
12 changes: 0 additions & 12 deletions features/storage/kvstore/conf/global/mbed_lib.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@
}
},
"target_overrides": {
"K66F": {
"storage_type": "TDB_INTERNAL"
},
"NUCLEO_F411RE": {
"storage_type": "TDB_INTERNAL"
},
"NUCLEO_F429ZI": {
"storage_type": "TDB_INTERNAL"
},
"UBLOX_EVK_ODIN_W2": {
"storage_type": "TDB_INTERNAL"
},
"LPC55S69_S": {
"storage_type": "TDB_INTERNAL"
},
Expand Down
4 changes: 3 additions & 1 deletion features/storage/kvstore/conf/kv_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -691,7 +691,9 @@ MBED_WEAK BlockDevice *get_other_blockdevice()

int _storage_config_TDB_INTERNAL()
{
#if COMPONENT_FLASHIAP
#if COMPONENT_FLASHIAP && \
MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE && \
MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS
bd_size_t internal_size = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_SIZE;
bd_addr_t internal_start_address = MBED_CONF_STORAGE_TDB_INTERNAL_INTERNAL_BASE_ADDRESS;
int ret;
Expand Down
7 changes: 2 additions & 5 deletions targets/targets.json
Original file line number Diff line number Diff line change
Expand Up @@ -1794,8 +1794,7 @@
"MCUXpresso_MCUS",
"KSDK2_MCUS",
"FRDM",
"Freescale_EMAC",
"PSA"
"Freescale_EMAC"
],
"is_disk_virtual": true,
"macros": ["CPU_MK66FN2M0VMD18", "FSL_RTOS_MBED", "MBED_SPLIT_HEAP", "MBED_TICKLESS"],
Expand Down Expand Up @@ -2859,8 +2858,7 @@
"STM32F429ZI",
"STM32F429xx",
"STM32F429xI",
"STM_EMAC",
"PSA"
"STM_EMAC"
],
"components_add": ["FLASHIAP"],
"macros_add": [
Expand Down Expand Up @@ -4782,7 +4780,6 @@
"release_versions": ["5"],
"macros_add": ["MBED_TICKLESS"],
"device_has_remove": [],
"extra_labels_add": ["PSA"],
"components_add": ["SD", "FLASHIAP"],
"config": {
"stdio_uart_tx_help": {
Expand Down