Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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/configs/greentea_full.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"overrides": {
"platform.all-stats-enabled": 1
}
}
2 changes: 1 addition & 1 deletion TESTS/integration/COMMON/common_defines_fs_test.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
#elif COMPONENT_NUSD
#define TEST_BLOCK_DEVICE_TYPE "NUSD"
#define TEST_USE_FILESYSTEM FS_FAT
#elif COMPONENT_FLASHIAP && MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE
#elif DEVICE_FLASH && MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE
#define TEST_BLOCK_DEVICE_TYPE "FLASHIAP"
#else
#define TEST_BLOCK_DEVICE_TYPE "UNKNOWN"
Expand Down
2 changes: 1 addition & 1 deletion drivers/device_key/include/device_key/DeviceKey.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

// 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)
#if !DEVICE_FLASH
#undef DEVICEKEY_ENABLED
#define DEVICEKEY_ENABLED 0
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ if(NOT "DEVICE_TRNG=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "True RNG is not supported for this target so device key cannot be used")
endif()

if(NOT ("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS AND "COMPONENT_FLASHIAP=1" IN_LIST MBED_TARGET_DEFINITIONS))
if(NOT "DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "Flash IAP is not supported for this target so device key cannot be used")
endif()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ utest::v1::status_t case_its_setup_handler(const Case *const source, const size_
Case cases[] = {
Case("PSA prot internal storage - Basic", case_its_setup_handler<its>, pits_ps_test<its>, case_its_teardown_handler),
Case("PSA prot internal storage - Write-once", case_its_setup_handler<its>, pits_ps_write_once_test<its>, case_its_teardown_handler),
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
Case("PSA protected storage - Basic", case_its_setup_handler<ps>, pits_ps_test<ps>),
Case("PSA protected storage - Write-once", case_its_setup_handler<ps>, pits_ps_write_once_test<ps>)
#endif
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

include(mbed_greentea)

if(NOT DEFINED MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED)
set(TEST_SKIPPED "crash_reporting test not supported.")
if(NOT "MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS)
set(TEST_SKIPPED "CRC is not supported for this target")
endif()

mbed_greentea_add_test(
Expand Down
7 changes: 5 additions & 2 deletions platform/tests/TESTS/mbed_platform/stats_cpu/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@

include(mbed_greentea)

if(NOT DEFINED MBED_CPU_STATS_ENABLED OR NOT "DEVICE_LPTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS
OR NOT "DEVICE_SLEEP=1" IN_LIST MBED_TARGET_DEFINITIONS)
if(NOT "DEVICE_LPTICKER=1" IN_LIST MBED_TARGET_DEFINITIONS OR NOT "DEVICE_SLEEP=1" IN_LIST MBED_TARGET_DEFINITIONS)
set(TEST_SKIPPED "Stats cpu test not supported.")
endif()

if((NOT "MBED_CPU_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS) AND (NOT "MBED_ALL_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS))
set(TEST_SKIPPED "CPU stats not enabled")
endif()

mbed_greentea_add_test(
TEST_NAME
mbed-platform-stats-cpu
Expand Down
6 changes: 3 additions & 3 deletions platform/tests/TESTS/mbed_platform/stats_cpu/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ DigitalOut led1(LED1);
#define MAX_THREAD_STACK 384
#endif

#define SAMPLE_TIME 1000 // msec
#define LOOP_TIME 2000 // msec
#define SAMPLE_TIME 1s
#define LOOP_TIME 2s

static int32_t wait_time = 5000;

Expand Down Expand Up @@ -76,7 +76,7 @@ void test_cpu_info(void)
mbed_stats_cpu_t stats;
// Additional read to make sure timer is initialized
mbed_stats_cpu_get(&stats);
ThisThread::sleep_for(3);
ThisThread::sleep_for(3ms);
mbed_stats_cpu_get(&stats);
TEST_ASSERT_NOT_EQUAL(0, stats.uptime);
TEST_ASSERT_NOT_EQUAL(0, stats.idle_time);
Expand Down
5 changes: 3 additions & 2 deletions platform/tests/TESTS/mbed_platform/stats_heap/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

include(mbed_greentea)

if(NOT DEFINED MBED_HEAP_STATS_ENABLED)
set(TEST_SKIPPED "Stats heap test not supported.")
if((NOT "MBED_HEAP_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS) AND (NOT "MBED_ALL_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS))
set(TEST_SKIPPED "heap stats not enabled")
endif()


mbed_greentea_add_test(
TEST_NAME
mbed-platform-stats-heap
Expand Down
4 changes: 2 additions & 2 deletions platform/tests/TESTS/mbed_platform/stats_sys/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

include(mbed_greentea)

if(NOT DEFINED MBED_SYS_STATS_ENABLED)
set(TEST_SKIPPED "System stats test not supported.")
if((NOT "MBED_SYS_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS) AND (NOT "MBED_ALL_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS))
set(TEST_SKIPPED "System stats not enabled")
endif()

mbed_greentea_add_test(
Expand Down
11 changes: 10 additions & 1 deletion platform/tests/TESTS/mbed_platform/stats_sys/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,22 @@ void test_sys_info()
mbed_stats_sys_t stats;
mbed_stats_sys_get(&stats);

// Print a summary of the stats, just for debug purposes
printf("Dump of Mbed System Stats: -------------------------------------\n");
printf("- OS Version: %" PRIu32 ".%" PRIu32 ".%" PRIu32 "\n",
stats.os_version / 10000,
(stats.os_version % 10000) / 100,
((stats.os_version % 10000) % 100));
printf("- CPUID Register: 0x%" PRIx32 "\n", stats.cpu_id);
printf("- Compiler Version: %" PRIu32 "\n", stats.compiler_version);

TEST_ASSERT_NOT_EQUAL(0, stats.os_version);
#if defined(__CORTEX_M)
TEST_ASSERT_NOT_EQUAL(0, stats.cpu_id);
#endif

#if defined(__IAR_SYSTEMS_ICC__)
TEST_ASSERT_EQUAL(IAR, stats.compiler_id);
TEST_ASSERT_EQUAL(IAR, stats.compiler_id);
#elif defined(__ARMCC_VERSION)
TEST_ASSERT_EQUAL(ARM, stats.compiler_id);
#elif defined(__GNUC__)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

include(mbed_greentea)

if(NOT DEFINED MBED_THREAD_STATS_ENABLED)
set(TEST_SKIPPED "Thread stats test not supported.")
if((NOT "MBED_THREAD_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS) AND (NOT "MBED_ALL_STATS_ENABLED=1" IN_LIST MBED_CONFIG_DEFINITIONS))
set(TEST_SKIPPED "Thread stats not enabled")
endif()

mbed_greentea_add_test(
Expand Down
4 changes: 2 additions & 2 deletions platform/tests/TESTS/mbed_platform/stats_thread/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void increment_with_delay()
{
while (1) {
counter++;
ThisThread::sleep_for(500);
ThisThread::sleep_for(500ms);
}
}

Expand Down Expand Up @@ -112,7 +112,7 @@ void test_case_multi_threads_blocked()
uint32_t ret = ef.set(FLAG_SIGNAL_DEC);
TEST_ASSERT_FALSE(ret & osFlagsError);

ThisThread::sleep_for(100);
ThisThread::sleep_for(100ms);

count = mbed_stats_thread_get_each(stats, MAX_THREAD_STATS);
TEST_ASSERT_EQUAL(1, (count - old_count));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
* limitations under the License.
*/

#ifndef COMPONENT_FLASHIAP
#ifndef DEVICE_FLASH
#error [NOT_SUPPORTED] Target must have internal FlashIAP for this test
#else

Expand Down Expand Up @@ -323,4 +323,4 @@ int main()
return !Harness::run(specification);
}

#endif // COMPONENT_FLASHIAP
#endif // DEVICE_FLASH
4 changes: 4 additions & 0 deletions storage/kvstore/kv_config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,7 @@ target_link_libraries(mbed-storage-kv-config
mbed-storage-littlefs-v2
mbed-storage-fat
)

if("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
target_link_libraries(mbed-storage-kv-config PUBLIC mbed-storage-flashiap)
endif()
12 changes: 6 additions & 6 deletions storage/kvstore/kv_config/source/kv_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include "securestore/SecureStore.h"
#define TRACE_GROUP "KVCFG"

#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
#include "FlashIAPBlockDevice.h"
#endif

Expand Down Expand Up @@ -284,7 +284,7 @@ FileSystem *_get_filesystem_default(const char *mount)

BlockDevice *_get_blockdevice_FLASHIAP(bd_addr_t start_address, bd_size_t size)
{
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
int ret = kv_get_flash_bounds_from_config(&start_address, &size);
if (ret != 0) {
tr_error("KV Config: Determination of internal block device bounds failed. The configured start address/size is likely invalid.");
Expand Down Expand Up @@ -677,7 +677,7 @@ int _create_internal_tdb(BlockDevice **internal_bd, KVStore **internal_tdb, bd_s

int _storage_config_TDB_INTERNAL()
{
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
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;

Expand Down Expand Up @@ -999,7 +999,7 @@ MBED_WEAK int kv_init_storage_config()
int ret = MBED_SUCCESS;

// We currently have no supported configuration without internal storage
#ifndef COMPONENT_FLASHIAP
#ifndef DEVICE_FLASH
return MBED_ERROR_UNSUPPORTED;
#endif

Expand All @@ -1026,7 +1026,7 @@ int kv_get_default_flash_addresses(bd_addr_t *start_address, bd_size_t *size)
{
int ret = MBED_SUCCESS;

#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
FlashIAP flash;
if (flash.init() != 0) {
return MBED_ERROR_INITIALIZATION_FAILED;
Expand Down Expand Up @@ -1072,7 +1072,7 @@ int kv_get_default_flash_addresses(bd_addr_t *start_address, bd_size_t *size)

int kv_get_flash_bounds_from_config(bd_addr_t *start_address, bd_size_t *size)
{
#if COMPONENT_FLASHIAP
#if DEVICE_FLASH

bd_addr_t flash_end_address;
bd_addr_t flash_start_address;
Expand Down
1 change: 0 additions & 1 deletion storage/kvstore/tdbstore/source/TDBStore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1490,7 +1490,6 @@ int TDBStore::check_erase_before_write(uint8_t area, uint32_t offset, uint32_t s
uint32_t end_offset;
while (size) {
uint32_t dist, offset_from_start;
int ret;
offset_in_erase_unit(area, offset, offset_from_start, dist);
uint32_t chunk = std::min(size, dist);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ static void kvstore_init()
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);

if (kv_setup == TDBStoreSet) {
#if COMPONENT_FLASHIAP && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
#if DEVICE_FLASH && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
// TDBStore requires two areas of equal size, do the check for FlashIAP
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ static void kvstore_init()
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);

if (kv_setup == TDBStoreSet) {
#if COMPONENT_FLASHIAP && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
#if DEVICE_FLASH && !COMPONENT_SPIF && !COMPONENT_QSPIF && !COMPONENT_DATAFLASH && !COMPONENT_SD
// TDBStore requires two areas of equal size
TEST_SKIP_UNLESS(MBED_CONF_TARGET_INTERNAL_FLASH_UNIFORM_SECTORS ||
(MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE != 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS != 0xFFFFFFFF))
Expand Down
12 changes: 6 additions & 6 deletions storage/platform/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,27 +14,27 @@ list(APPEND mbed-storage-libs
mbed-storage-littlefs-v2
)

if("DATAFLASH" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_DATAFLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-dataflash)
endif()

if("FLASHIAP" IN_LIST MBED_TARGET_LABELS)
if("DEVICE_FLASH=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-flashiap)
endif()

if("QSPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_QSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-qspif)
endif()

if("OSPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_OSPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-ospif)
endif()

if("SD" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_SD=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-sd)
endif()

if("SPIF" IN_LIST MBED_TARGET_LABELS)
if("COMPONENT_SPIF=1" IN_LIST MBED_TARGET_DEFINITIONS)
list(APPEND mbed-storage-libs mbed-storage-spif)
endif()

Expand Down
6 changes: 3 additions & 3 deletions storage/platform/source/PlatformStorage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ const spi_pinmap_t static_spi_pinmap = get_spi_pinmap(MBED_CONF_SD_SPI_MOSI, MBE
#endif
#endif

#if COMPONENT_FLASHIAP
#if DEVICE_FLASH
#include "FlashIAPBlockDevice.h"
#endif

Expand Down Expand Up @@ -104,7 +104,7 @@ MBED_WEAK BlockDevice *BlockDevice::get_default_instance()

return &default_bd;

#elif COMPONENT_FLASHIAP
#elif DEVICE_FLASH

#if (MBED_CONF_FLASHIAP_BLOCK_DEVICE_SIZE == 0) && (MBED_CONF_FLASHIAP_BLOCK_DEVICE_BASE_ADDRESS == 0xFFFFFFFF)

Expand Down Expand Up @@ -164,7 +164,7 @@ MBED_WEAK FileSystem *FileSystem::get_default_instance()

return &sdcard;

#elif COMPONENT_FLASHIAP
#elif DEVICE_FLASH

// To avoid alignment issues, initialize a filesystem if all sectors have the same size
// OR the user has specified an address range
Expand Down
Loading