Skip to content

Commit 5539d65

Browse files
authored
Merge pull request #12638 from tymoteuszblochmobica/testall
Enable storage tests to all targets
2 parents 74ace63 + 2ca832c commit 5539d65

File tree

7 files changed

+27
-26
lines changed

7 files changed

+27
-26
lines changed

components/storage/blockdevice/COMPONENT_QSPIF/mbed_lib.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"QSPI_POLARITY_MODE": 0,
1111
"QSPI_FREQ": "40000000",
1212
"QSPI_MIN_READ_SIZE": "1",
13-
"QSPI_MIN_PROG_SIZE": "1"
13+
"QSPI_MIN_PROG_SIZE": "256"
1414
},
1515
"target_overrides": {
1616
"MX25R6435F": {
@@ -28,15 +28,15 @@
2828
"MCU_NRF52840": {
2929
"QSPI_FREQ": "32000000",
3030
"QSPI_MIN_READ_SIZE": "4",
31-
"QSPI_MIN_PROG_SIZE": "4"
31+
"QSPI_MIN_PROG_SIZE": "256"
3232
},
3333
"MCU_PSOC6": {
3434
"QSPI_FREQ": "50000000",
3535
"QSPI_MIN_PROG_SIZE": "512"
3636
},
3737
"EFM32GG11_STK3701": {
3838
"QSPI_MIN_READ_SIZE": "4",
39-
"QSPI_MIN_PROG_SIZE": "4"
39+
"QSPI_MIN_PROG_SIZE": "256"
4040
}
4141
}
4242
}

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@
3030
#include "utest.h"
3131
#include <stdlib.h>
3232

33-
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6)
34-
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6
33+
#if !SECURESTORE_ENABLED
34+
#error [NOT_SUPPORTED] SecureStore need to be enabled for this test
3535
#else
3636

3737
#define FSST_TEST_NUM_OF_THREADS 5
@@ -524,5 +524,5 @@ int main()
524524
return !Harness::run(specification);
525525
}
526526

527-
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
527+
#endif //!SECURESTORE_ENABLED
528528
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
using namespace utest::v1;
3434
using namespace mbed;
3535

36-
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6)
37-
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6
36+
#if !SECURESTORE_ENABLED
37+
#error [NOT_SUPPORTED] SecureStore need to be enabled for this test
3838
#else
3939

4040
static const char data[] = "data";
@@ -911,5 +911,5 @@ int main()
911911
return !Harness::run(specification);
912912
}
913913

914-
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
914+
#endif //!SECURESTORE_ENABLED
915915
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
using namespace utest::v1;
3434
using namespace mbed;
3535

36-
#if !defined(TARGET_K64F) && !defined(TARGET_ARM_FM) && !defined(TARGET_MCU_PSOC6)
37-
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6
36+
#if !SECURESTORE_ENABLED
37+
#error [NOT_SUPPORTED] SecureStore need to be enabled for this test
3838
#else
3939

4040
static const char data[] = "data";
@@ -894,5 +894,5 @@ int main()
894894
return !Harness::run(specification);
895895
}
896896

897-
#endif // !defined(TARGET_K64F) && !defined(TARGET_ARM_FM)
897+
#endif //!SECURESTORE_ENABLED
898898
#endif // !defined(MBED_CONF_RTOS_PRESENT)

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@
3535
#include <algorithm>
3636
#include "DeviceKey.h"
3737

38-
#if (!defined(TARGET_K64F) && !defined(TARGET_ARM_FM)) && !defined(TARGET_MCU_PSOC6) || !SECURESTORE_ENABLED
39-
#error [NOT_SUPPORTED] Kvstore API tests run only on K64F devices, Fastmodels, and PSoC 6. KVStore & SecureStore need to be enabled for this test
38+
#if !SECURESTORE_ENABLED
39+
#error [NOT_SUPPORTED] SecureStore need to be enabled for this test
4040
#else
4141

4242
using namespace mbed;
@@ -535,4 +535,4 @@ int main()
535535
return !Harness::run(specification);
536536
}
537537

538-
#endif // (!defined(TARGET_K64F) && !defined(TARGET_ARM_FM)) || !SECURESTORE_ENABLED
538+
#endif // !SECURESTORE_ENABLED

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

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ static const char *const res_val2 = "This should surely not be saved as the res
9191

9292
static void white_box_test()
9393
{
94-
95-
#if !defined(TARGET_K64F) && !defined(TARGET_MCU_PSOC6)
96-
TEST_SKIP_MESSAGE("Kvstore API tests run only on K64F devices and PSoC 6");
97-
#endif
98-
9994
bd_params_t bd_params[] = {
10095
{8192, 1, 16, 4096}, // Standard
10196
{4096 * 4, 1, 1, 4096}, // K82F like
@@ -334,10 +329,6 @@ static void white_box_test()
334329
static void multi_set_test()
335330
{
336331

337-
#if !defined(TARGET_K64F) && !defined(TARGET_MCU_PSOC6)
338-
TEST_SKIP_MESSAGE("Kvstore API tests run only on K64F devices and PSoC 6");
339-
#endif
340-
341332
char *key;
342333
uint8_t *get_buf, *set_buf;
343334
size_t key_size = 32;

features/storage/system_storage/SystemStorage.cpp

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,11 @@ static inline uint32_t align_up(uint32_t val, uint32_t size)
5656
return (((val - 1) / size) + 1) * size;
5757
}
5858

59+
static inline uint32_t align_down(uint64_t val, uint64_t size)
60+
{
61+
return (((val) / size)) * size;
62+
}
63+
5964
MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
6065
{
6166
#if COMPONENT_SPIF
@@ -104,13 +109,18 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()
104109
}
105110

106111
//Find the start of first sector after text area
107-
bottom_address = align_up(FLASHIAP_APP_ROM_END_ADDR, flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR));
112+
int sector_size = flash.get_sector_size(FLASHIAP_APP_ROM_END_ADDR);
113+
bottom_address = align_up(FLASHIAP_APP_ROM_END_ADDR, sector_size);
108114
start_address = flash.get_flash_start();
109115
flash_size = flash.get_flash_size();
110116

111117
ret = flash.deinit();
112118

113-
static FlashIAPBlockDevice default_bd(bottom_address, start_address + flash_size - bottom_address);
119+
int total_size = start_address + flash_size - bottom_address;
120+
if (total_size % (sector_size * 2)) {
121+
total_size = align_down(total_size, sector_size * 2);
122+
}
123+
static FlashIAPBlockDevice default_bd(bottom_address, total_size);
114124

115125
#else
116126

0 commit comments

Comments
 (0)