dev(none): Добавил внешние зависимости
This commit is contained in:
parent
890193582a
commit
c503b0023c
86
profinet_stack/p-net/cmake/tools/AddGoogleTest.cmake
Normal file
86
profinet_stack/p-net/cmake/tools/AddGoogleTest.cmake
Normal file
@ -0,0 +1,86 @@
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if (CMAKE_COMPILER_IS_GNUCC AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
|
||||
# gtest doesn't build on older GCC
|
||||
message(FATAL_ERROR
|
||||
"GTest needs at least GCC version 5. Set BUILD_TESTING=OFF to disable tests.")
|
||||
endif()
|
||||
|
||||
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL rt-kernel)
|
||||
set(gtest_disable_pthreads ON CACHE BOOL "" FORCE)
|
||||
list(APPEND GTEST_COMPILE_OPTIONS
|
||||
-D_POSIX_C_SOURCE=200809L
|
||||
-Wno-psabi
|
||||
)
|
||||
endif()
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL STM32Cube)
|
||||
set(gtest_disable_pthreads ON CACHE BOOL "" FORCE)
|
||||
list(APPEND GTEST_COMPILE_OPTIONS
|
||||
-D_POSIX_C_SOURCE=200809L
|
||||
-Wno-psabi
|
||||
-D_POSIX_PATH_MAX=80
|
||||
)
|
||||
endif()
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
googletest
|
||||
GIT_REPOSITORY https://github.com/rtlabs-com/googletest.git
|
||||
GIT_TAG 25808659d317cb03409e7949914b274e10e6824f
|
||||
)
|
||||
FetchContent_GetProperties(googletest)
|
||||
if(NOT googletest_POPULATED)
|
||||
FetchContent_Populate(googletest)
|
||||
set(INSTALL_GTEST OFF CACHE BOOL "")
|
||||
add_subdirectory(${googletest_SOURCE_DIR} ${googletest_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
target_compile_options(gtest PRIVATE ${GTEST_COMPILE_OPTIONS})
|
||||
endif()
|
||||
|
||||
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND}
|
||||
--force-new-ctest-process
|
||||
--output-on-failure
|
||||
--build-config "$<CONFIGURATION>")
|
||||
set_target_properties(check PROPERTIES FOLDER "Scripts")
|
||||
|
||||
if(GOOGLE_TEST_INDIVIDUAL)
|
||||
include(GoogleTest)
|
||||
endif()
|
||||
|
||||
macro(add_gtest TESTNAME)
|
||||
target_link_libraries(${TESTNAME} PUBLIC gtest)
|
||||
|
||||
if (BUILD_GMOCK)
|
||||
target_link_libraries(${TESTNAME} PUBLIC gmock)
|
||||
endif()
|
||||
|
||||
if(GOOGLE_TEST_INDIVIDUAL)
|
||||
gtest_discover_tests(${TESTNAME}
|
||||
TEST_PREFIX "${TESTNAME}."
|
||||
PROPERTIES FOLDER "Tests")
|
||||
else()
|
||||
add_test(${TESTNAME} ${TESTNAME})
|
||||
set_target_properties(${TESTNAME} PROPERTIES FOLDER "Tests")
|
||||
endif()
|
||||
|
||||
endmacro()
|
||||
|
||||
mark_as_advanced(
|
||||
gmock_build_tests
|
||||
gtest_build_samples
|
||||
gtest_build_tests
|
||||
gtest_disable_pthreads
|
||||
gtest_force_shared_crt
|
||||
gtest_hide_internal_symbols
|
||||
BUILD_GMOCK
|
||||
BUILD_GTEST
|
||||
)
|
||||
|
||||
set_target_properties(gtest gtest_main
|
||||
PROPERTIES FOLDER "Extern")
|
||||
|
||||
if(BUILD_GMOCK)
|
||||
set_target_properties(gmock gmock_main
|
||||
PROPERTIES FOLDER "Extern")
|
||||
endif()
|
||||
63
profinet_stack/p-net/cmake/tools/AddOsal.cmake
Normal file
63
profinet_stack/p-net/cmake/tools/AddOsal.cmake
Normal file
@ -0,0 +1,63 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2020 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
# Find OSAL library. This module supports three use-cases:
|
||||
#
|
||||
# 1) OSAL sibling project
|
||||
#
|
||||
# If a target named OSAL exists then this module does nothing. This
|
||||
# would be the case if OSAL is managed by a superproject.
|
||||
#
|
||||
# 2) External OSAL
|
||||
#
|
||||
# Search for and use an external OSAL. CMake will find the external
|
||||
# OSAL library if it is installed in a default location such as
|
||||
# /usr/include or /usr/local/include. You can also give a search hint
|
||||
# by setting the Osal_DIR variable. This could be the case for a
|
||||
# native build or a cross-compiled Linux system with a staging folder.
|
||||
#
|
||||
# 3) Automatic download and build of OSAL
|
||||
#
|
||||
# Finally, if OSAL is not found in the system it will be downloaded
|
||||
# and built automatically.
|
||||
|
||||
cmake_minimum_required(VERSION 3.14)
|
||||
|
||||
if (NOT TARGET osal)
|
||||
# Attempt to find externally built OSAL
|
||||
find_package(Osal QUIET)
|
||||
|
||||
if (NOT Osal_FOUND)
|
||||
# Download and build OSAL locally as a static library
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
osal
|
||||
GIT_REPOSITORY https://github.com/rtlabs-com/osal.git
|
||||
GIT_TAG e960068
|
||||
)
|
||||
FetchContent_GetProperties(osal)
|
||||
if(NOT osal_POPULATED)
|
||||
FetchContent_Populate(osal)
|
||||
set(BUILD_SHARED_LIBS_OLD ${BUILD_SHARED_LIBS})
|
||||
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "" FORCE)
|
||||
add_subdirectory(${osal_SOURCE_DIR} ${osal_BINARY_DIR} EXCLUDE_FROM_ALL)
|
||||
set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_OLD} CACHE BOOL "" FORCE)
|
||||
endif()
|
||||
|
||||
# Hide Osal_DIR to avoid confusion, as it is not used in this
|
||||
# configuration
|
||||
mark_as_advanced(Osal_DIR)
|
||||
endif()
|
||||
endif()
|
||||
16
profinet_stack/p-net/cmake/tools/FindSphinx.cmake
Normal file
16
profinet_stack/p-net/cmake/tools/FindSphinx.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
|
||||
# Look for an executable called sphinx-build
|
||||
find_program(
|
||||
SPHINX_EXECUTABLE
|
||||
NAMES sphinx-build
|
||||
DOC "Path to sphinx-build executable"
|
||||
)
|
||||
|
||||
include(FindPackageHandleStandardArgs)
|
||||
|
||||
# Handle standard arguments to find_package like REQUIRED and QUIET
|
||||
find_package_handle_standard_args(
|
||||
Sphinx
|
||||
"Failed to find sphinx-build executable"
|
||||
SPHINX_EXECUTABLE
|
||||
)
|
||||
25
profinet_stack/p-net/cmake/tools/GetGitRevision.cmake
Normal file
25
profinet_stack/p-net/cmake/tools/GetGitRevision.cmake
Normal file
@ -0,0 +1,25 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2020 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
# Get git revision if available, as projectname_GIT_REVISION
|
||||
|
||||
find_package(Git QUIET)
|
||||
execute_process(COMMAND
|
||||
"${GIT_EXECUTABLE}" describe --tags --always --dirty
|
||||
WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
OUTPUT_VARIABLE "${CMAKE_PROJECT_NAME}_GIT_REVISION"
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
29
profinet_stack/p-net/cmake/tools/LICENSE
Normal file
29
profinet_stack/p-net/cmake/tools/LICENSE
Normal file
@ -0,0 +1,29 @@
|
||||
BSD 3-Clause License
|
||||
|
||||
Copyright (c) 2020, rt-labs AB
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice, this
|
||||
list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of the copyright holder nor the names of its
|
||||
contributors may be used to endorse or promote products derived from
|
||||
this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
80
profinet_stack/p-net/cmake/tools/Platform/STM32Cube.cmake
Normal file
80
profinet_stack/p-net/cmake/tools/Platform/STM32Cube.cmake
Normal file
@ -0,0 +1,80 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2021 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
include_guard()
|
||||
cmake_minimum_required (VERSION 3.1.2)
|
||||
enable_language(ASM)
|
||||
|
||||
# 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(UNIX 1)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
# Do not build executables during configuration stage. Required
|
||||
# libraries may not be built yet.
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
# Prefer standard extensions
|
||||
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
|
||||
|
||||
# Add machine-specific flags
|
||||
add_definitions(${MACHINE})
|
||||
add_link_options(${MACHINE})
|
||||
|
||||
# Common flags
|
||||
add_definitions(
|
||||
-fdata-sections
|
||||
-ffunction-sections
|
||||
)
|
||||
|
||||
# Common includes
|
||||
list (APPEND INCLUDES
|
||||
# nothing yet
|
||||
)
|
||||
|
||||
set(CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
|
||||
# Linker flags
|
||||
add_link_options(
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
# Libraries
|
||||
list (APPEND LIBS
|
||||
-lc
|
||||
-lm
|
||||
-lnosys
|
||||
)
|
||||
list(JOIN LIBS " " LIBS) # Convert list to space separated string
|
||||
set(CMAKE_C_STANDARD_LIBRARIES ${LIBS})
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${LIBS} -lstdc++")
|
||||
|
||||
# Macro to add .bin output
|
||||
macro(generate_bin TARGET)
|
||||
add_custom_command(TARGET ${TARGET} POST_BUILD
|
||||
COMMAND ${OBJCOPY}
|
||||
ARGS -O binary ${TARGET}.elf ${TARGET}.bin
|
||||
)
|
||||
endmacro()
|
||||
111
profinet_stack/p-net/cmake/tools/Platform/rt-kernel.cmake
Normal file
111
profinet_stack/p-net/cmake/tools/Platform/rt-kernel.cmake
Normal file
@ -0,0 +1,111 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
include_guard()
|
||||
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(UNIX 1)
|
||||
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
|
||||
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
|
||||
set(CMAKE_EXECUTABLE_SUFFIX ".elf")
|
||||
|
||||
# Do not build executables during configuration stage. Required
|
||||
# libraries may not be built yet.
|
||||
set(CMAKE_TRY_COMPILE_TARGET_TYPE STATIC_LIBRARY)
|
||||
|
||||
# Prefer standard extensions
|
||||
set(CMAKE_C_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_CXX_OUTPUT_EXTENSION_REPLACE 1)
|
||||
set(CMAKE_ASM_OUTPUT_EXTENSION_REPLACE 1)
|
||||
|
||||
# Add machine-specific flags
|
||||
add_definitions(${MACHINE})
|
||||
add_link_options(${MACHINE})
|
||||
|
||||
if (NOT ${VARIANT} STREQUAL "")
|
||||
add_definitions(-D${VARIANT})
|
||||
endif()
|
||||
|
||||
# Common flags
|
||||
add_definitions(
|
||||
-ffunction-sections
|
||||
-fomit-frame-pointer
|
||||
-fno-strict-aliasing
|
||||
-fshort-wchar
|
||||
)
|
||||
|
||||
# Common includes
|
||||
list (APPEND INCLUDES
|
||||
${RTK}/bsp/${BSP}/include
|
||||
${RTK}/include
|
||||
${RTK}/include/arch/${ARCH}
|
||||
${RTK}/lwip/src/include
|
||||
)
|
||||
set(CMAKE_ASM_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
set(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES ${INCLUDES})
|
||||
|
||||
# Linker flags
|
||||
add_link_options(
|
||||
-nostartfiles
|
||||
-L${RTK}/lib/${ARCH}/${VARIANT}/${CPU}
|
||||
-T${RTK}/bsp/${BSP}/${BSP}.ld
|
||||
-Wl,--gc-sections
|
||||
)
|
||||
|
||||
# Libraries
|
||||
list (APPEND LIBS
|
||||
-l${BSP}
|
||||
-l${ARCH}
|
||||
-lkern
|
||||
-ldev
|
||||
-lsio
|
||||
-lblock
|
||||
-lfs
|
||||
-lusb
|
||||
-llwip
|
||||
-lptpd
|
||||
-leth
|
||||
-li2c
|
||||
-lrtc
|
||||
-lcan
|
||||
-lnand
|
||||
-lspi
|
||||
-lnor
|
||||
-lpwm
|
||||
-ladc
|
||||
-ldac
|
||||
-ltrace
|
||||
-lcounter
|
||||
-lshell
|
||||
-llua
|
||||
-lc
|
||||
-lm
|
||||
)
|
||||
list(JOIN LIBS " " LIBS) # Convert list to space separated string
|
||||
set(CMAKE_C_STANDARD_LIBRARIES ${LIBS})
|
||||
set(CMAKE_CXX_STANDARD_LIBRARIES "${LIBS} -lstdc++")
|
||||
|
||||
# Group libraries when linking
|
||||
|
||||
set(CMAKE_C_LINK_EXECUTABLE "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group")
|
||||
|
||||
set(CMAKE_CXX_LINK_EXECUTABLE "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--start-group <LINK_LIBRARIES> -Wl,--end-group")
|
||||
5
profinet_stack/p-net/cmake/tools/README.md
Normal file
5
profinet_stack/p-net/cmake/tools/README.md
Normal file
@ -0,0 +1,5 @@
|
||||
CMake tools and utilities
|
||||
=========================
|
||||
|
||||
This repository contains common cmake functionality for rt-labs
|
||||
open-source projects.
|
||||
17
profinet_stack/p-net/cmake/tools/toolchain/arm7tdmi.cmake
Normal file
17
profinet_stack/p-net/cmake/tools/toolchain/arm7tdmi.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mthumb-interwork
|
||||
-mlittle-endian
|
||||
-mthumb
|
||||
)
|
||||
16
profinet_stack/p-net/cmake/tools/toolchain/arm926ej-s.cmake
Normal file
16
profinet_stack/p-net/cmake/tools/toolchain/arm926ej-s.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2010 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mlittle-endian
|
||||
-mcpu=arm926ej-s
|
||||
)
|
||||
@ -0,0 +1,17 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-a8
|
||||
-mfpu=neon
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
16
profinet_stack/p-net/cmake/tools/toolchain/cortex-a8.cmake
Normal file
16
profinet_stack/p-net/cmake/tools/toolchain/cortex-a8.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=neon
|
||||
-mcpu=cortex-a8
|
||||
)
|
||||
@ -0,0 +1,17 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-a9
|
||||
-mfpu=vfpv3-d16
|
||||
-mfloat-abi=hard
|
||||
)
|
||||
16
profinet_stack/p-net/cmake/tools/toolchain/cortex-a9.cmake
Normal file
16
profinet_stack/p-net/cmake/tools/toolchain/cortex-a9.cmake
Normal file
@ -0,0 +1,16 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2014 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=neon
|
||||
-mcpu=cortex-a9
|
||||
)
|
||||
17
profinet_stack/p-net/cmake/tools/toolchain/cortex-m3.cmake
Normal file
17
profinet_stack/p-net/cmake/tools/toolchain/cortex-m3.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=vfp
|
||||
-mcpu=cortex-m3
|
||||
-mthumb
|
||||
)
|
||||
17
profinet_stack/p-net/cmake/tools/toolchain/cortex-m4.cmake
Normal file
17
profinet_stack/p-net/cmake/tools/toolchain/cortex-m4.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mfpu=vfp
|
||||
-mcpu=cortex-m4
|
||||
-mthumb
|
||||
)
|
||||
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m4f.cmake
Normal file
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m4f.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m4
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv4-sp-d16
|
||||
)
|
||||
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m7f.cmake
Normal file
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m7f.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m7
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv4-sp-d16
|
||||
)
|
||||
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m7fd.cmake
Normal file
18
profinet_stack/p-net/cmake/tools/toolchain/cortex-m7fd.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-m7
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=fpv5-d16
|
||||
)
|
||||
@ -0,0 +1,18 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2018 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=cortex-r5
|
||||
-mthumb
|
||||
-mfloat-abi=hard
|
||||
-mfpu=vfpv3-d16
|
||||
)
|
||||
18
profinet_stack/p-net/cmake/tools/toolchain/e200.cmake
Normal file
18
profinet_stack/p-net/cmake/tools/toolchain/e200.cmake
Normal file
@ -0,0 +1,18 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mcpu=8540
|
||||
-mregnames
|
||||
-mmultiple
|
||||
-mabi=spe
|
||||
)
|
||||
19
profinet_stack/p-net/cmake/tools/toolchain/ppc604.cmake
Normal file
19
profinet_stack/p-net/cmake/tools/toolchain/ppc604.cmake
Normal file
@ -0,0 +1,19 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# http://www.rt-labs.com
|
||||
# Copyright 2011 rt-labs AB, Sweden.
|
||||
# See LICENSE file in the project root for full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
list(APPEND MACHINE
|
||||
-mbig
|
||||
-mregnames
|
||||
-mcpu=powerpc
|
||||
-mcall-sysv
|
||||
-meabi
|
||||
)
|
||||
92
profinet_stack/p-net/cmake/tools/toolchain/rt-kernel.cmake
Normal file
92
profinet_stack/p-net/cmake/tools/toolchain/rt-kernel.cmake
Normal file
@ -0,0 +1,92 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2017 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
rt-kernel toolchain
|
||||
-------------------
|
||||
|
||||
The following environment variables must be set when cmake
|
||||
configuration is invoked::
|
||||
|
||||
RTK - Location of rt-kernel tree
|
||||
BSP - Name of Board Support Package
|
||||
|
||||
The following environment variables are optional::
|
||||
|
||||
COMPILERS - Compiler search path, defaults to /opt/rt-tools/compilers
|
||||
|
||||
Your CMAKE_MODULE_PATH must also be configured so that
|
||||
Platform/rt-kernel.cmake can be found.
|
||||
|
||||
Example to build for the xmc48relax board::
|
||||
|
||||
RTK=/path/to/rt-kernel BSP=xmc48relax cmake \
|
||||
-B build.xmc48relax \
|
||||
-DCMAKE_TOOLCHAIN_FILE=/path/to/rt-kernel.cmake
|
||||
#]=======================================================================]
|
||||
|
||||
include_guard()
|
||||
|
||||
# The name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME rt-kernel)
|
||||
|
||||
# Default toolchain search path
|
||||
if (NOT DEFINED ENV{COMPILERS})
|
||||
set(ENV{COMPILERS} "/opt/rt-tools/compilers")
|
||||
endif()
|
||||
|
||||
# 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")
|
||||
|
||||
# Check that bsp.mk exists
|
||||
set(BSP_MK_FILE ${RTK}/bsp/${BSP}/${BSP}.mk)
|
||||
if (NOT EXISTS ${BSP_MK_FILE})
|
||||
message(FATAL_ERROR "Failed to open ${BSP_MK_FILE}")
|
||||
endif()
|
||||
|
||||
# Slurp bsp.mk contents
|
||||
file(READ ${BSP_MK_FILE} BSP_MK)
|
||||
|
||||
# Get CPU
|
||||
string(REGEX MATCH "CPU=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(CPU ${CMAKE_MATCH_1} CACHE STRING "")
|
||||
|
||||
# Get ARCH
|
||||
string(REGEX MATCH "ARCH=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(ARCH ${CMAKE_MATCH_1} CACHE STRING "")
|
||||
|
||||
# Get VARIANT
|
||||
string(REGEX MATCH "VARIANT=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(VARIANT ${CMAKE_MATCH_1} CACHE STRING "")
|
||||
|
||||
# Get CROSS_GCC
|
||||
string(REGEX MATCH "CROSS_GCC=([A-Za-z0-9_\-]*)" _ ${BSP_MK})
|
||||
set(CROSS_GCC ${CMAKE_MATCH_1} CACHE STRING "")
|
||||
|
||||
# Set cross-compiler toolchain
|
||||
set(CMAKE_C_COMPILER ${COMPILERS}/${CROSS_GCC}/bin/${CROSS_GCC}-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
|
||||
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 cross-compiler machine-specific flags
|
||||
include(toolchain/${CPU})
|
||||
54
profinet_stack/p-net/cmake/tools/toolchain/stm32cube.cmake
Normal file
54
profinet_stack/p-net/cmake/tools/toolchain/stm32cube.cmake
Normal file
@ -0,0 +1,54 @@
|
||||
#********************************************************************
|
||||
# _ _ _
|
||||
# _ __ | |_ _ | | __ _ | |__ ___
|
||||
# | '__|| __|(_)| | / _` || '_ \ / __|
|
||||
# | | | |_ _ | || (_| || |_) |\__ \
|
||||
# |_| \__|(_)|_| \__,_||_.__/ |___/
|
||||
#
|
||||
# www.rt-labs.com
|
||||
# Copyright 2021 rt-labs AB, Sweden.
|
||||
#
|
||||
# This software is licensed under the terms of the BSD 3-clause
|
||||
# license. See the file LICENSE distributed with this software for
|
||||
# full license information.
|
||||
#*******************************************************************/
|
||||
|
||||
#[=======================================================================[.rst:
|
||||
STM32Cube toolchain
|
||||
-------------------
|
||||
|
||||
The following environment variables must be set when cmake
|
||||
configuration is invoked::
|
||||
|
||||
CPU - Name of CPU
|
||||
BOARD - Name of board
|
||||
CUBE_DIR - Path to STM32Cube firmware
|
||||
|
||||
Machine-specific flags will be loaded from toolchain/${CPU}.cmake. See
|
||||
the toolchain folder for known values.
|
||||
|
||||
Your CMAKE_MODULE_PATH must also be configured so that
|
||||
Platform/STM32Cube.cmake can be found.
|
||||
#]=======================================================================]
|
||||
|
||||
include_guard()
|
||||
|
||||
# The name of the target operating system
|
||||
set(CMAKE_SYSTEM_NAME STM32Cube)
|
||||
|
||||
set(CPU $ENV{CPU} CACHE STRING "")
|
||||
set(BOARD $ENV{BOARD} CACHE STRING "")
|
||||
set(CUBE_DIR $ENV{CUBE_DIR} CACHE STRING "")
|
||||
|
||||
# Set cross-compiler toolchain
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_C_COMPILER})
|
||||
set(OBJCOPY arm-none-eabi-objcopy)
|
||||
if(CMAKE_HOST_WIN32)
|
||||
set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER}.exe)
|
||||
set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER}.exe)
|
||||
set(OBJCOPY ${OBJCOPY}.exe)
|
||||
endif(CMAKE_HOST_WIN32)
|
||||
|
||||
# Set cross-compiler machine-specific flags
|
||||
include(toolchain/${CPU})
|
||||
Loading…
Reference in New Issue
Block a user