Skip to content

Commit

Permalink
Merge pull request #11086 from Tharazi97/Greentea_compile_without_serial
Browse files Browse the repository at this point in the history
Mbed-os compile without DEVICE_SERIAL
  • Loading branch information
Seppo Takalo committed Jul 25, 2019
2 parents c5c7458 + 4c13c46 commit 6ce2439
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
#ifndef GREENTEA_SERIAL_H
#define GREENTEA_SERIAL_H

#if DEVICE_SERIAL

#include "RawSerial.h"
#include "SingletonPtr.h"

Expand All @@ -16,3 +18,4 @@ extern SingletonPtr<GreenteaSerial> greentea_serial;
#endif

/** @}*/
#endif
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
#include "greentea-client/greentea_serial.h"

#if DEVICE_SERIAL

/**
* Macros for setting console flow control.
*/
Expand All @@ -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
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

#if DEVICE_SERIAL

#include <ctype.h>
#include <cstdio>
#include <string.h>
Expand Down Expand Up @@ -780,3 +782,5 @@ static int HandleKV(char *out_key,
getNextToken(0, 0);
return 0;
}

#endif
6 changes: 5 additions & 1 deletion features/frameworks/utest/source/unity_handler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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

4 changes: 4 additions & 0 deletions features/frameworks/utest/source/utest_default_handlers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
****************************************************************************
*/

#if DEVICE_SERIAL

#include "utest/utest_default_handlers.h"
#include "utest/utest_case.h"
#include "utest/utest_stack_trace.h"
Expand Down Expand Up @@ -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
4 changes: 4 additions & 0 deletions features/frameworks/utest/utest/utest_serial.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
****************************************************************************
*/

#if DEVICE_SERIAL

#ifndef UTEST_SERIAL_H
#define UTEST_SERIAL_H

Expand All @@ -29,3 +31,5 @@
#endif // UTEST_SERIAL_H

/** @}*/

#endif

0 comments on commit 6ce2439

Please sign in to comment.