Skip to content

Commit 88c42ba

Browse files
Fix build error by checking flash size
1 parent f449eb6 commit 88c42ba

File tree

7 files changed

+15
-25
lines changed

7 files changed

+15
-25
lines changed

TESTS/configs/greentea_baremetal.json5

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,6 @@
2424
"mbed-trace.enable": true,
2525

2626
// Disable colored traces in tests, as the test runner does not like the terminal control chars
27-
"mbed-trace.default-config": "TRACE_ACTIVE_LEVEL_INFO | TRACE_CARRIAGE_RETURN",
28-
29-
// This allows use of Mbed TLS even on devices which do not have a cryptographic RNG.
30-
// This option is used FOR TESTING ONLY as it prevents secure cryptography operation.
31-
// If used in a real application, the application author is expected to provide overrides for reading & writing the seed:
32-
// https://github.com/arduino/ArduinoCore-mbed/pull/445/files
33-
"mbedtls.entropy-nv-seed": 1,
27+
"mbed-trace.default-config": "TRACE_ACTIVE_LEVEL_INFO | TRACE_CARRIAGE_RETURN"
3428
}
3529
}

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_1/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ mbed_greentea_add_test(
1010
mbed-storage-kvstore-general_tests_phase_1
1111
TEST_SKIPPED
1212
${TEST_SKIPPED}
13+
MIN_FLASH_BYTES 140000
1314
TEST_SOURCES
1415
main.cpp
1516
TEST_REQUIRED_LIBS

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,6 @@ static void kvstore_init()
8989

9090
res = bd->init();
9191
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
92-
int erase_val = bd->get_erase_value();
9392
// Clear out any stale data that might be left from a previous test.
9493
// Multiply by 2 because SecureStore requires two underlying block devices of this size
9594
size_t bytes_to_erase = align_up(2 * PAGES_ESTIMATE * bd->get_program_size(), bd->get_erase_size());
@@ -162,8 +161,6 @@ static void kvstore_deinit()
162161

163162
TEST_SKIP_UNLESS(kvstore != NULL);
164163

165-
int erase_val = bd->get_erase_value();
166-
167164
res = kvstore->deinit();
168165
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
169166

storage/kvstore/tests/TESTS/kvstore/general_tests_phase_2/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@ if(NOT "DEVICE_TRNG=1" IN_LIST MBED_TARGET_DEFINITIONS)
55
set(TEST_SKIPPED "This test requires TRNG support!")
66
endif()
77

8-
98
mbed_greentea_add_test(
109
TEST_NAME
1110
mbed-storage-kvstore-general_tests_phase_2
1211
TEST_SKIPPED
1312
${TEST_SKIPPED}
13+
MIN_FLASH_BYTES 140000
1414
TEST_SOURCES
1515
main.cpp
1616
TEST_REQUIRED_LIBS

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

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ static void kvstore_init()
8585

8686
res = bd->init();
8787
TEST_ASSERT_EQUAL_ERROR_CODE(0, res);
88-
int erase_val = bd->get_erase_value();
8988
// Clear out any stale data that might be left from a previous test
9089
// Multiply by 2 because SecureStore requires two underlying block devices of this size
9190
size_t bytes_to_erase = align_up(2 * PAGES_ESTIMATE * bd->get_program_size(), bd->get_erase_size());
@@ -158,8 +157,6 @@ static void kvstore_deinit()
158157

159158
TEST_SKIP_UNLESS(kvstore != NULL);
160159

161-
int erase_val = bd->get_erase_value();
162-
163160
res = kvstore->deinit();
164161
TEST_ASSERT_EQUAL_ERROR_CODE(MBED_SUCCESS, res);
165162

targets/upload_method_cfg/K64F.cmake

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,6 @@
66
# 1. Be sure to update the DAPLink firmware on the board via these instructions: https://os.mbed.com/blog/entry/DAPLink-bootloader-update/
77
# 2. OpenOCD 0.12 flashes this device perfectly and can enter a debug session, but cannot hit breakpoints
88
# 3. LinkServer can both flash and debug, so it's the recommended upload method for this device.
9-
# 4. LinkServer does appear to have a bug where it doesn't map the peripheral registers as valid memory, so you can't
10-
# inspect them. I was able to work around this by inserting a block like this into <LinkServer install dir>/devices/FRDM-K64F.json:
11-
#
12-
# "name": "MK64FN1M0xxx12",
13-
# "family": "K6x",
14-
# "memory": [
15-
# + {
16-
# + "location": "0x40000000",
17-
# + "size": "0x000f0000",
18-
# + "type": "RAM"
19-
# + },
209

2110
# General config parameters
2211
# -------------------------------------------------------------

tools/cmake/mbed_greentea.cmake

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ set(MBED_GREENTEA_SERIAL_PORT "" CACHE STRING "Serial port name to talk to the M
1313
# HOST_TESTS_DIR - Path to the "host_tests" directory. If a relative path is provided, it will be
1414
# interpreted relative to the source directory.
1515
# TEST_SKIPPED - Reason if suite is skipped
16+
# NEEDED_FLASH_BYTES - Minimum flash size, in bytes, needed to run this test. Test will be skipped if flash
17+
# size is known and is less than this.
1618
#
1719
# calling the macro:
1820
# if(some_condition)
@@ -31,6 +33,7 @@ set(MBED_GREENTEA_SERIAL_PORT "" CACHE STRING "Serial port name to talk to the M
3133
# mbed-xyz
3234
# HOST_TESTS_DIR
3335
# ${CMAKE_CURRENT_LIST_DIR}/host_tests
36+
# NEEDED_FLASH_BYTES 140000
3437
# TEST_SKIPPED
3538
# ${skip_reason}
3639
# )
@@ -40,6 +43,7 @@ function(mbed_greentea_add_test)
4043
set(singleValueArgs
4144
TEST_NAME
4245
TEST_SKIPPED
46+
NEEDED_FLASH_BYTES
4347
)
4448
set(multipleValueArgs
4549
TEST_INCLUDE_DIRS
@@ -58,6 +62,14 @@ function(mbed_greentea_add_test)
5862
message(FATAL_ERROR "Will not be able to run greentea tests without MBED_GREENTEA_SERIAL_PORT defined!")
5963
endif()
6064

65+
if(NOT "${MBED_GREENTEA_NEEDED_FLASH_BYTES}" STREQUAL "")
66+
if("${MBED_CONFIG_DEFINITIONS}" MATCHES "MBED_ROM_SIZE=((0x[0-9A-Fa-f]+)|([0-9]+))")
67+
if(${CMAKE_MATCH_1} LESS ${MBED_GREENTEA_NEEDED_FLASH_BYTES})
68+
set(MBED_GREENTEA_TEST_SKIPPED "Not enough flash space!")
69+
endif()
70+
endif()
71+
endif()
72+
6173
# Add a "test-" prefix to help distinguish test targets in the target list
6274
set(MBED_GREENTEA_TEST_NAME "test-${MBED_GREENTEA_TEST_NAME}")
6375

0 commit comments

Comments
 (0)