From 4c13c469d9e20bb10f6e7b253e0350102b12e8a1 Mon Sep 17 00:00:00 2001 From: int_szyk Date: Mon, 22 Jul 2019 16:17:52 +0200 Subject: [PATCH] Can compile without serial --- .../greentea-client/greentea-client/greentea_serial.h | 3 +++ .../frameworks/greentea-client/source/greentea_serial.cpp | 4 ++++ .../frameworks/greentea-client/source/greentea_test_env.cpp | 4 ++++ features/frameworks/utest/source/unity_handler.cpp | 6 +++++- features/frameworks/utest/source/utest_default_handlers.cpp | 4 ++++ features/frameworks/utest/utest/utest_serial.h | 4 ++++ 6 files changed, 24 insertions(+), 1 deletion(-) diff --git a/features/frameworks/greentea-client/greentea-client/greentea_serial.h b/features/frameworks/greentea-client/greentea-client/greentea_serial.h index 111204c326..ff0901cbfe 100644 --- a/features/frameworks/greentea-client/greentea-client/greentea_serial.h +++ b/features/frameworks/greentea-client/greentea-client/greentea_serial.h @@ -4,6 +4,8 @@ #ifndef GREENTEA_SERIAL_H #define GREENTEA_SERIAL_H +#if DEVICE_SERIAL + #include "RawSerial.h" #include "SingletonPtr.h" @@ -16,3 +18,4 @@ extern SingletonPtr greentea_serial; #endif /** @}*/ +#endif \ No newline at end of file diff --git a/features/frameworks/greentea-client/source/greentea_serial.cpp b/features/frameworks/greentea-client/source/greentea_serial.cpp index 3a4b8053f8..6f80a69a1d 100644 --- a/features/frameworks/greentea-client/source/greentea_serial.cpp +++ b/features/frameworks/greentea-client/source/greentea_serial.cpp @@ -1,5 +1,7 @@ #include "greentea-client/greentea_serial.h" +#if DEVICE_SERIAL + /** * Macros for setting console flow control. */ @@ -21,3 +23,5 @@ GreenteaSerial::GreenteaSerial() : mbed::RawSerial(USBTX, USBRX, MBED_CONF_PLATF set_flow_control(SerialBase::RTSCTS, STDIO_UART_RTS, STDIO_UART_CTS); #endif } + +#endif \ No newline at end of file diff --git a/features/frameworks/greentea-client/source/greentea_test_env.cpp b/features/frameworks/greentea-client/source/greentea_test_env.cpp index 89ee51c39c..e909c29ce7 100644 --- a/features/frameworks/greentea-client/source/greentea_test_env.cpp +++ b/features/frameworks/greentea-client/source/greentea_test_env.cpp @@ -15,6 +15,8 @@ * limitations under the License. */ +#if DEVICE_SERIAL + #include #include #include @@ -780,3 +782,5 @@ static int HandleKV(char *out_key, getNextToken(0, 0); return 0; } + +#endif \ No newline at end of file diff --git a/features/frameworks/utest/source/unity_handler.cpp b/features/frameworks/utest/source/unity_handler.cpp index b11454acd3..2b9b52000b 100644 --- a/features/frameworks/utest/source/unity_handler.cpp +++ b/features/frameworks/utest/source/unity_handler.cpp @@ -19,7 +19,10 @@ #include "utest/utest_harness.h" #include "utest/utest_stack_trace.h" #include "utest/unity_handler.h" + +#if DEVICE_SERIAL #include "greentea-client/greentea_serial.h" +#endif void utest_unity_assert_failure(void) { @@ -33,9 +36,10 @@ void utest_unity_ignore_failure(void) utest::v1::Harness::raise_failure(utest::v1::failure_reason_t(utest::v1::REASON_ASSERTION | utest::v1::REASON_IGNORE)); } +#if DEVICE_SERIAL void utest_safe_putc(int chr) { greentea_serial->putc(chr); } - +#endif diff --git a/features/frameworks/utest/source/utest_default_handlers.cpp b/features/frameworks/utest/source/utest_default_handlers.cpp index f487e2dcea..63171e8748 100644 --- a/features/frameworks/utest/source/utest_default_handlers.cpp +++ b/features/frameworks/utest/source/utest_default_handlers.cpp @@ -16,6 +16,8 @@ **************************************************************************** */ +#if DEVICE_SERIAL + #include "utest/utest_default_handlers.h" #include "utest/utest_case.h" #include "utest/utest_stack_trace.h" @@ -102,3 +104,5 @@ utest::v1::status_t utest::v1::verbose_case_failure_handler(const Case *const /* if (failure.reason & REASON_IGNORE) return STATUS_IGNORE; return STATUS_CONTINUE; } + +#endif \ No newline at end of file diff --git a/features/frameworks/utest/utest/utest_serial.h b/features/frameworks/utest/utest/utest_serial.h index 640577181c..8d94e21a3b 100644 --- a/features/frameworks/utest/utest/utest_serial.h +++ b/features/frameworks/utest/utest/utest_serial.h @@ -19,6 +19,8 @@ **************************************************************************** */ +#if DEVICE_SERIAL + #ifndef UTEST_SERIAL_H #define UTEST_SERIAL_H @@ -29,3 +31,5 @@ #endif // UTEST_SERIAL_H /** @}*/ + +#endif \ No newline at end of file