Skip to content

Commit

Permalink
Merge pull request #115 from matzipan/feature/rtems
Browse files Browse the repository at this point in the history
Add RTEMS5 support
  • Loading branch information
timcanham authored Apr 30, 2020
2 parents d6b6408 + 03ad1ac commit d72b829
Show file tree
Hide file tree
Showing 6 changed files with 58 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Drv/SocketIpDriver/SocketIpDriverComponentImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <taskLib.h>
#include <sysLib.h>
#include <errnoLib.h>
#elif defined TGT_OS_TYPE_LINUX || TGT_OS_TYPE_DARWIN
#elif defined TGT_OS_TYPE_LINUX || TGT_OS_TYPE_DARWIN || TGT_OS_TYPE_RTEMS
#include <sys/socket.h>
#include <netdb.h>
#include <unistd.h>
Expand Down
3 changes: 3 additions & 0 deletions Drv/SocketIpDriver/SocketIpDriverComponentImpl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
#include <inetLib.h>
#elif defined TGT_OS_TYPE_LINUX || TGT_OS_TYPE_DARWIN
#include <arpa/inet.h>
#elif TGT_OS_TYPE_RTEMS
#include <arpa/inet.h>
#include <netinet/in.h>
#else
#error OS not supported for IP Socket Communications
#endif
Expand Down
27 changes: 27 additions & 0 deletions Os/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,33 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "arm-linux-gnueabihf")
"${CMAKE_CURRENT_LIST_DIR}/ValidatedFile.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FileCommon.cpp"
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "RTEMS5")
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/Pthreads/Queue.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Pthreads/BufferQueueCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Pthreads/PriorityBufferQueue.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Pthreads/MaxHeap/MaxHeap.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Linux/File.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Posix/Task.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LogPrintf.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LogDefault.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Linux/InterruptLock.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Linux/WatchdogTimer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/X86/IntervalTimer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Linux/IntervalTimer.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Posix/Mutex.cpp"
"${CMAKE_CURRENT_LIST_DIR}/Linux/FileSystem.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TaskString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/TaskCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/QueueCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/QueueString.cpp"
"${CMAKE_CURRENT_LIST_DIR}/IPCQueueCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/SimpleQueueRegistry.cpp"
"${CMAKE_CURRENT_LIST_DIR}/MemCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ValidateFileCommon.cpp"
"${CMAKE_CURRENT_LIST_DIR}/ValidatedFile.cpp"
"${CMAKE_CURRENT_LIST_DIR}/FileCommon.cpp"
)
else()
# Default Linux
set(SOURCE_FILES
Expand Down
2 changes: 2 additions & 0 deletions Os/Linux/File.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ namespace Os {
case OPEN_SYNC_WRITE:
flags = O_WRONLY | O_CREAT | O_SYNC;
break;
#ifndef TGT_OS_TYPE_RTEMS
case OPEN_SYNC_DIRECT_WRITE:
flags = O_WRONLY | O_CREAT | O_DSYNC
#ifdef __linux__
Expand All @@ -59,6 +60,7 @@ namespace Os {
;
#endif
break;
#endif
case OPEN_CREATE:
flags = O_WRONLY | O_CREAT | O_TRUNC;
break;
Expand Down
6 changes: 6 additions & 0 deletions Svc/LinuxTimer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "arm-linux-gnueabihf")
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentImplTimerFd.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentImplCommon.cpp"
)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "RTEMS5")
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentAi.xml"
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentImplTaskDelay.cpp"
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentImplCommon.cpp"
)
else()
set(SOURCE_FILES
"${CMAKE_CURRENT_LIST_DIR}/LinuxTimerComponentAi.xml"
Expand Down
19 changes: 19 additions & 0 deletions cmake/platform/rtems5.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
add_definitions(-DTGT_OS_TYPE_RTEMS)

# Add Linux specific headers into the system
include_directories(SYSTEM "${FPRIME_CORE_DIR}/Fw/Types/Linux")

include_directories(SYSTEM
${RTEMS_INCLUDE_DIRS}
${RTEMS_BSP_INCLUDE_DIRS}
${RTEMS_SOURCE_DIR}/testsuites/support/include
)

add_compile_options(${RTEMS_C_FLAGS})

add_link_options(${RTEMS_LINK_FLAGS})

add_compile_definitions(
__rtems__
_POSIX_THREADS
)

0 comments on commit d72b829

Please sign in to comment.