...
CPPTEST_INC_DIR=/usr/local/<CPPTEST_INSTALL_DIR>/bin/engine/runtime/include
Info | ||||
---|---|---|---|---|
| ||||
To build a custom Runtime Library with the multi-thread support, add "-DCPPTEST_THREADS_ENABLED=1" to the compiler command line. |
...
Data emitted from the target via the TCP/IP sockets should be captured with the help of a socket listener. The listener is a simple utility program shipped with C/cC++test. It is located in <CPPTEST_INSTALL_DIR>/bin/ engine/runtime/listeners/socket_listener, and it accepts the following parameters:
...
Add a new file in the <CPPTEST_INSTALL_DIR>/bin/engine/runtime/src/transport directory with the implementation of the custom serial communication. Follow this template:
Code Block #define CPPTEST_RUNTIME_IMPLEMENTATION #include "cpptest_portinfo.h" #ifdef CPPTEST_USE_RS232_MYPLATFORM_COMMUNICATION #include "CppTestTransportRS232Common.h" int localRsInitInternalSerial(CppTestStreamParameters *par) { return RS_OK; } int localRsUninitInternalSerial(CppTestStreamParameters *par) { return RS_OK; } int localRsSendInternalByte(CppTestStreamParameters *par, unsigned char byte, unsigned char *is_send) { return RS_OK; } int localRsSendInternalStr(CppTestStreamParameters *par, unsigned char *bytes, int *nBytes) { return RS_OK; } int localRsRecvInternalByte(CppTestStreamParameters *par, unsigned char *pByte, unsigned char *is_recv) { return RS_OK; } int localFlushInternalRS(CppTestStreamParameters *par) { return RS_OK; } void localSetStop(int *stop_bit, int result) { } void localSetParity(int *parity, char *result) { } void localRsSleep(unsigned int msec) { } #endif
- Provide the implementation for the following functions:
- int localFlushInternalRS(CppTestStreamParameters *par);
Flush internal Serial port buffer. CppTestStreamParameters described below. - int localRsInitInternalSerial(CppTestStreamParameters *par);
Init serial port. - localRsSendInternalByte(CppTestStreamParameters *par, unsigned char byte, unsigned char *is_send);
Send one byte. Parameters are par (described below), byte to send and result. - int localRsSendInternalStr(CppTestStreamParameters *par, unsigned char bytes, int *nBytes);
Send nBytes bytes. Parameters are par (described below), bytes to send and nBytes sent. - int localRsRecvInternalByte(CppTestStreamParameters *par, unsigned char *pByte, unsigned char *is_recv);
Receiving one byte. Parameters are par (described below), received byte result. - int localRsUninitInternalSerial(CppTestStreamParameters *par);
Close serial port. - void localSetStop(int *stop_bit, int result);
Set stop bit transmission parameter. - void localSetParity(int *parity, char *result);
Set parity transmission parameter. - char *localGetErrorText(void);
Return buffer with ErrorText (if any). - void localRsSleep(unsigned int msec);
Sleep implementation.
- int localFlushInternalRS(CppTestStreamParameters *par);
...
Data emitted from the target via the serial link should be captured with the help of a serial port listener. The listener is a simple utility program shipped with C/c++test. It is located in <CPPTEST_INSTALL_DIR>/bin/engine/runtime/listeners/rs232_listener, and it accepts the following parameters:
...