Compare commits
10 Commits
d752ef5b44
...
2e9c3df2e2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2e9c3df2e2 | ||
|
|
c0ebcdd507 | ||
|
|
a7c7dc682f | ||
|
|
d0d8f31dc5 | ||
|
|
f507403d39 | ||
|
|
8bef7d3ec8 | ||
|
|
111b24392c | ||
|
|
da63bec594 | ||
|
|
7d65fcf69f | ||
|
|
f6bbef1af9 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -3,3 +3,4 @@
|
|||||||
/profinet_test/sample_app/build
|
/profinet_test/sample_app/build
|
||||||
/profinet_test/sample_app_echo/build
|
/profinet_test/sample_app_echo/build
|
||||||
*.bin
|
*.bin
|
||||||
|
/src/out
|
||||||
|
|||||||
4
.gitmodules
vendored
Normal file
4
.gitmodules
vendored
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
[submodule "sitara_depot"]
|
||||||
|
path = sitara_depot
|
||||||
|
url = http://server_gorbunov:3000/SmartForce4.0/sitara_depot.git
|
||||||
|
branch = master
|
||||||
32
README.md
32
README.md
@ -187,6 +187,38 @@ echo_submod_ptr->inp_data.Write(0, Echo_inpCycData.mem, echo_submod_ptr->cyc_ind
|
|||||||
|
|
||||||
Обмен происходит с помощью json rpc, протокол описан в файле `src/interprocess/pipes/json_rpc_protocol.txt`.
|
Обмен происходит с помощью json rpc, протокол описан в файле `src/interprocess/pipes/json_rpc_protocol.txt`.
|
||||||
|
|
||||||
|
## Инструкция по сборке
|
||||||
|
ПО кроссплатформенное, настройка окружения сборки осущетсвляется в файле `CMakePresets.json`.
|
||||||
|
|
||||||
|
### Сборка под x86_64
|
||||||
|
|
||||||
|
Выбрать конфигурацию "x86_64 Debug" или "x86_64 Release"
|
||||||
|
|
||||||
|
### Сборка под arm cortex-a15 (sitara)
|
||||||
|
|
||||||
|
Перед сборкой отредактировать значения переменных окружения:
|
||||||
|
* ENV_TARGET_CROSS_COMPILE_PREFIX - префикс компилятора с полным путем к нему. Например:
|
||||||
|
`/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-`
|
||||||
|
|
||||||
|
* ENV_TARGET_SYSTOOT_PATH - путь к библиотекам целефой платформы.
|
||||||
|
Для платы am571x-idk - это:
|
||||||
|
`/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi`
|
||||||
|
|
||||||
|
SYSROOT можно выкачать из платы напрямую. Например для BeagleBoardAI есть скрипт `../sitara_depot/scripts/beagleboard/host/create_sysroot.sh`
|
||||||
|
|
||||||
|
## Зависимости
|
||||||
|
Две библиотеки:
|
||||||
|
* osal `http://server_gorbunov:3000/SmartForce4.0/profinet_io_dev/src/branch/master/profinet_stack/osal`
|
||||||
|
* pnet `http://server_gorbunov:3000/SmartForce4.0/profinet_io_dev/src/branch/master/profinet_stack/p-net`
|
||||||
|
|
||||||
|
Библиотеки уже собраны под две архитектуры cortex-a15 и x86_64. Сбори лежат тут:
|
||||||
|
* `http://server_gorbunov:3000/SmartForce4.0/profinet_io_dev/src/branch/master/libs/lib/arm_a15`
|
||||||
|
* `http://server_gorbunov:3000/SmartForce4.0/profinet_io_dev/src/branch/master/libs/lib/x86_64`
|
||||||
|
|
||||||
|
В названии файла d - значит дебажная версия библиотеки, например libosal.a - Release, а libosald.a - Debug.
|
||||||
|
|
||||||
|
Сборка библиоитек реализована аналогично.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
#ifndef PNET_VERSION_H
|
#ifndef PNET_VERSION_H
|
||||||
#define PNET_VERSION_H
|
#define PNET_VERSION_H
|
||||||
|
|
||||||
/* #undef PROFINET_GIT_REVISION */
|
#define PROFINET_GIT_REVISION "da63bec-dirty"
|
||||||
|
|
||||||
#if !defined(PNET_VERSION_BUILD) && defined(PROFINET_GIT_REVISION)
|
#if !defined(PNET_VERSION_BUILD) && defined(PROFINET_GIT_REVISION)
|
||||||
#define PNET_VERSION_BUILD PROFINET_GIT_REVISION
|
#define PNET_VERSION_BUILD PROFINET_GIT_REVISION
|
||||||
|
|||||||
BIN
libs/lib/arm_a15/BeagleBoneAI/libosal.a
Normal file
BIN
libs/lib/arm_a15/BeagleBoneAI/libosal.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/BeagleBoneAI/libosald.a
Normal file
BIN
libs/lib/arm_a15/BeagleBoneAI/libosald.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/BeagleBoneAI/libprofinet.a
Normal file
BIN
libs/lib/arm_a15/BeagleBoneAI/libprofinet.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/BeagleBoneAI/libprofinetd.a
Normal file
BIN
libs/lib/arm_a15/BeagleBoneAI/libprofinetd.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/am5718-idk/libosal.a
Normal file
BIN
libs/lib/arm_a15/am5718-idk/libosal.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/am5718-idk/libosald.a
Normal file
BIN
libs/lib/arm_a15/am5718-idk/libosald.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/am5718-idk/libprofinet.a
Normal file
BIN
libs/lib/arm_a15/am5718-idk/libprofinet.a
Normal file
Binary file not shown.
BIN
libs/lib/arm_a15/am5718-idk/libprofinetd.a
Normal file
BIN
libs/lib/arm_a15/am5718-idk/libprofinetd.a
Normal file
Binary file not shown.
70
profinet_stack/osal/.vscode/settings.json
vendored
Normal file
70
profinet_stack/osal/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"cmake.useCMakePresets": "always",
|
||||||
|
"files.associations": {
|
||||||
|
"typeinfo": "c",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"any": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"valarray": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"typeindex": "cpp",
|
||||||
|
"variant": "cpp",
|
||||||
|
"cfenv": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,6 +18,19 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools")
|
||||||
project (OSAL VERSION 0.1.0)
|
project (OSAL VERSION 0.1.0)
|
||||||
|
|
||||||
|
message("CMakeList.txt: Starting...")
|
||||||
|
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
if ( (NOT (${BOARD} STREQUAL "am5718-idk")) AND (NOT (${BOARD} STREQUAL "BeagleBoneAI")))
|
||||||
|
message(FATAL_ERROR "BOARD ${BOARD} unsupported!\n"
|
||||||
|
"BOARD can take the following values:\n"
|
||||||
|
" -- am5718-idk\n"
|
||||||
|
" -- BeagleBoneAI")
|
||||||
|
else()
|
||||||
|
message(STATUS "BOARD = " ${BOARD})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
include(GetGitRevision)
|
include(GetGitRevision)
|
||||||
|
|
||||||
# Default settings if this is the main project
|
# Default settings if this is the main project
|
||||||
@ -51,32 +64,60 @@ configure_file (
|
|||||||
version.h.in
|
version.h.in
|
||||||
${OSAL_BINARY_DIR}/src/version.h
|
${OSAL_BINARY_DIR}/src/version.h
|
||||||
)
|
)
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Ïóòü ê ïàïêå ñ áèáëèîòåêàìè
|
||||||
|
set(INSTALL_PATH ${CMAKE_SOURCE_DIR}/../../libs)
|
||||||
|
# Ïóòü êóäà áóäóò êîïèðîâàòüñÿ ñîáðàííàÿ áèáëèîòåêà
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH}/lib)
|
||||||
|
|
||||||
|
#BOARD çàäàåòñÿ â ïàðàìåòðàõ çàïóñêà cmake, ïðîïèñàíî â .vscode/settings.json
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../../sitara_depot)
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH_LIB}/arm_a15/${BOARD})
|
||||||
|
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake)
|
||||||
|
message(STATUS "Building for ${BOARD}")
|
||||||
|
else()
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH_LIB}/x86_64)
|
||||||
|
message(STATUS "Building for x86")
|
||||||
|
endif()
|
||||||
|
# Ïóòü êóäà áóäóò êîïèðîâàòüñÿ h-ôàéëû
|
||||||
|
set(INSTALL_PATH_INC ${INSTALL_PATH}/include)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
# Add platform-dependent targets early, so they can be configured by
|
# Add platform-dependent targets early, so they can be configured by
|
||||||
# platform
|
# platform
|
||||||
add_library(osal "")
|
|
||||||
|
# Èìÿ áèáëèîòåêè
|
||||||
|
set(LIB_NAME osal)
|
||||||
|
# Äëÿ îòëàäî÷íîé âåðñèè â êîíöå äîáàâëÿåì d: osald
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
set(LIB_NAME ${LIB_NAME}d)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${LIB_NAME} "")
|
||||||
|
|
||||||
# Use position independent code if platform supports shared libraries
|
# Use position independent code if platform supports shared libraries
|
||||||
get_property(SUPPORTS_SHARED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
get_property(SUPPORTS_SHARED GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS)
|
||||||
if (SUPPORTS_SHARED)
|
if (SUPPORTS_SHARED)
|
||||||
set_property(TARGET osal PROPERTY POSITION_INDEPENDENT_CODE ON)
|
set_property(TARGET ${LIB_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_PROJECT_NAME STREQUAL OSAL AND BUILD_TESTING)
|
#if (CMAKE_PROJECT_NAME STREQUAL OSAL AND BUILD_TESTING)
|
||||||
add_executable(osal_test "")
|
# add_executable(osal_test "")
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
# Platform configuration
|
# Platform configuration
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_SYSTEM_NAME}.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_SYSTEM_NAME}.cmake)
|
||||||
|
|
||||||
set_target_properties (osal
|
set_target_properties (${LIB_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
C_STANDARD 99
|
C_STANDARD 99
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_features(osal PUBLIC c_std_99)
|
target_compile_features(${LIB_NAME} PUBLIC c_std_99)
|
||||||
|
|
||||||
target_include_directories(osal
|
target_include_directories(${LIB_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${OSAL_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${OSAL_SOURCE_DIR}/include>
|
||||||
$<INSTALL_INTERFACE:include>
|
$<INSTALL_INTERFACE:include>
|
||||||
@ -86,8 +127,9 @@ target_include_directories(osal
|
|||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
TARGETS osal
|
TARGETS ${LIB_NAME}
|
||||||
EXPORT OsalTargets
|
EXPORT OsalTargets
|
||||||
|
DESTINATION ${INSTALL_PATH_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
@ -112,14 +154,14 @@ install(FILES
|
|||||||
install(FILES
|
install(FILES
|
||||||
include/osal.h
|
include/osal.h
|
||||||
include/osal_log.h
|
include/osal_log.h
|
||||||
DESTINATION include
|
DESTINATION ${INSTALL_PATH_INC}
|
||||||
)
|
)
|
||||||
|
|
||||||
if (CMAKE_PROJECT_NAME STREQUAL OSAL AND BUILD_TESTING)
|
#if (CMAKE_PROJECT_NAME STREQUAL OSAL AND BUILD_TESTING)
|
||||||
add_subdirectory (test)
|
# add_subdirectory (test)
|
||||||
include(AddGoogleTest)
|
# include(AddGoogleTest)
|
||||||
add_gtest(osal_test)
|
# add_gtest(osal_test)
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
# Doxygen configuration
|
# Doxygen configuration
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
|
|||||||
110
profinet_stack/osal/CMakePresets.json
Normal file
110
profinet_stack/osal/CMakePresets.json
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"displayName": "default",
|
||||||
|
"description": "Default build using Ninja generator",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "x86_64 Debug",
|
||||||
|
"description": "Degub build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
|
"CMAKE_CXX_COMPILER": "g++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Release",
|
||||||
|
"inherits": "x86_64_Debug",
|
||||||
|
"displayName": "x86_64 Release",
|
||||||
|
"description": "Release build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "am571x-idk Debug",
|
||||||
|
"description": "Degub build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "am5718-idk"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Release",
|
||||||
|
"inherits": "am571x_idk_Debug",
|
||||||
|
"displayName": "am571x-idk Release",
|
||||||
|
"description": "Release build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "BeagleBoneAI Debug",
|
||||||
|
"description": "Degub build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "BeagleBoneAI"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/armdev/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/armdev/beagle_board/sysroot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Release",
|
||||||
|
"inherits": "BeagleBoneAI_Debug",
|
||||||
|
"displayName": "BeagleBoneAI Release",
|
||||||
|
"description": "Release build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "x86_64 Debug",
|
||||||
|
"configurePreset": "x86_64_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64 Release",
|
||||||
|
"configurePreset": "x86_64_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Debug",
|
||||||
|
"configurePreset": "am571x_idk_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Release",
|
||||||
|
"configurePreset": "am571x_idk_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Debug",
|
||||||
|
"configurePreset": "BeagleBoneAI_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Release",
|
||||||
|
"configurePreset": "BeagleBoneAI_Release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -19,12 +19,12 @@ option (USE_SCHED_FIFO
|
|||||||
"Use SCHED_FIFO policy. May require extra privileges to run"
|
"Use SCHED_FIFO policy. May require extra privileges to run"
|
||||||
OFF)
|
OFF)
|
||||||
|
|
||||||
target_sources(osal PRIVATE
|
target_sources(${LIB_NAME} PRIVATE
|
||||||
src/linux/osal.c
|
src/linux/osal.c
|
||||||
src/linux/osal_log.c
|
src/linux/osal_log.c
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(osal
|
target_compile_options(${LIB_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
@ -35,11 +35,11 @@ target_compile_options(osal
|
|||||||
$<$<CONFIG:Coverage>:--coverage>
|
$<$<CONFIG:Coverage>:--coverage>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(osal PUBLIC
|
target_include_directories(${LIB_NAME} PUBLIC
|
||||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/linux>
|
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src/linux>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(osal PUBLIC
|
target_link_libraries(${LIB_NAME} PUBLIC
|
||||||
Threads::Threads
|
Threads::Threads
|
||||||
rt
|
rt
|
||||||
INTERFACE
|
INTERFACE
|
||||||
@ -49,7 +49,7 @@ target_link_libraries(osal PUBLIC
|
|||||||
install(FILES
|
install(FILES
|
||||||
src/linux/sys/osal_cc.h
|
src/linux/sys/osal_cc.h
|
||||||
src/linux/sys/osal_sys.h
|
src/linux/sys/osal_sys.h
|
||||||
DESTINATION include/sys
|
DESTINATION ${INSTALL_PATH_INC}/sys
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_TESTING)
|
if (BUILD_TESTING)
|
||||||
|
|||||||
3
profinet_stack/p-net/.gitignore
vendored
3
profinet_stack/p-net/.gitignore
vendored
@ -40,9 +40,6 @@ doc/_copied
|
|||||||
*.x86_64
|
*.x86_64
|
||||||
*.hex
|
*.hex
|
||||||
|
|
||||||
# Editor files
|
|
||||||
.vscode/
|
|
||||||
|
|
||||||
# Sampleapp dummy LED files
|
# Sampleapp dummy LED files
|
||||||
pnet_led*.txt
|
pnet_led*.txt
|
||||||
|
|
||||||
|
|||||||
70
profinet_stack/p-net/.vscode/settings.json
vendored
Normal file
70
profinet_stack/p-net/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,70 @@
|
|||||||
|
{
|
||||||
|
"cmake.useCMakePresets": "always",
|
||||||
|
"files.associations": {
|
||||||
|
"typeinfo": "c",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"string_view": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"any": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"valarray": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"typeindex": "cpp",
|
||||||
|
"variant": "cpp",
|
||||||
|
"cfenv": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -18,6 +18,19 @@ list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|||||||
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools")
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/tools")
|
||||||
project (PROFINET VERSION 0.2.0)
|
project (PROFINET VERSION 0.2.0)
|
||||||
|
|
||||||
|
message("CMakeList.txt: Starting...")
|
||||||
|
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
if ( (NOT (${BOARD} STREQUAL "am5718-idk")) AND (NOT (${BOARD} STREQUAL "BeagleBoneAI")))
|
||||||
|
message(FATAL_ERROR "BOARD ${BOARD} unsupported!\n"
|
||||||
|
"BOARD can take the following values:\n"
|
||||||
|
" -- am5718-idk\n"
|
||||||
|
" -- BeagleBoneAI")
|
||||||
|
else()
|
||||||
|
message(STATUS "BOARD = " ${BOARD})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
# Default settings if this is the main project
|
# Default settings if this is the main project
|
||||||
if (CMAKE_PROJECT_NAME STREQUAL PROFINET)
|
if (CMAKE_PROJECT_NAME STREQUAL PROFINET)
|
||||||
include(CTest)
|
include(CTest)
|
||||||
@ -43,7 +56,7 @@ if (CMAKE_PROJECT_NAME STREQUAL PROFINET)
|
|||||||
message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
|
message(STATUS "Building for ${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
include(AddOsal)
|
#include(AddOsal)
|
||||||
include(GenerateExportHeader)
|
include(GenerateExportHeader)
|
||||||
include(CMakeDependentOption)
|
include(CMakeDependentOption)
|
||||||
include(GetGitRevision)
|
include(GetGitRevision)
|
||||||
@ -165,35 +178,74 @@ configure_file (
|
|||||||
${PROFINET_BINARY_DIR}/include/pnet_options.h
|
${PROFINET_BINARY_DIR}/include/pnet_options.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
# Ïóòü ê ïàïêå ñ áèáëèîòåêàìè
|
||||||
|
set(INSTALL_PATH ${CMAKE_SOURCE_DIR}/../../libs)
|
||||||
|
# Ïóòü êóäà áóäóò êîïèîðîâàòüñÿ ñîáðàííàÿ áèáëèîòåêà
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH}/lib)
|
||||||
|
|
||||||
|
#BOARD çàäàåòñÿ â ïàðàìåòðàõ çàïóñêà cmake, ïðîïèñàíî â .vscode/settings.json
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../../sitara_depot)
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH_LIB}/arm_a15/${BOARD})
|
||||||
|
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake)
|
||||||
|
message(STATUS "Building for ${BOARD}")
|
||||||
|
else()
|
||||||
|
set(INSTALL_PATH_LIB ${INSTALL_PATH_LIB}/x86_64)
|
||||||
|
message(STATUS "Building for x86")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
# Ïóòü êóäà áóäóò êîïèðîâàòüñÿ h-ôàéëû
|
||||||
|
set(INSTALL_PATH_INC ${INSTALL_PATH}/include)
|
||||||
|
|
||||||
|
set(OSAL_NAME osal)
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
set(OSAL_NAME ${OSAL_NAME}d)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
# Add platform-dependent targets early, so they can be configured by
|
# Add platform-dependent targets early, so they can be configured by
|
||||||
# platform
|
# platform
|
||||||
add_library(profinet "")
|
|
||||||
add_executable(pn_dev "")
|
# Èìÿ áèáëèîòåêè
|
||||||
|
set(LIB_NAME profinet)
|
||||||
|
# Äëÿ îòëàäî÷íîé âåðñèè â êîíöå äîáàâëÿåì d: osald
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
set(LIB_NAME ${LIB_NAME}d)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
add_library(${LIB_NAME} "")
|
||||||
|
|
||||||
|
#add_library(profinet "")
|
||||||
|
#add_executable(pn_dev "")
|
||||||
|
|
||||||
if (PNET_OPTION_DRIVER_ENABLE)
|
if (PNET_OPTION_DRIVER_ENABLE)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/src/drivers/drivers.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/src/drivers/drivers.cmake)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (CMAKE_PROJECT_NAME STREQUAL PROFINET AND BUILD_TESTING)
|
#if (CMAKE_PROJECT_NAME STREQUAL PROFINET AND BUILD_TESTING)
|
||||||
add_executable(pf_test "")
|
# add_executable(pf_test "")
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
# Platform configuration
|
# Platform configuration
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_SYSTEM_NAME}.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/${CMAKE_SYSTEM_NAME}.cmake)
|
||||||
|
|
||||||
generate_export_header(profinet
|
generate_export_header(${LIB_NAME}
|
||||||
BASE_NAME pnet
|
BASE_NAME pnet
|
||||||
EXPORT_FILE_NAME ${PROFINET_BINARY_DIR}/include/pnet_export.h
|
EXPORT_FILE_NAME ${PROFINET_BINARY_DIR}/include/pnet_export.h
|
||||||
)
|
)
|
||||||
|
|
||||||
set_target_properties (profinet pn_dev
|
set_target_properties (${LIB_NAME}
|
||||||
PROPERTIES
|
PROPERTIES
|
||||||
C_STANDARD 11
|
C_STANDARD 11
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_features(profinet PUBLIC c_std_99)
|
target_compile_features(${LIB_NAME} PUBLIC c_std_99)
|
||||||
|
|
||||||
target_include_directories(profinet
|
target_include_directories(${LIB_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<BUILD_INTERFACE:${PROFINET_SOURCE_DIR}/include>
|
$<BUILD_INTERFACE:${PROFINET_SOURCE_DIR}/include>
|
||||||
$<BUILD_INTERFACE:${PROFINET_BINARY_DIR}/include>
|
$<BUILD_INTERFACE:${PROFINET_BINARY_DIR}/include>
|
||||||
@ -203,14 +255,19 @@ target_include_directories(profinet
|
|||||||
src
|
src
|
||||||
src/common
|
src/common
|
||||||
src/device
|
src/device
|
||||||
|
${INSTALL_PATH_INC}
|
||||||
|
${INSTALL_PATH_INC}/sys
|
||||||
|
${INSTALL_PATH_INC}/x86_64
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(profinet PUBLIC osal)
|
target_link_directories(${LIB_NAME} PRIVATE ${INSTALL_PATH_LIB})
|
||||||
|
|
||||||
|
target_link_libraries(${LIB_NAME} PUBLIC ${OSAL_NAME})
|
||||||
|
|
||||||
install (
|
install (
|
||||||
TARGETS profinet
|
TARGETS ${LIB_NAME}
|
||||||
EXPORT ProfinetConfig
|
EXPORT ProfinetConfig
|
||||||
DESTINATION lib
|
DESTINATION ${INSTALL_PATH_LIB}
|
||||||
)
|
)
|
||||||
|
|
||||||
install(
|
install(
|
||||||
@ -223,17 +280,17 @@ install (FILES
|
|||||||
${PROFINET_BINARY_DIR}/include/pnet_export.h
|
${PROFINET_BINARY_DIR}/include/pnet_export.h
|
||||||
${PROFINET_BINARY_DIR}/include/pnet_options.h
|
${PROFINET_BINARY_DIR}/include/pnet_options.h
|
||||||
${PROFINET_BINARY_DIR}/include/pnet_version.h
|
${PROFINET_BINARY_DIR}/include/pnet_version.h
|
||||||
DESTINATION include
|
DESTINATION ${INSTALL_PATH_INC}
|
||||||
)
|
)
|
||||||
|
|
||||||
add_subdirectory (src)
|
add_subdirectory (src)
|
||||||
add_subdirectory (samples/pn_dev)
|
#add_subdirectory (samples/pn_dev)
|
||||||
|
|
||||||
if (CMAKE_PROJECT_NAME STREQUAL PROFINET AND BUILD_TESTING)
|
#if (CMAKE_PROJECT_NAME STREQUAL PROFINET AND BUILD_TESTING)
|
||||||
add_subdirectory (test)
|
# add_subdirectory (test)
|
||||||
include(AddGoogleTest)
|
# include(AddGoogleTest)
|
||||||
add_gtest(pf_test)
|
# add_gtest(pf_test)
|
||||||
endif()
|
#endif()
|
||||||
|
|
||||||
# Doxygen configuration
|
# Doxygen configuration
|
||||||
cmake_policy(SET CMP0057 NEW)
|
cmake_policy(SET CMP0057 NEW)
|
||||||
|
|||||||
110
profinet_stack/p-net/CMakePresets.json
Normal file
110
profinet_stack/p-net/CMakePresets.json
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"displayName": "default",
|
||||||
|
"description": "Default build using Ninja generator",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "x86_64 Debug",
|
||||||
|
"description": "Degub build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
|
"CMAKE_CXX_COMPILER": "g++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Release",
|
||||||
|
"inherits": "x86_64_Debug",
|
||||||
|
"displayName": "x86_64 Release",
|
||||||
|
"description": "Release build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "am571x-idk Debug",
|
||||||
|
"description": "Degub build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "am5718-idk"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Release",
|
||||||
|
"inherits": "am571x_idk_Debug",
|
||||||
|
"displayName": "am571x-idk Release",
|
||||||
|
"description": "Release build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "BeagleBoneAI Debug",
|
||||||
|
"description": "Degub build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "BeagleBoneAI"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/armdev/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/armdev/beagle_board/sysroot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Release",
|
||||||
|
"inherits": "BeagleBoneAI_Debug",
|
||||||
|
"displayName": "BeagleBoneAI Release",
|
||||||
|
"description": "Release build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "x86_64 Debug",
|
||||||
|
"configurePreset": "x86_64_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64 Release",
|
||||||
|
"configurePreset": "x86_64_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Debug",
|
||||||
|
"configurePreset": "am571x_idk_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Release",
|
||||||
|
"configurePreset": "am571x_idk_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Debug",
|
||||||
|
"configurePreset": "BeagleBoneAI_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Release",
|
||||||
|
"configurePreset": "BeagleBoneAI_Release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -18,12 +18,12 @@ if (PNET_OPTION_SNMP)
|
|||||||
find_package(NetSNMPAgent REQUIRED)
|
find_package(NetSNMPAgent REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
target_include_directories(profinet
|
target_include_directories(${LIB_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/ports/linux
|
src/ports/linux
|
||||||
)
|
)
|
||||||
|
|
||||||
target_sources(profinet
|
target_sources(${LIB_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
src/ports/linux/pnal.c
|
src/ports/linux/pnal.c
|
||||||
src/ports/linux/pnal_eth.c
|
src/ports/linux/pnal_eth.c
|
||||||
@ -43,7 +43,7 @@ target_sources(profinet
|
|||||||
$<$<BOOL:${PNET_OPTION_SNMP}>:src/ports/linux/mib/lldpXPnoRemTable.c>
|
$<$<BOOL:${PNET_OPTION_SNMP}>:src/ports/linux/mib/lldpXPnoRemTable.c>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_options(profinet
|
target_compile_options(${LIB_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
-Wall
|
-Wall
|
||||||
-Wextra
|
-Wextra
|
||||||
@ -54,7 +54,7 @@ target_compile_options(profinet
|
|||||||
$<$<CONFIG:Coverage>:--coverage>
|
$<$<CONFIG:Coverage>:--coverage>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_libraries(profinet
|
target_link_libraries(${LIB_NAME}
|
||||||
PUBLIC
|
PUBLIC
|
||||||
$<$<BOOL:${PNET_OPTION_SNMP}>:NetSNMP::NetSNMPAgent>
|
$<$<BOOL:${PNET_OPTION_SNMP}>:NetSNMP::NetSNMPAgent>
|
||||||
$<$<BOOL:${PNET_OPTION_SNMP}>:NetSNMP::NetSNMP>
|
$<$<BOOL:${PNET_OPTION_SNMP}>:NetSNMP::NetSNMP>
|
||||||
@ -62,35 +62,35 @@ target_link_libraries(profinet
|
|||||||
$<$<CONFIG:Coverage>:--coverage>
|
$<$<CONFIG:Coverage>:--coverage>
|
||||||
)
|
)
|
||||||
|
|
||||||
target_include_directories(pn_dev
|
#target_include_directories(pn_dev
|
||||||
PRIVATE
|
# PRIVATE
|
||||||
samples/pn_dev
|
# samples/pn_dev
|
||||||
src/ports/linux
|
# src/ports/linux
|
||||||
)
|
# )
|
||||||
|
|
||||||
target_sources(pn_dev
|
#target_sources(pn_dev
|
||||||
PRIVATE
|
# PRIVATE
|
||||||
samples/pn_dev/sampleapp_common.c
|
# samples/pn_dev/sampleapp_common.c
|
||||||
samples/pn_dev/app_utils.c
|
# samples/pn_dev/app_utils.c
|
||||||
samples/pn_dev/app_log.c
|
# samples/pn_dev/app_log.c
|
||||||
samples/pn_dev/app_gsdml.c
|
# samples/pn_dev/app_gsdml.c
|
||||||
samples/pn_dev/app_data.c
|
# samples/pn_dev/app_data.c
|
||||||
src/ports/linux/sampleapp_main.c
|
# src/ports/linux/sampleapp_main.c
|
||||||
)
|
# )
|
||||||
|
|
||||||
target_compile_options(pn_dev
|
#target_compile_options(pn_dev
|
||||||
PRIVATE
|
# PRIVATE
|
||||||
-Wall
|
# -Wall
|
||||||
-Wextra
|
# -Wextra
|
||||||
-Wno-unused-parameter
|
# -Wno-unused-parameter
|
||||||
-ffunction-sections
|
# -ffunction-sections
|
||||||
-fdata-sections
|
# -fdata-sections
|
||||||
)
|
# )
|
||||||
|
|
||||||
target_link_options(pn_dev
|
#target_link_options(pn_dev
|
||||||
PRIVATE
|
# PRIVATE
|
||||||
-Wl,--gc-sections
|
# -Wl,--gc-sections
|
||||||
)
|
#)
|
||||||
|
|
||||||
install (FILES
|
install (FILES
|
||||||
src/ports/linux/pnal_config.h
|
src/ports/linux/pnal_config.h
|
||||||
@ -105,10 +105,10 @@ file(COPY
|
|||||||
${PROFINET_BINARY_DIR}/
|
${PROFINET_BINARY_DIR}/
|
||||||
)
|
)
|
||||||
|
|
||||||
if (BUILD_TESTING)
|
#if (BUILD_TESTING)
|
||||||
set(GOOGLE_TEST_INDIVIDUAL TRUE)
|
# set(GOOGLE_TEST_INDIVIDUAL TRUE)
|
||||||
target_include_directories(pf_test
|
# target_include_directories(pf_test
|
||||||
PRIVATE
|
# PRIVATE
|
||||||
src/ports/linux
|
# src/ports/linux
|
||||||
)
|
# )
|
||||||
endif()
|
#endif()
|
||||||
|
|||||||
@ -16,7 +16,7 @@
|
|||||||
# NOTE: add headers to make them show up in an IDE
|
# NOTE: add headers to make them show up in an IDE
|
||||||
# NOTE: Use full path for the <$<BOOL:${PNET_OPTION_SNMP}> expression
|
# NOTE: Use full path for the <$<BOOL:${PNET_OPTION_SNMP}> expression
|
||||||
# to work with certain cmake versions
|
# to work with certain cmake versions
|
||||||
target_sources (profinet PRIVATE
|
target_sources (${LIB_NAME} PRIVATE
|
||||||
${PROFINET_SOURCE_DIR}/include/pnet_api.h
|
${PROFINET_SOURCE_DIR}/include/pnet_api.h
|
||||||
pf_includes.h
|
pf_includes.h
|
||||||
pf_types.h
|
pf_types.h
|
||||||
|
|||||||
@ -2,7 +2,9 @@ cmake_minimum_required (VERSION 3.0)
|
|||||||
|
|
||||||
project (PN_ECHO_TEST VERSION 0.0.1)
|
project (PN_ECHO_TEST VERSION 0.0.1)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
|
set(TARGET_NAME pn_echo_test)
|
||||||
|
|
||||||
set(INC_DIRS ${INC_DIRS} ../../src/profinet)
|
set(INC_DIRS ${INC_DIRS} ../../src/profinet)
|
||||||
set(INC_DIRS ${INC_DIRS} ../../src/nlohmann_json)
|
set(INC_DIRS ${INC_DIRS} ../../src/nlohmann_json)
|
||||||
@ -19,8 +21,15 @@ set(SRC_FILES ${SRC_FILES} ./CreatePipes.cpp)
|
|||||||
set(SRC_FILES ${SRC_FILES} ../../src/file_api/file_api.cpp)
|
set(SRC_FILES ${SRC_FILES} ../../src/file_api/file_api.cpp)
|
||||||
set(SRC_FILES ${SRC_FILES} ./main.cpp)
|
set(SRC_FILES ${SRC_FILES} ./main.cpp)
|
||||||
|
|
||||||
set(Boost_USE_STATIC_LIBS ON)
|
set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../../sitara_depot)
|
||||||
set(Boost_USE_STATIC_RUNTIME ON)
|
|
||||||
|
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake)
|
||||||
|
|
||||||
|
# óáèðàåò ïðåäóïðåæäåíèÿ nlohman json î GCC7.1
|
||||||
|
add_compile_options(-Wno-psabi)
|
||||||
|
|
||||||
|
#set(Boost_USE_STATIC_LIBS ON)
|
||||||
|
#set(Boost_USE_STATIC_RUNTIME ON)
|
||||||
|
|
||||||
find_package(Boost 1.74.0)
|
find_package(Boost 1.74.0)
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
@ -32,13 +41,21 @@ endif()
|
|||||||
message("Boost dir: " ${Boost_INCLUDE_DIRS})
|
message("Boost dir: " ${Boost_INCLUDE_DIRS})
|
||||||
message("Boost libs:" ${Boost_LIBRARIES})
|
message("Boost libs:" ${Boost_LIBRARIES})
|
||||||
|
|
||||||
#Копирование тестового файла конфигурации устройства Profinet
|
add_executable(${TARGET_NAME} ./main.cpp ${SRC_FILES})
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sample_app_echo_config.json
|
|
||||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
add_executable(pn_echo_test ./main.cpp ${SRC_FILES})
|
target_include_directories(${TARGET_NAME} PRIVATE
|
||||||
|
|
||||||
target_include_directories(pn_echo_test PRIVATE
|
|
||||||
./
|
./
|
||||||
${INC_DIRS}
|
${INC_DIRS}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
target_link_libraries (${TARGET_NAME} PUBLIC ${Boost_LIBRARIES} pthread c rt)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS ${TARGET_NAME}
|
||||||
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/sample_app_echo_config.json
|
||||||
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|||||||
@ -160,7 +160,7 @@ int main(int argc, char * argv[])
|
|||||||
{
|
{
|
||||||
answer_str.clear();
|
answer_str.clear();
|
||||||
|
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(500));
|
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
|
||||||
std::string request{j_get_flags.dump()};
|
std::string request{j_get_flags.dump()};
|
||||||
///Запрос:
|
///Запрос:
|
||||||
*p_output_stream_ << request << std::endl;
|
*p_output_stream_ << request << std::endl;
|
||||||
@ -409,13 +409,22 @@ int main(int argc, char * argv[])
|
|||||||
j_set_data["submodule_id"] = submodule_id;
|
j_set_data["submodule_id"] = submodule_id;
|
||||||
|
|
||||||
auto& data = j_set_data["data"]["I808InpBits"];
|
auto& data = j_set_data["data"]["I808InpBits"];
|
||||||
|
static bool init = true;
|
||||||
for (int i = 0; i < 8; ++i)
|
if (init)
|
||||||
{
|
{
|
||||||
bits[i] = (~bits[i]) & 0x01;
|
for (int i = 0; i < 8; ++i)
|
||||||
std::string bit_name = "in_bit_" + std::to_string(i);
|
{
|
||||||
data[bit_name] = bits[i];
|
//bits[i] = (~bits[i]) & 0x01;
|
||||||
|
std::string bit_name = "in_bit_" + std::to_string(i);
|
||||||
|
data[bit_name] = value_bits[i];
|
||||||
|
}
|
||||||
|
init = false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
data["in_bit_1"] = 1;
|
||||||
|
}
|
||||||
|
|
||||||
j_set_echo_data["params"].push_back(j_set_data);
|
j_set_echo_data["params"].push_back(j_set_data);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"app_settings":
|
"app_settings":
|
||||||
{
|
{
|
||||||
"app_out_pipe_name": "/home/svad/Projects/profinet_io_dev/profinet_io_dev_inp",
|
"app_out_pipe_name": "/home/root/pnet/profinet_io_dev_inp",
|
||||||
"app_inp_pipe_name": "/home/svad/Projects/profinet_io_dev/profinet_io_dev_out"
|
"app_inp_pipe_name": "/home/root/pnet/profinet_io_dev_out"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
1
sitara_depot
Submodule
1
sitara_depot
Submodule
@ -0,0 +1 @@
|
|||||||
|
Subproject commit beec7da14ed48a18e73812e4120a52f2fc057049
|
||||||
76
src/.vscode/launch.json
vendored
Executable file
76
src/.vscode/launch.json
vendored
Executable file
@ -0,0 +1,76 @@
|
|||||||
|
{
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "pn_dev: start debug",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${workspaceFolder}/build/profinet_io_dev",
|
||||||
|
"args": [],
|
||||||
|
"stopAtEntry": true,
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
/*"cwd": "${fileDirname}",*/
|
||||||
|
"environment": [],
|
||||||
|
"externalConsole": false,
|
||||||
|
"miDebuggerPath": "/home/svad/Projects/profinet_io_dev/debug_support/gdb",
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Включить автоматическое форматирование для gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
/*{
|
||||||
|
"description": "Enable break on all exceptions",
|
||||||
|
"text": "catch throw",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},*/
|
||||||
|
{
|
||||||
|
"description": "Задать для варианта приложения дизассемблирования значение Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
/*{
|
||||||
|
"text": "set target-async on"
|
||||||
|
}*/
|
||||||
|
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
// "processId": "${command:pickProcess}",
|
||||||
|
"name": "(gdb) Remote debug",
|
||||||
|
"type": "cppdbg",
|
||||||
|
"request": "launch",
|
||||||
|
"preLaunchTask": "PreDebug",
|
||||||
|
"program": "./build/profinet_io_dev",
|
||||||
|
"additionalSOLibSearchPath": "/home/svad/armdev/beagle_board/sysroot/lib",
|
||||||
|
// "processId": "${command:pickProcess}",
|
||||||
|
"MIMode": "gdb",
|
||||||
|
"cwd": "${workspaceFolder}",
|
||||||
|
"miDebuggerPath": "/usr/bin/gdb-multiarch",
|
||||||
|
"miDebuggerServerAddress": "192.168.6.2:2345",
|
||||||
|
"miDebuggerArgs": "",
|
||||||
|
"setupCommands": [
|
||||||
|
{
|
||||||
|
"description": "Включить автоматическое форматирование для gdb",
|
||||||
|
"text": "-enable-pretty-printing",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
/*{
|
||||||
|
"description": "Enable break on all exceptions",
|
||||||
|
"text": "catch throw",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},*/
|
||||||
|
{
|
||||||
|
"description": "Задать для варианта приложения дизассемблирования значение Intel",
|
||||||
|
"text": "-gdb-set disassembly-flavor intel",
|
||||||
|
"ignoreFailures": true
|
||||||
|
},
|
||||||
|
/*{
|
||||||
|
"text": "set target-async on"
|
||||||
|
}*/
|
||||||
|
]
|
||||||
|
},
|
||||||
|
],
|
||||||
|
"version": "2.0.0"
|
||||||
|
}
|
||||||
77
src/.vscode/settings.json
vendored
Executable file
77
src/.vscode/settings.json
vendored
Executable file
@ -0,0 +1,77 @@
|
|||||||
|
{
|
||||||
|
"cmake.useCMakePresets": "always",
|
||||||
|
"files.associations": {
|
||||||
|
"string_view": "cpp",
|
||||||
|
"cctype": "cpp",
|
||||||
|
"clocale": "cpp",
|
||||||
|
"cmath": "cpp",
|
||||||
|
"cstdarg": "cpp",
|
||||||
|
"cstddef": "cpp",
|
||||||
|
"cstdio": "cpp",
|
||||||
|
"cstdlib": "cpp",
|
||||||
|
"cstring": "cpp",
|
||||||
|
"ctime": "cpp",
|
||||||
|
"cwchar": "cpp",
|
||||||
|
"cwctype": "cpp",
|
||||||
|
"any": "cpp",
|
||||||
|
"array": "cpp",
|
||||||
|
"atomic": "cpp",
|
||||||
|
"bit": "cpp",
|
||||||
|
"*.tcc": "cpp",
|
||||||
|
"bitset": "cpp",
|
||||||
|
"chrono": "cpp",
|
||||||
|
"codecvt": "cpp",
|
||||||
|
"compare": "cpp",
|
||||||
|
"complex": "cpp",
|
||||||
|
"concepts": "cpp",
|
||||||
|
"condition_variable": "cpp",
|
||||||
|
"cstdint": "cpp",
|
||||||
|
"deque": "cpp",
|
||||||
|
"forward_list": "cpp",
|
||||||
|
"list": "cpp",
|
||||||
|
"map": "cpp",
|
||||||
|
"set": "cpp",
|
||||||
|
"unordered_map": "cpp",
|
||||||
|
"vector": "cpp",
|
||||||
|
"exception": "cpp",
|
||||||
|
"algorithm": "cpp",
|
||||||
|
"functional": "cpp",
|
||||||
|
"iterator": "cpp",
|
||||||
|
"memory": "cpp",
|
||||||
|
"memory_resource": "cpp",
|
||||||
|
"numeric": "cpp",
|
||||||
|
"optional": "cpp",
|
||||||
|
"random": "cpp",
|
||||||
|
"ratio": "cpp",
|
||||||
|
"string": "cpp",
|
||||||
|
"system_error": "cpp",
|
||||||
|
"tuple": "cpp",
|
||||||
|
"type_traits": "cpp",
|
||||||
|
"utility": "cpp",
|
||||||
|
"fstream": "cpp",
|
||||||
|
"initializer_list": "cpp",
|
||||||
|
"iomanip": "cpp",
|
||||||
|
"iosfwd": "cpp",
|
||||||
|
"iostream": "cpp",
|
||||||
|
"istream": "cpp",
|
||||||
|
"limits": "cpp",
|
||||||
|
"mutex": "cpp",
|
||||||
|
"new": "cpp",
|
||||||
|
"numbers": "cpp",
|
||||||
|
"ostream": "cpp",
|
||||||
|
"ranges": "cpp",
|
||||||
|
"sstream": "cpp",
|
||||||
|
"stdexcept": "cpp",
|
||||||
|
"stop_token": "cpp",
|
||||||
|
"streambuf": "cpp",
|
||||||
|
"thread": "cpp",
|
||||||
|
"cinttypes": "cpp",
|
||||||
|
"typeindex": "cpp",
|
||||||
|
"typeinfo": "cpp",
|
||||||
|
"valarray": "cpp",
|
||||||
|
"variant": "cpp",
|
||||||
|
"semaphore": "cpp",
|
||||||
|
"filesystem": "cpp",
|
||||||
|
"shared_mutex": "cpp"
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -1,8 +1,22 @@
|
|||||||
cmake_minimum_required (VERSION 3.0)
|
cmake_minimum_required (VERSION 3.0)
|
||||||
|
|
||||||
project (PN_DEV_TEST VERSION 0.0.1)
|
project (PROFINET_IO_DEV VERSION 0.0.1)
|
||||||
|
|
||||||
|
message("CMakeList.txt: Starting...")
|
||||||
|
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
if ( (NOT (${BOARD} STREQUAL "am5718-idk")) AND (NOT (${BOARD} STREQUAL "BeagleBoneAI")))
|
||||||
|
message(FATAL_ERROR "BOARD ${BOARD} unsupported!\n"
|
||||||
|
"BOARD can take the following values:\n"
|
||||||
|
" -- am5718-idk\n"
|
||||||
|
" -- BeagleBoneAI")
|
||||||
|
else()
|
||||||
|
message(STATUS "BOARD = " ${BOARD})
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
|
||||||
set(CMAKE_CXX_STANDARD 20)
|
|
||||||
set(LIBS_INSTALL_PATH ../libs)
|
set(LIBS_INSTALL_PATH ../libs)
|
||||||
set(PNET_PATH ../profinet_stack/p-net)
|
set(PNET_PATH ../profinet_stack/p-net)
|
||||||
set(TARGET_NAME profinet_io_dev)
|
set(TARGET_NAME profinet_io_dev)
|
||||||
@ -19,21 +33,16 @@ include (./user_data/user_data.cmake)
|
|||||||
|
|
||||||
set(SRC_FILES ${SRC_FILES} ./app.cpp)
|
set(SRC_FILES ${SRC_FILES} ./app.cpp)
|
||||||
|
|
||||||
# Копирование заглушки скрипта установки параметров сети.
|
set(SITARA_DEPOT ${CMAKE_SOURCE_DIR}/../sitara_depot)
|
||||||
# Если не копировать, то в недрах pnet после fork вызовется exit и
|
|
||||||
# вызовутся деструкторы объектов, что может привести к непредвиденным последствиям.
|
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/set_network_parameters
|
|
||||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
#Копирование файла конфигурации
|
if(DEFINED BOARD)
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/program_configure.json
|
include(${SITARA_DEPOT}/compile/sitara_compile_flags.cmake)
|
||||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
endif()
|
||||||
|
|
||||||
#Копирование тестового файла конфигурации устройства Profinet
|
# óáèðàåò ïðåäóïðåæäåíèÿ nlohman json î GCC7.1
|
||||||
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/profinet_device_configure.json
|
add_compile_options(-Wno-psabi)
|
||||||
DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
|
|
||||||
|
|
||||||
#Если не собирается с ошибкой линкера undefined reference pthread, то добавить флаг линкера:
|
#Åñëè íå ñîáèðàåòñÿ ñ îøèáêîé ëèíêåðà undefined reference pthread, òî äîáàâèòü ôëàã ëèíêåðà:
|
||||||
#add_link_options(-lrt)
|
#add_link_options(-lrt)
|
||||||
add_executable(${TARGET_NAME} ./main.cpp ${SRC_FILES})
|
add_executable(${TARGET_NAME} ./main.cpp ${SRC_FILES})
|
||||||
|
|
||||||
@ -43,12 +52,54 @@ target_include_directories(${TARGET_NAME} PRIVATE
|
|||||||
${LIBS_INSTALL_PATH}/include
|
${LIBS_INSTALL_PATH}/include
|
||||||
${LIBS_INSTALL_PATH}/include/sys
|
${LIBS_INSTALL_PATH}/include/sys
|
||||||
${LIBS_INSTALL_PATH}/include/x86_64
|
${LIBS_INSTALL_PATH}/include/x86_64
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_link_directories(${TARGET_NAME} PUBLIC ${LIBS_INSTALL_PATH}/lib/x86_64)
|
if (CMAKE_BUILD_TYPE STREQUAL Debug)
|
||||||
|
set(LIB_LIST profinetd osald ${Boost_LIBRARIES})
|
||||||
|
elseif(CMAKE_BUILD_TYPE STREQUAL Release)
|
||||||
|
set(LIB_LIST profinet osal ${Boost_LIBRARIES})
|
||||||
|
endif()
|
||||||
|
|
||||||
#Если не собирается с ошибкой линкера undefined reference pthread, то после ${Boost_LIBRARIES} добавить pthread или -lpthread:
|
# óáèðàåò ïðåäóïðåæäåíèÿ nlohman json î GCC7.1
|
||||||
|
add_compile_options(-Wno-psabi)
|
||||||
|
|
||||||
|
set(LIB_ARCH_DIR x86_64)
|
||||||
|
|
||||||
|
if(DEFINED BOARD)
|
||||||
|
set(LIB_ARCH_DIR arm_a15)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(LINK_PATH ${LIBS_INSTALL_PATH}/lib/${LIB_ARCH_DIR})
|
||||||
|
|
||||||
|
if (DEFINED BOARD)
|
||||||
|
set(LINK_PATH ${LINK_PATH}/${BOARD})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_directories(${TARGET_NAME} PUBLIC ${LINK_PATH})
|
||||||
|
|
||||||
|
#Åñëè íå ñîáèðàåòñÿ ñ îøèáêîé ëèíêåðà undefined reference pthread, òî ïîñëå ${Boost_LIBRARIES} äîáàâèòü pthread èëè -lpthread:
|
||||||
#target_link_libraries (${TARGET_NAME} PUBLIC profinet osal ${Boost_LIBRARIES} pthread)
|
#target_link_libraries (${TARGET_NAME} PUBLIC profinet osal ${Boost_LIBRARIES} pthread)
|
||||||
target_link_libraries (${TARGET_NAME} PUBLIC profinetd osald ${Boost_LIBRARIES})
|
|
||||||
|
|
||||||
|
# Äëÿ BeagleBoneAI: âåðñèÿ GCC8 íóæíî óêàçûâàòü stdc++fs(áèáëèîòåêà <filesystem>)
|
||||||
|
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 9)
|
||||||
|
set(LIB_LIST ${LIB_LIST} stdc++fs)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_link_libraries (${TARGET_NAME} PUBLIC ${LIB_LIST} pthread c rt)
|
||||||
|
|
||||||
|
install(
|
||||||
|
TARGETS ${TARGET_NAME}
|
||||||
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
|
|
||||||
|
install(FILES
|
||||||
|
# Êîïèðîâàíèå çàãëóøêè ñêðèïòà óñòàíîâêè ïàðàìåòðîâ ñåòè.
|
||||||
|
# Åñëè íå êîïèðîâàòü, òî â íåäðàõ pnet ïîñëå fork âûçîâåòñÿ exit è
|
||||||
|
# âûçîâóòñÿ äåñòðóêòîðû îáúåêòîâ, ÷òî ìîæåò ïðèâåñòè ê íåïðåäâèäåííûì ïîñëåäñòâèÿì.
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/set_network_parameters
|
||||||
|
#Êîïèðîâàíèå ôàéëà êîíôèãóðàöèè
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/program_configure.json
|
||||||
|
#Êîïèðîâàíèå òåñòîâîãî ôàéëà êîíôèãóðàöèè óñòðîéñòâà Profinet
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/profinet_device_configure.json
|
||||||
|
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin
|
||||||
|
)
|
||||||
110
src/CMakePresets.json
Normal file
110
src/CMakePresets.json
Normal file
@ -0,0 +1,110 @@
|
|||||||
|
{
|
||||||
|
"version": 3,
|
||||||
|
"configurePresets": [
|
||||||
|
{
|
||||||
|
"name": "default",
|
||||||
|
"displayName": "default",
|
||||||
|
"description": "Default build using Ninja generator",
|
||||||
|
"generator": "Ninja",
|
||||||
|
"binaryDir": "${sourceDir}/out/build/${presetName}",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_INSTALL_PREFIX": "${sourceDir}/out/install/${presetName}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "x86_64 Debug",
|
||||||
|
"description": "Degub build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_C_COMPILER": "gcc",
|
||||||
|
"CMAKE_CXX_COMPILER": "g++"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64_Release",
|
||||||
|
"inherits": "x86_64_Debug",
|
||||||
|
"displayName": "x86_64 Release",
|
||||||
|
"description": "Release build for x86_64",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "am571x-idk Debug",
|
||||||
|
"description": "Degub build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "am5718-idk"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/x86_64-arago-linux/usr/bin/arm-none-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/linux-devkit/sysroots/armv7at2hf-neon-linux-gnueabi"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x_idk_Release",
|
||||||
|
"inherits": "am571x_idk_Debug",
|
||||||
|
"displayName": "am571x-idk Release",
|
||||||
|
"description": "Release build for AM571x-IDK board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Debug",
|
||||||
|
"inherits": "default",
|
||||||
|
"displayName": "BeagleBoneAI Debug",
|
||||||
|
"description": "Degub build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Debug",
|
||||||
|
"CMAKE_TOOLCHAIN_FILE": "${workspaceFolder}/../sitara_depot/compile/toolchain.cmake",
|
||||||
|
"BOARD": "BeagleBoneAI"
|
||||||
|
},
|
||||||
|
"environment": {
|
||||||
|
"ENV_TARGET_CROSS_COMPILE_PREFIX": "/home/svad/armdev/gcc-arm-8.3-2019.03-x86_64-arm-linux-gnueabihf/bin/arm-linux-gnueabihf-",
|
||||||
|
"ENV_TARGET_SYSTOOT_PATH": "/home/svad/armdev/beagle_board/sysroot"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI_Release",
|
||||||
|
"inherits": "BeagleBoneAI_Debug",
|
||||||
|
"displayName": "BeagleBoneAI Release",
|
||||||
|
"description": "Release build for BeagleBoneAI board(arm cortex-a15)",
|
||||||
|
"cacheVariables": {
|
||||||
|
"CMAKE_BUILD_TYPE": "Release"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
],
|
||||||
|
|
||||||
|
"buildPresets": [
|
||||||
|
{
|
||||||
|
"name": "x86_64 Debug",
|
||||||
|
"configurePreset": "x86_64_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "x86_64 Release",
|
||||||
|
"configurePreset": "x86_64_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Debug",
|
||||||
|
"configurePreset": "am571x_idk_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "am571x-idk Release",
|
||||||
|
"configurePreset": "am571x_idk_Release"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Debug",
|
||||||
|
"configurePreset": "BeagleBoneAI_Debug"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "BeagleBoneAI Release",
|
||||||
|
"configurePreset": "BeagleBoneAI_Release"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -8,7 +8,7 @@ bool App::Init(std::string profinet_config_file)
|
|||||||
ProfinetPipesSettings profinet_pipe_settings;
|
ProfinetPipesSettings profinet_pipe_settings;
|
||||||
|
|
||||||
/// Читаем настройки из файла
|
/// Читаем настройки из файла
|
||||||
if (!programconf_getProfinetSettings("program_configure.json", profinet_settings, profinet_pipe_settings))
|
if (!programconf_getProfinetSettings(profinet_config_file, profinet_settings, profinet_pipe_settings))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -234,7 +234,7 @@ static bool programconf_getCyclycDataDir(json& j_cyclic_data, uint8_t& dir)
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool programconf_getCyclicDataSettings(const json& j_cyc_data, std::map<std::string, UserData>& user_data, uint16_t& cyc_data_len)
|
static bool programconf_getCyclicDataSettings(const json& j_cyc_data, std::map<std::string, UserData>& user_data, uint16_t& cyc_data_len, bool swap)
|
||||||
{
|
{
|
||||||
uint16_t data_lengh = 0;
|
uint16_t data_lengh = 0;
|
||||||
|
|
||||||
@ -256,7 +256,7 @@ static bool programconf_getCyclicDataSettings(const json& j_cyc_data, std::map<s
|
|||||||
auto name = j.at("name").get<std::string>();
|
auto name = j.at("name").get<std::string>();
|
||||||
auto Type = j.at("DataType").get<std::string>();
|
auto Type = j.at("DataType").get<std::string>();
|
||||||
|
|
||||||
user_data.emplace(std::make_pair(std::string(name), UserData{name, Type, data_lengh}));
|
user_data.emplace(std::make_pair(std::string(name), UserData{name, Type, data_lengh, swap}));
|
||||||
|
|
||||||
data_lengh+= user_data.at(name).size;
|
data_lengh+= user_data.at(name).size;
|
||||||
|
|
||||||
@ -285,7 +285,7 @@ static bool programconf_getCyclicDataSettings(const json& j_cyc_data, std::map<s
|
|||||||
static bool programconf_getParamsSettings(const json& j_sett,
|
static bool programconf_getParamsSettings(const json& j_sett,
|
||||||
ProfinetData_Submodule& submod,
|
ProfinetData_Submodule& submod,
|
||||||
ProfinetSharedData& shared_data,
|
ProfinetSharedData& shared_data,
|
||||||
std::map<std::uint32_t, UserData>& user_data)
|
std::map<std::uint32_t, UserData>& user_data, bool swap)
|
||||||
{
|
{
|
||||||
if (!j_sett.contains("parameters"))
|
if (!j_sett.contains("parameters"))
|
||||||
return false;
|
return false;
|
||||||
@ -319,7 +319,7 @@ static bool programconf_getParamsSettings(const json& j_sett,
|
|||||||
param.index = static_cast<uint32_t>(parm_sett.at("index").get<int>());
|
param.index = static_cast<uint32_t>(parm_sett.at("index").get<int>());
|
||||||
param.name = parm_sett.at("name").get<string>();
|
param.name = parm_sett.at("name").get<string>();
|
||||||
|
|
||||||
user_data.emplace(std::make_pair(param.index, UserData{param.name, data_type, 0}));
|
user_data.emplace(std::make_pair(param.index, UserData{param.name, data_type, 0, swap}));
|
||||||
|
|
||||||
param.length = static_cast<uint16_t>(user_data.at(param.index).size);
|
param.length = static_cast<uint16_t>(user_data.at(param.index).size);
|
||||||
|
|
||||||
@ -378,6 +378,14 @@ static bool programconf_getProfinetModulesSettings(json& j, ProfinetData_Map * p
|
|||||||
|
|
||||||
uint32_t module_index = 0;
|
uint32_t module_index = 0;
|
||||||
|
|
||||||
|
/// Необходимость изменять порядок байт в датаграмме(мастер - bigendian)
|
||||||
|
bool swap = true;
|
||||||
|
if (j.contains("SwapData"))
|
||||||
|
{
|
||||||
|
swap = j.at("SwapData").get<bool>();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
for (auto& mod_set : modules_sett)
|
for (auto& mod_set : modules_sett)
|
||||||
{
|
{
|
||||||
uint32_t mod_id = hexstring_to_int(mod_set["id"].get<string>());
|
uint32_t mod_id = hexstring_to_int(mod_set["id"].get<string>());
|
||||||
@ -434,7 +442,7 @@ static bool programconf_getProfinetModulesSettings(json& j, ProfinetData_Map * p
|
|||||||
if (j_cycdata_sett.contains("Inputs"))
|
if (j_cycdata_sett.contains("Inputs"))
|
||||||
{
|
{
|
||||||
/// Конструируем поля пользовательских данных в датаграмме циклических данных
|
/// Конструируем поля пользовательских данных в датаграмме циклических данных
|
||||||
if (!programconf_getCyclicDataSettings(j_cycdata_sett.at("Inputs"), submod_user_data.inp_data_map, submod.cyc_indata_len))
|
if (!programconf_getCyclicDataSettings(j_cycdata_sett.at("Inputs"), submod_user_data.inp_data_map, submod.cyc_indata_len, swap))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -447,7 +455,7 @@ static bool programconf_getProfinetModulesSettings(json& j, ProfinetData_Map * p
|
|||||||
|
|
||||||
if (j_cycdata_sett.contains("Outputs"))
|
if (j_cycdata_sett.contains("Outputs"))
|
||||||
{
|
{
|
||||||
if (!programconf_getCyclicDataSettings(j_cycdata_sett.at("Outputs"), submod_user_data.out_data_map, submod.cyc_outdata_len))
|
if (!programconf_getCyclicDataSettings(j_cycdata_sett.at("Outputs"), submod_user_data.out_data_map, submod.cyc_outdata_len, swap))
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -481,7 +489,7 @@ static bool programconf_getProfinetModulesSettings(json& j, ProfinetData_Map * p
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Читаем конфигурацию параметров
|
/// Читаем конфигурацию параметров
|
||||||
programconf_getParamsSettings(submod_sett, submod, shared_data, submod_user_data.params_map);
|
programconf_getParamsSettings(submod_sett, submod, shared_data, submod_user_data.params_map, swap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
81
src/copy_snmp.sh
Executable file
81
src/copy_snmp.sh
Executable file
@ -0,0 +1,81 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
COPY_SCRIPT=/home/svad/Projects/pipe_msgq_translator/host_scripts/copy.sh
|
||||||
|
FS_PATH=/home/svad/ti/ti-processor-sdk-linux-am57xx-evm-08_02_01_00/targetNFS
|
||||||
|
|
||||||
|
$COPY_SCRIPT "-r ${FS_PATH}/etc/snmp" /etc
|
||||||
|
$COPY_SCRIPT "-r ${FS_PATH}/usr/share/snmp" /usr/share
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmptop /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpinform /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc0.d/K60snmpd /etc/rc0.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc1.d/K60snmpd /etc/rc1.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc2.d/S90snmpd /etc/rc2.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc3.d/S90snmpd /etc/rc3.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc4.d/S90snmpd /etc/rc4.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc5.d/S90snmpd /etc/rc5.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/rc6.d/K60snmpd /etc/rc6.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmp.so.35 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmpmibs.so.35 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmpagent.so.35 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmphelpers.so.35 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/init.d/snmpd /etc/init.d
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/sbin/snmpd /usr/sbin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpdf /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpps /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpget /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpset /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpusm /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpconf /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpping /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmptest /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmptrap /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpvacm /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpwalk /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpcheck /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpdelta /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmptable /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpstatus /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpbulkget /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpgetnext /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpnetstat /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmpbulkwalk /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmptranslate /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/snmp-bridge-mib /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/bin/net-snmp-cert /usr/bin
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmp.so.35.0.0 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmpmibs.so.35.0.0 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmpagent.so.35.0.0 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/lib/libnetsnmphelpers.so.35.0.0 /usr/lib
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/usr/include/linux/snmp.h /usr/include/linux
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/lib/systemd/system/snmpd.service /lib/systemd/system
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/lib/systemd/system-preset/98-net-snmp-server-snmpd.preset /lib/systemd/system-preset
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/etc/systemd/system/multi-user.target.wants/snmpd.service /etc/systemd/system/multi-user.target.wants
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-libs.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-mibs.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-client.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-libs.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-mibs.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-client.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.prerm /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.postrm /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.postinst /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/net-snmp-server-snmpd.conffiles /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmp35.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmp35.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmp35.postinst /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpmibs35.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpagent35.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmphelpers35.list /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpmibs35.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpagent35.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmphelpers35.control /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpmibs35.postinst /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmpagent35.postinst /var/lib/opkg/info
|
||||||
|
$COPY_SCRIPT ${FS_PATH}/var/lib/opkg/info/libnetsnmphelpers35.postinst /var/lib/opkg/info
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -1,12 +1,13 @@
|
|||||||
find_package(Boost 1.74.0)
|
find_package(Boost 1.67.0)
|
||||||
|
|
||||||
if(Boost_FOUND)
|
if(Boost_FOUND)
|
||||||
set(INC_DIRS ${INC_DIRS} ${Boost_INCLUDE_DIRS})
|
set(INC_DIRS ${INC_DIRS} ${Boost_INCLUDE_DIRS})
|
||||||
else()
|
else()
|
||||||
message(BOOST NOT FOUND)
|
message(FATAL_ERROR "interprocess.cmake: BOOST not found")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("Boost dir: " ${Boost_INCLUDE_DIRS})
|
message(STATUS "Boost dir: " ${Boost_INCLUDE_DIRS})
|
||||||
message("Boost libs:" ${Boost_LIBRARIES})
|
message(STATUS "Boost libs:" ${Boost_LIBRARIES})
|
||||||
|
|
||||||
include(./interprocess/shared_memory/shared_memory.cmake)
|
include(./interprocess/shared_memory/shared_memory.cmake)
|
||||||
include(./interprocess/pipes/pipes.cmake)
|
include(./interprocess/pipes/pipes.cmake)
|
||||||
@ -48,7 +48,7 @@ void ProfinetPipes::listen_pipe(ProfinetIface * p_profinet, UserDataMap * p_User
|
|||||||
//std::cout << "Request: " << request_str << std::endl;
|
//std::cout << "Request: " << request_str << std::endl;
|
||||||
if (json_rpc_handler(request_str, answer_str, p_profinet, p_UserDataMap))
|
if (json_rpc_handler(request_str, answer_str, p_profinet, p_UserDataMap))
|
||||||
{
|
{
|
||||||
//std::cout << "Answer: " << answer_str << std::endl;
|
//std::cout << "Answer: " << answer_str << std::endl;
|
||||||
*p_output_stream_ << answer_str << std::endl;
|
*p_output_stream_ << answer_str << std::endl;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||||
message("log enable")
|
message(STATUS "profinet log enable")
|
||||||
add_definitions(-DLOG_ENABLE)
|
add_definitions(-DLOG_ENABLE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|||||||
@ -663,9 +663,12 @@ int Profinet::getOutputCyclicData(uint32_t module_id,
|
|||||||
uint32_t submodule_id,
|
uint32_t submodule_id,
|
||||||
std::vector<uint8_t>& data)
|
std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
if (!m_modules.contains(module_id))
|
if (m_modules.find(module_id) == m_modules.end())
|
||||||
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
||||||
|
|
||||||
|
/*if (!m_modules.contains(module_id))
|
||||||
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;*/
|
||||||
|
|
||||||
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
||||||
|
|
||||||
if (submodule == nullptr)
|
if (submodule == nullptr)
|
||||||
@ -680,8 +683,10 @@ int Profinet::putInputCyclicData(uint32_t module_id,
|
|||||||
uint32_t submodule_id,
|
uint32_t submodule_id,
|
||||||
std::vector<uint8_t>& data)
|
std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
if (!m_modules.contains(module_id))
|
if (m_modules.find(module_id) == m_modules.end())
|
||||||
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
||||||
|
/*if (!m_modules.contains(module_id))
|
||||||
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;*/
|
||||||
|
|
||||||
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
||||||
|
|
||||||
@ -703,8 +708,11 @@ int Profinet::getSubmoduleParam(uint32_t module_id,
|
|||||||
uint32_t param_id,
|
uint32_t param_id,
|
||||||
std::vector<uint8_t>& data)
|
std::vector<uint8_t>& data)
|
||||||
{
|
{
|
||||||
if (!m_modules.contains(module_id))
|
if (m_modules.find(module_id) == m_modules.end())
|
||||||
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
||||||
|
|
||||||
|
/*if (!m_modules.contains(module_id))
|
||||||
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;*/
|
||||||
|
|
||||||
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
auto submodule = m_modules[module_id]->getSubmodulePtr(submodule_id);
|
||||||
|
|
||||||
@ -738,8 +746,10 @@ Profinet::~Profinet()
|
|||||||
|
|
||||||
int Profinet::getSubmoduleCyclicInpDataLen(uint32_t module_id, uint32_t submodule_id) const
|
int Profinet::getSubmoduleCyclicInpDataLen(uint32_t module_id, uint32_t submodule_id) const
|
||||||
{
|
{
|
||||||
if (!m_modules.contains(module_id))
|
if (m_modules.find(module_id) == m_modules.end())
|
||||||
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
||||||
|
/*if (!m_modules.contains(module_id))
|
||||||
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;*/
|
||||||
|
|
||||||
auto submodule = m_modules.at(module_id)->getSubmodulePtr(submodule_id);
|
auto submodule = m_modules.at(module_id)->getSubmodulePtr(submodule_id);
|
||||||
|
|
||||||
@ -751,8 +761,10 @@ int Profinet::getSubmoduleCyclicInpDataLen(uint32_t module_id, uint32_t submodul
|
|||||||
|
|
||||||
int Profinet::getSubmoduleCyclicOutDataLen(uint32_t module_id, uint32_t submodule_id) const
|
int Profinet::getSubmoduleCyclicOutDataLen(uint32_t module_id, uint32_t submodule_id) const
|
||||||
{
|
{
|
||||||
if (!m_modules.contains(module_id))
|
if (m_modules.find(module_id) == m_modules.end())
|
||||||
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;
|
||||||
|
/*if (!m_modules.contains(module_id))
|
||||||
|
return ErrorCode::ERR_MODULE_DOES_NOT_EXIST;*/
|
||||||
|
|
||||||
auto submodule = m_modules.at(module_id)->getSubmodulePtr(submodule_id);
|
auto submodule = m_modules.at(module_id)->getSubmodulePtr(submodule_id);
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,5 @@
|
|||||||
{
|
{
|
||||||
|
"SwapData": false,
|
||||||
"ProfinetDeviceSettings":
|
"ProfinetDeviceSettings":
|
||||||
{
|
{
|
||||||
"product_name": "P-Net Sample Application",
|
"product_name": "P-Net Sample Application",
|
||||||
|
|||||||
@ -3,10 +3,10 @@
|
|||||||
{
|
{
|
||||||
"ticks_us": 1000,
|
"ticks_us": 1000,
|
||||||
"cyclic_ms": 100,
|
"cyclic_ms": 100,
|
||||||
"eth_dev_name": "enp6s1",
|
"eth_dev_name": "eth0",
|
||||||
"profinet_device_config": "profinet_device_configure.json",
|
"profinet_device_config": "profinet_device_configure.json",
|
||||||
"enable_pipes": true,
|
"enable_pipes": true,
|
||||||
"out_pipe_name": "/home/svad/Projects/profinet_io_dev/profinet_io_dev_out",
|
"out_pipe_name": "/home/root/pnet/profinet_io_dev_out",
|
||||||
"inp_pipe_name": "/home/svad/Projects/profinet_io_dev/profinet_io_dev_inp"
|
"inp_pipe_name": "/home/root/pnet/profinet_io_dev_inp"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,5 +1,4 @@
|
|||||||
#include "user_data.hpp"
|
#include "user_data.hpp"
|
||||||
#include <bit>
|
|
||||||
#include "../endian/endian.hpp"
|
#include "../endian/endian.hpp"
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@ -255,7 +254,10 @@ void UserData::extractData(std::vector<uint8_t>& vect)
|
|||||||
std::copy(&data_.uint8[0], &data_.uint8[size], buf);
|
std::copy(&data_.uint8[0], &data_.uint8[size], buf);
|
||||||
/// Данные в профинет передаются в формате BigEndian
|
/// Данные в профинет передаются в формате BigEndian
|
||||||
/// преобразуем из Little в Big
|
/// преобразуем из Little в Big
|
||||||
endian_swapbytes(&buf[0], size);
|
if (swap_)
|
||||||
|
{
|
||||||
|
endian_swapbytes(&buf[0], size);
|
||||||
|
}
|
||||||
/// Вставляем данные в вектор по офсету
|
/// Вставляем данные в вектор по офсету
|
||||||
std::copy(buf, &buf[size], vect.begin() + data_offset_);
|
std::copy(buf, &buf[size], vect.begin() + data_offset_);
|
||||||
}
|
}
|
||||||
@ -266,7 +268,7 @@ void UserData::insertData(const std::vector<uint8_t>& vect)
|
|||||||
std::copy(&vect[data_offset_], &vect[data_offset_ + size], data_.uint8);
|
std::copy(&vect[data_offset_], &vect[data_offset_ + size], data_.uint8);
|
||||||
/// Конвертим
|
/// Конвертим
|
||||||
if ((type >= UserDataTypes::UINT16) &&
|
if ((type >= UserDataTypes::UINT16) &&
|
||||||
(type <= UserDataTypes::FLOAT64))
|
(type <= UserDataTypes::FLOAT64) && swap_)
|
||||||
{
|
{
|
||||||
/// Данные в профинет передаются в формате BigEndian
|
/// Данные в профинет передаются в формате BigEndian
|
||||||
/// преобразуем из Big в Little
|
/// преобразуем из Big в Little
|
||||||
@ -296,8 +298,11 @@ SubmoduleUserData& UserData_getSubmod(uint32_t mod_id, uint32_t submod_id, UserD
|
|||||||
|
|
||||||
int UserData::getDataSize(const std::string& type_name)
|
int UserData::getDataSize(const std::string& type_name)
|
||||||
{
|
{
|
||||||
if (!data_corr.contains(type_name))
|
if (data_corr.find(type_name) == data_corr.end())
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/*if (!data_corr.contains(type_name))
|
||||||
|
return 0;*/
|
||||||
|
|
||||||
return data_size.at(data_corr.at(type_name));
|
return data_size.at(data_corr.at(type_name));
|
||||||
}
|
}
|
||||||
|
|||||||
@ -36,11 +36,12 @@ public:
|
|||||||
FLOAT64,
|
FLOAT64,
|
||||||
};
|
};
|
||||||
|
|
||||||
UserData(std::string& Name, std::string& DataType, uint16_t offset) :
|
UserData(std::string& Name, std::string& DataType, uint16_t offset, bool swap) :
|
||||||
name{Name},
|
name{Name},
|
||||||
type{data_corr.at(DataType)},
|
type{data_corr.at(DataType)},
|
||||||
size{data_size.at(type)},
|
size{data_size.at(type)},
|
||||||
data_offset_{offset}
|
data_offset_{offset},
|
||||||
|
swap_{swap}
|
||||||
{
|
{
|
||||||
data_.uint64 = 0;
|
data_.uint64 = 0;
|
||||||
};
|
};
|
||||||
@ -115,6 +116,7 @@ private:
|
|||||||
AnyData data_; /// Данные
|
AnyData data_; /// Данные
|
||||||
std::vector<UserDataBit> bits_; ///
|
std::vector<UserDataBit> bits_; ///
|
||||||
const uint16_t data_offset_; /// Офсет от начала датаграммы откуда начинаются данные
|
const uint16_t data_offset_; /// Офсет от начала датаграммы откуда начинаются данные
|
||||||
|
const bool swap_; /// Перобразование порядка байт
|
||||||
};
|
};
|
||||||
|
|
||||||
struct SubmoduleUserData
|
struct SubmoduleUserData
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user