T

TCP Serial

This is a SystemC module which allows to get/send data from a GreenSerialSocket to a TCP connection.

passed 5d6e2449 mingw: minor fixes · by Clement Deschamps

TCPSerial

This is a SystemC module which allows to get/send data from a GreenSerialSocket to a TCP connection.

Code status

build status

Requirements

  • GIT > 1.8.2
  • SystemC1 2.1.0 to 2.3.1
  • GreenLib > 1.0.0
  • CMake > 2.6
  • Boost > 1.47 (optional)

Official OS support :

  • Linux (Debian/Ubuntu, CentOS)
  • Windows with MinGW

Build

cmake -DGREENLIB_PREFIX=[...] -DSYSTEMC_PREFIX=[...] [options]
  • GREENLIB_PREFIX: specify path to GreenLib
  • SYSTEMC_PREFIX: specify path to SystemC

This will result in generating the Makefile to build TCPSerial.

Available options are:

  • USE_BOOST_THREAD : Set to ON if you want to use Boost.Thread instead of POSIX Thread (pthread)
  • USE_BOOST_ASIO : Set to ON if you want to use ASIO instead of UNIX/WIN32 socket
  • CMAKE_INSTALL_PREFIX2 : Specify install directory used by install.
  • SYSTEMC_PREFIX : Specify SystemC prefix (Otherwise, CMake will scan SYSTEMC_HOME environment variable)
  • LUA_LIBRARIES : Specify LUA libraries directory (where is located lua.a, lua.dll, ...).
  • LUA_INCLUDE_DIR : Specify LUA header directory (where is located lua.h).
  • BOOST_ROOT : Specify Boost directory.
  • SWIG_DIR : Specify SWIG directory (where is located swig binary).
  • SWIG_EXECUTABLE : Specify SWIG binary path.
  • -G : Specify build tools. Currently, we only support "Unix Makefiles".

By default, TCPSerial will use POSIX Thread (pthread) on all platforms. If you want to use Boost.Thread, you need to set USE_BOOST_THREAD cmake option to ON:

cmake -DUSE_BOOST_THREAD=ON [...]

By default, TCPSerial will use UNIX/WIN32 socket depending on platform. If you want to use Boost.ASIO, you need to set USE_BOOST_ASIO cmake option to ON:

cmake -DUSE_BOOST_ASIO=ON [...]

Important note for Windows users: TCPSerial requires preprocessor definition of _WIN32_WINNT. This value is automatically fill with this CMake project. However, if you include TCPSerial.h in your project, you will need to define this value too to avoid build problems. You can find value of _WIN32_WINNT for your systems on Microsoft website or reuse _WIN32_WINNT value detection script in CMakeLists.txt.

Then compile:

make

This action will result in the compilation of TCPSerial.

Include this model in a project

  • Copy the misc/FindTCPSERIAL.cmake in your project repository.
  • Add the following lines into your CMakeLists.txt:
find_package(TCPSERIAL)
if(TCPSERIAL_FOUND)
    include_directories(${TCPSERIAL_INCLUDE_DIRS})
    link_directories(${TCPSERIAL_LIBRARY_DIRS})
else()
    message(FATAL_ERROR "TCPSerial not found.")
endif()

You're now able to use TCPSerial headers and link your program with ${TCPSERIAL_LIBRARIES}.

Contributing

TCPSerial is an open source, community-driven project. If you'd like to contribute, please feel free to fork project and open a merge request or to send us a patch.

GreenLib-logo

  1. On Windows, TCPSerial requires SystemC 2.3.1. 

  2. Default value is /usr/local