mirror of
https://github.com/espressif/openthread.git
synced 2026-06-05 21:14:49 +00:00
[cmake] add support for nrf528xx (#6109)
This commit is contained in:
committed by
GitHub
parent
b87abb9e3c
commit
8bbbe194f1
+5
-1
@@ -37,6 +37,7 @@ project(openthread VERSION ${OT_DEFAULT_VERSION})
|
||||
option(OT_BUILD_EXECUTABLES "Build executables" ON)
|
||||
option(OT_COVERAGE "enable coverage" OFF)
|
||||
set(OT_EXTERNAL_MBEDTLS "" CACHE STRING "Specify external mbedtls library")
|
||||
option(OT_MBEDTLS_THREADING "enable mbedtls threading" OFF)
|
||||
|
||||
add_library(ot-config INTERFACE)
|
||||
|
||||
@@ -159,7 +160,10 @@ if(OT_PLATFORM STREQUAL "posix")
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/src/posix/platform")
|
||||
elseif(OT_PLATFORM STREQUAL "external")
|
||||
# skip in this case
|
||||
elseif(OT_PLATFORM)
|
||||
elseif(OT_PLATFORM MATCHES "^nrf*")
|
||||
target_include_directories(ot-config INTERFACE ${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/${OT_PLATFORM})
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx")
|
||||
else()
|
||||
target_include_directories(ot-config INTERFACE ${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM})
|
||||
add_subdirectory("${PROJECT_SOURCE_DIR}/examples/platforms/${OT_PLATFORM}")
|
||||
endif()
|
||||
|
||||
@@ -30,14 +30,16 @@
|
||||
function(ot_get_platforms arg_platforms)
|
||||
list(APPEND result "NO" "posix" "external")
|
||||
set(platforms_dir "${PROJECT_SOURCE_DIR}/examples/platforms")
|
||||
file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*")
|
||||
file(GLOB platforms RELATIVE "${platforms_dir}" "${platforms_dir}/*"
|
||||
RELATIVE "${platforms_dir}/nrf528xx" "${platforms_dir}/nrf528xx/nrf*")
|
||||
foreach(platform IN LISTS platforms)
|
||||
if(IS_DIRECTORY "${platforms_dir}/${platform}")
|
||||
if((IS_DIRECTORY "${platforms_dir}/${platform}") OR
|
||||
(IS_DIRECTORY "${platforms_dir}/nrf528xx/${platform}"))
|
||||
list(APPEND result "${platform}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
list(REMOVE_ITEM result utils)
|
||||
list(REMOVE_ITEM result utils nrf528xx)
|
||||
list(SORT result)
|
||||
set(${arg_platforms} "${result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
if(OT_NCP_SPI)
|
||||
list(APPEND OT_PLATFORM_DEFINES "SPIS_AS_SERIAL_TRANSPORT=1")
|
||||
else()
|
||||
option(OT_USB "enable nrf USB as serial transport support")
|
||||
if(OT_USB)
|
||||
list(APPEND OT_PLATFORM_DEFINES "USB_CDC_AS_SERIAL_TRANSPORT=1")
|
||||
else()
|
||||
list(APPEND OT_PLATFORM_DEFINES "UART_AS_SERIAL_TRANSPORT=1")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set(NRF_COMM_SOURCES
|
||||
src/alarm.c
|
||||
src/diag.c
|
||||
src/entropy.c
|
||||
src/fem.c
|
||||
src/flash.c
|
||||
src/logging.c
|
||||
src/misc.c
|
||||
src/radio.c
|
||||
src/system.c
|
||||
src/temp.c
|
||||
)
|
||||
|
||||
set(NRF_TRANSPORT_SOURCES
|
||||
src/transport/spi-slave.c
|
||||
src/transport/transport.c
|
||||
src/transport/uart.c
|
||||
src/transport/usb-cdc-uart.c
|
||||
)
|
||||
|
||||
set(NRF_SINGLEPHY_SOURCES
|
||||
src/flash_nosd.c
|
||||
)
|
||||
|
||||
set(NRF_SOFTDEVICE_SOURCES
|
||||
src/flash_sd.c
|
||||
src/softdevice.c
|
||||
)
|
||||
|
||||
set(NRF_INCLUDES
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/src
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
)
|
||||
|
||||
if(OT_PLATFORM STREQUAL "nrf52811")
|
||||
set(NRF_TRANSPORT_SOURCES
|
||||
src/transport/spi-slave.c
|
||||
src/transport/transport.c
|
||||
src/transport/uart.c
|
||||
)
|
||||
set(NRF52811_3RD_LIBS
|
||||
nordicsemi-nrf52811-radio-driver
|
||||
nordicsemi-nrf52811-sdk
|
||||
jlinkrtt
|
||||
)
|
||||
include(nrf52811/nrf52811.cmake)
|
||||
elseif(OT_PLATFORM STREQUAL "nrf52833")
|
||||
set(NRF52833_3RD_LIBS
|
||||
nordicsemi-nrf52833-radio-driver
|
||||
nordicsemi-nrf52833-radio-driver-softdevice
|
||||
nordicsemi-nrf52833-sdk
|
||||
jlinkrtt
|
||||
)
|
||||
include(nrf52833/nrf52833.cmake)
|
||||
elseif(OT_PLATFORM STREQUAL "nrf52840")
|
||||
set(NRF52840_3RD_LIBS
|
||||
nordicsemi-nrf52840-radio-driver
|
||||
nordicsemi-nrf52840-radio-driver-softdevice
|
||||
nordicsemi-nrf52840-sdk
|
||||
jlinkrtt
|
||||
)
|
||||
include(nrf52840/nrf52840.cmake)
|
||||
endif()
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
|
||||
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
||||
set(CMAKE_RANLIB arm-none-eabi-ranlib)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mfloat-abi=soft -mthumb -mabi=aapcs -fdata-sections -ffunction-sections")
|
||||
|
||||
if(COMPILER_VERSION VERSION_GREATER_EQUAL 7)
|
||||
set(COMMON_C_FLAGS "${COMMON_C_FLAGS} -Wno-expansion-to-defined")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS} -x assembler-with-cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_ASM_FLAGS_DEBUG "-g")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_ASM_FLAGS_RELEASE "")
|
||||
@@ -0,0 +1,179 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(OT_PLATFORM_LIB "openthread-nrf52811" "openthread-nrf52811-transport" PARENT_SCOPE)
|
||||
|
||||
if(NOT OT_CONFIG)
|
||||
set(OT_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/nrf52811/openthread-core-nrf52811-config.h")
|
||||
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52811/nrf52811.ld")
|
||||
|
||||
set(COMM_FLAGS
|
||||
-DDISABLE_CC310=1
|
||||
-DCONFIG_GPIO_AS_PINRESET
|
||||
-DNRF52811_XXAA
|
||||
-DUSE_APP_CONFIG=1
|
||||
-Wno-unused-parameter
|
||||
-Wno-expansion-to-defined
|
||||
)
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES
|
||||
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-nrf52811-config-check.h\""
|
||||
)
|
||||
|
||||
list(APPEND OT_PUBLIC_INCLUDES
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/mdk"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/cmsis"
|
||||
)
|
||||
|
||||
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
|
||||
target_compile_definitions(ot-config INTERFACE
|
||||
"MBEDTLS_USER_CONFIG_FILE=\"nrf52811-mbedtls-config.h\""
|
||||
)
|
||||
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
|
||||
|
||||
if(OT_CFLAGS MATCHES "-pedantic-errors")
|
||||
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
|
||||
endif()
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
|
||||
|
||||
add_library(openthread-nrf52811
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52811-transport
|
||||
${NRF_TRANSPORT_SOURCES}
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52811-sdk
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
set_target_properties(openthread-nrf52811 openthread-nrf52811-transport openthread-nrf52811-sdk
|
||||
PROPERTIES
|
||||
C_STANDARD 99
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52811
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52811_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52811-transport
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
nordicsemi-nrf52811-sdk
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52811-sdk
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52811_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52811
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52811-transport
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52811-sdk
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52811
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52811-transport
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52811-sdk
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52811
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52811
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52811-transport
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52811
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52811-sdk
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52811
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
|
||||
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
||||
set(CMAKE_RANLIB arm-none-eabi-ranlib)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -fdata-sections -ffunction-sections")
|
||||
|
||||
if(COMPILER_VERSION VERSION_GREATER_EQUAL 7)
|
||||
set(COMMON_C_FLAGS "${COMMON_C_FLAGS} -Wno-expansion-to-defined")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS} -x assembler-with-cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_ASM_FLAGS_DEBUG "-g")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_ASM_FLAGS_RELEASE "")
|
||||
@@ -0,0 +1,220 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(OT_PLATFORM_LIB "openthread-nrf52833" "openthread-nrf52833-transport" PARENT_SCOPE)
|
||||
|
||||
if(NOT OT_CONFIG)
|
||||
set(OT_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/nrf52833/openthread-core-nrf52833-config.h")
|
||||
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
option(OT_BOOTLOADER "OT nrf bootloader type")
|
||||
if(OT_BOOTLOADER STREQUAL "USB")
|
||||
list(APPEND OT_PLATFORM_DEFINES "APP_USBD_NRF_DFU_TRIGGER_ENABLED=1")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52833/nrf52833_bootloader_usb.ld")
|
||||
elseif(OT_BOOTLOADER STREQUAL "UART")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52833/nrf52833_bootloader_uart.ld")
|
||||
elseif(OT_BOOTLOADER STREQUAL "BLE")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52833/nrf52833_bootloader_ble.ld")
|
||||
else()
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52833/nrf52833.ld")
|
||||
endif()
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES
|
||||
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-nrf52833-config-check.h\""
|
||||
)
|
||||
list(APPEND OT_PUBLIC_INCLUDES
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/nrfx/mdk"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/cmsis"
|
||||
)
|
||||
|
||||
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
|
||||
target_compile_definitions(ot-config INTERFACE
|
||||
"MBEDTLS_USER_CONFIG_FILE=\"nrf52833-mbedtls-config.h\""
|
||||
)
|
||||
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
|
||||
|
||||
set(COMM_FLAGS
|
||||
-DDISABLE_CC310=1
|
||||
-DCONFIG_GPIO_AS_PINRESET
|
||||
-DNRF52833_XXAA
|
||||
-DUSE_APP_CONFIG=1
|
||||
-Wno-unused-parameter
|
||||
-Wno-expansion-to-defined
|
||||
)
|
||||
if(OT_CFLAGS MATCHES "-pedantic-errors")
|
||||
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
|
||||
endif()
|
||||
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
|
||||
|
||||
add_library(openthread-nrf52833
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52833-transport
|
||||
${NRF_TRANSPORT_SOURCES}
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52833-sdk
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52833-softdevice-sdk
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SOFTDEVICE_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
set_target_properties(openthread-nrf52833 openthread-nrf52833-transport openthread-nrf52833-sdk openthread-nrf52833-softdevice-sdk
|
||||
PROPERTIES
|
||||
C_STANDARD 99
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52833
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52833_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52833-transport
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
nordicsemi-nrf52833-sdk
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52833-sdk
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52833_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52833-softdevice-sdk
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52833_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52833
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52833-transport
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52833-sdk
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52833-softdevice-sdk
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52833
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52833-transport
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52833-sdk
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52833-softdevice-sdk
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DSOFTDEVICE_PRESENT
|
||||
-DS140
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52833
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52833
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52833-transport
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52833
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52833-sdk
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52833
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52833-softdevice-sdk
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52833
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
@@ -0,0 +1,56 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(CMAKE_SYSTEM_NAME Generic)
|
||||
set(CMAKE_SYSTEM_PROCESSOR ARM)
|
||||
|
||||
set(CMAKE_C_COMPILER arm-none-eabi-gcc)
|
||||
set(CMAKE_CXX_COMPILER arm-none-eabi-g++)
|
||||
set(CMAKE_ASM_COMPILER arm-none-eabi-as)
|
||||
set(CMAKE_RANLIB arm-none-eabi-ranlib)
|
||||
|
||||
execute_process(COMMAND ${CMAKE_CXX_COMPILER} -dumpversion OUTPUT_VARIABLE COMPILER_VERSION OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
set(COMMON_C_FLAGS "-mcpu=cortex-m4 -mfloat-abi=hard -mfpu=fpv4-sp-d16 -mthumb -mabi=aapcs -fdata-sections -ffunction-sections")
|
||||
|
||||
if(COMPILER_VERSION VERSION_GREATER_EQUAL 7)
|
||||
set(COMMON_C_FLAGS "${COMMON_C_FLAGS} -Wno-expansion-to-defined")
|
||||
endif()
|
||||
|
||||
set(CMAKE_C_FLAGS_INIT "${COMMON_C_FLAGS} -std=gnu99")
|
||||
set(CMAKE_CXX_FLAGS_INIT "${COMMON_C_FLAGS} -fno-exceptions -fno-rtti")
|
||||
set(CMAKE_ASM_FLAGS_INIT "${COMMON_C_FLAGS} -x assembler-with-cpp")
|
||||
set(CMAKE_EXE_LINKER_FLAGS_INIT "${COMMON_C_FLAGS} -specs=nano.specs -specs=nosys.specs")
|
||||
|
||||
set(CMAKE_C_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_CXX_FLAGS_DEBUG "-Og -g")
|
||||
set(CMAKE_ASM_FLAGS_DEBUG "-g")
|
||||
|
||||
set(CMAKE_C_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "-Os")
|
||||
set(CMAKE_ASM_FLAGS_RELEASE "")
|
||||
@@ -0,0 +1,233 @@
|
||||
#
|
||||
# Copyright (c) 2021, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(OT_PLATFORM_LIB "openthread-nrf52840" "openthread-nrf52840-transport" PARENT_SCOPE)
|
||||
|
||||
if(NOT OT_CONFIG)
|
||||
set(OT_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}/nrf52840/openthread-core-nrf52840-config.h")
|
||||
set(OT_CONFIG ${OT_CONFIG} PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
option(OT_BOOTLOADER "OT nrf bootloader type")
|
||||
if(OT_BOOTLOADER STREQUAL "USB")
|
||||
list(APPEND OT_PLATFORM_DEFINES "APP_USBD_NRF_DFU_TRIGGER_ENABLED=1")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52840/nrf52840_bootloader_usb.ld")
|
||||
elseif(OT_BOOTLOADER STREQUAL "UART")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52840/nrf52840_bootloader_uart.ld")
|
||||
elseif(OT_BOOTLOADER STREQUAL "BLE")
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52840/nrf52840_bootloader_ble.ld")
|
||||
else()
|
||||
set(LD_FILE "${CMAKE_CURRENT_SOURCE_DIR}/nrf52840/nrf52840.ld")
|
||||
endif()
|
||||
|
||||
list(APPEND OT_PLATFORM_DEFINES
|
||||
"OPENTHREAD_CORE_CONFIG_PLATFORM_CHECK_FILE=\"openthread-core-nrf52840-config-check.h\""
|
||||
)
|
||||
if(NOT OT_EXTERNAL_MBEDTLS)
|
||||
if(OT_MBEDTLS_THREADING)
|
||||
list(APPEND OT_PLATFORM_DEFINES "MBEDTLS_THREADING_C")
|
||||
list(APPEND OT_PLATFORM_DEFINES "MBEDTLS_THREADING_ALT")
|
||||
list(APPEND OT_PUBLIC_INCLUDES
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/include/software-only-threading"
|
||||
)
|
||||
endif()
|
||||
else()
|
||||
list(APPEND OT_PLATFORM_DEFINES "MBEDTLS_CONFIG_FILE=\"nrf-config.h\"")
|
||||
list(APPEND OT_PUBLIC_INCLUDES
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/include"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/config"
|
||||
"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/nrf_cc310_plat/include"
|
||||
)
|
||||
endif()
|
||||
|
||||
set(OT_PLATFORM_DEFINES ${OT_PLATFORM_DEFINES} PARENT_SCOPE)
|
||||
target_compile_definitions(ot-config INTERFACE
|
||||
"MBEDTLS_USER_CONFIG_FILE=\"nrf52840-mbedtls-config.h\""
|
||||
)
|
||||
list(APPEND OT_PUBLIC_INCLUDES "${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/nrf_security/mbedtls_plat_config")
|
||||
set(OT_PUBLIC_INCLUDES ${OT_PUBLIC_INCLUDES} PARENT_SCOPE)
|
||||
|
||||
set(COMM_FLAGS
|
||||
-DCONFIG_GPIO_AS_PINRESET
|
||||
-DNRF52840_XXAA
|
||||
-DUSE_APP_CONFIG=1
|
||||
-Wno-unused-parameter
|
||||
-Wno-expansion-to-defined
|
||||
)
|
||||
if(OT_CFLAGS MATCHES "-pedantic-errors")
|
||||
string(REPLACE "-pedantic-errors" "" OT_CFLAGS "${OT_CFLAGS}")
|
||||
endif()
|
||||
list(APPEND OT_PLATFORM_DEFINES "OPENTHREAD_PROJECT_CORE_CONFIG_FILE=\"${OT_CONFIG}\"")
|
||||
|
||||
add_library(openthread-nrf52840
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52840-transport
|
||||
${NRF_TRANSPORT_SOURCES}
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52840-sdk
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SINGLEPHY_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
add_library(openthread-nrf52840-softdevice-sdk
|
||||
${NRF_COMM_SOURCES}
|
||||
${NRF_SOFTDEVICE_SOURCES}
|
||||
$<TARGET_OBJECTS:openthread-platform-utils>
|
||||
)
|
||||
|
||||
set_target_properties(openthread-nrf52840 openthread-nrf52840-transport openthread-nrf52840-sdk openthread-nrf52840-softdevice-sdk
|
||||
PROPERTIES
|
||||
C_STANDARD 99
|
||||
CXX_STANDARD 11
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52840
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52840_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52840-transport
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
nordicsemi-nrf52840-sdk
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52840-sdk
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52840_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_link_libraries(openthread-nrf52840-softdevice-sdk
|
||||
PUBLIC
|
||||
${OT_MBEDTLS}
|
||||
${NRF52840_3RD_LIBS}
|
||||
-T${LD_FILE}
|
||||
-Wl,--gc-sections
|
||||
-Wl,-Map=$<TARGET_PROPERTY:NAME>.map
|
||||
PRIVATE
|
||||
ot-config
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52840
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52840-transport
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52840-sdk
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_definitions(openthread-nrf52840-softdevice-sdk
|
||||
PUBLIC
|
||||
${OT_PLATFORM_DEFINES}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52840
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DPLATFORM_OPENTHREAD_VANILLA
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52840-transport
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DPLATFORM_OPENTHREAD_VANILLA
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52840-sdk
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
)
|
||||
|
||||
target_compile_options(openthread-nrf52840-softdevice-sdk
|
||||
PRIVATE
|
||||
${OT_CFLAGS}
|
||||
${COMM_FLAGS}
|
||||
-DSOFTDEVICE_PRESENT
|
||||
-DS140
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52840
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52840
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52840-transport
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52840
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52840-sdk
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52840
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
|
||||
target_include_directories(openthread-nrf52840-softdevice-sdk
|
||||
PRIVATE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/nrf52840
|
||||
${NRF_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
)
|
||||
@@ -78,6 +78,24 @@ build_kw41z()
|
||||
"$(dirname "$0")"/cmake-build kw41z "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_nrf52811()
|
||||
{
|
||||
reset_source
|
||||
"$(dirname "$0")"/cmake-build nrf52811 "$1" "${OT_COMMON_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_nrf52833()
|
||||
{
|
||||
reset_source
|
||||
"$(dirname "$0")"/cmake-build nrf52833 "$1" "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_nrf52840()
|
||||
{
|
||||
reset_source
|
||||
"$(dirname "$0")"/cmake-build nrf52840 "$1" "${OT_COMMON_OPTIONS[@]}" "${OT_BASIC_CHECK_OPTIONS[@]}"
|
||||
}
|
||||
|
||||
build_qpg6095()
|
||||
{
|
||||
reset_source
|
||||
@@ -108,6 +126,16 @@ main()
|
||||
build_kw41z
|
||||
build_qpg6095
|
||||
build_samr21
|
||||
# UART transport
|
||||
build_nrf52840 UART_trans
|
||||
# USB transport with bootloader e.g. to support PCA10059 dongle
|
||||
build_nrf52840 USB_trans_bl
|
||||
# SPI transport for NCP
|
||||
build_nrf52840 SPI_trans_NCP
|
||||
# Software cryptography
|
||||
build_nrf52840 soft_crypto
|
||||
# Software cryptography with threading support
|
||||
build_nrf52840 soft_crypto_threading
|
||||
return 0
|
||||
fi
|
||||
|
||||
|
||||
+92
-4
@@ -42,6 +42,10 @@
|
||||
#
|
||||
# script/cmake-build ${platform} -D${option}=OFF
|
||||
#
|
||||
# Need to add build type when compilling nrf528xx:
|
||||
#
|
||||
# script/cmake-build ${platform} ${nrf_build_type} -D${option}=ON -D${option}=OFF
|
||||
#
|
||||
# Compile with the specified ninja build target:
|
||||
#
|
||||
# OT_CMAKE_NINJA_TARGET="ot-cli-ftd" script/cmake-build ${platform}
|
||||
@@ -64,7 +68,8 @@ set -euxo pipefail
|
||||
OT_CMAKE_NINJA_TARGET=${OT_CMAKE_NINJA_TARGET:-}
|
||||
|
||||
readonly OT_SRCDIR="$(pwd)"
|
||||
readonly OT_PLATFORMS=(cc1352 cc2538 cc2650 cc2652 kw41z qpg6095 samr21 simulation posix)
|
||||
readonly OT_PLATFORMS=(cc1352 cc2538 cc2650 cc2652 kw41z nrf52811 nrf52833 nrf52840 qpg6095 samr21 simulation posix)
|
||||
readonly OT_NRF528XX_BUILD_TYPES=(UART_trans USB_trans_bl SPI_trans_NCP soft_crypto soft_crypto_threading)
|
||||
readonly OT_POSIX_SIM_COMMON_OPTIONS=(
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
@@ -98,6 +103,33 @@ readonly OT_POSIX_SIM_COMMON_OPTIONS=(
|
||||
"-DOT_RCP_RESTORATION_MAX_COUNT=2"
|
||||
)
|
||||
|
||||
readonly OT_nrf52811_OPTIONS=(
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_DNS_CLIENT=ON"
|
||||
"-DOT_LINK_RAW=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
)
|
||||
|
||||
readonly OT_nrf52833_OPTIONS=(
|
||||
"-DOT_BORDER_AGENT=ON"
|
||||
"-DOT_BORDER_ROUTER=ON"
|
||||
"-DOT_COAP=ON"
|
||||
"-DOT_COAPS=ON"
|
||||
"-DOT_ECDSA=ON"
|
||||
"-DOT_FULL_LOGS=ON"
|
||||
"-DOT_IP6_FRAGM=ON"
|
||||
"-DOT_LINK_RAW=ON"
|
||||
"-DOT_MAC_FILTER=ON"
|
||||
"-DOT_MTD_NETDIAG=ON"
|
||||
"-DOT_SERVICE=ON"
|
||||
"-DOT_SNTP_CLIENT=ON"
|
||||
"-DOT_UDP_FORWARD=ON"
|
||||
)
|
||||
|
||||
readonly OT_nrf52840_OPTIONS=("${OT_nrf52833_OPTIONS[@]:0}")
|
||||
|
||||
die()
|
||||
{
|
||||
echo " ** ERROR: Openthread CMake doesn't support platform \"$1\""
|
||||
@@ -132,6 +164,16 @@ main()
|
||||
fi
|
||||
|
||||
local platform="$1"
|
||||
# Check if the platform supports cmake.
|
||||
echo "${OT_PLATFORMS[@]}" | grep -wq "${platform}" || die "${platform}"
|
||||
|
||||
local nrf_build_type=""
|
||||
if [[ ${platform} == nrf528* ]]; then
|
||||
nrf_build_type="$2"
|
||||
echo "${OT_NRF528XX_BUILD_TYPES[@]}" | grep -wq "${nrf_build_type}" || die "${nrf_build_type}"
|
||||
shift
|
||||
fi
|
||||
|
||||
shift
|
||||
local local_options=()
|
||||
local options=(
|
||||
@@ -139,9 +181,6 @@ main()
|
||||
"-DOT_SLAAC=ON"
|
||||
)
|
||||
|
||||
# Check if the platform supports cmake.
|
||||
echo "${OT_PLATFORMS[@]}" | grep -wq "${platform}" || die "${platform}"
|
||||
|
||||
case "${platform}" in
|
||||
posix)
|
||||
local_options+=(
|
||||
@@ -161,6 +200,55 @@ main()
|
||||
cc1352 | cc2538 | cc2652 | kw41z | qpg6095 | samr21)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=MinSizeRel")
|
||||
;;
|
||||
nrf52811)
|
||||
local_options+=("${OT_nrf52811_OPTIONS[@]}" "-DCMAKE_TOOLCHAIN_FILE=examples/platforms/nrf528xx/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=Release")
|
||||
case "${nrf_build_type}" in
|
||||
UART_trans)
|
||||
OT_CMAKE_NINJA_TARGET=("ot-cli-mtd" "ot-ncp-mtd" "ot-rcp")
|
||||
options+=("${local_options[@]}")
|
||||
;;
|
||||
SPI_trans_NCP)
|
||||
OT_CMAKE_NINJA_TARGET=("ot-ncp-mtd" "ot-rcp")
|
||||
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nrf52833)
|
||||
local_options+=("${OT_nrf52833_OPTIONS[@]}" "-DCMAKE_TOOLCHAIN_FILE=examples/platforms/nrf528xx/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=Release")
|
||||
case "${nrf_build_type}" in
|
||||
UART_trans)
|
||||
options+=("${local_options[@]}")
|
||||
;;
|
||||
USB_trans_bl)
|
||||
options+=("${local_options[@]}" "-DOT_USB=ON" "-DOT_BOOTLOADER=USB")
|
||||
;;
|
||||
SPI_trans_NCP)
|
||||
OT_CMAKE_NINJA_TARGET=("ot-ncp-ftd" "ot-ncp-mtd" "ot-rcp")
|
||||
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
nrf52840)
|
||||
local_options+=("${OT_nrf52840_OPTIONS[@]}" "-DCMAKE_TOOLCHAIN_FILE=examples/platforms/nrf528xx/${platform}/arm-none-eabi.cmake" "-DCMAKE_BUILD_TYPE=Release")
|
||||
case "${nrf_build_type}" in
|
||||
UART_trans)
|
||||
options+=("${local_options[@]}" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
|
||||
;;
|
||||
USB_trans_bl)
|
||||
options+=("${local_options[@]}" "-DOT_USB=ON" "-DOT_BOOTLOADER=USB" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
|
||||
;;
|
||||
SPI_trans_NCP)
|
||||
OT_CMAKE_NINJA_TARGET=("ot-ncp-ftd" "ot-ncp-mtd" "ot-rcp")
|
||||
options+=("${local_options[@]}" "-DOT_NCP_SPI=ON" "-DOT_EXTERNAL_MBEDTLS=nordicsemi-mbedtls")
|
||||
;;
|
||||
soft_crypto)
|
||||
options+=("${local_options[@]}")
|
||||
;;
|
||||
soft_crypto_threading)
|
||||
options+=("${local_options[@]}" "-DOT_MBEDTLS_THREADING=ON")
|
||||
;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
options+=("-DCMAKE_TOOLCHAIN_FILE=examples/platforms/${platform}/arm-none-eabi.cmake")
|
||||
;;
|
||||
|
||||
@@ -51,6 +51,12 @@ set(COMMON_NCP_SOURCES
|
||||
ncp_base_ftd.cpp
|
||||
ncp_base_mtd.cpp
|
||||
)
|
||||
option(OT_NCP_SPI "enable NCP SPI support")
|
||||
if(OT_NCP_SPI)
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_SPI_ENABLE=1")
|
||||
else()
|
||||
target_compile_definitions(ot-config INTERFACE "OPENTHREAD_CONFIG_NCP_UART_ENABLE=1")
|
||||
endif()
|
||||
|
||||
if(OT_FTD)
|
||||
include(ftd.cmake)
|
||||
|
||||
Vendored
+3
@@ -38,4 +38,7 @@ elseif(OT_PLATFORM STREQUAL "qpg6095")
|
||||
add_subdirectory(Qorvo)
|
||||
elseif(OT_PLATFORM STREQUAL "samr21")
|
||||
add_subdirectory(microchip)
|
||||
elseif(OT_PLATFORM MATCHES "^nrf*")
|
||||
add_subdirectory(jlink)
|
||||
add_subdirectory(NordicSemiconductor)
|
||||
endif()
|
||||
|
||||
+375
@@ -0,0 +1,375 @@
|
||||
#
|
||||
# Copyright (c) 2020, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
set(COMMON_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/src
|
||||
${PROJECT_SOURCE_DIR}/src/core
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/fem
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/fem/three_pin_gpio
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/mac_features
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/mac_features/ack_generator
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/platform/temperature
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/platform/lp_timer
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/rsch
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/rsch/raal
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/drivers/radio/rsch/raal/softdevice
|
||||
)
|
||||
|
||||
set(EXAMPLE_INCLUDES
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/cmsis
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/dependencies
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/drivers/clock
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/drivers/common
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/drivers/power
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/drivers/systick
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/drivers/usbd
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/app_error
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/atfifo
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/atomic
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/block_dev
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/delay
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/usb
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/usb/config
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/usb/class/cdc
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/usb/class/cdc/acm
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/utf_converter
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/hal
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/drivers
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/drivers/include
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/mdk
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/soc
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/softdevice/s140/headers
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/softdevice/s140/headers/nrf52
|
||||
)
|
||||
|
||||
set(COMMON_FLAG
|
||||
-DSPIS_ENABLED=1
|
||||
-DSPIS0_ENABLED=1
|
||||
-DNRFX_SPIS_ENABLED=1
|
||||
-DNRFX_SPIS0_ENABLED=1
|
||||
-DCONFIG_GPIO_AS_PINRESET
|
||||
-DENABLE_FEM=1
|
||||
-DUSE_APP_CONFIG=1
|
||||
)
|
||||
|
||||
set(COMMON_SOURCES
|
||||
dependencies/app_util_platform.c
|
||||
drivers/clock/nrf_drv_clock.c
|
||||
drivers/power/nrf_drv_power.c
|
||||
libraries/app_error/app_error.c
|
||||
libraries/app_error/app_error_weak.c
|
||||
libraries/utf_converter/utf.c
|
||||
nrfx/drivers/src/nrfx_clock.c
|
||||
nrfx/drivers/src/nrfx_nvmc.c
|
||||
nrfx/drivers/src/nrfx_power.c
|
||||
nrfx/drivers/src/nrfx_spis.c
|
||||
nrfx/drivers/src/nrfx_systick.c
|
||||
nrfx/hal/nrf_nvmc.c
|
||||
nrfx/soc/nrfx_atomic.c
|
||||
)
|
||||
|
||||
set(USB_SOURCES
|
||||
nrfx/drivers/src/nrfx_usbd.c
|
||||
libraries/atfifo/nrf_atfifo.c
|
||||
libraries/atomic/nrf_atomic.c
|
||||
libraries/usb/app_usbd.c
|
||||
libraries/usb/app_usbd_core.c
|
||||
libraries/usb/app_usbd_string_desc.c
|
||||
libraries/usb/app_usbd_serial_num.c
|
||||
libraries/usb/app_usbd_nrf_dfu_trigger.c
|
||||
libraries/usb/nrf_dfu_trigger_usb.c
|
||||
libraries/usb/class/cdc/acm/app_usbd_cdc_acm.c
|
||||
)
|
||||
|
||||
set(RADIO_DRIVER_SOURCES
|
||||
drivers/radio/fal/nrf_802154_fal.c
|
||||
drivers/radio/mac_features/ack_generator/nrf_802154_ack_data.c
|
||||
drivers/radio/mac_features/ack_generator/nrf_802154_ack_generator.c
|
||||
drivers/radio/mac_features/ack_generator/nrf_802154_enh_ack_generator.c
|
||||
drivers/radio/mac_features/ack_generator/nrf_802154_imm_ack_generator.c
|
||||
drivers/radio/mac_features/nrf_802154_csma_ca.c
|
||||
drivers/radio/mac_features/nrf_802154_delayed_trx.c
|
||||
drivers/radio/mac_features/nrf_802154_filter.c
|
||||
drivers/radio/mac_features/nrf_802154_frame_parser.c
|
||||
drivers/radio/mac_features/nrf_802154_precise_ack_timeout.c
|
||||
drivers/radio/fem/three_pin_gpio/nrf_fem_three_pin_gpio.c
|
||||
drivers/radio/nrf_802154_core_hooks.c
|
||||
drivers/radio/nrf_802154_core.c
|
||||
drivers/radio/nrf_802154_critical_section.c
|
||||
drivers/radio/nrf_802154_debug.c
|
||||
drivers/radio/nrf_802154_pib.c
|
||||
drivers/radio/nrf_802154_rssi.c
|
||||
drivers/radio/nrf_802154_rx_buffer.c
|
||||
drivers/radio/nrf_802154_timer_coord.c
|
||||
drivers/radio/nrf_802154.c
|
||||
drivers/radio/platform/coex/nrf_802154_wifi_coex_none.c
|
||||
drivers/radio/platform/clock/nrf_802154_clock_ot.c
|
||||
drivers/radio/platform/hp_timer/nrf_802154_hp_timer.c
|
||||
drivers/radio/rsch/nrf_802154_rsch_crit_sect.c
|
||||
drivers/radio/rsch/nrf_802154_rsch.c
|
||||
drivers/radio/timer_scheduler/nrf_802154_timer_sched.c
|
||||
)
|
||||
|
||||
set(SINGLE_PHY_SOURCES
|
||||
drivers/radio/nrf_802154_notification_direct.c
|
||||
drivers/radio/nrf_802154_priority_drop_direct.c
|
||||
drivers/radio/nrf_802154_request_direct.c
|
||||
drivers/radio/rsch/raal/single_phy/single_phy.c
|
||||
)
|
||||
|
||||
set(RADIO_DRIVER_SOFTDEVICE_SOURCES
|
||||
drivers/radio/nrf_802154_notification_swi.c
|
||||
drivers/radio/nrf_802154_priority_drop_swi.c
|
||||
drivers/radio/nrf_802154_request_swi.c
|
||||
drivers/radio/nrf_802154_swi.c
|
||||
drivers/radio/rsch/raal/softdevice/nrf_raal_softdevice.c
|
||||
)
|
||||
|
||||
set(RADIO_DRIVER_SINGLE_PHY_SOURCES
|
||||
drivers/radio/nrf_802154_notification_direct.c
|
||||
drivers/radio/nrf_802154_priority_drop_direct.c
|
||||
drivers/radio/nrf_802154_request_direct.c
|
||||
drivers/radio/rsch/raal/single_phy/single_phy.c
|
||||
)
|
||||
|
||||
if(OT_PLATFORM STREQUAL "nrf52811")
|
||||
add_library(nordicsemi-nrf52811-sdk)
|
||||
target_compile_definitions(nordicsemi-nrf52811-sdk
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52811_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-D__HEAP_SIZE=0
|
||||
-D__STACK_SIZE=2048
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52811-sdk
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52811
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52811/config
|
||||
)
|
||||
set_property(SOURCE nrfx/mdk/gcc_startup_nrf52811.S PROPERTY LANGUAGE C)
|
||||
target_sources(nordicsemi-nrf52811-sdk
|
||||
PRIVATE
|
||||
${COMMON_SOURCES}
|
||||
nrfx/mdk/gcc_startup_nrf52811.S
|
||||
nrfx/mdk/system_nrf52811.c
|
||||
)
|
||||
target_link_libraries(nordicsemi-nrf52811-sdk PRIVATE ot-config)
|
||||
|
||||
add_library(nordicsemi-nrf52811-radio-driver)
|
||||
target_compile_definitions(nordicsemi-nrf52811-radio-driver
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52811_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-D__HEAP_SIZE=0
|
||||
-D__STACK_SIZE=2048
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52811-radio-driver
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52811
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52811/config
|
||||
)
|
||||
target_sources(nordicsemi-nrf52811-radio-driver
|
||||
PRIVATE
|
||||
${RADIO_DRIVER_SOURCES}
|
||||
${RADIO_DRIVER_SINGLE_PHY_SOURCES}
|
||||
)
|
||||
elseif(OT_PLATFORM STREQUAL "nrf52833")
|
||||
add_library(nordicsemi-nrf52833-sdk)
|
||||
target_compile_definitions(nordicsemi-nrf52833-sdk
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52833_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52833-sdk
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52833
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52833/config
|
||||
)
|
||||
set_property(SOURCE nrfx/mdk/gcc_startup_nrf52833.S PROPERTY LANGUAGE C)
|
||||
target_sources(nordicsemi-nrf52833-sdk
|
||||
PRIVATE
|
||||
${COMMON_SOURCES}
|
||||
${USB_SOURCES}
|
||||
nrfx/mdk/gcc_startup_nrf52833.S
|
||||
nrfx/mdk/system_nrf52833.c
|
||||
)
|
||||
target_link_libraries(nordicsemi-nrf52833-sdk PRIVATE ot-config)
|
||||
|
||||
add_library(nordicsemi-nrf52833-radio-driver)
|
||||
target_compile_definitions(nordicsemi-nrf52833-radio-driver
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52833_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52833-radio-driver
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52833
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52833/config
|
||||
)
|
||||
target_sources(nordicsemi-nrf52833-radio-driver
|
||||
PRIVATE
|
||||
${RADIO_DRIVER_SOURCES}
|
||||
${RADIO_DRIVER_SINGLE_PHY_SOURCES}
|
||||
)
|
||||
add_library(nordicsemi-nrf52833-radio-driver-softdevice)
|
||||
target_compile_definitions(nordicsemi-nrf52833-radio-driver-softdevice
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52833_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
-DSOFTDEVICE_PRESENT
|
||||
-DS140
|
||||
-DRAAL_SOFTDEVICE=1
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52833-radio-driver-softdevice
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52833
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52833/config
|
||||
)
|
||||
target_sources(nordicsemi-nrf52833-radio-driver-softdevice
|
||||
PRIVATE
|
||||
${RADIO_DRIVER_SOURCES}
|
||||
${RADIO_DRIVER_SINGLE_PHY_SOURCES}
|
||||
)
|
||||
elseif(OT_PLATFORM STREQUAL "nrf52840")
|
||||
add_library(nordicsemi-nrf52840-sdk)
|
||||
target_compile_definitions(nordicsemi-nrf52840-sdk
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52840_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52840-sdk
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52840/
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52840/config
|
||||
)
|
||||
set_property(SOURCE nrfx/mdk/gcc_startup_nrf52840.S PROPERTY LANGUAGE C)
|
||||
target_sources(nordicsemi-nrf52840-sdk
|
||||
PRIVATE
|
||||
${COMMON_SOURCES}
|
||||
${USB_SOURCES}
|
||||
nrfx/mdk/gcc_startup_nrf52840.S
|
||||
nrfx/mdk/system_nrf52840.c
|
||||
)
|
||||
target_link_libraries(nordicsemi-nrf52840-sdk PRIVATE ot-config)
|
||||
|
||||
add_library(nordicsemi-nrf52840-radio-driver)
|
||||
target_compile_definitions(nordicsemi-nrf52840-radio-driver
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52840_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52840-radio-driver
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52840/
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52840/config
|
||||
)
|
||||
target_sources(nordicsemi-nrf52840-radio-driver
|
||||
PRIVATE
|
||||
${RADIO_DRIVER_SOURCES}
|
||||
${RADIO_DRIVER_SINGLE_PHY_SOURCES}
|
||||
)
|
||||
|
||||
add_library(nordicsemi-nrf52840-radio-driver-softdevice)
|
||||
target_compile_definitions(nordicsemi-nrf52840-radio-driver-softdevice
|
||||
PRIVATE
|
||||
${COMMON_FLAG}
|
||||
-DNRF52840_XXAA
|
||||
-DNRF_802154_PROJECT_CONFIG=\"platform-config.h\"
|
||||
-DRAAL_SINGLE_PHY=1
|
||||
-DSOFTDEVICE_PRESENT
|
||||
-DS140
|
||||
-DRAAL_SOFTDEVICE=1
|
||||
)
|
||||
target_include_directories(nordicsemi-nrf52840-radio-driver-softdevice
|
||||
PUBLIC
|
||||
${COMMON_INCLUDES}
|
||||
${EXAMPLE_INCLUDES}
|
||||
${OT_PUBLIC_INCLUDES}
|
||||
${PROJECT_SOURCE_DIR}/examples/platforms/nrf528xx/nrf52840/
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/nrf52840/config
|
||||
)
|
||||
target_sources(nordicsemi-nrf52840-radio-driver-softdevice
|
||||
PRIVATE
|
||||
${RADIO_DRIVER_SOURCES}
|
||||
${RADIO_DRIVER_SINGLE_PHY_SOURCES}
|
||||
)
|
||||
else()
|
||||
message(FATAL_ERROR "Platform unknown: ${OT_PLATFORM}")
|
||||
endif()
|
||||
|
||||
add_library(nordicsemi-mbedtls INTERFACE)
|
||||
|
||||
target_link_libraries(nordicsemi-mbedtls
|
||||
INTERFACE
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedcrypto_shared.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedtls_tls_vanilla.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedtls_x509_vanilla.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedcrypto_cc3xx.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libnrf_cc310_platform_0.9.4.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedcrypto_oberon.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedtls_base_vanilla.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedcrypto_cc3xx.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedtls_base_vanilla.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libmbedcrypto_shared.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/libraries/nrf_security/lib/libnrf_cc310_platform_0.9.4.a
|
||||
)
|
||||
|
||||
Vendored
+61
@@ -0,0 +1,61 @@
|
||||
#
|
||||
# Copyright (c) 2020, The OpenThread Authors.
|
||||
# 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.
|
||||
#
|
||||
|
||||
string(REPLACE "-Wundef" "" OT_CFLAGS "${OT_CFLAGS}")
|
||||
add_library(jlinkrtt
|
||||
SEGGER_RTT_V640/RTT/SEGGER_RTT.c
|
||||
)
|
||||
|
||||
if(OT_PLATFORM STREQUAL "nrf52811")
|
||||
target_compile_options(jlinkrtt PRIVATE
|
||||
-DNRF52811_XXAA
|
||||
)
|
||||
elseif(OT_PLATFORM STREQUAL "nrf52833")
|
||||
target_compile_options(jlinkrtt PRIVATE
|
||||
-DNRF52833_XXAA
|
||||
)
|
||||
else()
|
||||
target_compile_options(jlinkrtt PRIVATE
|
||||
-DNRF52840_XXAA
|
||||
)
|
||||
endif()
|
||||
|
||||
target_compile_options(jlinkrtt PRIVATE
|
||||
-DSEGGER_RTT_CONFIG_H=\"${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/segger_rtt/SEGGER_RTT_Conf.h\"
|
||||
-DUSE_APP_CONFIG=1
|
||||
)
|
||||
|
||||
target_include_directories(jlinkrtt PRIVATE
|
||||
${PROJECT_SOURCE_DIR}/include
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/cmsis
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/config/${OT_PLATFORM}/config
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/dependencies
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/libraries/app_error
|
||||
${PROJECT_SOURCE_DIR}/third_party/NordicSemiconductor/nrfx/mdk
|
||||
)
|
||||
Reference in New Issue
Block a user