pull/4/head
Hans-Erik Floryd 2015-05-07 17:44:01 +02:00
parent 6b9aa5a343
commit d0a7447117
7 changed files with 138 additions and 0 deletions

34
CMakeLists.txt 100644
View File

@ -0,0 +1,34 @@
# CMakeLists files in this project can
# refer to the root source directory of the project as ${SOES_SOURCE_DIR} and
# to the root binary directory of the project as ${SOES_BINARY_DIR}.
cmake_minimum_required (VERSION 2.8.4)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
project (SOES)
set (SOES_VERSION_MAJOR 0)
set (SOES_VERSION_MINOR 1)
set (SOES_VERSION_PATCH 0)
# Generate version numbers
configure_file (
"${SOES_SOURCE_DIR}/version.h.in"
"${SOES_SOURCE_DIR}/soes/version.h"
)
# Include paths
include_directories("${SOES_SOURCE_DIR}/include")
include_directories("${SOES_SOURCE_DIR}/soes")
# Platform flags, OSAL sources
include(${CMAKE_SYSTEM_NAME})
# Source paths
add_subdirectory (soes)
include (InstallRequiredSystemLibraries)
set (CPACK_RESOURCE_FILE_LICENSE "${SOES_SOURCE_DIR}/LICENSE")
set (CPACK_PACKAGE_VERSION_MAJOR "${SOES_VERSION_MAJOR}")
set (CPACK_PACKAGE_VERSION_MINOR "${SOES_VERSION_MINOR}")
set (CPACK_PACKAGE_VERSION_PATCH "${SOES_VERSION_MINOR}")
set (CPACK_PACKAGE_CONTACT info.ethercat@rt-labs.com)
include (CPack)

View File

@ -0,0 +1,34 @@
# Guard against multiple inclusion
if(_RT_KERNEL_CMAKE_)
return()
endif()
set(_RT_KERNEL_CMAKE_ TRUE)
cmake_minimum_required (VERSION 3.1.2)
# Avoid warning when re-running cmake
set(DUMMY ${CMAKE_TOOLCHAIN_FILE})
# No support for shared libs
set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS FALSE)
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
#set(CMAKE_FIND_LIBRARY_PREFIXES "lib")
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
# Get environment variables
set(RTK $ENV{RTK} CACHE STRING
"Location of rt-kernel tree")
set(COMPILERS $ENV{COMPILERS} CACHE STRING
"Location of compiler toolchain")
set(BSP $ENV{BSP} CACHE STRING
"The name of the BSP to build for")
# Common flags
add_definitions(-Wall -Wextra -Wno-unused-parameter -Werror -fomit-frame-pointer -fno-strict-aliasing -fshort-wchar)
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostartfiles -L${RTK}/lib/${ARCH}/${CPU} -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--start-group <LINK_LIBRARIES> -l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -lptpd -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lcounter -lstdc++ -lc -lm -Wl,--end-group")
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -nostartfiles -L${RTK}/lib/${ARCH}/${CPU} -T${RTK}/bsp/${BSP}/${BSP}.ld -Wl,--start-group <LINK_LIBRARIES> -l${BSP} -l${ARCH} -lkern -ldev -lsio -lblock -lfs -lusb -llwip -lptpd -leth -li2c -lrtc -lcan -lnand -lspi -lnor -lpwm -ladc -ltrace -lcounter -lc -lm -Wl,--end-group")

View File

@ -0,0 +1,9 @@
set(OSAL_SOURCES
${SOES_SOURCE_DIR}/os_hw/rtl_spi/esc_hw.c
)
set(OSAL_INCLUDES
${SOES_SOURCE_DIR}/include/sys/gcc
${RTK}/include/kern
${RTK}/include/drivers
)

View File

@ -0,0 +1,15 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME rt-kernel)
# which compiler to use
set(CMAKE_C_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
set(CMAKE_CXX_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
if(CMAKE_HOST_WIN32)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
endif(CMAKE_HOST_WIN32)
set(ARCH arm9e)
set(CPU arm7tdmi)
add_definitions(-mlittle-endian -mcpu=arm7tdmi)

View File

@ -0,0 +1,16 @@
# the name of the target operating system
set(CMAKE_SYSTEM_NAME rt-kernel)
# which compiler to use
set(CMAKE_C_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
set(CMAKE_CXX_COMPILER $ENV{COMPILERS}/arm-eabi/bin/arm-eabi-gcc)
if(CMAKE_HOST_WIN32)
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
endif(CMAKE_HOST_WIN32)
set(RTK_ROOT rt-kernel-imx53)
set(RTK_LIBS rt-kernel-imx53/lib/imx53/cortex-a8)
set(RTK_TARGET_LIBS "-limx53qsb -limx53")
add_definitions(-mfpu=neon -mcpu=cortex-a8)

View File

@ -0,0 +1,22 @@
message (STATUS "Building for ${CMAKE_SYSTEM_NAME}")
# NOTE: add headers to make them show up in an IDE
add_library (soes
esc.c
esc.h
esc_coe.c
esc_coe.h
esc_foe.c
esc_foe.h
${OSAL_SOURCES}
)
include_directories(${OSAL_INCLUDES})
install (TARGETS soes DESTINATION bin)
install (FILES
esc.h
esc_coe.h
esc_foe.h
DESTINATION include)

8
version.h.in 100644
View File

@ -0,0 +1,8 @@
#ifndef VERSION_H
#define SOES_VERSION_MAJOR @SOES_VERSION_MAJOR@
#define SOES_VERSION_MINOR @SOES_VERSION_MINOR@
#define SOES_VERSION_PATCH @SOES_VERSION_PATCH@
#endif /* VERSION_H */