Enable storage tests to all targets

pull/12638/head
Tymoteusz Bloch 2020-03-17 11:54:11 +01:00
parent da9f85b6af
commit 2ca832c673
7 changed files with 27 additions and 26 deletions

View File

@ -10,7 +10,7 @@
"QSPI_POLARITY_MODE": 0, "QSPI_POLARITY_MODE": 0,
"QSPI_FREQ": "40000000", "QSPI_FREQ": "40000000",
"QSPI_MIN_READ_SIZE": "1", "QSPI_MIN_READ_SIZE": "1",
"QSPI_MIN_PROG_SIZE": "1" "QSPI_MIN_PROG_SIZE": "256"
}, },
"target_overrides": { "target_overrides": {
"MX25R6435F": { "MX25R6435F": {
@ -28,7 +28,7 @@
"MCU_NRF52840": { "MCU_NRF52840": {
"QSPI_FREQ": "32000000", "QSPI_FREQ": "32000000",
"QSPI_MIN_READ_SIZE": "4", "QSPI_MIN_READ_SIZE": "4",
"QSPI_MIN_PROG_SIZE": "4" "QSPI_MIN_PROG_SIZE": "256"
}, },
"MCU_PSOC6": { "MCU_PSOC6": {
"QSPI_FREQ": "50000000", "QSPI_FREQ": "50000000",
@ -36,7 +36,7 @@
}, },
"EFM32GG11_STK3701": { "EFM32GG11_STK3701": {
"QSPI_MIN_READ_SIZE": "4", "QSPI_MIN_READ_SIZE": "4",
"QSPI_MIN_PROG_SIZE": "4" "QSPI_MIN_PROG_SIZE": "256"
} }
} }
} }

View File

@ -30,8 +30,8 @@
#include "utest.h" #include "utest.h"
#include <stdlib.h> #include <stdlib.h>
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6) #if !SECURESTORE_ENABLED
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6 #error [NOT_SUPPORTED] SecureStore need to be enabled for this test
#else #else
#define FSST_TEST_NUM_OF_THREADS 5 #define FSST_TEST_NUM_OF_THREADS 5
@ -524,5 +524,5 @@ int main()
return !Harness::run(specification); return !Harness::run(specification);
} }
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) #endif //!SECURESTORE_ENABLED
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -33,8 +33,8 @@
using namespace utest::v1; using namespace utest::v1;
using namespace mbed; using namespace mbed;
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6) #if !SECURESTORE_ENABLED
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6 #error [NOT_SUPPORTED] SecureStore need to be enabled for this test
#else #else
static const char data[] = "data"; static const char data[] = "data";
@ -911,5 +911,5 @@ int main()
return !Harness::run(specification); return !Harness::run(specification);
} }
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) #endif //!SECURESTORE_ENABLED
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -33,8 +33,8 @@
using namespace utest::v1; using namespace utest::v1;
using namespace mbed; using namespace mbed;
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6) #if !SECURESTORE_ENABLED
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6 #error [NOT_SUPPORTED] SecureStore need to be enabled for this test
#else #else
static const char data[] = "data"; static const char data[] = "data";
@ -894,5 +894,5 @@ int main()
return !Harness::run(specification); return !Harness::run(specification);
} }
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) #endif //!SECURESTORE_ENABLED
#endif // !defined(MBED_CONF_RTOS_PRESENT) #endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -35,8 +35,8 @@
#include <algorithm> #include <algorithm>
#include "DeviceKey.h" #include "DeviceKey.h"
#if (!defined(TARGET_K64F) && !defined(TARGET_ARM_FM)) && !defined(TARGET_MCU_PSOC6) || !SECURESTORE_ENABLED #if !SECURESTORE_ENABLED
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6. KVStore & SecureStore need to be enabled for this test #error [NOT_SUPPORTED] SecureStore need to be enabled for this test
#else #else
using namespace mbed; using namespace mbed;
@ -535,4 +535,4 @@ int main()
return !Harness::run(specification); return !Harness::run(specification);
} }
#endif // (!defined(TARGET_K64F) && !defined(TARGET_ARM_FM)) || !SECURESTORE_ENABLED #endif // !SECURESTORE_ENABLED

View File

@ -91,11 +91,6 @@ static const char *const res_val2 = "This should surely not be saved as the res
static void white_box_test() static void white_box_test()
{ {
#if !defined(TARGET_K64F) && !defined(TARGET_MCU_PSOC6)
TEST_SKIP_MESSAGE("Kvstore API tests run only on K64F devices and PSoC 6");
#endif
bd_params_t bd_params[] = { bd_params_t bd_params[] = {
{8192, 1, 16, 4096}, // Standard {8192, 1, 16, 4096}, // Standard
{4096 * 4, 1, 1, 4096}, // K82F like {4096 * 4, 1, 1, 4096}, // K82F like
@ -334,10 +329,6 @@ static void white_box_test()
static void multi_set_test() static void multi_set_test()
{ {
#if !defined(TARGET_K64F) && !defined(TARGET_MCU_PSOC6)
TEST_SKIP_MESSAGE("Kvstore API tests run only on K64F devices and PSoC 6");
#endif
char *key; char *key;
uint8_t *get_buf, *set_buf; uint8_t *get_buf, *set_buf;
size_t key_size = 32; size_t key_size = 32;

View File

@ -56,6 +56,11 @@ static inline uint32_t align_up(uint32_t val, uint32_t size)
return (((val - 1) / size) + 1) * size; return (((val - 1) / size) + 1) * size;
} }
static inline uint32_t align_down(uint64_t val, uint64_t size)
{
return (((val) / size)) * size;
}
MBED_WEAK BlockDevice *BlockDevice::get_default_instance() MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
{ {
#if COMPONENT_SPIF #if COMPONENT_SPIF
@ -104,13 +109,18 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
} }
//Find the start of first sector after text area //Find the start of first sector after text area
bottom_address = align_up(FLASHIAP_APP_ROM_END_ADDR, flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR)); int sector_size = flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR);
bottom_address = align_up(FLASHIAP_APP_ROM_END_ADDR, sector_size);
start_address = flash.get_flash_start(); start_address = flash.get_flash_start();
flash_size = flash.get_flash_size(); flash_size = flash.get_flash_size();
ret = flash.deinit(); ret = flash.deinit();
static FlashIAPBlockDevice default_bd(bottom_address, start_address + flash_size - bottom_address); int total_size = start_address + flash_size - bottom_address;
if (total_size % (sector_size * 2)) {
total_size = align_down(total_size, sector_size * 2);
}
static FlashIAPBlockDevice default_bd(bottom_address, total_size);
#else #else