Merge pull request #11721 from rajkan01/feature-baremetal-greentea

Bare metal greentea support
pull/11870/head
Martin Kojtal 2019-11-12 10:59:39 +01:00 committed by GitHub
commit 09d9287e3b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
55 changed files with 301 additions and 109 deletions

View File

@ -0,0 +1,42 @@
{
"requires": [
"bare-metal",
"rtos-api",
"greentea-client",
"utest",
"unity",
"psa",
"mbed-crypto",
"mbedtls",
"psa-compliance-framework",
"filesystem",
"littlefs",
"mbed-trace",
"device_key",
"storage_tdb_internal",
"storage_filesystem",
"storage_tdb_external",
"lora",
"nfc",
"network-emac",
"nanostack-libservice",
"flashiap-block-device",
"system-storage",
"filesystemstore",
"SecureStore",
"storage",
"kv-map",
"direct-access-devicekey",
"tdbstore",
"kv-config",
"events",
"kv-global-api",
"sd",
"nvstore"
],
"target_overrides": {
"*": {
"target.device_has_remove": ["EMAC", "USBDEVICE"]
}
}
}

View File

@ -15,7 +15,6 @@
*/
#include "mbed_events.h"
#include "mbed.h"
#include "rtos.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"

View File

@ -15,7 +15,6 @@
*/
#include "mbed_events.h"
#include "mbed.h"
#include "rtos.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"

View File

@ -21,6 +21,8 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if INTEGRATION_TESTS
#include "mbed.h"
#include "unity/unity.h"
#include "greentea-client/test_env.h"
@ -202,4 +204,4 @@ size_t download_test(NetworkInterface *interface, const unsigned char *data, siz
return received_bytes;
}
#endif // INTEGRATION_TESTS

View File

@ -20,6 +20,5 @@
/*
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
size_t download_test(NetworkInterface *interface, const unsigned char *data, size_t data_length, size_t buff_size, uint32_t thread_id = 0);

View File

@ -20,6 +20,7 @@
/*
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if INTEGRATION_TESTS
#include "mbed.h"
#include "unity/unity.h"
@ -103,3 +104,4 @@ void file_test_read(const char *file, size_t offset, const unsigned char *data,
float(data_length) / 1024, float(data_length) / timer.read() / 1024, timer.read());
}
#endif //#if INTEGRATION_TESTS

View File

@ -20,7 +20,6 @@
/*
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
void file_test_write(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size);
void file_test_read(const char *file, size_t offset, const unsigned char *data, size_t data_length, size_t block_size);

View File

@ -21,6 +21,10 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#else
#include "mbed.h"
#include "FATFileSystem.h"
#include "LittleFileSystem.h"
@ -30,10 +34,6 @@
#include "common_defines_test.h"
#include "file_test.h"
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#endif
#ifdef MBED_CONF_APP_BASICS_TEST_FILENAME
#include MBED_CONF_APP_BASICS_TEST_FILENAME
#else
@ -162,3 +162,4 @@ int main()
return !Harness::run(specification);
}
#endif // !INTEGRATION_TESTS

View File

@ -21,6 +21,10 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#else
#include "mbed.h"
#include "FATFileSystem.h"
#include "LittleFileSystem.h"
@ -30,10 +34,6 @@
#include "common_defines_test.h"
#include "file_test.h"
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#endif
#ifdef MBED_CONF_APP_BASICS_TEST_FILENAME
#include MBED_CONF_APP_BASICS_TEST_FILENAME
#else
@ -181,3 +181,4 @@ int main()
return !Harness::run(specification);
}
#endif // !INTEGRATION_TESTS

View File

@ -21,6 +21,10 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#else
#include "mbed.h"
#include "utest/utest.h"
#include "unity/unity.h"
@ -29,10 +33,6 @@
#include "download_test.h"
#include <string>
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#endif
#ifdef MBED_CONF_APP_BASICS_TEST_FILENAME
#include MBED_CONF_APP_BASICS_TEST_FILENAME
#else
@ -139,3 +139,4 @@ int main()
return !Harness::run(specification);
}
#endif // !INTEGRATION_TESTS

View File

@ -21,6 +21,10 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#else
#include "mbed.h"
#include "utest/utest.h"
#include "unity/unity.h"
@ -29,10 +33,6 @@
#include "download_test.h"
#include <string>
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#endif
#ifdef MBED_CONF_APP_BASICS_TEST_FILENAME
#include MBED_CONF_APP_BASICS_TEST_FILENAME
#else
@ -173,3 +173,4 @@ int main()
return !Harness::run(specification);
}
#endif // !INTEGRATION_TESTS

View File

@ -21,6 +21,10 @@
* Based on mbed-stress-test by Marcus Chang @ Arm Mbed - http://github.com/ARMmbed/mbed-stress-test
*/
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#else
#include "mbed.h"
#include "FATFileSystem.h"
#include "LittleFileSystem.h"
@ -32,9 +36,6 @@
#include "file_test.h"
#include <string>
#if !INTEGRATION_TESTS
#error [NOT_SUPPORTED] integration tests not enabled for this target
#endif
#ifdef MBED_CONF_APP_BASICS_TEST_FILENAME
#include MBED_CONF_APP_BASICS_TEST_FILENAME
@ -243,3 +244,4 @@ int main()
return !Harness::run(specification);
}
#endif // !INTEGRATION_TESTS

View File

@ -134,6 +134,7 @@ void test_thread(void)
TEST_ASSERT_EQUAL(0xCBF43926, crc);
}
#if defined(MBED_CONF_RTOS_PRESENT)
void test_thread_safety()
{
char test[] = "123456789";
@ -153,13 +154,16 @@ void test_thread_safety()
// Wait for the thread to finish
t1.join();
}
#endif
Case cases[] = {
Case("Test supported polynomials", test_supported_polynomials),
Case("Test partial CRC", test_partial_crc),
Case("Test SD CRC polynomials", test_sd_crc),
Case("Test not supported polynomials", test_any_polynomial),
Case("Test thread safety", test_thread_safety)
#if defined(MBED_CONF_RTOS_PRESENT)
Case("Test thread safety", test_thread_safety),
#endif
Case("Test not supported polynomials", test_any_polynomial)
};
utest::v1::status_t greentea_test_setup(const size_t number_of_cases)

View File

@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Low power timer test cases require a RTOS to run.
#else
#if !DEVICE_LPTICKER
#error [NOT_SUPPORTED] Low power timer not supported for this target
@ -95,3 +98,4 @@ int main()
}
#endif // !DEVICE_LPTICKER
#endif //!defined(MBED_CONF_RTOS_PRESENT)

View File

@ -19,7 +19,6 @@
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#include "hal/us_ticker_api.h"
#if !DEVICE_LPTICKER

View File

@ -14,6 +14,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Race test test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "rtos.h"
#include "greentea-client/test_env.h"
@ -22,10 +30,6 @@
#include "SingletonPtr.h"
#include <stdio.h>
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] Test not supported for single threaded enviroment. UsTicker need to be enabled for this test.
#else
using namespace utest::v1;
#define TEST_STACK_SIZE 512
@ -132,4 +136,5 @@ int main()
Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_THREAD)

View File

@ -18,7 +18,6 @@
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#include "rtc_api.h"
#if !DEVICE_RTC || !DEVICE_USTICKER

View File

@ -19,7 +19,6 @@
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#include "hal/us_ticker_api.h"
#if !DEVICE_USTICKER

View File

@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Watchdog test cases require a RTOS to run.
#else
#if !DEVICE_WATCHDOG
#error [NOT_SUPPORTED] Watchdog not supported for this target
#else
@ -284,3 +289,4 @@ int main()
}
#endif // !DEVICE_WATCHDOG
#endif // !defined(MBED_CONG_RTOS_PRESENT)

View File

@ -14,6 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Watchdog reset test cases require a RTOS to run.
#else
#if !DEVICE_WATCHDOG
#error [NOT_SUPPORTED] Watchdog not supported for this target
#else
@ -334,3 +338,4 @@ int main()
return !Harness::run(specification);
}
#endif // !DEVICE_WATCHDOG
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_RTOS_CONF_PRESENT)
#error [NOT_SUPPORTED] usticker test cases require a RTOS to run
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -606,3 +611,4 @@ int main()
return !Harness::run(specification);
}
#endif // !DEVICE_USTICKER
#endif // !defined(MBED_RTOS_CONF_PRESENT)

View File

@ -20,6 +20,9 @@
* freqency is valid.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] common tickers frequency test cases require a RTOS to run.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
@ -206,3 +209,4 @@ int main()
}
#endif // defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER
#endif // !defined(MBED_RTOS_CONF_PRESENT)

View File

@ -13,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Low power timer test cases require a RTOS to run.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -207,3 +212,4 @@ int main()
}
#endif // !DEVICE_LPTICKER
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,7 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !DEVICE_SLEEP
#error [NOT_SUPPORTED] sleep not supported for this target
#else
@ -216,7 +215,9 @@ utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
{
GREENTEA_SETUP(60, "default_auto");
/* Suspend RTOS Kernel to enable sleep modes. */
#if defined(MBED_CONF_RTOS_PRESENT)
osKernelSuspend();
#endif
#if DEVICE_LPTICKER
ticker_suspend(get_lp_ticker_data());
#if DEVICE_LPTICKER && (LPTICKER_DELAY_TICKS > 0)
@ -242,8 +243,9 @@ void greentea_test_teardown(const size_t passed, const size_t failed, const fail
#endif
ticker_resume(get_lp_ticker_data());
#endif
#if defined(MBED_CONF_RTOS_PRESENT)
osKernelResume(0);
#endif
greentea_test_teardown_handler(passed, failed, failure);
}

View File

@ -88,7 +88,9 @@ void test_lock_eq_ushrt_max()
utest::v1::status_t testcase_setup(const Case *const source, const size_t index_of_case)
{
// Suspend the RTOS kernel scheduler to prevent interference with duration of sleep.
#if defined(MBED_RTOS_PRESENT)
osKernelSuspend();
#endif
#if DEVICE_LPTICKER
ticker_suspend(get_lp_ticker_data());
#if (LPTICKER_DELAY_TICKS > 0)
@ -115,7 +117,9 @@ utest::v1::status_t testcase_teardown(const Case *const source, const size_t pas
#endif
ticker_resume(get_lp_ticker_data());
#endif
#if defined(MBED_RTOS_PRESENT)
osKernelResume(0);
#endif
return utest::v1::greentea_case_teardown_handler(source, passed, failed, failure);
}

View File

@ -26,7 +26,7 @@
using namespace utest::v1;
#define TEST_STACK_SIZE 256
#if defined(MBED_CONF_RTOS_PRESENT)
void sleep_manager_locking_thread_test()
{
for (uint32_t i = 0; i < 100; i++) {
@ -55,6 +55,7 @@ void sleep_manager_multithread_test()
bool deep_sleep_allowed = sleep_manager_can_deep_sleep_test_check();
TEST_ASSERT_TRUE_MESSAGE(deep_sleep_allowed, "Deep sleep should be allowed");
}
#endif
void sleep_manager_locking_irq_test()
{
@ -91,7 +92,9 @@ utest::v1::status_t greentea_test_setup(const size_t number_of_cases)
}
Case cases[] = {
#if defined(MBED_CONF_RTOS_PRESENT)
Case("deep sleep lock/unlock is thread safe", sleep_manager_multithread_test),
#endif
Case("deep sleep lock/unlock is IRQ safe", sleep_manager_irq_test),
};

View File

@ -15,6 +15,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] stack size unification test cases require a RTOS to run.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -76,3 +80,4 @@ int main()
}
#endif // TARGET_RENESAS
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,6 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Watchdog test cases require a RTOS to run.
#else
#if !DEVICE_WATCHDOG
#error [NOT_SUPPORTED] Watchdog not supported for this target
#else
@ -285,3 +289,4 @@ int main()
}
#endif // !DEVICE_WATCHDOG
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,6 +13,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] crash_reporting test cases require a RTOS to run.
#else
#include "mbed.h"
#include "mbed_error.h"
#include "mbed_crash_data_offsets.h"
@ -80,3 +83,4 @@ int main(void)
}
#endif // !MBED_CONF_PLATFORM_CRASH_CAPTURE_ENABLED
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -125,6 +125,7 @@ void test_error_context_capture()
mbed_error_status_t status = mbed_get_last_error_info(&error_ctx);
TEST_ASSERT(status == MBED_SUCCESS);
TEST_ASSERT_EQUAL_UINT(error_value, error_ctx.error_value);
#if defined(MBED_CONF_RTOS_PRESENT)
TEST_ASSERT_EQUAL_UINT((uint32_t)osThreadGetId(), error_ctx.thread_id);
//Capture thread info and compare
@ -135,6 +136,7 @@ void test_error_context_capture()
#if MBED_CONF_PLATFORM_ERROR_FILENAME_CAPTURE_ENABLED
TEST_ASSERT_EQUAL_STRING(MBED_FILENAME, error_ctx.error_filename);
#endif
#endif
}
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
@ -246,14 +248,17 @@ void test_error_logging_multithread()
}
#endif
#if defined(MBED_CONF_RTOS_PRESENT)
static Semaphore callback_sem;
void MyErrorHook(const mbed_error_ctx *error_ctx)
{
callback_sem.release();
}
#endif
/** Test error hook
*/
#if defined(MBED_CONF_RTOS_PRESENT)
void test_error_hook()
{
if (MBED_SUCCESS != mbed_set_error_hook(MyErrorHook)) {
@ -265,6 +270,7 @@ void test_error_hook()
TEST_ASSERT(acquired);
}
#endif
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED && defined(MBED_TEST_SIM_BLOCKDEVICE)
@ -352,13 +358,11 @@ utest::v1::status_t test_setup(const size_t number_of_cases)
Case cases[] = {
Case("Test error counting and reset", test_error_count_and_reset),
Case("Test error encoding, value capture, first and last errors", test_error_capturing),
#if MBED_CONF_RTOS_PRESENT
Case("Test error context capture", test_error_context_capture),
#endif //MBED_CONF_RTOS_PRESENT
Case("Test error hook", test_error_hook),
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED
Case("Test error logging", test_error_logging),
#if MBED_CONF_RTOS_PRESENT
Case("Test error hook", test_error_hook),
Case("Test error handling multi-threaded", test_error_logging_multithread),
#endif //MBED_CONF_RTOS_PRESENT
#if MBED_CONF_PLATFORM_ERROR_HIST_ENABLED && defined(MBED_TEST_SIM_BLOCKDEVICE)

View File

@ -18,6 +18,10 @@
#include "unity.h"
#include "utest.h"
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] MemoryPool test cases require a RTOS to run.
#else
using namespace utest::v1;
#define THREAD_STACK_SIZE 512
@ -666,3 +670,4 @@ int main()
Harness::run(specification);
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,13 +14,17 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] RTOS basic test cases require RTOS with multithread to run
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "utest/utest.h"
#include "unity/unity.h"
#if defined(SKIP_TIME_DRIFT_TESTS) || defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#if defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
using utest::v1::Case;
@ -116,4 +120,5 @@ int main()
utest::v1::Harness::run(specification);
}
#endif // defined(SKIP_TIME_DRIFT_TESTS) || defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // defined(SKIP_TIME_DRIFT_TESTS) || !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Condition variable test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
using namespace utest::v1;
#define TEST_STACK_SIZE 512
@ -185,4 +189,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,6 +14,9 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Event flags test cases require RTOS with multithread to run
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
@ -22,8 +25,8 @@
using utest::v1::Case;
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
@ -371,4 +374,5 @@ int main()
return !utest::v1::Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -15,8 +15,8 @@
* limitations under the License.
*/
#if defined(TARGET_CORTEX_A) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] This function not supported for this target
#if defined(TARGET_CORTEX_A) || !DEVICE_USTICKER || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] test not supported.
#else
#include <stdio.h>
@ -263,4 +263,4 @@ int main()
return !utest::v1::Harness::run(specification);
}
#endif // defined(TARGET_CORTEX_A) || !DEVICE_USTICKER
#endif // defined(TARGET_CORTEX_A) || !DEVICE_USTICKER || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,6 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] kernel tick count test cases require a RTOS to run.
#else
#include "greentea-client/test_env.h"
#include "utest/utest.h"
#include "unity/unity.h"
@ -117,3 +121,4 @@ int main()
{
return !utest::v1::Harness::run(specification);
}
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] mail test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
using namespace utest::v1;
#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
@ -509,4 +513,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -19,7 +19,7 @@
#include "unity/unity.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
@ -59,13 +59,13 @@ void task_using_malloc(void)
free(data);
}
}
/** Test for multithreaded heap allocations
Given multiple threads are started in parallel
When each of the threads allocate memory
Then the memory allocation succeed and @a malloc return valid memory
*/
#if defined(MBED_CONF_RTOS_PRESENT)
void test_multithread_allocation(void)
{
// static stack for threads to reduce heap usage on devices with small RAM
@ -102,6 +102,7 @@ void test_multithread_allocation(void)
}
TEST_ASSERT_FALSE(thread_alloc_failure);
}
#endif
/** Test for multiple heap alloc and free calls */
#define ALLOC_ARRAY_SIZE 100
@ -200,7 +201,9 @@ void test_null_free(void)
Case cases[] = {
Case("Test 0 size allocation", test_zero_allocation),
Case("Test NULL pointer free", test_null_free),
#if defined(MBED_CONF_RTOS_PRESENT)
Case("Test multithreaded allocations", test_multithread_allocation),
#endif
Case("Test large allocation", test_big_allocation),
Case("Test multiple alloc and free calls", test_alloc_and_free)
};

View File

@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Mutex test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
using namespace utest::v1;
#if defined(__CORTEX_M23) || defined(__CORTEX_M33)
@ -305,4 +309,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,16 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Queue test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
#include "utest.h"
#include "rtos.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
using namespace utest::v1;
#define THREAD_STACK_SIZE 512
@ -345,4 +349,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,6 +13,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] RTOS timer test cases require RTOS to run
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -360,3 +365,4 @@ int main()
#endif // !DEVICE_USTICKER
#endif // RESTART_DELAY_MS >= DELAY_MS
#endif

View File

@ -13,6 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Semaphore test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -21,10 +29,6 @@
using namespace utest::v1;
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
#define THREAD_DELAY 30
#define SEMAPHORE_SLOTS 2
#define SEM_CHANGES 100
@ -246,4 +250,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -13,6 +13,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Signals test cases require RTOS with multithread to run
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "utest/utest.h"
@ -20,8 +24,8 @@
using utest::v1::Case;
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#define TEST_STACK_SIZE 512
@ -393,4 +397,5 @@ int main()
return !utest::v1::Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -20,9 +20,6 @@
#include "utest.h"
#include "ticker_api.h"
extern "C" {
#include "rtx_lib.h"
}
#include "platform/source/SysTimer.h"
#define TEST_TICKS 42

View File

@ -49,5 +49,4 @@ private:
LockGuard &operator=(const LockGuard &);
rtos::Mutex &_mutex;
};
#endif /* MBEDMICRO_RTOS_MBED_THREADS_LOCK_GUARD */

View File

@ -75,5 +75,4 @@ private:
mutable rtos::Mutex _mutex;
T _value;
};
#endif /* MBEDMICRO_RTOS_MBED_THREADS_SYNCHRONIZED_INTEGRAL */

View File

@ -13,6 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] Threads test cases require RTOS with multithread to run
#else
#if !DEVICE_USTICKER
#error [NOT_SUPPORTED] UsTicker need to be enabled for this test.
#else
#include "mbed.h"
#include "greentea-client/test_env.h"
#include "unity.h"
@ -21,10 +29,6 @@
#include "SynchronizedIntegral.h"
#include "LockGuard.h"
#if defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#error [NOT_SUPPORTED] test not supported
#else
#define THREAD_STACK_SIZE 512
#if defined(__CORTEX_A9) || defined(__CORTEX_M23) || defined(__CORTEX_M33) || defined(TARGET_ARM_FM) || defined(TARGET_CY8CKIT_062_WIFI_BT_PSA)
#define PARALLEL_THREAD_STACK_SIZE 512
@ -847,4 +851,5 @@ int main()
return !Harness::run(specification);
}
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !DEVICE_USTICKER
#endif // !DEVICE_USTICKER
#endif // defined(MBED_RTOS_SINGLE_THREAD) || !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -15,6 +15,8 @@
* limitations under the License.
*/
#if defined(MBED_CONF_RTOS_PRESENT)
#include "stdint.h"
#include "stdlib.h"
#include "USBEndpointTester.h"
@ -169,7 +171,6 @@ USBEndpointTester::USBEndpointTester(USBPhy *phy, uint16_t vendor_id, uint16_t p
MBED_ASSERT(_endpoint_buffs[i] != NULL);
}
MBED_ASSERT(resolver.valid());
queue = mbed::mbed_highprio_event_queue();
configuration_desc(0);
ctrl_buf = new uint8_t[CTRL_BUF_SIZE];
@ -861,3 +862,4 @@ void USBEndpointTester::start_ep_in_abort_test()
write_start(_endpoints[EP_BULK_IN], _endpoint_buffs[EP_BULK_IN], (*_endpoint_configs)[EP_BULK_IN].max_packet);
write_start(_endpoints[EP_INT_IN], _endpoint_buffs[EP_INT_IN], (*_endpoint_configs)[EP_INT_IN].max_packet);
}
#endif

View File

@ -15,6 +15,8 @@
* limitations under the License.
*/
#if defined(MBED_CONF_RTOS_PRESENT)
#include "stdint.h"
#include "USBTester.h"
#include "mbed_shared_queues.h"
@ -57,7 +59,6 @@ USBTester::USBTester(USBPhy *phy, uint16_t vendor_id, uint16_t product_id, uint1
int_out = resolver.endpoint_out(USB_EP_TYPE_INT, 64);
MBED_ASSERT(resolver.valid());
queue = mbed::mbed_highprio_event_queue();
configuration_desc(0);
ctrl_buf = new uint8_t[CTRL_BUF_SIZE];
init();
@ -703,3 +704,4 @@ void USBTester::epbulk_out_callback()
read_finish(bulk_out);
read_start(bulk_out, bulk_buf, sizeof(bulk_buf));
}
#endif

View File

@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
#include <stdio.h>
#include <string.h>
#include "mbed.h"
@ -660,3 +665,4 @@ int main()
}
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,6 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
#if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#error [NOT_SUPPORTED] USB Device not supported for this target
#else
@ -385,3 +389,4 @@ int main()
}
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,6 +14,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
#include <stdio.h>
#include <string.h>
#include <stdlib.h> /* srand, rand */
@ -482,3 +487,4 @@ int main()
}
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -14,6 +14,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
#if !defined(MBED_CONF_RTOS_PRESENT)
#error [NOT_SUPPORTED] USB stack and test cases require RTOS to run.
#else
#if !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#error [NOT_SUPPORTED] USB Device not supported for this target
#else
@ -848,3 +852,4 @@ int main()
}
#endif // !defined(DEVICE_USBDEVICE) || !DEVICE_USBDEVICE
#endif // !defined(MBED_CONF_RTOS_PRESENT)

View File

@ -20,19 +20,7 @@
#include "platform/mbed_stats.h"
#include <stdint.h>
#define THREAD_BUF_COUNT 16
typedef struct {
uint32_t entry;
uint32_t stack_size;
uint32_t max_stack;
} thread_info_t;
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if !defined(MBED_CONF_RTOS_PRESENT) || !(MBED_CONF_RTOS_PRESENT)
#error "RTOS required for Stack stats"
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
#include "rtos/Mutex.h"
#include "rtos/Thread.h"
@ -44,6 +32,14 @@ typedef struct {
using namespace mbed;
using namespace rtos;
#define THREAD_BUF_COUNT 16
typedef struct {
uint32_t entry;
uint32_t stack_size;
uint32_t max_stack;
} thread_info_t;
// Mutex to protect "buf"
static SingletonPtr<Mutex> mutex;
static char buf[128];
@ -57,7 +53,7 @@ static void send_CPU_info(void);
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
static void send_heap_info(void);
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
static void send_stack_info(void);
static void on_thread_terminate(osThreadId_t id);
static void enqeue_thread_info(osThreadId_t id);
@ -70,7 +66,7 @@ static uint32_t print_dec(char *buf, uint32_t value);
void greentea_metrics_setup()
{
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
Kernel::attach_thread_terminate_hook(on_thread_terminate);
#endif
}
@ -80,7 +76,7 @@ void greentea_metrics_report()
#if defined(MBED_HEAP_STATS_ENABLED ) && MBED_HEAP_STATS_ENABLED
send_heap_info();
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
send_stack_info();
Kernel::attach_thread_terminate_hook(NULL);
#endif
@ -112,7 +108,7 @@ static void send_heap_info()
}
#endif
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED
#if defined(MBED_STACK_STATS_ENABLED) && MBED_STACK_STATS_ENABLED && defined(MBED_CONF_RTOS_PRESENT)
MBED_UNUSED static void send_stack_info()
{
mutex->lock();

View File

@ -787,4 +787,4 @@ static int HandleKV(char *out_key,
return 0;
}
#endif
#endif