Skip to content

Commit

Permalink
lib: add R23 ZBOSS based libraries
Browse files Browse the repository at this point in the history
Signed-off-by: Eduardo Montoya <[email protected]>
  • Loading branch information
edmont committed Nov 15, 2024
1 parent 0600bdc commit 5293262
Show file tree
Hide file tree
Showing 295 changed files with 169,069 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Copyright (c) 2024 Nordic Semiconductor ASA
# SPDX-License-Identifier: Apache-2.0

add_subdirectory(zboss)
7 changes: 7 additions & 0 deletions lib/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

rsource "zboss/Kconfig"
7 changes: 7 additions & 0 deletions lib/zboss/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2022 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

add_subdirectory_ifdef(CONFIG_ZIGBEE_LIBRARY_PRODUCTION production)
90 changes: 90 additions & 0 deletions lib/zboss/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
#
# Copyright (c) 2021 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

if ZIGBEE_ADD_ON

menu "ZBOSS library configuration"

config ZBOSS_SOURCES_AVAILABLE
bool

# Select between the production and development version of libraries
choice ZIGBEE_LIBRARY_TYPE
bool "ZBOSS library version"
default ZIGBEE_LIBRARY_PRODUCTION

config ZIGBEE_LIBRARY_PRODUCTION
bool "Use production libraries"
help
If selected, the application will be linked with the latest, stable
version of ZBOSS libraries.
Please check NCS documentation in order to get the certification status
of those libraries.

config ZIGBEE_LIBRARY_DEVELOPMENT
bool "Use development libraries [DEPRECATED]"
select DEPRECATED
help
If selected, the application will be linked with newest version of
ZBOSS libraries.
Those libraries are not officially certified, but may be used for
an early development of applications, that require experimental features.

endchoice # ZIGBEE_LIBRARY_TYPE

# Add a menu option to switch between platform designs.
choice ZIGBEE_LIBRARY_PLATFORM
prompt "Zigbee platform design"
default ZIGBEE_LIBRARY_SOC

config ZIGBEE_LIBRARY_SOC
bool "System-on-Chip"
help
The Zigbee stack, as well as the application is implemented on the SoC

config ZIGBEE_LIBRARY_NCP_DEV
bool "Network co-processor (connectivity device)"
help
The Zigbee stack is implemented on the connectivity SoC,
but the application is implemented on the host MCU

endchoice

# Add a menu option to switch between subsets of Zigbee Green Power features.
choice ZIGBEE_GP_FEATURES
prompt "Zigbee Green Power feature set configuration"
default ZIGBEE_GP_PB

config ZIGBEE_GP_NONE
bool "Disable Zigbee Green Power functionality"
help
This option is valid only when building ZBOSS without application layer

config ZIGBEE_GP_PB
bool "Enable Zigbee Green Power Proxy Basic functionality"

config ZIGBEE_GP_CB
bool "Enable Zigbee Green Power Combo Basic functionality [EXPERIMENTAL]"
select EXPERIMENTAL
depends on !ZIGBEE_ROLE_END_DEVICE && ZBOSS_SOURCES_AVAILABLE

endchoice

config ZIGBEE_ENABLE_TRACES
bool "Use ZBOSS libraries, dedicated for debugging issues [EXPERIMENTAL]"
select EXPERIMENTAL
help
Those libraries do not include additional debug symbols, but they include
extended set of ZBOSS binary traces, that allow Nordic's support team to debug issues.

config APP_LINK_WITH_ZBOSS
bool
help
Link application with ZBOSS library

endmenu

endif #ZIGBEE_ADD_ON
47 changes: 47 additions & 0 deletions lib/zboss/license.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* ZBOSS Zigbee 3.0
*
* Copyright (c) 2012-2020 DSR Corporation, Denver CO, USA.
* http://www.dsr-zboss.com
* http://www.dsr-corporation.com
* All rights reserved.
*
*
* Use in source and binary forms, redistribution in binary form only, with
* or without modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions in binary form, except as embedded into a Nordic
* Semiconductor ASA integrated circuit in a product or a software update for
* such product, 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.
*
* 2. Neither the name of Nordic Semiconductor ASA nor the names of its
* contributors may be used to endorse or promote products derived from this
* software without specific prior written permission.
*
* 3. This software, with or without modification, must only be used with a Nordic
* Semiconductor ASA integrated circuit.
*
* 4. Any software provided in binary form under this license must not be reverse
* engineered, decompiled, modified and/or disassembled.
*
* THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA "AS IS" AND ANY EXPRESS OR
* IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
* MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA 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.
*/

/*
* The following tags tell the "west ncs-sbom" tool which files are covered
* by the license information above.
* SPDX-License-Identifier: LicenseRef-ZBOSS-4-Clause
* NCS-SBOM-Apply-To-File: ./**/*.a
*/
169 changes: 169 additions & 0 deletions lib/zboss/production/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,169 @@
#
# Copyright (c) 2020 Nordic Semiconductor ASA
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Usage:
# nrfxlib_calculate_lib_path(<dir> [SOC_MODE] [BASE_DIR <dir> [SOFT_FLOAT_FALLBACK]])
#
# Calculate a library path based on current SoC architecture or SoC name and
# FPU ABI mode.
# The calculated library path is returned in the '<dir>' argument.
#
# If BASE_DIR is specified the calculated path will be converted to an absolute
# path starting from BASE_DIR. The absolute path will be checked for existence
# and if the absolute path does not exists, the returned value will be
# '<dir>-NOTFOUND'.
#
# SOC_MODE: Use the SoC name instead of the SoC architecture when calculating the path.
# For example 'nrf52840' will be used for the path instead of 'cortex-m4'
# NS_PROVIDED Use name identifying non-secure library version for builds with
# 'CONFIG_TRUSTED_EXECUTION_NONSECURE' on supported SoCs.
# Libraries that do not distinguish between secure and non-secure version
# should not use this parameter.
# BASE_DIR: Base path from where the calculated path should start from.
# When specifying BASE_DIR the path returned will be absolute, or
# '<dir>-NOTFOUND' if the path does not exists
# SOFT_FLOAT_FALLBACK: Allow soft float library path fallback if softfp-float is the FPU ABI in use
# and no 'softfp-float' is found.
# This flag requires 'BASE_DIR'
#
function(nrfxlib_calculate_lib_path lib_path)
cmake_parse_arguments(CALC_LIB_PATH "NS_PROVIDED" "BASE_DIR" "" ${ARGN})

# Add Arch type
assert(GCC_M_CPU "GCC_M_CPU must be set to find correct lib.")
set(arch_soc_dir ${GCC_M_CPU})

# Set floating ABI
if(CONFIG_FPU)
if(CONFIG_FP_HARDABI)
set(float_dir hard-float)
elseif(CONFIG_FP_SOFTABI)
set(float_dir softfp-float)
else()
assert(0 "Unreachable code")
endif()
else()
set(float_dir soft-float)
endif()
list(FIND COMPILER_OPT_AS_LIST "-fshort-wchar" SHORT_WCHAR_INDEX)
if (NOT (SHORT_WCHAR_INDEX EQUAL -1))
set(short_wchar "/short-wchar")
endif()
set(${lib_path} "lib/${arch_soc_dir}/${float_dir}${short_wchar}" PARENT_SCOPE)
endfunction()


# Define an interface library for Nordic's ZBOSS stack.
# This library contains official ZBOSS headers, platform-specific configuration,
# Nordic's extensions of ZBOSS API.
zephyr_interface_library_named(zboss)

# Common includes, not related to ZBOSS source code.
target_include_directories(zboss INTERFACE
src/zb_error
include/addons
)

# Suppress bitfield compatibility warning.
# This has to be included in all files, that uses ZBOSS headers.
# Those options will be inherited by everything that links to the ZBOSS target.
target_compile_options(zboss INTERFACE
-Wno-packed-bitfield-compat
)

# Add compile-time definition, indicating which ZBOSS library will be linked
# This definition adjusts ZBOSS headers, by making non-applicable API for
# a given Zigbee role invisible.
# Those options will be inherited by everything that links to the ZBOSS target.
if (CONFIG_ZIGBEE_ROLE_END_DEVICE)
target_compile_definitions(zboss INTERFACE
ZB_ED_ROLE
)
endif()


# Create a library for Nordic's extensions to ZBOSS stack.
# The target name is generated based on the path and is not meant to be
# explicitly linked in other modules.
# It will be pulled if the module links to the ZBOSS interface library.
zephyr_library()

# Add source files for the Nordic's extensions to ZBOSS stack.
# Due to the fact that extensions are linked for all variants of ZBOSS builds
# (libraries, closed source), they are separate from the CMakelists.txt file
# found under the src directory.
zephyr_library_sources(src/zb_error/zb_error_to_string.c)

# Link with ZBOSS interface library.
zephyr_library_link_libraries(zboss)

# Precompiled libraries -only part.
# Use the CONFIG_ZBOSS_SOURCES_AVAILABLE Kconfig option is defined in ZBOSS
# platform module to check if user uses ZOI repositories for building
# application.
# If so, the user still may select libraries from nrfxlib to link with
# verified state of ZBOSS (CONFIG_ZBOSS_LIBRARY_PRECOMPILED symbol).
if ((NOT DEFINED CONFIG_ZBOSS_SOURCES_AVAILABLE) OR
(CONFIG_ZBOSS_LIBRARY_PRECOMPILED))

nrfxlib_calculate_lib_path(lib_path)
if (CONFIG_ZIGBEE_ENABLE_TRACES)
set(ZBOSS_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/trace/${lib_path})
set(ZBOSS_LIB_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/trace/include)
else()
set(ZBOSS_LIB_PATH ${CMAKE_CURRENT_SOURCE_DIR}/${lib_path})
set(ZBOSS_LIB_CONFIG_DIR ${CMAKE_CURRENT_SOURCE_DIR}/include/osif)
endif()
if(NOT EXISTS ${ZBOSS_LIB_PATH})
message(WARNING "This combination of SoC and floating point ABI is not supported by the ZBOSS lib."
"(${ZBOSS_LIB_PATH} doesn't exist.)")
endif()

# Extend ZBOSS interface libraries by headers placed in nrfxlib.
target_include_directories(zboss INTERFACE
include
include/zcl
include/ha
include/se
include/osif
)

# Add the part of ZBOSS that is distributed in the source code.
add_subdirectory(src)

# Resolve Zigbee role to library variant
if (CONFIG_ZIGBEE_ROLE_COORDINATOR OR CONFIG_ZIGBEE_ROLE_ROUTER)
set(LIB_VARIANT )
else()
set(LIB_VARIANT ".ed")
endif()

# Include the static library to the ZBOSS interface definition and select
# ZBOSS configuration header file by defining compile-time definition.
target_link_libraries(zboss INTERFACE ${ZBOSS_LIB_PATH}/libzboss${LIB_VARIANT}.a)
target_compile_definitions(zboss INTERFACE LIBZBOSS_CONFIG_FILE="${ZBOSS_LIB_CONFIG_DIR}/libzboss_config${LIB_VARIANT}.h")

# Include the selected subset of Zigbee Green Power functionalities
if (CONFIG_ZIGBEE_ROLE_COORDINATOR OR CONFIG_ZIGBEE_ROLE_ROUTER)
if (CONFIG_ZIGBEE_GP_PB)
target_link_libraries(zboss INTERFACE ${ZBOSS_LIB_PATH}/libgppb${LIB_VARIANT}.a)
elseif (CONFIG_ZIGBEE_GP_CB)
target_link_libraries(zboss INTERFACE ${ZBOSS_LIB_PATH}/libgpcb${LIB_VARIANT}.a)
else()
message( FATAL_ERROR "Unsupported Zigbee Green Power feature set")
endif()
endif()

# Include NCP protocol and commands implementation.
# Since the libncp-dev contains the application code, all object files has to
# be included while linking.
if (CONFIG_ZIGBEE_LIBRARY_NCP_DEV)
zephyr_library_import(zboss_libncp-dev ${ZBOSS_LIB_PATH}/libncp-dev${LIB_VARIANT}.a)
elseif (CONFIG_ZIGBEE_LIBRARY_SOC)
else()
message(FATAL_ERROR "Unsupported Zigbee platform design")
endif()
endif()
16 changes: 16 additions & 0 deletions lib/zboss/production/include/addons/zboss_api_addons.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
*
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

#ifndef ZBOSS_API_ADDONS_H__
#define ZBOSS_API_ADDONS_H__

#include "zboss_api.h"

#include "zboss_api_zcl_addons.h"
#include "zboss_api_af_addons.h"


#endif /* ZBOSS_API_ADDONS_H__ */
Loading

0 comments on commit 5293262

Please sign in to comment.