Skip to content

Commit

Permalink
Initial commit of the complete master stack and a sample application
Browse files Browse the repository at this point in the history
  • Loading branch information
lrsdnlssn committed Nov 22, 2021
1 parent 2866368 commit 73db397
Show file tree
Hide file tree
Showing 65 changed files with 24,036 additions and 1 deletion.
17 changes: 17 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Auto detect text files and perform LF normalization
* text=auto

# Custom for Visual Studio
*.cs diff=csharp

# Standard to msysgit
*.doc diff=astextplain
*.DOC diff=astextplain
*.docx diff=astextplain
*.DOCX diff=astextplain
*.dot diff=astextplain
*.DOT diff=astextplain
*.pdf diff=astextplain
*.PDF diff=astextplain
*.rtf diff=astextplain
*.RTF diff=astextplain
46 changes: 46 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
build*/
*~
*#
CMakeFiles/
CMakeCache.txt
install
doc/_build
doc/_copied

.cproject
.project

# Object files
*.o
*.ko
*.obj
*.elf

# Precompiled Headers
*.gch
*.pch

# Libraries
*.lib
*.a
*.la
*.lo

# Shared objects (inc. Windows DLLs)
*.dll
*.so
*.so.*
*.dylib

# Executables
*.exe
*.out
*.app
*.i*86
*.x86_64
*.hex

# Editor files
.vscode/
/Debug/
/Release/
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "cmake/tools"]
path = cmake/tools
url = https://github.com/rtlabs-com/cmake-tools
11 changes: 11 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),

## [Unreleased]

## 2021-11-19

### Added
- The stack
118 changes: 118 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
#********************************************************************
# _ _ _
# _ __ | |_ _ | | __ _ | |__ ___
# | '__|| __|(_)| | / _` || '_ \ / __|
# | | | |_ _ | || (_| || |_) |\__ \
# |_| \__|(_)|_| \__,_||_.__/ |___/
#
# www.rt-labs.com
# Copyright 2019 rt-labs AB, Sweden.
# See LICENSE file in the project root for full license information.
#*******************************************************************/

cmake_minimum_required (VERSION 3.13)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools")
project (IOLINKMASTER VERSION 0.1.0)
include(CTest)

# Set required standard level
set (CMAKE_C_STANDARD 99)
set (CMAKE_CXX_STANDARD 11)

# Always use standard .o suffix
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)

# Options
include(CMakeDependentOption)

option (BUILD_SHARED_LIBS "Build shared library" OFF)
option (LOG_ENABLE "Enable logging" OFF)
option (BUILD_TESTS "Build unit tests" OFF)

set(LOG_STATE_VALUES "ON;OFF")
set(LOG_LEVEL_VALUES "DEBUG;INFO;WARNING;ERROR")

Set(IOLINK_NUM_PORTS "2"
CACHE STRING "max number IO-Link ports")

Set(IOLINK_NUM_DIAG_ENTRIES "64"
CACHE STRING "max number IO-Link diagnosis entries")

Set(IOLINK_MAX_EVENTS "6"
CACHE STRING "max number IO-Link events")

set(LOG_LEVEL INFO CACHE STRING "default log level")
set_property(CACHE LOG_LEVEL PROPERTY STRINGS ${LOG_LEVEL_VALUES})

# Default to release build with debug info
if (NOT CMAKE_BUILD_TYPE)
set (CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
endif (NOT CMAKE_BUILD_TYPE)

message (STATUS "Default log level is: ${LOG_LEVEL}")
message (STATUS "Build type is: ${CMAKE_BUILD_TYPE}")
message (STATUS "Building for ${CMAKE_SYSTEM_NAME}")

# Generate version numbers
configure_file (
${IOLINKMASTER_SOURCE_DIR}/version.h.in
${IOLINKMASTER_BINARY_DIR}/include/version.h
)

# Generate config options
configure_file (
${IOLINKMASTER_SOURCE_DIR}/options.h.in
${IOLINKMASTER_BINARY_DIR}/src/options.h
)

# Include paths
include_directories(
${IOLINKMASTER_BINARY_DIR}/include
${IOLINKMASTER_BINARY_DIR}/src
${IOLINKMASTER_SOURCE_DIR}/include
${IOLINKMASTER_SOURCE_DIR}/src
)

# Platform configuration
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_SYSTEM_NAME}.cmake)

# Source paths
add_subdirectory (src)
if (${BUILD_TESTS})
add_subdirectory (test)
endif (${BUILD_TESTS})
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
add_subdirectory (sample_app)
endif ()

# Doxygen configuration
cmake_policy(SET CMP0057 NEW)
find_package(Doxygen)
if (DOXYGEN_FOUND)
set(DOXYGEN_OPTIMIZE_OUTPUT_FOR_C YES)
set(DOXYGEN_TYPEDEF_HIDES_STRUCT YES)
set(DOXYGEN_STRIP_CODE_COMMENTS NO)
set(DOXYGEN_MACRO_EXPANSION YES)
set(DOXYGEN_EXPAND_ONLY_PREDEF YES)
set(DOXYGEN_PREDEFINED IOLINKMASTER_EXPORT)
set(DOXYGEN_EXPAND_AS_DEFINED IOLINKMASTER_EXPORT)
set(DOXYGEN_COLLABORATION_GRAPH NO)
set(DOXYGEN_INCLUDE_GRAPH NO)
set(DOXYGEN_INCLUDED_BY_GRAPH NO)
set(DOXYGEN_RECURSIVE NO)
set(DOXYGEN_USE_MDFILE_AS_MAINPAGE README.md)
doxygen_add_docs(docs
README.md
include
src
)
endif ()

include (InstallRequiredSystemLibraries)
set (CPACK_RESOURCE_FILE_LICENSE "${IOLINKMASTER_SOURCE_DIR}/LICENSE.md")
set (CPACK_PACKAGE_IOLMCONTACT [email protected])
include (CPack)
16 changes: 16 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# License

This software is dual-licensed.

## GPL version 3

This software is distributed under GPLv3. You are allowed to use this
software for an open-source project with a compatible license.

[GNU GPL license v3](https://www.gnu.org/licenses/gpl-3.0.html)

## Commercial license

This software is also available under a commercial license with
options for support and maintenance. Please contact [email protected]
for further details.
66 changes: 65 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,65 @@
# i-link
i-link IO-Link master stack
===========================

Web resources
-------------

* Source repository: [https://github.com/rtlabs-com/i-link](https://github.com/rtlabs-com/i-link)
* Documentation: [https://rt-labs.com/docs/i-link](https://rt-labs.com/docs/i-link)
* Continuous integration: [https://github.com/rtlabs-com/i-link/actions](https://github.com/rtlabs-com/i-link/actions)
* RT-Labs (stack integration, certification services and training): [https://rt-labs.com](https://rt-labs.com)

[![Build Status](https://travis-ci.org/rtlabs-com/i-link.svg?branch=master)](https://travis-ci.org/rtlabs-com/i-link)

i-link
-----
The rt-labs IO-Link stack i-link is used for IO-Link master implementations.
It is easy to use and provides a small footprint.
It is especially well suited for embedded systems where resources are limited and efficiency is crucial.

It is written in C and can be run on bare-metal hardware, an RTOS such as rt-kernel, or on Linux.
The i-link stack is supplied with full sources including a porting layer.

Also C++ (any version) is supported.

rt-labs i-link is developed according to specification 2.3:

* Conformance Class A (Class B upon request)
* Real Time Class 1

Features:

* Porting layer provided
* MAX14819 master transceiver supported

Limitations:

* None

This software is dual-licensed, with GPL version 3 and a commercial license.
See LICENSE.md for more details.

Requirements
------------
cmake

* cmake 3.14 or later

For Linux:

* gcc 4.6 or later

For rt-kernel:

* Workbench 2018.1 or later

As an example of a microcontroller we have been using the Infineon XMC4800,
which has an ARM Cortex-M4 running at 144 MHz, with 2 MB Flash and 352 kB RAM.
It runs rt-kernel, and we have tested it with 2 MAX14819 chips, each with 2 IO-Link ports.

Contributions
--------------
Contributions are welcome. If you want to contribute you will need to
sign a Contributor License Agreement and send it to us either by
e-mail or by physical mail. More information is available
on [https://rt-labs.com/contribution](https://rt-labs.com/contribution).
29 changes: 29 additions & 0 deletions cmake/Linux.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#********************************************************************
# _ _ _
# _ __ | |_ _ | | __ _ | |__ ___
# | '__|| __|(_)| | / _` || '_ \ / __|
# | | | |_ _ | || (_| || |_) |\__ \
# |_| \__|(_)|_| \__,_||_.__/ |___/
#
# www.rt-labs.com
# Copyright 2019 rt-labs AB, Sweden.
# See LICENSE file in the project root for full license information.
#*******************************************************************/

set(OSAL_SOURCES
${IOLINKMASTER_SOURCE_DIR}/../osal/src/linux/osal.c
${IOLINKMASTER_SOURCE_DIR}/../osal/src/linux/osal_log.c
${IOLINKMASTER_SOURCE_DIR}/iol_osal/linux/osal_drv.c
${IOLINKMASTER_SOURCE_DIR}/iol_osal/linux/osal_fileops.c
)
set(OSAL_INCLUDES
${IOLINKMASTER_SOURCE_DIR}/../osal/include
${IOLINKMASTER_SOURCE_DIR}/../osal/src/linux
${IOLINKMASTER_SOURCE_DIR}/iol_osal/include
)
set(OSAL_LIBS
"pthread"
"rt"
)

set(GOOGLE_TEST_INDIVIDUAL TRUE)
20 changes: 20 additions & 0 deletions cmake/rt-kernel.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#********************************************************************
# _ _ _
# _ __ | |_ _ | | __ _ | |__ ___
# | '__|| __|(_)| | / _` || '_ \ / __|
# | | | |_ _ | || (_| || |_) |\__ \
# |_| \__|(_)|_| \__,_||_.__/ |___/
#
# www.rt-labs.com
# Copyright 2019 rt-labs AB, Sweden.
# See LICENSE file in the project root for full license information.
#*******************************************************************/

set(OSAL_INCLUDES
${IOLINKMASTER_SOURCE_DIR}/../osal/include
${IOLINKMASTER_SOURCE_DIR}/../osal/src/rt-kernel
${RTK}/include
${RTK}/include/kern
${RTK}/include/arch/${ARCH}
${RTK}/include/drivers
)
1 change: 1 addition & 0 deletions cmake/tools
Submodule tools added at da9bb4
Loading

0 comments on commit 73db397

Please sign in to comment.