From 39c87a90d1373757c0eccba5c21b991624eda5ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 2 Jan 2025 10:41:17 +0100 Subject: [PATCH 001/109] scripts: ncs_west_helpers: Update revert SHA workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add corrections for a bunch of sdk-zephyr revert commits that were cherry-picked after rebase without updating their references to reverted commits. Remove a no longer needed correction for one sdk-trusted-firmware-m commit. The added corrections can be removed after the next sdk-zephyr rebase. Signed-off-by: Andrzej Głąbek --- scripts/west_commands/ncs_west_helpers.py | 34 +++++++++++++++++++++-- 1 file changed, 31 insertions(+), 3 deletions(-) diff --git a/scripts/west_commands/ncs_west_helpers.py b/scripts/west_commands/ncs_west_helpers.py index 7f1cf377ead6..46ab4faacb38 100644 --- a/scripts/west_commands/ncs_west_helpers.py +++ b/scripts/west_commands/ncs_west_helpers.py @@ -233,9 +233,37 @@ def _downstream_outstanding_commits(self) -> list[pygit2.Commit]: # Temporary workaround for any commit(s) that are known # to specify incorrect SHAs of the commits they revert. - if self.downstream_repo.name == 'trusted-firmware-m': - if rsha == '74ebcb636cb39b498a2ac05f7587f8ee9158bba9': - rsha = 'af7b2f48e88bd3f260347138f87e5c4f7819b273' + if self.downstream_repo.name == 'zephyr': + if rsha == '8027617116b66548dc6d115af8cca84282adc87e': + rsha = 'd269d6fcc54c9f03bb19419120ce3a57f69a6a88' + if rsha == 'a278ee4af1397201e4b9a8431d601c3e64d34a6b': + rsha = '4f9ab7947c5214f837d806b33d3cb5262ff9bc83' + if rsha == '9a0b81bf553b937f2ecb729a4ae9dff6df93919f': + rsha = '9a675fa35fbd88a3464aaf015f68dff3fa22090a' + if rsha == '500609863634bf00a675146dcb78f5137aed330a': + rsha = '188ec35dc3785cf4e498434ebb55bdf47b08061b' + if rsha == 'e02f019aaac99993da5e39a986c2345eeac22dfc': + rsha = '045899a31200e2b57627442ced7cb80916270fb2' + if rsha == '8d6a853718ee5be65221d5187fa32793e44b8bdb': + rsha = '7db6fe0372890ceb24f9c644203261ba242f5792' + if rsha == '38f2104a801b1db40ab4596f972c0178f21821c5': + rsha = 'f787d7b1dd2cd768dd849c95f00ecac6b399b005' + if rsha == 'b0ce7fe23a0c83ce3038baf2b8899e0e6b1497fc': + rsha = 'ccd2f6324256a9dd7cdba83b1b4b8f5627df77ac' + if rsha == '687cefae54d14d19010ec95b6a6a89eedb6da5b0': + rsha = 'eefa2fee0b36fb0a502e7b44fc4a2d90e5cf23bb' + # Commit 34ac0f01d11fd78304df355cc139479bb32e511e that + # contains this incorrect SHA reference reverts in fact + # only a part of 29b9b3e2052e7022ce8a5c197612e08d75796535, + # so just ignore it. + if rsha == '330eb8146a5b694fb90d738cc04e6ef76d80f636': + continue + # Commit 08b6e7604926f6a2ec5eca9d4058f2f3fbc11e6e that + # contains this incorrect SHA reference reverts in fact + # only a part of 5eec5ca2ac59038194a91b7086edc50949ed83c9, + # so just ignore it. + if rsha == 'fe339b14b3effd069458f5e4710f17cda8295229': + continue if rsha in downstream_out: log.dbg('** commit {} ("{}") was reverted in {}'. From 8ceff450a2f91fc63db4d315c6564d4272d844cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 31 Dec 2024 00:07:54 +0100 Subject: [PATCH 002/109] manifest: Update zephyr and mcuboot MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Pull in upmerged revisions of zephyr and mcuboot. Update other modules with related adjustments. Signed-off-by: Andrzej Głąbek --- west.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/west.yml b/west.yml index 15ef81b6eb4e..83c0404bff1b 100644 --- a/west.yml +++ b/west.yml @@ -69,7 +69,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: 7cbe361b02aaa1921916c7bc0c314103730dce6c + revision: pull/2411/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above @@ -93,6 +93,7 @@ manifest: - fatfs - hal_nordic - hal_st # required for ST sensors (unrelated to STM32 MCUs) + - hal_tdk # required for Invensense sensors such as ICM42670 - hal_wurthelektronik - hostap - liblc3 @@ -130,7 +131,7 @@ manifest: compare-by-default: true - name: mcuboot repo-path: sdk-mcuboot - revision: 3a25855215a2cfc64c3f0e2dba3ada3f11df7816 + revision: pull/393/head path: bootloader/mcuboot - name: qcbor url: https://github.com/laurencelundblade/QCBOR @@ -147,7 +148,7 @@ manifest: - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib - revision: 1cdbd26200df91ae3500daf6f5e15fae686ffdf8 + revision: pull/1648/head - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m @@ -245,7 +246,7 @@ manifest: revision: b37972cd90c122bb8f384f2509b72fad62c3aa4b path: modules/lib/suit-generator - name: suit-processor - revision: a499bcadceff8877da63a0a140c6a91ff2f87b25 + revision: a1a9ef77c6cd7c85315ac59f1cd8b66d9bd434b5 path: modules/lib/suit-processor - name: doc-internal repo-path: doc-internal From d8ec9bc2ffc77408ec6fc96ff4a77876d76a6806 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 31 Dec 2024 00:17:39 +0100 Subject: [PATCH 003/109] checkpatch: Remove --ignore BRACES statement MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adapt to the latest changes applied to Zephyr. Signed-off-by: Andrzej Głąbek --- .checkpatch.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/.checkpatch.conf b/.checkpatch.conf index 3248690b08e8..df7e0f87c00a 100644 --- a/.checkpatch.conf +++ b/.checkpatch.conf @@ -5,7 +5,6 @@ --min-conf-desc-length=1 --typedefsfile=scripts/checkpatch/typedefsfile ---ignore BRACES --ignore PRINTK_WITHOUT_KERN_LEVEL --ignore SPLIT_STRING --ignore VOLATILE From da809e038abb5055800168d2ad0449b48f5156b5 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 2 Jan 2025 12:56:13 +0100 Subject: [PATCH 004/109] bluetooth: rpc: remove unnecessary source The bluetooth shell has been refactored (see bf897cf941a514e7ea7a5f837d2287e360281f24), so the sourced file no longer exists. Note that it was actually a bad use of sourcing, as the upstream options are already part of the Kconfig tree (unless I missed something). Signed-off-by: Gerard Marull-Paretas --- subsys/bluetooth/rpc/Kconfig | 1 - 1 file changed, 1 deletion(-) diff --git a/subsys/bluetooth/rpc/Kconfig b/subsys/bluetooth/rpc/Kconfig index dd1e54434f60..f7272d0869fe 100644 --- a/subsys/bluetooth/rpc/Kconfig +++ b/subsys/bluetooth/rpc/Kconfig @@ -184,6 +184,5 @@ source "$(ZEPHYR_BASE)/subsys/bluetooth/services/Kconfig" source "$(ZEPHYR_BASE)/subsys/bluetooth/common/Kconfig" source "$(ZEPHYR_BASE)/subsys/bluetooth/host/Kconfig" source "$(ZEPHYR_BASE)/subsys/bluetooth/crypto/Kconfig" -source "$(ZEPHYR_BASE)/subsys/bluetooth/shell/Kconfig" endif # BT_RPC_STACK From 53c638b15577972fedcef14118791ba8fb4c5af1 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 2 Jan 2025 15:09:39 +0100 Subject: [PATCH 005/109] doc: upmerge fixes - Upgrade to latest Sphinx - Fix some references - Fix Zephyr docset required env vars Signed-off-by: Gerard Marull-Paretas --- doc/nrf/releases_and_maturity/releases/release-notes-1.4.1.rst | 2 +- doc/requirements.txt | 2 +- doc/zephyr/conf.py | 2 +- samples/openthread/coprocessor/README.rst | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/nrf/releases_and_maturity/releases/release-notes-1.4.1.rst b/doc/nrf/releases_and_maturity/releases/release-notes-1.4.1.rst index 284992e30187..bd0a41961724 100644 --- a/doc/nrf/releases_and_maturity/releases/release-notes-1.4.1.rst +++ b/doc/nrf/releases_and_maturity/releases/release-notes-1.4.1.rst @@ -92,7 +92,7 @@ Zephyr changes incorporated into |NCS| This section contains changes in Zephyr that were cherry-picked into |NCS| for this release. -* Added support for the :ref:`zephyr:actinius_icarus` board. +* Added support for the Actinius Icarus board. Bluetooth Host ~~~~~~~~~~~~~~ diff --git a/doc/requirements.txt b/doc/requirements.txt index 10b1e50a3972..c01ffbf5a868 100644 --- a/doc/requirements.txt +++ b/doc/requirements.txt @@ -14,7 +14,7 @@ PyYAML # | X | | | | | pykwalify # | | | | | | | X | pytest # | | | | | | | X | recommonmark # | | | X | X | | | | -sphinx~=7.4 # | X | X | X | X | X | X | X | +sphinx~=8.1 # | X | X | X | X | X | X | X | sphinx-autobuild # | X | X | X | X | X | X | X | sphinx-copybutton # | X | | | | | | X | sphinx-ncs-theme<1.1 # | X | | | | | | | diff --git a/doc/zephyr/conf.py b/doc/zephyr/conf.py index e262bbcd12e7..caef1546d2f5 100644 --- a/doc/zephyr/conf.py +++ b/doc/zephyr/conf.py @@ -27,7 +27,7 @@ # Import all Zephyr configuration, override as needed later os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) -os.environ["ZEPHYR_BUILD"] = str(utils.get_builddir() / "zephyr") +os.environ["OUTPUT_DIR"] = str(utils.get_builddir() / "html" / "zephyr") conf = eval_config_file(str(ZEPHYR_BASE / "doc" / "conf.py"), tags) locals().update(conf) diff --git a/samples/openthread/coprocessor/README.rst b/samples/openthread/coprocessor/README.rst index 1120e62bf34b..0f1cc1e21675 100644 --- a/samples/openthread/coprocessor/README.rst +++ b/samples/openthread/coprocessor/README.rst @@ -10,7 +10,7 @@ Thread: Co-processor The :ref:`Thread ` Co-processor sample demonstrates how to implement OpenThread's :ref:`thread_architectures_designs_cp` inside the Zephyr environment. The sample uses the :ref:`thread_architectures_designs_cp_rcp` architecture. -The sample is based on Zephyr's :zephyr:code-sample:`coprocessor` sample. +The sample is based on Zephyr's :zephyr:code-sample:`openthread-coprocessor` sample. However, it customizes Zephyr's sample to fulfill the |NCS| requirements (for example, by increasing the stack size dedicated for the user application), and also extends it with features such as: * Increased Mbed TLS heap size. From c8f95366b393f0375ef159ab16237b0147369319 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Wed, 8 Jan 2025 15:20:54 +0100 Subject: [PATCH 006/109] doc: zephyr: add missing Doxygen input folder Align with list of inputs in upstream Zephyr. Signed-off-by: Gerard Marull-Paretas --- doc/zephyr/zephyr.doxyfile.in | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/zephyr/zephyr.doxyfile.in b/doc/zephyr/zephyr.doxyfile.in index b24bc5ed7ef0..33bcbf875872 100644 --- a/doc/zephyr/zephyr.doxyfile.in +++ b/doc/zephyr/zephyr.doxyfile.in @@ -978,7 +978,8 @@ INPUT = @DOCSET_SOURCE_BASE@/doc/_doxygen/mainpage.md \ @DOCSET_SOURCE_BASE@/include/ \ @DOCSET_SOURCE_BASE@/lib/libc/minimal/include/ \ @DOCSET_SOURCE_BASE@/subsys/testsuite/include/ \ - @DOCSET_SOURCE_BASE@/subsys/testsuite/ztest/include/ + @DOCSET_SOURCE_BASE@/subsys/testsuite/ztest/include/ \ + @DOCSET_SOURCE_BASE@/subsys/secure_storage/include/ # This tag can be used to specify the character encoding of the source files # that Doxygen parses. Internally Doxygen uses the UTF-8 encoding. Doxygen uses From f51f384ed2f168a1e55f59642d4fbd9f30798013 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 9 Dec 2024 11:44:14 +0100 Subject: [PATCH 007/109] doc: adjust doxyrunner/doxybridge settings According to the new extension parameters. Signed-off-by: Gerard Marull-Paretas --- doc/nrf/conf.py | 28 +++++++++++++++++----------- doc/nrfxlib/conf.py | 24 +++++++++++++++--------- doc/zephyr/conf.py | 26 ++++++++++++++++++-------- 3 files changed, 50 insertions(+), 28 deletions(-) diff --git a/doc/nrf/conf.py b/doc/nrf/conf.py index a054e2c25687..4f1ab3b4b12d 100644 --- a/doc/nrf/conf.py +++ b/doc/nrf/conf.py @@ -122,22 +122,28 @@ # -- Options for doxyrunner plugin --------------------------------------------- +_doxyrunner_outdir = utils.get_builddir() / "html" / "nrf" / "doxygen" + doxyrunner_doxygen = os.environ.get("DOXYGEN_EXECUTABLE", "doxygen") -doxyrunner_doxyfile = NRF_BASE / "doc" / "nrf" / "nrf.doxyfile.in" -doxyrunner_outdir = utils.get_builddir() / "html" / "nrf" / "doxygen" -doxyrunner_fmt = True -doxyrunner_fmt_vars = { - "NRF_BASE": str(NRF_BASE), - "DOCSET_SOURCE_BASE": str(NRF_BASE), - "DOCSET_BUILD_DIR": str(doxyrunner_outdir), - "DOCSET_VERSION": version, +doxyrunner_projects = { + "nrf": { + "doxyfile": NRF_BASE / "doc" / "nrf" / "nrf.doxyfile.in", + "outdir": _doxyrunner_outdir, + "fmt": True, + "fmt_vars": { + "NRF_BASE": str(NRF_BASE), + "DOCSET_SOURCE_BASE": str(NRF_BASE), + "DOCSET_BUILD_DIR": str(_doxyrunner_outdir), + "DOCSET_VERSION": version, + } + } } # create mbedtls config header (needed for Doxygen) -doxyrunner_outdir.mkdir(exist_ok=True, parents=True) +_doxyrunner_outdir.mkdir(exist_ok=True, parents=True) fin_path = NRF_BASE / "subsys" / "nrf_security" / "configs" / "legacy_crypto_config.h.template" -fout_path = doxyrunner_outdir / "mbedtls_doxygen_config.h" +fout_path = _doxyrunner_outdir / "mbedtls_doxygen_config.h" with open(fin_path) as fin, open(fout_path, "w") as fout: fout.write( @@ -150,7 +156,7 @@ # -- Options for doxybridge plugin --------------------------------------------- -doxybridge_dir = doxyrunner_outdir +doxybridge_projects = {"nrf": _doxyrunner_outdir} # Options for ncs_include ------------------------------------------------------ diff --git a/doc/nrfxlib/conf.py b/doc/nrfxlib/conf.py index 9b9b7e9d24b8..dbea695dd8df 100644 --- a/doc/nrfxlib/conf.py +++ b/doc/nrfxlib/conf.py @@ -79,20 +79,26 @@ # -- Options for doxyrunner plugin --------------------------------------------- +_doxyrunner_outdir = utils.get_builddir() / "html" / "nrfxlib" / "doxygen" + doxyrunner_doxygen = os.environ.get("DOXYGEN_EXECUTABLE", "doxygen") -doxyrunner_doxyfile = NRF_BASE / "doc" / "nrfxlib" / "nrfxlib.doxyfile.in" -doxyrunner_outdir = utils.get_builddir() / "html" / "nrfxlib" / "doxygen" -doxyrunner_fmt = True -doxyrunner_fmt_vars = { - "NRF_BASE": str(NRF_BASE), - "DOCSET_SOURCE_BASE": str(NRFXLIB_BASE), - "DOCSET_BUILD_DIR": str(doxyrunner_outdir), - "DOCSET_VERSION": version, +doxyrunner_projects = { + "nrfxlib": { + "doxyfile": NRF_BASE / "doc" / "nrfxlib" / "nrfxlib.doxyfile.in", + "outdir": _doxyrunner_outdir, + "fmt": True, + "fmt_vars": { + "NRF_BASE": str(NRF_BASE), + "DOCSET_SOURCE_BASE": str(NRFXLIB_BASE), + "DOCSET_BUILD_DIR": str(_doxyrunner_outdir), + "DOCSET_VERSION": version, + } + } } # -- Options for doxybridge plugin --------------------------------------------- -doxybridge_dir = doxyrunner_outdir +doxybridge_projects = {"nrfxlib": _doxyrunner_outdir} # -- Options for warnings_filter ----------------------------------------------- diff --git a/doc/zephyr/conf.py b/doc/zephyr/conf.py index caef1546d2f5..585cabb39394 100644 --- a/doc/zephyr/conf.py +++ b/doc/zephyr/conf.py @@ -71,17 +71,27 @@ # -- Options for doxyrunner plugin --------------------------------------------- +_doxyrunner_outdir = utils.get_builddir() / "html" / "zephyr" / "doxygen" + doxyrunner_doxygen = os.environ.get("DOXYGEN_EXECUTABLE", "doxygen") -doxyrunner_doxyfile = NRF_BASE / "doc" / "zephyr" / "zephyr.doxyfile.in" -doxyrunner_outdir = utils.get_builddir() / "html" / "zephyr" / "doxygen" -doxyrunner_fmt = True -doxyrunner_fmt_vars = { - "NRF_BASE": str(NRF_BASE), - "DOCSET_SOURCE_BASE": str(ZEPHYR_BASE), - "DOCSET_BUILD_DIR": str(doxyrunner_outdir), - "DOCSET_VERSION": version, +doxyrunner_projects = { + "zephyr": { + "doxyfile": NRF_BASE / "doc" / "zephyr" / "zephyr.doxyfile.in", + "outdir": _doxyrunner_outdir, + "fmt": True, + "fmt_vars": { + "NRF_BASE": str(NRF_BASE), + "DOCSET_SOURCE_BASE": str(ZEPHYR_BASE), + "DOCSET_BUILD_DIR": str(_doxyrunner_outdir), + "DOCSET_VERSION": version, + } + } } +# -- Options for doxybridge plugin --------------------------------------------- + +doxybridge_projects = {"zephyr": _doxyrunner_outdir} + # -- Options for zephyr.warnings_filter ---------------------------------------- warnings_filter_silent = True From 77d8ce7129d2b18f5c031a246a8174a1fbe3509a Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 9 Dec 2024 12:49:08 +0100 Subject: [PATCH 008/109] doc: doxygen: change standalone docsets layout Now the output will be $name/html|xml, so that we can generate other outputs other than HTML only, e.g. XML. Signed-off-by: Gerard Marull-Paretas --- .github/workflows/docbuild.yml | 2 +- doc/CMakeLists.txt | 4 ++-- doc/nrfx/nrfx.doxyfile.in | 2 +- doc/wifi/wifi.doxyfile.in | 4 ++-- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/docbuild.yml b/.github/workflows/docbuild.yml index fa243cd0eac5..a98893bc4e7a 100644 --- a/.github/workflows/docbuild.yml +++ b/.github/workflows/docbuild.yml @@ -147,7 +147,7 @@ jobs: for docset in "${DOXYGEN[@]}"; do OUTDIR=doc/_build/html-doxygen/$docset-apis - mv doc/_build/html/$docset "$OUTDIR" + mv doc/_build/html/$docset/html "$OUTDIR" # Populate custom.properties, tags.yml cp doc/_zoomin/$docset.apis.custom.properties "$OUTDIR/custom.properties" diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index e60cd5ff2301..a2c1a5f9a256 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -74,13 +74,13 @@ file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) # function(add_doxygen_docset name sources version) cmake_parse_arguments(DOXYGEN "STANDALONE" "" "" ${ARGN}) - set(DOCSET_BUILD_DIR ${CMAKE_BINARY_DIR}/html) + set(DOCSET_BUILD_DIR ${CMAKE_BINARY_DIR}/html/${name}) set(DOCSET_SOURCE_BASE ${sources}) set(DOCSET_VERSION ${version}) if(NOT DOXYGEN_STANDALONE) set(SUFFIX "-doxygen") - set(DOCSET_BUILD_DIR ${DOCSET_BUILD_DIR}/${name}/doxygen) + set(DOCSET_BUILD_DIR ${DOCSET_BUILD_DIR}/doxygen) endif() configure_file(${CMAKE_CURRENT_LIST_DIR}/${name}/${name}.doxyfile.in ${CMAKE_BINARY_DIR}/${name}.doxyfile) diff --git a/doc/nrfx/nrfx.doxyfile.in b/doc/nrfx/nrfx.doxyfile.in index 00edb7ddc486..54ce176bbfd3 100644 --- a/doc/nrfx/nrfx.doxyfile.in +++ b/doc/nrfx/nrfx.doxyfile.in @@ -1275,7 +1275,7 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = nrfx +HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). diff --git a/doc/wifi/wifi.doxyfile.in b/doc/wifi/wifi.doxyfile.in index 237a2eef590a..db26c64b506f 100644 --- a/doc/wifi/wifi.doxyfile.in +++ b/doc/wifi/wifi.doxyfile.in @@ -1304,7 +1304,7 @@ GENERATE_HTML = YES # The default directory is: html. # This tag requires that the tag GENERATE_HTML is set to YES. -HTML_OUTPUT = wifi +HTML_OUTPUT = html # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each # generated HTML page (for example: .htm, .php, .asp). @@ -2262,7 +2262,7 @@ MAN_LINKS = NO # captures the structure of the code including all documentation. # The default value is: NO. -GENERATE_XML = NO +GENERATE_XML = YES # The XML_OUTPUT tag is used to specify where the XML pages will be put. If a # relative path is entered the value of OUTPUT_DIRECTORY will be put in front of From 368b9c8d053a75613d0ed8b7f958e85e6d18ad59 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Thu, 28 Nov 2024 16:07:52 +0100 Subject: [PATCH 009/109] samples: suit: use CONFIG_SOC_NRF54H20_GENERATE_BICR Instead of the removed CONFIG_NRF_REGTOOL_GENERATE_BICR. Signed-off-by: Gerard Marull-Paretas --- .../device_guides/nrf54h/ug_nrf54h20_suit_recovery.rst | 4 ++-- samples/suit/flash_companion/prj.conf | 2 +- samples/suit/recovery/prj.conf | 2 +- samples/suit/recovery/sysbuild/hci_ipc.conf | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/doc/nrf/app_dev/device_guides/nrf54h/ug_nrf54h20_suit_recovery.rst b/doc/nrf/app_dev/device_guides/nrf54h/ug_nrf54h20_suit_recovery.rst index c1dab7cabbd4..d7482642b98f 100644 --- a/doc/nrf/app_dev/device_guides/nrf54h/ug_nrf54h20_suit_recovery.rst +++ b/doc/nrf/app_dev/device_guides/nrf54h/ug_nrf54h20_suit_recovery.rst @@ -125,7 +125,7 @@ To turn an application into a recovery application, the following steps have to * :kconfig:option:`CONFIG_SUIT_RECOVERY` set to ``y`` * :kconfig:option:`CONFIG_NRF_REGTOOL_GENERATE_UICR` set to ``n`` - * :kconfig:option:`CONFIG_NRF_REGTOOL_GENERATE_BICR` set to ``n`` + * :kconfig:option:`CONFIG_SOC_NRF54H20_GENERATE_BICR` set to ``n`` To do that you can simply paste the following code snippet into your configuration files: @@ -133,7 +133,7 @@ To turn an application into a recovery application, the following steps have to CONFIG_SUIT_RECOVERY=y CONFIG_NRF_REGTOOL_GENERATE_UICR=n - CONFIG_NRF_REGTOOL_GENERATE_BICR=n + CONFIG_SOC_NRF54H20_GENERATE_BICR=n #. Create the overlay files to be used by the recovery application. In this guide it is assumed that for the application core they are placed in the custom recovery application directory in the :file:`boards/nrf54h20dk_nrf54h20_cpuapp.overlay` file. diff --git a/samples/suit/flash_companion/prj.conf b/samples/suit/flash_companion/prj.conf index 24223dfcadf2..02c6f19412f3 100644 --- a/samples/suit/flash_companion/prj.conf +++ b/samples/suit/flash_companion/prj.conf @@ -63,7 +63,7 @@ CONFIG_USE_DT_CODE_PARTITION=y CONFIG_SUIT_LOCAL_ENVELOPE_GENERATE=n CONFIG_SUIT_ENVELOPE_TARGET="" CONFIG_NRF_REGTOOL_GENERATE_UICR=n -CONFIG_NRF_REGTOOL_GENERATE_BICR=n +CONFIG_SOC_NRF54H20_GENERATE_BICR=n # Enable canonical zcbor encoding CONFIG_ZCBOR_CANONICAL=y diff --git a/samples/suit/recovery/prj.conf b/samples/suit/recovery/prj.conf index 59cb90b07d6a..2f464c8d020b 100644 --- a/samples/suit/recovery/prj.conf +++ b/samples/suit/recovery/prj.conf @@ -11,7 +11,7 @@ CONFIG_SUIT_RECOVERY=y # It is the main application which is responsible for flashing and generating the UICR # configuration - the recovery application should not do it. CONFIG_NRF_REGTOOL_GENERATE_UICR=n -CONFIG_NRF_REGTOOL_GENERATE_BICR=n +CONFIG_SOC_NRF54H20_GENERATE_BICR=n ############ diff --git a/samples/suit/recovery/sysbuild/hci_ipc.conf b/samples/suit/recovery/sysbuild/hci_ipc.conf index c2f546c93beb..9dcfcfa57d18 100644 --- a/samples/suit/recovery/sysbuild/hci_ipc.conf +++ b/samples/suit/recovery/sysbuild/hci_ipc.conf @@ -11,7 +11,7 @@ CONFIG_SUIT_RECOVERY=y # It is the main application which is responsible for flashing and generating the UICR # configuration - the recovery application should not do it. CONFIG_NRF_REGTOOL_GENERATE_UICR=n -CONFIG_NRF_REGTOOL_GENERATE_BICR=n +CONFIG_SOC_NRF54H20_GENERATE_BICR=n ########### CONFIG_BT_BUF_ACL_RX_SIZE=502 From cae4046f333e5b0dc9c763c8a701dee549c67d98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 7 Jan 2025 10:09:49 +0100 Subject: [PATCH 010/109] dts: bindings: Adapt nordic,bt-hci-sdc to recent upstream changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `bt-hci-bus` property values are now specified in lowercase and without the `BT_HCI_BUS_` prefix. Signed-off-by: Andrzej Głąbek --- dts/bindings/bluetooth/nordic,bt-hci-sdc.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dts/bindings/bluetooth/nordic,bt-hci-sdc.yaml b/dts/bindings/bluetooth/nordic,bt-hci-sdc.yaml index 08ea1fc8d2ed..3bfb8798887f 100644 --- a/dts/bindings/bluetooth/nordic,bt-hci-sdc.yaml +++ b/dts/bindings/bluetooth/nordic,bt-hci-sdc.yaml @@ -8,4 +8,4 @@ properties: bt-hci-name: default: "SDC" bt-hci-bus: - default: "BT_HCI_BUS_VIRTUAL" + default: "virtual" From dc2883ea87c6f8b509a7f7be570ddbd073eb484e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 13:06:01 +0100 Subject: [PATCH 011/109] esb: kconfig: Fix ESB_DYNAMIC_INTERRUPTS dependencies MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The ESB_DYNAMIC_INTERRUPTS option enables code that uses direct dynamic interrupts mechanism, so it should select the DYNAMIC_DIRECT_INTERRUPTS option together with its dependency DIRECT_INTERRUPTS, not depend on those, otherwise some unobvious dependency loops may appear (like one with MBOX; through NRF_RPC, MPSL_CX_SOFTWARE_RPC, NRF_FEM_ONLY, and MBOX_ANDES_PLIC_SW). Signed-off-by: Andrzej Głąbek --- subsys/esb/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/esb/Kconfig b/subsys/esb/Kconfig index 3daea5b389fa..44edf81a75d2 100644 --- a/subsys/esb/Kconfig +++ b/subsys/esb/Kconfig @@ -132,7 +132,8 @@ endmenu config ESB_DYNAMIC_INTERRUPTS bool "Use direct dynamic interrupts" - depends on DYNAMIC_INTERRUPTS && DYNAMIC_DIRECT_INTERRUPTS + select DYNAMIC_INTERRUPTS + select DYNAMIC_DIRECT_INTERRUPTS help This option configures ESB IRQ handlers using direct dynamic interrupts. This allows reconfiguring ESB_SYS_TIMER_IRQn, ESB_EVT_IRQ, From 02af4ef4c47bb84d71a9f4928b2c35bffa93dd40 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 8 Jan 2025 13:18:43 +0100 Subject: [PATCH 012/109] bluetooth: rpc: Remove dependency on BT_DRIVERS MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This dependency introduced as a fix for cmake warnings doesn't seem to be needed anymore but it leads to a dependency loop with BT_CTLR_ADV_EXT_SUPPORT. This commit basically reverts 43c4519374dee15be55b53ed0e651a3812cba2ac. Signed-off-by: Andrzej Głąbek --- subsys/bluetooth/rpc/Kconfig | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/bluetooth/rpc/Kconfig b/subsys/bluetooth/rpc/Kconfig index f7272d0869fe..df0db70a78b5 100644 --- a/subsys/bluetooth/rpc/Kconfig +++ b/subsys/bluetooth/rpc/Kconfig @@ -72,10 +72,6 @@ if BT_RPC_CLIENT config HEAP_MEM_POOL_SIZE default 4096 -config BT_DRIVERS - bool "Bluetooth Drivers" - default n - endif # BT_RPC_CLIENT if BT_RPC_HOST From 5f3409522685261dba8fbe54738c61cddef8cac2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 9 Jan 2025 17:39:48 +0100 Subject: [PATCH 013/109] boards: thingy91x: Update discharge current limit for npm1300 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After the latest update of the "nordic,npm1300-charger" binding, 1000 mA is the maximum value for the dischg-limit-microamp property. Signed-off-by: Andrzej Głąbek --- boards/nordic/thingy91x/thingy91x_common.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/boards/nordic/thingy91x/thingy91x_common.dtsi b/boards/nordic/thingy91x/thingy91x_common.dtsi index 37ac05289e1d..a09acad0c1ff 100644 --- a/boards/nordic/thingy91x/thingy91x_common.dtsi +++ b/boards/nordic/thingy91x/thingy91x_common.dtsi @@ -83,7 +83,7 @@ /* Battery specs from LiPol LP803448 datasheet (Dwg. nr. FD_3245_70) */ term-microvolt = <4200000>; current-microamp = <675000>; /* 0.5C charging current */ - dischg-limit-microamp = <1340000>; /* Maximum value for PMIC */ + dischg-limit-microamp = <1000000>; /* Maximum value for PMIC */ thermistor-cold-millidegrees = <0>; thermistor-cool-millidegrees = <0>; thermistor-warm-millidegrees = <45000>; From 5cb9303d2c9b3f583c674cf214a407115fe0681a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 9 Jan 2025 17:56:03 +0100 Subject: [PATCH 014/109] net: lib: hostap_crypto: Remove cmake entries for deleted files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove entries for the following files that were recently deleted from the hostap module: - crypto_mbedtls-bignum.c - crypto_mbedtls-ec.c - crypto_mbedtls.c - tls_mbedtls.c Signed-off-by: Andrzej Głąbek --- subsys/net/lib/hostap_crypto/CMakeLists.txt | 4 ---- 1 file changed, 4 deletions(-) diff --git a/subsys/net/lib/hostap_crypto/CMakeLists.txt b/subsys/net/lib/hostap_crypto/CMakeLists.txt index 0cfb8518d772..074a20f4277c 100644 --- a/subsys/net/lib/hostap_crypto/CMakeLists.txt +++ b/subsys/net/lib/hostap_crypto/CMakeLists.txt @@ -25,9 +25,6 @@ target_link_libraries(hostap_crypto INTERFACE hostap) if(DEFINED CONFIG_HOSTAP_CRYPTO_LEGACY OR DEFINED CONFIG_HOSTAP_CRYPTO_LEGACY_PSA) zephyr_library_sources( - ${HOSTAP_SRC_BASE}/crypto/crypto_mbedtls-bignum.c - ${HOSTAP_SRC_BASE}/crypto/crypto_mbedtls-ec.c - ${HOSTAP_SRC_BASE}/crypto/crypto_mbedtls.c ${HOSTAP_SRC_BASE}/crypto/aes-internal.c ${HOSTAP_SRC_BASE}/crypto/aes-wrap.c ${HOSTAP_SRC_BASE}/crypto/aes-unwrap.c @@ -64,7 +61,6 @@ if(DEFINED CONFIG_HOSTAP_CRYPTO_LEGACY OR # MD4 removed from MbedTLS ${HOSTAP_SRC_BASE}/crypto/md4-internal.c ${HOSTAP_SRC_BASE}/crypto/aes-encblock.c - ${HOSTAP_SRC_BASE}/crypto/tls_mbedtls.c ) endif() From 36cd090013431187f80fd7ab87f74c30f14427eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 10 Jan 2025 12:35:48 +0100 Subject: [PATCH 015/109] bluetooth: controller: Kconfig: Adapt to upstream Zephyr changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit As the BT_LL_CHOICE choice was removed upstream, BT_LL_SOFTDEVICE needs to be a regular option now (and not depending on BT_CTLR anymore). Also it should select HAS_BT_CTLR as it is supposed for all LL implemenations. See Zephyr PR 82157. Also adjust dragoon revision accordingly. Signed-off-by: Andrzej Głąbek --- subsys/bluetooth/Kconfig | 2 -- subsys/bluetooth/controller/Kconfig | 8 ++------ west.yml | 2 +- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index ec2310816b1a..a439143aed8d 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -39,9 +39,7 @@ config BT_LL_SOFTDEVICE_HEADERS_INCLUDE config BT_LL_SOFTDEVICE_HEADERS_INCLUDE_PATH_OVERRIDE bool -if BT_CTLR rsource "controller/Kconfig" -endif rsource "host_extensions/Kconfig" comment "BLE Libraries" diff --git a/subsys/bluetooth/controller/Kconfig b/subsys/bluetooth/controller/Kconfig index a5397c7458a8..bb4c40ec1c85 100644 --- a/subsys/bluetooth/controller/Kconfig +++ b/subsys/bluetooth/controller/Kconfig @@ -4,12 +4,10 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -choice BT_LL_CHOICE - prompt "Bluetooth Link Layer Selection" - default BT_LL_SOFTDEVICE - config BT_LL_SOFTDEVICE bool "SoftDevice Link Layer" + default y + select HAS_BT_CTLR select MPSL select ZERO_LATENCY_IRQS if !SOC_SERIES_BSIM_NRFXX select BT_CTLR_CRYPTO_SUPPORT @@ -52,8 +50,6 @@ config BT_LL_SOFTDEVICE help Use SoftDevice Link Layer implementation. -endchoice - config BT_CTLR_DF_SUPPORT select BT_CTLR_DF_CTE_TX_SUPPORT diff --git a/west.yml b/west.yml index 83c0404bff1b..216d1e792c82 100644 --- a/west.yml +++ b/west.yml @@ -192,7 +192,7 @@ manifest: # Only for internal Nordic development repo-path: dragoon.git remote: dragoon - revision: d85f37138db71ea6376260fb3ed5819faa4b97ee + revision: develop/DRGN-23817_adapt_for_upmerge_20241220 submodules: true groups: - dragoon From aca183132af3ffdd3b75f1b0059d0b047d193c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 11 Jan 2025 14:01:30 +0100 Subject: [PATCH 016/109] treewide: Adapt to upstream Zephyr changes related to BT_CTLR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - the BT_CTLR option was replaced with HAS_BT_CTLR which is selected by the LL implementations - the BT_LL_CHOICE choice option was removed See Zephyr PR 82157. Signed-off-by: Andrzej Głąbek --- .../boards/thingy91_nrf52840.conf | 1 - applications/nrf_desktop/Kconfig.ble | 12 ++---------- boards/nordic/nrf52810dmouse/Kconfig.defconfig | 3 --- boards/nordic/nrf52820dongle/Kconfig.defconfig | 3 --- boards/nordic/nrf52833dongle/Kconfig.defconfig | 3 --- boards/nordic/nrf52840gmouse/Kconfig.defconfig | 3 --- boards/nordic/nrf52dmouse/Kconfig.defconfig | 3 --- boards/nordic/nrf52kbd/Kconfig.defconfig | 3 --- boards/nordic/thingy91x/Kconfig | 5 ----- boards/nordic/thingy91x/Kconfig.defconfig.nrf5340 | 7 ------- .../hci_lpuart/boards/thingy91_nrf52840.conf | 1 - samples/bluetooth/mesh/light_ctrl/src/main.c | 4 ++-- samples/common/mcumgr_bt_ota_dfu/Kconfig | 4 ++-- .../nrf_rpc/protocols_serialization/client/Kconfig | 3 --- .../west_commands/create_board/ncs_create_board.py | 11 +++++++---- .../templates/nrf52/Kconfig.defconfig.jinja2 | 6 ------ .../templates/nrf53/Kconfig.defconfig.jinja2 | 7 ------- .../templates/nrf54l/Kconfig.defconfig.jinja2 | 3 --- subsys/bluetooth/Kconfig | 2 +- subsys/bluetooth/adv_prov/providers/Kconfig.tx_power | 2 +- .../bluetooth/services/fast_pair/Kconfig.fast_pair | 2 +- subsys/caf/modules/Kconfig.ble_adv | 4 ++-- subsys/caf/modules/Kconfig.ble_state | 4 ++-- subsys/zigbee/osif/zb_nrf_crypto.c | 4 ++-- 24 files changed, 22 insertions(+), 78 deletions(-) delete mode 100644 scripts/west_commands/create_board/templates/nrf52/Kconfig.defconfig.jinja2 diff --git a/applications/connectivity_bridge/boards/thingy91_nrf52840.conf b/applications/connectivity_bridge/boards/thingy91_nrf52840.conf index 4efb654d4314..062efe231a62 100644 --- a/applications/connectivity_bridge/boards/thingy91_nrf52840.conf +++ b/applications/connectivity_bridge/boards/thingy91_nrf52840.conf @@ -17,7 +17,6 @@ CONFIG_BT_BUF_ACL_RX_SIZE=251 CONFIG_BT_NUS=y CONFIG_BT_GATT_CLIENT=y CONFIG_BT_SMP=y -CONFIG_BT_CTLR=y CONFIG_BT_CTLR_RX_BUFFERS=10 CONFIG_BT_BUF_ACL_TX_COUNT=10 CONFIG_BT_BUF_ACL_TX_SIZE=251 diff --git a/applications/nrf_desktop/Kconfig.ble b/applications/nrf_desktop/Kconfig.ble index 91db0c6b10ad..a2c484c5fa91 100644 --- a/applications/nrf_desktop/Kconfig.ble +++ b/applications/nrf_desktop/Kconfig.ble @@ -260,15 +260,7 @@ config BT_MAX_PAIRED endif # DESKTOP_BT_CENTRAL -if BT_CTLR - -choice BT_LL_CHOICE - default BT_LL_SOFTDEVICE - help - nRF Desktop devices should use the Softdevice controller by default. - Other controller variants may be used for resource-constrained - devices. -endchoice +if HAS_BT_CTLR choice BT_CTLR_TX_PWR default BT_CTLR_TX_PWR_0 @@ -282,7 +274,7 @@ config BT_CTLR_CONN_PARAM_REQ nRF Desktop devices disable support for the Connection Parameter Request feature as it is not needed. -endif # BT_CTLR +endif # HAS_BT_CTLR config BT_DEVICE_NAME default DESKTOP_DEVICE_PRODUCT diff --git a/boards/nordic/nrf52810dmouse/Kconfig.defconfig b/boards/nordic/nrf52810dmouse/Kconfig.defconfig index 2251139128e2..d9866927ec40 100644 --- a/boards/nordic/nrf52810dmouse/Kconfig.defconfig +++ b/boards/nordic/nrf52810dmouse/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52810DMOUSE -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/nrf52820dongle/Kconfig.defconfig b/boards/nordic/nrf52820dongle/Kconfig.defconfig index 5214f0a6a2b9..080649e904ba 100644 --- a/boards/nordic/nrf52820dongle/Kconfig.defconfig +++ b/boards/nordic/nrf52820dongle/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52820DONGLE -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/nrf52833dongle/Kconfig.defconfig b/boards/nordic/nrf52833dongle/Kconfig.defconfig index 80279a0fceab..8a810243637e 100644 --- a/boards/nordic/nrf52833dongle/Kconfig.defconfig +++ b/boards/nordic/nrf52833dongle/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52833DONGLE -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/nrf52840gmouse/Kconfig.defconfig b/boards/nordic/nrf52840gmouse/Kconfig.defconfig index 92dc9bebdd55..ee408f3124bb 100644 --- a/boards/nordic/nrf52840gmouse/Kconfig.defconfig +++ b/boards/nordic/nrf52840gmouse/Kconfig.defconfig @@ -13,9 +13,6 @@ config IEEE802154_NRF5 endif # IEEE802154 -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/nrf52dmouse/Kconfig.defconfig b/boards/nordic/nrf52dmouse/Kconfig.defconfig index b4f411bf315c..7f0b642c3006 100644 --- a/boards/nordic/nrf52dmouse/Kconfig.defconfig +++ b/boards/nordic/nrf52dmouse/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52DMOUSE -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/nrf52kbd/Kconfig.defconfig b/boards/nordic/nrf52kbd/Kconfig.defconfig index e70306c6515d..ad9ac577ebb7 100644 --- a/boards/nordic/nrf52kbd/Kconfig.defconfig +++ b/boards/nordic/nrf52kbd/Kconfig.defconfig @@ -6,9 +6,6 @@ if BOARD_NRF52KBD -config BT_CTLR - default BT - config HW_STACK_PROTECTION default ARCH_HAS_STACK_PROTECTION diff --git a/boards/nordic/thingy91x/Kconfig b/boards/nordic/thingy91x/Kconfig index 7fcd1cdc89dd..09c7f5197753 100644 --- a/boards/nordic/thingy91x/Kconfig +++ b/boards/nordic/thingy91x/Kconfig @@ -32,11 +32,6 @@ endif if BOARD_THINGY91X_NRF5340_CPUNET -# BT_CTLR depends on BT. When BT is enabled we should default to also -# enabling the controller. -config BT_CTLR - default y if BT - config BT_ECC default y if BT diff --git a/boards/nordic/thingy91x/Kconfig.defconfig.nrf5340 b/boards/nordic/thingy91x/Kconfig.defconfig.nrf5340 index f789488a53dc..d03191722bd4 100644 --- a/boards/nordic/thingy91x/Kconfig.defconfig.nrf5340 +++ b/boards/nordic/thingy91x/Kconfig.defconfig.nrf5340 @@ -75,13 +75,6 @@ endif # BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS config MBOX_NRFX_IPC default MBOX -if BOARD_THINGY91X_NRF5340_CPUNET - -config BT_CTLR - default y if BT - -endif # BOARD_THINGY91X_NRF5340_CPUNET - config USE_SEGGER_RTT default y if BOARD_THINGY91X_NRF5340_CPUAPP || BOARD_THINGY91X_NRF5340_CPUAPP_NS || BOARD_THINGY91X_NRF5340_CPUNET diff --git a/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf b/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf index 457fd9a0f487..668e2d91e88b 100644 --- a/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf +++ b/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf @@ -1,7 +1,6 @@ # Override prj.conf defaults CONFIG_GPIO=y -CONFIG_BT_CTLR=y CONFIG_MAIN_STACK_SIZE=1024 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 CONFIG_BT_WAIT_NOP=y diff --git a/samples/bluetooth/mesh/light_ctrl/src/main.c b/samples/bluetooth/mesh/light_ctrl/src/main.c index d23f48d2b373..4a6f27c77ecc 100644 --- a/samples/bluetooth/mesh/light_ctrl/src/main.c +++ b/samples/bluetooth/mesh/light_ctrl/src/main.c @@ -18,7 +18,7 @@ #ifdef CONFIG_EMDS #include -#if defined(CONFIG_BT_CTLR) +#if defined(CONFIG_HAS_BT_CTLR) #include #endif @@ -57,7 +57,7 @@ static void isr_emds_cb(void *arg) { ARG_UNUSED(arg); -#if defined(CONFIG_BT_CTLR) +#if defined(CONFIG_HAS_BT_CTLR) int32_t err = mpsl_lib_uninit(); if (err != 0) { diff --git a/samples/common/mcumgr_bt_ota_dfu/Kconfig b/samples/common/mcumgr_bt_ota_dfu/Kconfig index ba124e4de095..a5fa0051f7c9 100644 --- a/samples/common/mcumgr_bt_ota_dfu/Kconfig +++ b/samples/common/mcumgr_bt_ota_dfu/Kconfig @@ -116,7 +116,7 @@ endif # NCS_SAMPLE_MCUMGR_BT_OTA_DFU config NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP bool "MCUmgr OTA DFU speedup" - depends on BT_CTLR || BT_HCI_HOST + depends on HAS_BT_CTLR || BT_HCI_HOST help Enable this option to speed up the OTA DFU transfer over Bluetooth. This option extends the Bluetooth buffers to extend Bluetooth MTU @@ -135,7 +135,7 @@ config BT_BUF_ACL_RX_SIZE default 502 config BT_CTLR_DATA_LENGTH_MAX - default 251 if BT_CTLR + default 251 if HAS_BT_CTLR endif # NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP diff --git a/samples/nrf_rpc/protocols_serialization/client/Kconfig b/samples/nrf_rpc/protocols_serialization/client/Kconfig index d4fbfd8ff3d4..40b1feb1452b 100644 --- a/samples/nrf_rpc/protocols_serialization/client/Kconfig +++ b/samples/nrf_rpc/protocols_serialization/client/Kconfig @@ -6,9 +6,6 @@ menu "Protocols serialization client" -config BT_CTLR - default n - choice BT_NUS_LOG_LEVEL_CHOICE default BT_NUS_LOG_LEVEL_DBG if DEBUG endchoice diff --git a/scripts/west_commands/create_board/ncs_create_board.py b/scripts/west_commands/create_board/ncs_create_board.py index aa6d7b8fde08..4855c4c74607 100644 --- a/scripts/west_commands/create_board/ncs_create_board.py +++ b/scripts/west_commands/create_board/ncs_create_board.py @@ -5,7 +5,7 @@ import json import shutil -from jinja2 import Environment, FileSystemLoader +from jinja2 import Environment, FileSystemLoader, TemplateNotFound from west.commands import WestCommand from west import log from yaml import load @@ -167,9 +167,12 @@ def do_run(self, args, unknown_args): with open(out_dir / f"board.yml", "w") as f: f.write(tmpl.render()) - tmpl = env.get_template("Kconfig.defconfig.jinja2") - with open(out_dir / f"Kconfig.defconfig", "w") as f: - f.write(tmpl.render(config)) + try: + tmpl = env.get_template("Kconfig.defconfig.jinja2") + with open(out_dir / f"Kconfig.defconfig", "w") as f: + f.write(tmpl.render(config)) + except TemplateNotFound: + pass # nrf53 specific files if series == "nrf53": diff --git a/scripts/west_commands/create_board/templates/nrf52/Kconfig.defconfig.jinja2 b/scripts/west_commands/create_board/templates/nrf52/Kconfig.defconfig.jinja2 deleted file mode 100644 index 7bc3de6dccf9..000000000000 --- a/scripts/west_commands/create_board/templates/nrf52/Kconfig.defconfig.jinja2 +++ /dev/null @@ -1,6 +0,0 @@ -if BOARD_{{ board | upper }} - -config BT_CTLR - default BT - -endif # BOARD_{{ board | upper }} diff --git a/scripts/west_commands/create_board/templates/nrf53/Kconfig.defconfig.jinja2 b/scripts/west_commands/create_board/templates/nrf53/Kconfig.defconfig.jinja2 index 88294c603e0e..2f322bffa177 100644 --- a/scripts/west_commands/create_board/templates/nrf53/Kconfig.defconfig.jinja2 +++ b/scripts/west_commands/create_board/templates/nrf53/Kconfig.defconfig.jinja2 @@ -54,10 +54,3 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD default 4096 if BT_HCI_IPC endif # BOARD_{{ board | upper }}_NRF5340_CPUAPP || BOARD_{{ board | upper }}_NRF5340_CPUAPP_NS - -if BOARD_{{ board | upper }}_NRF5340_CPUNET - -config BT_CTLR - default y if BT - -endif # BOARD_{{ board | upper }}_NRF5340_CPUNET diff --git a/scripts/west_commands/create_board/templates/nrf54l/Kconfig.defconfig.jinja2 b/scripts/west_commands/create_board/templates/nrf54l/Kconfig.defconfig.jinja2 index bdb12bdfd778..de016bde0ab9 100644 --- a/scripts/west_commands/create_board/templates/nrf54l/Kconfig.defconfig.jinja2 +++ b/scripts/west_commands/create_board/templates/nrf54l/Kconfig.defconfig.jinja2 @@ -1,8 +1,5 @@ if BOARD_{{ board | upper }}_CPUAPP -config BT_CTLR - default BT - config ROM_START_OFFSET default 0x800 if BOOTLOADER_MCUBOOT diff --git a/subsys/bluetooth/Kconfig b/subsys/bluetooth/Kconfig index a439143aed8d..9c511009251d 100644 --- a/subsys/bluetooth/Kconfig +++ b/subsys/bluetooth/Kconfig @@ -32,7 +32,7 @@ config BT_MAX_CONN config BT_LL_SOFTDEVICE_HEADERS_INCLUDE bool depends on (SOC_SERIES_BSIM_NRFXX || SOC_FAMILY_NORDIC_NRF) - default y if !BT_CTLR + default y if !HAS_BT_CTLR help Include SoftDevice header files provided with the library. diff --git a/subsys/bluetooth/adv_prov/providers/Kconfig.tx_power b/subsys/bluetooth/adv_prov/providers/Kconfig.tx_power index 803750eec231..cb6f8882d407 100644 --- a/subsys/bluetooth/adv_prov/providers/Kconfig.tx_power +++ b/subsys/bluetooth/adv_prov/providers/Kconfig.tx_power @@ -6,7 +6,7 @@ menuconfig BT_ADV_PROV_TX_POWER bool "TX power" - select BT_CTLR_TX_PWR_DYNAMIC_CONTROL if BT_CTLR + select BT_CTLR_TX_PWR_DYNAMIC_CONTROL if HAS_BT_CTLR help Adds TX power to advertising data. Provider reads the advertising TX power from Bluetooth controller and adds predefined correction value diff --git a/subsys/bluetooth/services/fast_pair/Kconfig.fast_pair b/subsys/bluetooth/services/fast_pair/Kconfig.fast_pair index fc5ba76b6d62..80addec4dd0b 100644 --- a/subsys/bluetooth/services/fast_pair/Kconfig.fast_pair +++ b/subsys/bluetooth/services/fast_pair/Kconfig.fast_pair @@ -122,7 +122,7 @@ config BT_BUF_ACL_RX_SIZE If Fast Pair is enabled, use MTU value of 83 (recommended by the specification). config BT_CTLR_DATA_LENGTH_MAX - default 87 if BT_CTLR + default 87 if HAS_BT_CTLR help If Fast Pair is enabled, use MTU value of 83 (recommended by the specification). diff --git a/subsys/caf/modules/Kconfig.ble_adv b/subsys/caf/modules/Kconfig.ble_adv index 30b81089837e..3a35431d972e 100644 --- a/subsys/caf/modules/Kconfig.ble_adv +++ b/subsys/caf/modules/Kconfig.ble_adv @@ -110,8 +110,8 @@ endif config CAF_BLE_ADV_FILTER_ACCEPT_LIST bool "Enable filter accept list" select BT_FILTER_ACCEPT_LIST - select BT_CTLR_FILTER_ACCEPT_LIST if BT_CTLR - select BT_CTLR_PRIVACY if BT_CTLR + select BT_CTLR_FILTER_ACCEPT_LIST if HAS_BT_CTLR + select BT_CTLR_PRIVACY if HAS_BT_CTLR help If the used local identity already has bond, the device will filter incoming scan response data requests and connection requests. In diff --git a/subsys/caf/modules/Kconfig.ble_state b/subsys/caf/modules/Kconfig.ble_state index 97f1b7c50856..1f9cee53b562 100644 --- a/subsys/caf/modules/Kconfig.ble_state +++ b/subsys/caf/modules/Kconfig.ble_state @@ -58,9 +58,9 @@ config CAF_BLE_STATE_EXCHANGE_MTU config CAF_BLE_USE_LLPM bool "Enable Low Latency Packet Mode (LLPM)" - depends on (BT_CTLR_SDC_LLPM || !BT_CTLR) + depends on (BT_CTLR_SDC_LLPM || !HAS_BT_CTLR) depends on !SOC_SERIES_NRF53X - default y if BT_CTLR + default y if HAS_BT_CTLR help LLPM is a proprietary Bluetooth extension from Nordic Semiconductor. It is designed for applications in which the interface response time is critical for the user. It introduces diff --git a/subsys/zigbee/osif/zb_nrf_crypto.c b/subsys/zigbee/osif/zb_nrf_crypto.c index c5313dd5a440..f00e14789b80 100644 --- a/subsys/zigbee/osif/zb_nrf_crypto.c +++ b/subsys/zigbee/osif/zb_nrf_crypto.c @@ -9,7 +9,7 @@ #include #if CONFIG_CRYPTO_NRF_ECB #include -#elif CONFIG_BT_CTLR +#elif CONFIG_HAS_BT_CTLR #include #elif CONFIG_ZIGBEE_USE_SOFTWARE_AES #include @@ -59,7 +59,7 @@ static void encrypt_aes(zb_uint8_t *key, zb_uint8_t *msg, zb_uint8_t *c) out: cipher_free_session(dev, &ctx); } -#elif CONFIG_BT_CTLR +#elif CONFIG_HAS_BT_CTLR static void encrypt_aes(zb_uint8_t *key, zb_uint8_t *msg, zb_uint8_t *c) { int err; From 347ccf206286e21ec3227b04a771471dddd795ce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 10 Jan 2025 16:46:17 +0100 Subject: [PATCH 017/109] tests: nrfx_integration_test: Kconfig: Adapt to upstream Zephyr changes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Bluetooth LL is now selected via devicetree so remove the obsolete Kconfig stuff. See Zephyr PR 82157. Signed-off-by: Andrzej Głąbek --- tests/drivers/nrfx_integration_test/Kconfig | 13 ------------- tests/drivers/nrfx_integration_test/testcase.yaml | 4 ---- 2 files changed, 17 deletions(-) diff --git a/tests/drivers/nrfx_integration_test/Kconfig b/tests/drivers/nrfx_integration_test/Kconfig index a1da4098321a..26dbc3ea32d8 100644 --- a/tests/drivers/nrfx_integration_test/Kconfig +++ b/tests/drivers/nrfx_integration_test/Kconfig @@ -148,17 +148,4 @@ config NRFX_ALL_DRIVERS select NRFX_PRS_BOX_3 select NRFX_PRS_BOX_4 -config NRFX_AND_BT_LL_SOFTDEVICE - bool "Test nrfx integration with SoftDevice BLE LL" - select BT - -config NRFX_AND_BT_LL_SW_SPLIT - bool "Test nrfx integration with Zephyr BLE LL" - select BT - -choice BT_LL_CHOICE - default BT_LL_SOFTDEVICE if NRFX_AND_BT_LL_SOFTDEVICE - default BT_LL_SW_SPLIT if NRFX_AND_BT_LL_SW_SPLIT -endchoice - source "Kconfig.zephyr" diff --git a/tests/drivers/nrfx_integration_test/testcase.yaml b/tests/drivers/nrfx_integration_test/testcase.yaml index 30df0785b0aa..0ff54a829bcc 100644 --- a/tests/drivers/nrfx_integration_test/testcase.yaml +++ b/tests/drivers/nrfx_integration_test/testcase.yaml @@ -37,8 +37,6 @@ tests: - ci_build - sysbuild - ci_tests_drivers_nrfx_integration_test - extra_configs: - - CONFIG_NRFX_AND_BT_LL_SOFTDEVICE=y platform_allow: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpunet @@ -54,8 +52,6 @@ tests: - ci_build - sysbuild - ci_tests_drivers_nrfx_integration_test - extra_configs: - - CONFIG_NRFX_AND_BT_LL_SW_SPLIT=y extra_args: SNIPPET="bt-ll-sw-split" platform_allow: - nrf52840dk/nrf52840 From 24aec3bfc81e917da777c201a59ea01e7f24175f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 11 Jan 2025 13:55:11 +0100 Subject: [PATCH 018/109] zigbee: osif: Replace net_pkt_set_txtime with net_pkt_set_timestamp_ns MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit net_pkt_set_txtime() was deprecated for two Zephyr releases and has been finally removed. net_pkt_set_timestamp_ns() is to be used instead. Signed-off-by: Andrzej Głąbek --- subsys/zigbee/osif/zb_nrf_transceiver.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/zigbee/osif/zb_nrf_transceiver.c b/subsys/zigbee/osif/zb_nrf_transceiver.c index 5eb9b8ed189c..46681a9b732b 100644 --- a/subsys/zigbee/osif/zb_nrf_transceiver.c +++ b/subsys/zigbee/osif/zb_nrf_transceiver.c @@ -349,7 +349,7 @@ zb_bool_t zb_trans_transmit(zb_uint8_t wait_type, zb_time_t tx_at, return ZB_FALSE; } - net_pkt_set_txtime(pkt, (uint64_t)tx_at * NSEC_PER_USEC); + net_pkt_set_timestamp_ns(pkt, (uint64_t)tx_at * NSEC_PER_USEC); state_cache.radio_state = RADIO_802154_STATE_TRANSMIT; err = radio_api->tx(radio_dev, IEEE802154_TX_MODE_TXTIME, From 6aa66917babf897272febe1e4d75994ee518fda0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 11 Jan 2025 14:16:57 +0100 Subject: [PATCH 019/109] samples: Disable CDC_ACM logging when CDC_ACM is used for shell/console MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Such configuration would lead to a recursive logging loop and a special check catching it was introduced, so now it generates a build warning. See Zephyr PR 78449. Signed-off-by: Andrzej Głąbek --- samples/wifi/shell/boards/thingy91x_nrf5340_cpuapp.conf | 1 + samples/zigbee/shell/prj_usb.conf | 1 + 2 files changed, 2 insertions(+) diff --git a/samples/wifi/shell/boards/thingy91x_nrf5340_cpuapp.conf b/samples/wifi/shell/boards/thingy91x_nrf5340_cpuapp.conf index 8e8e6e36b7fb..c02f67e58778 100644 --- a/samples/wifi/shell/boards/thingy91x_nrf5340_cpuapp.conf +++ b/samples/wifi/shell/boards/thingy91x_nrf5340_cpuapp.conf @@ -17,6 +17,7 @@ CONFIG_NFCT_PINS_AS_GPIOS=y CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_PRODUCT="Thingy:91 X Wi-Fi Shell" CONFIG_USB_CDC_ACM=y +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_USB_COMPOSITE_DEVICE=y CONFIG_USB_MASS_STORAGE=n CONFIG_USB_DEVICE_MANUFACTURER="Nordic Semiconductor" diff --git a/samples/zigbee/shell/prj_usb.conf b/samples/zigbee/shell/prj_usb.conf index a4620f4c569b..8e5b9d97f844 100644 --- a/samples/zigbee/shell/prj_usb.conf +++ b/samples/zigbee/shell/prj_usb.conf @@ -58,6 +58,7 @@ CONFIG_USB_DEVICE_STACK=y CONFIG_USB_DEVICE_REMOTE_WAKEUP=n CONFIG_USB_DEVICE_PRODUCT="Zigbee Shell" CONFIG_USB_CDC_ACM=y +CONFIG_USB_CDC_ACM_LOG_LEVEL_OFF=y CONFIG_UART_LINE_CTRL=y # Initialize USB device as soon as possible as the USB CDC ACM is used # as backend for both Shell and Logging subsystems. From 76924710c9bfd0f467ae8f32c93c56c23e49119c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 11 Jan 2025 14:31:18 +0100 Subject: [PATCH 020/109] samples: Rename cdc_acm_uart node label to board_cdc_acm_uart MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow the renaming applied in upstream Zephyr when common CDC ACM UART configuration was introduced. See Zephyr PR 81308. Signed-off-by: Andrzej Głąbek --- .../sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay | 2 +- .../coprocessor/boards/nrf52840dongle_nrf52840.overlay | 2 +- .../zigbee/ncp/boards/nrf52840dongle_nrf52840_dongle.overlay | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/bluetooth/fast_pair/locator_tag/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay b/samples/bluetooth/fast_pair/locator_tag/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay index 407f3f83a94a..6651c4d270e8 100644 --- a/samples/bluetooth/fast_pair/locator_tag/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay +++ b/samples/bluetooth/fast_pair/locator_tag/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.overlay @@ -4,6 +4,6 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -&cdc_acm_uart { +&board_cdc_acm_uart { status = "disabled"; }; diff --git a/samples/openthread/coprocessor/boards/nrf52840dongle_nrf52840.overlay b/samples/openthread/coprocessor/boards/nrf52840dongle_nrf52840.overlay index ef3ccdd0cba5..7ed19b5a85a3 100644 --- a/samples/openthread/coprocessor/boards/nrf52840dongle_nrf52840.overlay +++ b/samples/openthread/coprocessor/boards/nrf52840dongle_nrf52840.overlay @@ -16,6 +16,6 @@ }; chosen { - zephyr,ot-uart = &cdc_acm_uart; + zephyr,ot-uart = &board_cdc_acm_uart; }; }; diff --git a/samples/zigbee/ncp/boards/nrf52840dongle_nrf52840_dongle.overlay b/samples/zigbee/ncp/boards/nrf52840dongle_nrf52840_dongle.overlay index e8ebc4a851a5..163f04fb5285 100644 --- a/samples/zigbee/ncp/boards/nrf52840dongle_nrf52840_dongle.overlay +++ b/samples/zigbee/ncp/boards/nrf52840dongle_nrf52840_dongle.overlay @@ -6,7 +6,7 @@ / { chosen { - ncs,zigbee-uart = &cdc_acm_uart; + ncs,zigbee-uart = &board_cdc_acm_uart; }; buttons { From f1b47f515701d7a3391629a99b4e340eab3c9e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 13 Jan 2025 16:07:46 +0100 Subject: [PATCH 021/109] samples: direction_finding: Remove unnecessary configuration entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BT_LL_SW_SPLIT option is now automatically enabled based on the corresponding node ("zephyr,bt-hci-ll-sw-split" compatible) being enabled in devicetree (and this is done by the bt-ll-sw-split snippet). The BT_CTLR option is deprecated in favor of HAS_BT_CTLR which is selected accordingly by LL implementations. Signed-off-by: Andrzej Głąbek --- .../direction_finding_central/boards/nrf52833dk_nrf52820.conf | 3 --- .../direction_finding_central/boards/nrf52833dk_nrf52833.conf | 3 --- .../direction_finding_central/sysbuild/ipc_radio/prj.conf | 3 --- .../boards/nrf52833dk_nrf52820.conf | 3 --- .../boards/nrf52833dk_nrf52833.conf | 3 --- .../sysbuild/ipc_radio/prj.conf | 3 --- .../overlay-bt_ll_sw_split.conf | 3 --- .../direction_finding_peripheral/overlay-bt_ll_sw_split.conf | 3 --- 8 files changed, 24 deletions(-) diff --git a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf index 18a076bcfcc3..90967479c3ab 100644 --- a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf +++ b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52820.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf index 18a076bcfcc3..90967479c3ab 100644 --- a/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf +++ b/samples/bluetooth/direction_finding_central/boards/nrf52833dk_nrf52833.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_central/sysbuild/ipc_radio/prj.conf b/samples/bluetooth/direction_finding_central/sysbuild/ipc_radio/prj.conf index 20c7699d86c2..556ab546e545 100644 --- a/samples/bluetooth/direction_finding_central/sysbuild/ipc_radio/prj.conf +++ b/samples/bluetooth/direction_finding_central/sysbuild/ipc_radio/prj.conf @@ -16,9 +16,6 @@ CONFIG_BT_MAX_CONN=16 # CONFIG_BT_BUF_ACL_TX_SIZE=251 # CONFIG_BT_BUF_CMD_TX_SIZE=255 -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y diff --git a/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52820.conf b/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52820.conf index d030f006d949..4a675a91ce04 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52820.conf +++ b/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52820.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y diff --git a/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf b/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf index 96498c082021..d5d8d82fa206 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf +++ b/samples/bluetooth/direction_finding_connectionless_rx/boards/nrf52833dk_nrf52833.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y diff --git a/samples/bluetooth/direction_finding_connectionless_rx/sysbuild/ipc_radio/prj.conf b/samples/bluetooth/direction_finding_connectionless_rx/sysbuild/ipc_radio/prj.conf index 884172611490..26b9acdc0d51 100644 --- a/samples/bluetooth/direction_finding_connectionless_rx/sysbuild/ipc_radio/prj.conf +++ b/samples/bluetooth/direction_finding_connectionless_rx/sysbuild/ipc_radio/prj.conf @@ -23,9 +23,6 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_OBSERVER=y -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y diff --git a/samples/bluetooth/direction_finding_connectionless_tx/overlay-bt_ll_sw_split.conf b/samples/bluetooth/direction_finding_connectionless_tx/overlay-bt_ll_sw_split.conf index 0ad2b92a3612..f357ef8f3221 100644 --- a/samples/bluetooth/direction_finding_connectionless_tx/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/direction_finding_connectionless_tx/overlay-bt_ll_sw_split.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y diff --git a/samples/bluetooth/direction_finding_peripheral/overlay-bt_ll_sw_split.conf b/samples/bluetooth/direction_finding_peripheral/overlay-bt_ll_sw_split.conf index d5c5c57f3ffb..d4eafc04d88a 100644 --- a/samples/bluetooth/direction_finding_peripheral/overlay-bt_ll_sw_split.conf +++ b/samples/bluetooth/direction_finding_peripheral/overlay-bt_ll_sw_split.conf @@ -4,9 +4,6 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -CONFIG_BT_CTLR=y -CONFIG_BT_LL_SW_SPLIT=y - # Enable Direction Finding Feature including AoA and AoD CONFIG_BT_CTLR_DF=y From 919ad14e682b9d7565d6a1005a05da5e1355f1eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 14 Jan 2025 10:42:02 +0100 Subject: [PATCH 022/109] Kconfig.nrf: Add NRF_SECURITY_ENABLER MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add an option that will make NRF_SECURITY enabled when this is required for builds involving BT. This is a temporary solution, just to unblock building of many samples and tests. It is supposed to be eventually replaced with something more suitable. Signed-off-by: Andrzej Głąbek --- Kconfig.nrf | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Kconfig.nrf b/Kconfig.nrf index 8b6e648b2f3d..3b3dea7b299d 100644 --- a/Kconfig.nrf +++ b/Kconfig.nrf @@ -113,6 +113,11 @@ config FLASH_SIZE default 1524 endif +config NRF_SECURITY_ENABLER + def_bool y + imply NRF_SECURITY if BT_CRYPTO || BT_HOST_CRYPTO || BT_MESH_USES_MBEDTLS_PSA || BT_FAST_PAIR_CRYPTO_PSA + imply ENTROPY_GENERATOR if BOARD_NATIVE_SIM + imply PSA_WANT_GENERATE_RANDOM if BT_HOST_CRYPTO_PRNG rsource "samples/Kconfig" rsource "subsys/Kconfig" From 24712ff0df1d02c8f3d879283493093d3181fcb2 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Wed, 20 Nov 2024 16:57:36 +0000 Subject: [PATCH 023/109] samples: bluetooth: Update to no longer use deprecated adv resume MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit zephyr commit 8cfad44852845cd30336d40f61dade69ab4357db removed the auto adv resume and deprecated the options that were using this. So this commit updates all uses of the deprecated options in nrf. Also update accordingly find-my and sidewalk modules. Signed-off-by: Sean Madigan Signed-off-by: Andrzej Głąbek --- .../connectivity_bridge/src/modules/ble_handler.c | 2 +- .../src/bluetooth/bt_management/bt_mgmt.h | 11 +++++------ .../src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c | 2 +- .../bluetooth/central_and_peripheral_hr/src/main.c | 2 +- .../channel_sounding_ras_reflector/src/main.c | 2 +- samples/bluetooth/conn_time_sync/src/peripheral.c | 2 +- .../bluetooth/direction_finding_peripheral/src/main.c | 2 +- samples/bluetooth/event_trigger/src/main.c | 2 +- .../fast_pair/input_device/src/bt_adv_helper.c | 2 +- samples/bluetooth/fast_pair/locator_tag/src/fp_adv.c | 2 +- samples/bluetooth/iso_time_sync/src/cis_peripheral.c | 2 +- samples/bluetooth/llpm/src/main.c | 2 +- .../ble_peripheral_lbs_coex/src/lb_service_handler.c | 2 +- samples/bluetooth/mesh/common/smp_bt.c | 2 +- samples/bluetooth/multiple_adv_sets/src/main.c | 2 +- samples/bluetooth/nrf_dm/src/main.c | 2 +- samples/bluetooth/peripheral_ams_client/src/main.c | 2 +- samples/bluetooth/peripheral_ancs_client/src/main.c | 2 +- samples/bluetooth/peripheral_bms/src/main.c | 2 +- samples/bluetooth/peripheral_cgms/src/main.c | 2 +- samples/bluetooth/peripheral_cts_client/src/main.c | 2 +- samples/bluetooth/peripheral_gatt_dm/src/main.c | 2 +- samples/bluetooth/peripheral_hids_keyboard/src/main.c | 3 +-- samples/bluetooth/peripheral_hids_mouse/src/main.c | 3 +-- samples/bluetooth/peripheral_hr_coded/src/main.c | 2 +- samples/bluetooth/peripheral_lbs/src/main.c | 2 +- samples/bluetooth/peripheral_mds/src/main.c | 2 +- samples/bluetooth/peripheral_nfc_pairing/src/main.c | 3 +-- .../bluetooth/peripheral_power_profiling/src/main.c | 2 +- samples/bluetooth/peripheral_rscs/src/main.c | 2 +- samples/bluetooth/peripheral_status/src/main.c | 2 +- samples/bluetooth/peripheral_uart/src/main.c | 2 +- .../peripheral_with_multiple_identities/src/main.c | 2 +- .../bluetooth/radio_notification_cb/src/peripheral.c | 2 +- samples/bluetooth/shell_bt_nus/src/main.c | 2 +- samples/bluetooth/subrating/src/main.c | 3 +-- samples/bluetooth/throughput/src/main.c | 3 +-- samples/matter/common/src/bt_nus/bt_nus_service.cpp | 2 +- samples/matter/common/src/dfu/smp/dfu_over_smp.cpp | 2 +- samples/openthread/cli/src/ble.c | 2 +- samples/openthread/coap_client/src/ble_utils.c | 2 +- samples/wifi/ble_coex/src/bt_throughput_test.c | 3 +-- samples/wifi/provisioning/ble/src/main.c | 4 ++-- samples/zigbee/light_switch/src/nus_cmd.c | 2 +- subsys/bluetooth/services/fast_pair/fmdn/state.c | 2 +- subsys/caf/modules/ble_adv.c | 2 +- tests/bluetooth/iso/modules/peripheral.c | 3 +-- west.yml | 4 ++-- 48 files changed, 54 insertions(+), 62 deletions(-) diff --git a/applications/connectivity_bridge/src/modules/ble_handler.c b/applications/connectivity_bridge/src/modules/ble_handler.c index 6359561519d4..227956f41f59 100644 --- a/applications/connectivity_bridge/src/modules/ble_handler.c +++ b/applications/connectivity_bridge/src/modules/ble_handler.c @@ -222,7 +222,7 @@ static void adv_start(void) err = bt_le_adv_start( BT_LE_ADV_PARAM( - BT_LE_ADV_OPT_CONNECTABLE, + BT_LE_ADV_OPT_CONN, BT_GAP_ADV_SLOW_INT_MIN, BT_GAP_ADV_SLOW_INT_MAX, NULL), diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.h b/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.h index 302eca3198a2..e0263d9e3469 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.h +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/bt_mgmt.h @@ -16,13 +16,12 @@ CONFIG_BLE_ACL_EXT_ADV_INT_MIN, CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL) #define LE_AUDIO_EXTENDED_ADV_CONN_NAME \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_USE_NAME, \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_NAME, \ CONFIG_BLE_ACL_EXT_ADV_INT_MIN, CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL) #define LE_AUDIO_EXTENDED_ADV_CONN_NAME_FILTER \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_USE_NAME | BT_LE_ADV_OPT_FILTER_CONN, \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_NAME | \ + BT_LE_ADV_OPT_FILTER_CONN, \ CONFIG_BLE_ACL_EXT_ADV_INT_MIN, CONFIG_BLE_ACL_EXT_ADV_INT_MAX, NULL) #define LE_AUDIO_PERIODIC_ADV \ @@ -30,8 +29,8 @@ BT_LE_PER_ADV_OPT_NONE) #define BT_LE_ADV_FAST_CONN \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, BT_GAP_ADV_FAST_INT_MIN_1, \ - BT_GAP_ADV_FAST_INT_MAX_1, NULL) + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_1, BT_GAP_ADV_FAST_INT_MAX_1, \ + NULL) /* Broadcast name can be max 32 bytes long, so this will be the limit for both. * Add one for '\0' at the end. diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c b/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c index a6bece89c988..d87f20cc9d4d 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/dfu/bt_mgmt_dfu.c @@ -36,7 +36,7 @@ static void smp_adv(void) { int ret; - ret = bt_le_adv_start(BT_LE_ADV_CONN, ad_peer, ARRAY_SIZE(ad_peer), sd_peer, + ret = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad_peer, ARRAY_SIZE(ad_peer), sd_peer, ARRAY_SIZE(sd_peer)); if (ret) { LOG_ERR("SMP_SVR Advertising failed to start (ret %d)", ret); diff --git a/samples/bluetooth/central_and_peripheral_hr/src/main.c b/samples/bluetooth/central_and_peripheral_hr/src/main.c index 2716ba46e460..5bdedb50181e 100644 --- a/samples/bluetooth/central_and_peripheral_hr/src/main.c +++ b/samples/bluetooth/central_and_peripheral_hr/src/main.c @@ -425,7 +425,7 @@ int main(void) printk("Scanning started\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/channel_sounding_ras_reflector/src/main.c b/samples/bluetooth/channel_sounding_ras_reflector/src/main.c index 41f8171519c9..baa6e78ed2fe 100644 --- a/samples/bluetooth/channel_sounding_ras_reflector/src/main.c +++ b/samples/bluetooth/channel_sounding_ras_reflector/src/main.c @@ -115,7 +115,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); return 0; diff --git a/samples/bluetooth/conn_time_sync/src/peripheral.c b/samples/bluetooth/conn_time_sync/src/peripheral.c index 6b8e11cff031..e339e3422605 100644 --- a/samples/bluetooth/conn_time_sync/src/peripheral.c +++ b/samples/bluetooth/conn_time_sync/src/peripheral.c @@ -68,7 +68,7 @@ static void adv_start(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/direction_finding_peripheral/src/main.c b/samples/bluetooth/direction_finding_peripheral/src/main.c index 6673f91d8abf..b8191450b0ea 100644 --- a/samples/bluetooth/direction_finding_peripheral/src/main.c +++ b/samples/bluetooth/direction_finding_peripheral/src/main.c @@ -98,7 +98,7 @@ static void bt_ready(void) printk("Bluetooth initialized\n"); - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/event_trigger/src/main.c b/samples/bluetooth/event_trigger/src/main.c index 1910754b9379..ddd646720810 100644 --- a/samples/bluetooth/event_trigger/src/main.c +++ b/samples/bluetooth/event_trigger/src/main.c @@ -175,7 +175,7 @@ static void adv_start(void) int err; err = bt_le_adv_start( - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL), diff --git a/samples/bluetooth/fast_pair/input_device/src/bt_adv_helper.c b/samples/bluetooth/fast_pair/input_device/src/bt_adv_helper.c index 2caf112f07dd..37c7eaeebac7 100644 --- a/samples/bluetooth/fast_pair/input_device/src/bt_adv_helper.c +++ b/samples/bluetooth/fast_pair/input_device/src/bt_adv_helper.c @@ -100,7 +100,7 @@ static int adv_start_internal(void) */ static const struct bt_le_adv_param adv_param = { .id = BT_ID_DEFAULT, - .options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME), + .options = BT_LE_ADV_OPT_CONN, .interval_min = BT_GAP_ADV_FAST_INT_MIN_1, .interval_max = BT_GAP_ADV_FAST_INT_MAX_1, .peer = NULL, diff --git a/samples/bluetooth/fast_pair/locator_tag/src/fp_adv.c b/samples/bluetooth/fast_pair/locator_tag/src/fp_adv.c index 56d4f1962d91..997a8fc33c62 100644 --- a/samples/bluetooth/fast_pair/locator_tag/src/fp_adv.c +++ b/samples/bluetooth/fast_pair/locator_tag/src/fp_adv.c @@ -59,7 +59,7 @@ static const char * const fp_adv_mode_description[] = { */ static struct bt_le_adv_param fp_adv_param = { .id = BT_ID_DEFAULT, - .options = (BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME), + .options = BT_LE_ADV_OPT_CONN, .interval_min = FP_ADV_INTERVAL, .interval_max = FP_ADV_INTERVAL, }; diff --git a/samples/bluetooth/iso_time_sync/src/cis_peripheral.c b/samples/bluetooth/iso_time_sync/src/cis_peripheral.c index 833814d748ef..eae0cdfdf831 100644 --- a/samples/bluetooth/iso_time_sync/src/cis_peripheral.c +++ b/samples/bluetooth/iso_time_sync/src/cis_peripheral.c @@ -98,7 +98,7 @@ void cis_peripheral_start(bool do_tx) return; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/llpm/src/main.c b/samples/bluetooth/llpm/src/main.c index 7f2666b6da06..3d321848b45a 100644 --- a/samples/bluetooth/llpm/src/main.c +++ b/samples/bluetooth/llpm/src/main.c @@ -153,7 +153,7 @@ static void adv_start(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/lb_service_handler.c b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/lb_service_handler.c index c4949115baaf..3b79ef729782 100644 --- a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/lb_service_handler.c +++ b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/src/lb_service_handler.c @@ -119,7 +119,7 @@ static void lbs_adv_start(void) { int err; size_t id_count = 0xFF; - struct bt_le_adv_param adv_params = *BT_LE_ADV_CONN; + struct bt_le_adv_param adv_params = *BT_LE_ADV_CONN_FAST_2; /* Use different identity from Bluetooth Mesh to avoid conflicts with Mesh Provisioning * Service and Mesh Proxy Service advertisements. */ diff --git a/samples/bluetooth/mesh/common/smp_bt.c b/samples/bluetooth/mesh/common/smp_bt.c index 2860cd2072da..db14ed4fecc8 100644 --- a/samples/bluetooth/mesh/common/smp_bt.c +++ b/samples/bluetooth/mesh/common/smp_bt.c @@ -26,7 +26,7 @@ static struct bt_le_adv_param adv_params = { .id = BT_ID_DEFAULT, .sid = 0, .secondary_max_skip = 0, - .options = BT_LE_ADV_OPT_CONNECTABLE, + .options = BT_LE_ADV_OPT_CONN, .interval_min = BT_GAP_ADV_SLOW_INT_MIN, .interval_max = BT_GAP_ADV_SLOW_INT_MAX, .peer = NULL diff --git a/samples/bluetooth/multiple_adv_sets/src/main.c b/samples/bluetooth/multiple_adv_sets/src/main.c index b2d9e47c50ec..4b8898572c63 100644 --- a/samples/bluetooth/multiple_adv_sets/src/main.c +++ b/samples/bluetooth/multiple_adv_sets/src/main.c @@ -37,7 +37,7 @@ static const struct bt_le_adv_param *non_connectable_adv_param = NULL); static const struct bt_le_adv_param *connectable_adv_param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, /* 100 ms */ BT_GAP_ADV_FAST_INT_MAX_2, /* 150 ms */ NULL); diff --git a/samples/bluetooth/nrf_dm/src/main.c b/samples/bluetooth/nrf_dm/src/main.c index 8d0fb5cab7c0..ccb650a8e9ab 100644 --- a/samples/bluetooth/nrf_dm/src/main.c +++ b/samples/bluetooth/nrf_dm/src/main.c @@ -40,7 +40,7 @@ struct adv_mfg_data { static struct adv_mfg_data mfg_data; struct bt_le_adv_param adv_param_conn = - BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | + BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_NOTIFY_SCAN_REQ, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, diff --git a/samples/bluetooth/peripheral_ams_client/src/main.c b/samples/bluetooth/peripheral_ams_client/src/main.c index fb36e46b56a4..4de68bd79392 100644 --- a/samples/bluetooth/peripheral_ams_client/src/main.c +++ b/samples/bluetooth/peripheral_ams_client/src/main.c @@ -479,7 +479,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_ancs_client/src/main.c b/samples/bluetooth/peripheral_ancs_client/src/main.c index 31e0f9f4b3f3..2a2072f4fb6d 100644 --- a/samples/bluetooth/peripheral_ancs_client/src/main.c +++ b/samples/bluetooth/peripheral_ancs_client/src/main.c @@ -730,7 +730,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_bms/src/main.c b/samples/bluetooth/peripheral_bms/src/main.c index a8b8012cc8e0..2b128b6c689b 100644 --- a/samples/bluetooth/peripheral_bms/src/main.c +++ b/samples/bluetooth/peripheral_bms/src/main.c @@ -217,7 +217,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_cgms/src/main.c b/samples/bluetooth/peripheral_cgms/src/main.c index 5c0249d52a3d..e8832571a2ab 100644 --- a/samples/bluetooth/peripheral_cgms/src/main.c +++ b/samples/bluetooth/peripheral_cgms/src/main.c @@ -151,7 +151,7 @@ int main(void) printk("Error occurred when initializing cgm service (err %d)\n", err); return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_cts_client/src/main.c b/samples/bluetooth/peripheral_cts_client/src/main.c index 5a0ddfaad91a..aaabc343655f 100644 --- a/samples/bluetooth/peripheral_cts_client/src/main.c +++ b/samples/bluetooth/peripheral_cts_client/src/main.c @@ -346,7 +346,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_gatt_dm/src/main.c b/samples/bluetooth/peripheral_gatt_dm/src/main.c index b30a744606ea..5f44853db4c3 100644 --- a/samples/bluetooth/peripheral_gatt_dm/src/main.c +++ b/samples/bluetooth/peripheral_gatt_dm/src/main.c @@ -250,7 +250,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_hids_keyboard/src/main.c b/samples/bluetooth/peripheral_hids_keyboard/src/main.c index facd9a4a5065..aacd17f48f70 100644 --- a/samples/bluetooth/peripheral_hids_keyboard/src/main.c +++ b/samples/bluetooth/peripheral_hids_keyboard/src/main.c @@ -170,8 +170,7 @@ static void advertising_start(void) { int err; const struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM( - BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME, + BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); diff --git a/samples/bluetooth/peripheral_hids_mouse/src/main.c b/samples/bluetooth/peripheral_hids_mouse/src/main.c index 720abcb3c4c5..0c5f42456a41 100644 --- a/samples/bluetooth/peripheral_hids_mouse/src/main.c +++ b/samples/bluetooth/peripheral_hids_mouse/src/main.c @@ -196,8 +196,7 @@ static void advertising_continue(void) return; } - adv_param = *BT_LE_ADV_CONN; - adv_param.options |= BT_LE_ADV_OPT_ONE_TIME; + adv_param = *BT_LE_ADV_CONN_FAST_2; err = bt_le_adv_start(&adv_param, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { diff --git a/samples/bluetooth/peripheral_hr_coded/src/main.c b/samples/bluetooth/peripheral_hr_coded/src/main.c index 985183457bee..eb8c4e06055b 100644 --- a/samples/bluetooth/peripheral_hr_coded/src/main.c +++ b/samples/bluetooth/peripheral_hr_coded/src/main.c @@ -94,7 +94,7 @@ static int create_advertising_coded(void) { int err; struct bt_le_adv_param param = - BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE | + BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CODED, BT_GAP_ADV_FAST_INT_MIN_2, diff --git a/samples/bluetooth/peripheral_lbs/src/main.c b/samples/bluetooth/peripheral_lbs/src/main.c index 8ceee699c72f..fb21b433181c 100644 --- a/samples/bluetooth/peripheral_lbs/src/main.c +++ b/samples/bluetooth/peripheral_lbs/src/main.c @@ -233,7 +233,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_mds/src/main.c b/samples/bluetooth/peripheral_mds/src/main.c index 9d2ac9828983..788c538f2c19 100644 --- a/samples/bluetooth/peripheral_mds/src/main.c +++ b/samples/bluetooth/peripheral_mds/src/main.c @@ -332,7 +332,7 @@ int main(void) } } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); diff --git a/samples/bluetooth/peripheral_nfc_pairing/src/main.c b/samples/bluetooth/peripheral_nfc_pairing/src/main.c index a86bbdfe6d97..e05510a03038 100644 --- a/samples/bluetooth/peripheral_nfc_pairing/src/main.c +++ b/samples/bluetooth/peripheral_nfc_pairing/src/main.c @@ -213,8 +213,7 @@ static void advertising_continue(void) } else { int err; - adv_param = *BT_LE_ADV_CONN; - adv_param.options |= BT_LE_ADV_OPT_ONE_TIME; + adv_param = *BT_LE_ADV_CONN_FAST_2; err = bt_le_adv_start(&adv_param, ad, ARRAY_SIZE(ad), NULL, 0); diff --git a/samples/bluetooth/peripheral_power_profiling/src/main.c b/samples/bluetooth/peripheral_power_profiling/src/main.c index b59d6d303b80..b7ee17e679f4 100644 --- a/samples/bluetooth/peripheral_power_profiling/src/main.c +++ b/samples/bluetooth/peripheral_power_profiling/src/main.c @@ -98,7 +98,7 @@ static const struct bt_data non_connectable_sd_data[] = { }; static const struct bt_le_adv_param *connectable_ad_params = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, CONNECTABLE_ADV_INTERVAL_MIN, CONNECTABLE_ADV_INTERVAL_MAX, NULL); diff --git a/samples/bluetooth/peripheral_rscs/src/main.c b/samples/bluetooth/peripheral_rscs/src/main.c index 0bc742383630..f01e07c43f79 100644 --- a/samples/bluetooth/peripheral_rscs/src/main.c +++ b/samples/bluetooth/peripheral_rscs/src/main.c @@ -288,7 +288,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_status/src/main.c b/samples/bluetooth/peripheral_status/src/main.c index f78be8652570..6f7b3776e64f 100644 --- a/samples/bluetooth/peripheral_status/src/main.c +++ b/samples/bluetooth/peripheral_status/src/main.c @@ -218,7 +218,7 @@ int main(void) settings_load(); } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { printk("Advertising failed to start (err %d)\n", err); return 0; diff --git a/samples/bluetooth/peripheral_uart/src/main.c b/samples/bluetooth/peripheral_uart/src/main.c index 7e2d657891b5..efd2481c6830 100644 --- a/samples/bluetooth/peripheral_uart/src/main.c +++ b/samples/bluetooth/peripheral_uart/src/main.c @@ -621,7 +621,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); diff --git a/samples/bluetooth/peripheral_with_multiple_identities/src/main.c b/samples/bluetooth/peripheral_with_multiple_identities/src/main.c index a9416ea7f493..d39062acedff 100644 --- a/samples/bluetooth/peripheral_with_multiple_identities/src/main.c +++ b/samples/bluetooth/peripheral_with_multiple_identities/src/main.c @@ -126,7 +126,7 @@ static int setup_advertiser(uint8_t id_adv) /* Initialize the parameters for each connecable advertiser. */ struct bt_le_adv_param adv_param = - BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONNECTABLE, + BT_LE_ADV_PARAM_INIT(BT_LE_ADV_OPT_CONN, MIN_ADV_INTERVAL, MAX_ADV_INTERVAL, NULL); diff --git a/samples/bluetooth/radio_notification_cb/src/peripheral.c b/samples/bluetooth/radio_notification_cb/src/peripheral.c index a4f4bc91c7ad..98ee323df5ce 100644 --- a/samples/bluetooth/radio_notification_cb/src/peripheral.c +++ b/samples/bluetooth/radio_notification_cb/src/peripheral.c @@ -16,7 +16,7 @@ void adv_start(void) { int err; - err = bt_le_adv_start(BT_LE_ADV_CONN_ONE_TIME, ad, ARRAY_SIZE(ad), NULL, 0); + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), NULL, 0); if (err) { printk("Advertising failed to start (err %d)\n", err); return; diff --git a/samples/bluetooth/shell_bt_nus/src/main.c b/samples/bluetooth/shell_bt_nus/src/main.c index ab4ce3e40a40..48302a24afa4 100644 --- a/samples/bluetooth/shell_bt_nus/src/main.c +++ b/samples/bluetooth/shell_bt_nus/src/main.c @@ -151,7 +151,7 @@ int main(void) return 0; } - err = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, + err = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (err) { LOG_ERR("Advertising failed to start (err %d)", err); diff --git a/samples/bluetooth/subrating/src/main.c b/samples/bluetooth/subrating/src/main.c index 9940c8c4b99d..1ec935746ad2 100644 --- a/samples/bluetooth/subrating/src/main.c +++ b/samples/bluetooth/subrating/src/main.c @@ -162,8 +162,7 @@ static void adv_start(void) int err; const struct bt_le_adv_param *adv_param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); diff --git a/samples/bluetooth/throughput/src/main.c b/samples/bluetooth/throughput/src/main.c index 40698a307bac..b499a7952341 100644 --- a/samples/bluetooth/throughput/src/main.c +++ b/samples/bluetooth/throughput/src/main.c @@ -281,8 +281,7 @@ static void scan_start(void) static void adv_start(void) { const struct bt_le_adv_param *adv_param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); diff --git a/samples/matter/common/src/bt_nus/bt_nus_service.cpp b/samples/matter/common/src/bt_nus/bt_nus_service.cpp index 216160011754..af067d107139 100644 --- a/samples/matter/common/src/bt_nus/bt_nus_service.cpp +++ b/samples/matter/common/src/bt_nus/bt_nus_service.cpp @@ -18,7 +18,7 @@ LOG_MODULE_DECLARE(app, CONFIG_MATTER_LOG_LEVEL); namespace { -constexpr uint32_t kAdvertisingOptions = BT_LE_ADV_OPT_CONNECTABLE; +constexpr uint32_t kAdvertisingOptions = BT_LE_ADV_OPT_CONN; constexpr uint8_t kAdvertisingFlags = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; constexpr uint8_t kBTUuid[] = { BT_UUID_NUS_VAL }; } /* namespace */ diff --git a/samples/matter/common/src/dfu/smp/dfu_over_smp.cpp b/samples/matter/common/src/dfu/smp/dfu_over_smp.cpp index 33a46e656673..e14b15f6e878 100644 --- a/samples/matter/common/src/dfu/smp/dfu_over_smp.cpp +++ b/samples/matter/common/src/dfu/smp/dfu_over_smp.cpp @@ -33,7 +33,7 @@ using namespace ::chip; using namespace ::chip::DeviceLayer; constexpr static uint8_t kAdvertisingPriority = UINT8_MAX; -constexpr static uint32_t kAdvertisingOptions = BT_LE_ADV_OPT_CONNECTABLE; +constexpr static uint32_t kAdvertisingOptions = BT_LE_ADV_OPT_CONN; constexpr static uint16_t kAdvertisingIntervalMin = 400; constexpr static uint16_t kAdvertisingIntervalMax = 500; constexpr static uint8_t kAdvertisingFlags = BT_LE_AD_GENERAL | BT_LE_AD_NO_BREDR; diff --git a/samples/openthread/cli/src/ble.c b/samples/openthread/cli/src/ble.c index 6ad0c996f1a8..64a4a8c3a847 100644 --- a/samples/openthread/cli/src/ble.c +++ b/samples/openthread/cli/src/ble.c @@ -25,7 +25,7 @@ static struct bt_conn_cb conn_callbacks; void ble_enable(void) { const struct bt_le_adv_param *adv_param = BT_LE_ADV_PARAM( - BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, ADV_INT_MIN, ADV_INT_MAX, NULL); + BT_LE_ADV_OPT_CONN, ADV_INT_MIN, ADV_INT_MAX, NULL); bt_enable(NULL); bt_conn_cb_register(&conn_callbacks); diff --git a/samples/openthread/coap_client/src/ble_utils.c b/samples/openthread/coap_client/src/ble_utils.c index fd1f655a6ff5..cdb63c700e3b 100644 --- a/samples/openthread/coap_client/src/ble_utils.c +++ b/samples/openthread/coap_client/src/ble_utils.c @@ -175,7 +175,7 @@ int ble_utils_init(struct bt_nus_cb *nus_clbs, ble_connection_cb_t on_connect, goto end; } - ret = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, + ret = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (ret) { LOG_ERR("Advertising failed to start (error: %d)", ret); diff --git a/samples/wifi/ble_coex/src/bt_throughput_test.c b/samples/wifi/ble_coex/src/bt_throughput_test.c index cb64e14f98c5..f28b32570fa2 100644 --- a/samples/wifi/ble_coex/src/bt_throughput_test.c +++ b/samples/wifi/ble_coex/src/bt_throughput_test.c @@ -262,8 +262,7 @@ static void scan_start(void) static void adv_start(void) { const struct bt_le_adv_param *adv_param = - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE | - BT_LE_ADV_OPT_ONE_TIME, + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, BT_GAP_ADV_FAST_INT_MIN_2, BT_GAP_ADV_FAST_INT_MAX_2, NULL); diff --git a/samples/wifi/provisioning/ble/src/main.c b/samples/wifi/provisioning/ble/src/main.c index 6f695013efc0..2ce6de130d4e 100644 --- a/samples/wifi/provisioning/ble/src/main.c +++ b/samples/wifi/provisioning/ble/src/main.c @@ -34,11 +34,11 @@ #define ADV_DATA_FLAG_CONN_STATUS_BIT BIT(1) #define ADV_DATA_RSSI_IDX (BT_UUID_SIZE_128 + 3) -#define PROV_BT_LE_ADV_PARAM_FAST BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \ +#define PROV_BT_LE_ADV_PARAM_FAST BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, \ BT_GAP_ADV_FAST_INT_MIN_2, \ BT_GAP_ADV_FAST_INT_MAX_2, NULL) -#define PROV_BT_LE_ADV_PARAM_SLOW BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONNECTABLE, \ +#define PROV_BT_LE_ADV_PARAM_SLOW BT_LE_ADV_PARAM(BT_LE_ADV_OPT_CONN, \ BT_GAP_ADV_SLOW_INT_MIN, \ BT_GAP_ADV_SLOW_INT_MAX, NULL) diff --git a/samples/zigbee/light_switch/src/nus_cmd.c b/samples/zigbee/light_switch/src/nus_cmd.c index c7325661bcac..43e1291559a7 100644 --- a/samples/zigbee/light_switch/src/nus_cmd.c +++ b/samples/zigbee/light_switch/src/nus_cmd.c @@ -177,7 +177,7 @@ static int ble_utils_init(struct bt_nus_cb *nus_clbs, goto end; } - ret = bt_le_adv_start(BT_LE_ADV_CONN, ad, ARRAY_SIZE(ad), sd, + ret = bt_le_adv_start(BT_LE_ADV_CONN_FAST_2, ad, ARRAY_SIZE(ad), sd, ARRAY_SIZE(sd)); if (ret) { LOG_ERR("Advertising failed to start (error: %d)", ret); diff --git a/subsys/bluetooth/services/fast_pair/fmdn/state.c b/subsys/bluetooth/services/fast_pair/fmdn/state.c index ba94a9fae76f..df0b57f24f2c 100644 --- a/subsys/bluetooth/services/fast_pair/fmdn/state.c +++ b/subsys/bluetooth/services/fast_pair/fmdn/state.c @@ -125,7 +125,7 @@ static struct bt_le_adv_param fmdn_adv_param = { .options = /* Enable Extended Advertising for the SECP256R1 ECC variant. */ (IS_ENABLED(CONFIG_BT_FAST_PAIR_FMDN_ECC_SECP256R1) * BT_LE_ADV_OPT_EXT_ADV) | - BT_LE_ADV_OPT_CONNECTABLE, + BT_LE_ADV_OPT_CONN, }; static int8_t fmdn_adv_set_tx_power; diff --git a/subsys/caf/modules/ble_adv.c b/subsys/caf/modules/ble_adv.c index 760f63987873..7bada34d7090 100644 --- a/subsys/caf/modules/ble_adv.c +++ b/subsys/caf/modules/ble_adv.c @@ -358,7 +358,7 @@ static int setup_accept_list(uint8_t local_id) static int ble_adv_start_undirected(void) { struct bt_le_adv_param adv_param = { - .options = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME, + .options = BT_LE_ADV_OPT_CONN, }; __ASSERT_NO_MSG((state == STATE_ACTIVE) || (state == STATE_GRACE_PERIOD)); diff --git a/tests/bluetooth/iso/modules/peripheral.c b/tests/bluetooth/iso/modules/peripheral.c index fe222d1854aa..7f3410d84c1e 100644 --- a/tests/bluetooth/iso/modules/peripheral.c +++ b/tests/bluetooth/iso/modules/peripheral.c @@ -13,8 +13,7 @@ LOG_MODULE_REGISTER(peripheral, CONFIG_ACL_TEST_LOG_LEVEL); #define LE_AUDIO_EXTENDED_ADV_CONN_NAME \ - BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONNECTABLE | \ - BT_LE_ADV_OPT_USE_NAME, \ + BT_LE_ADV_PARAM(BT_LE_ADV_OPT_EXT_ADV | BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_USE_NAME, \ 0x100, 0x200, NULL) static struct k_work adv_work; diff --git a/west.yml b/west.yml index 216d1e792c82..405488b227c9 100644 --- a/west.yml +++ b/west.yml @@ -207,12 +207,12 @@ manifest: compare-by-default: false - name: sidewalk repo-path: sdk-sidewalk - revision: f274ce8ab97d1504de4c6b372bb98d4dc41bacc5 + revision: pull/673/head groups: - sidewalk - name: find-my repo-path: sdk-find-my - revision: 719d36b15db3f228b0d83c52f13b97145d971ea4 + revision: pull/260/head groups: - find-my - name: azure-sdk-for-c From 3bacff61a7b3da8822b716498269b1c611698e90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 14 Jan 2025 15:32:22 +0100 Subject: [PATCH 024/109] treewide: Remove redefinitions of SEC_PER_HOUR and SEC_PER_DAY MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit These macros are now provided by Zephyr (in sys_clock.h). As these macros for mesh were defined with `unsigned long long` type and now they are `unsigned long`, casting was added where needed to avoid overflows. Signed-off-by: Andrzej Głąbek --- applications/serial_lte_modem/src/gnss/slm_at_gnss.c | 2 -- samples/cellular/gnss/src/assistance_minimal.c | 2 -- subsys/bluetooth/mesh/time_util.c | 2 +- subsys/bluetooth/mesh/time_util.h | 2 -- subsys/bluetooth/services/cgms/cgms.c | 2 -- subsys/net/lib/nrf_cloud/include/nrf_cloud_pgps_utils.h | 2 -- 6 files changed, 1 insertion(+), 11 deletions(-) diff --git a/applications/serial_lte_modem/src/gnss/slm_at_gnss.c b/applications/serial_lte_modem/src/gnss/slm_at_gnss.c index 3964d0ce3aa7..50852beb37cb 100644 --- a/applications/serial_lte_modem/src/gnss/slm_at_gnss.c +++ b/applications/serial_lte_modem/src/gnss/slm_at_gnss.c @@ -53,8 +53,6 @@ static struct modem_pipe *gnss_pipe; #define LOCATION_REPORT_MS 5000 -#define SEC_PER_HOUR (MIN_PER_HOUR * SEC_PER_MIN) -#define SEC_PER_DAY (HOUR_PER_DAY * SEC_PER_HOUR) /* (6.1.1980 UTC - 1.1.1970 UTC) */ #define GPS_TO_UNIX_UTC_OFFSET_SECONDS (315964800UL) /* UTC/GPS time offset as of 1st of January 2017. */ diff --git a/samples/cellular/gnss/src/assistance_minimal.c b/samples/cellular/gnss/src/assistance_minimal.c index 1ab9390646e7..64f31bc6fe6a 100644 --- a/samples/cellular/gnss/src/assistance_minimal.c +++ b/samples/cellular/gnss/src/assistance_minimal.c @@ -25,8 +25,6 @@ LOG_MODULE_DECLARE(gnss_sample, CONFIG_GNSS_SAMPLE_LOG_LEVEL); #define GPS_TO_UNIX_UTC_OFFSET_SECONDS (315964800UL) /* UTC/GPS time offset as of 1st of January 2017. */ #define GPS_TO_UTC_LEAP_SECONDS (18UL) -#define SEC_PER_HOUR (MIN_PER_HOUR * SEC_PER_MIN) -#define SEC_PER_DAY (HOUR_PER_DAY * SEC_PER_HOUR) #define DAYS_PER_WEEK (7UL) #define PLMN_STR_MAX_LEN 8 /* MCC + MNC + quotes */ diff --git a/subsys/bluetooth/mesh/time_util.c b/subsys/bluetooth/mesh/time_util.c index fd024e17ee42..dc0af3d088c0 100644 --- a/subsys/bluetooth/mesh/time_util.c +++ b/subsys/bluetooth/mesh/time_util.c @@ -41,7 +41,7 @@ int ts_to_tai(struct bt_mesh_time_tai *tai, const struct tm *timeptr) days += timeptr->tm_mday - 1; - tai->sec = (days * SEC_PER_DAY); + tai->sec = ((uint64_t)days * SEC_PER_DAY); tai->sec += ((uint64_t)timeptr->tm_hour * SEC_PER_HOUR); tai->sec += ((uint64_t)timeptr->tm_min * SEC_PER_MIN); tai->sec += (uint64_t)timeptr->tm_sec; diff --git a/subsys/bluetooth/mesh/time_util.h b/subsys/bluetooth/mesh/time_util.h index 281c7344287a..82aba2487c28 100644 --- a/subsys/bluetooth/mesh/time_util.h +++ b/subsys/bluetooth/mesh/time_util.h @@ -20,8 +20,6 @@ extern "C" { #define DAYS_YEAR 365ULL #define DAYS_LEAP_YEAR 366ULL -#define SEC_PER_HOUR (60ULL * SEC_PER_MIN) -#define SEC_PER_DAY (24ULL * SEC_PER_HOUR) #define SEC_PER_YEAR (DAYS_YEAR * SEC_PER_DAY) #define SEC_PER_LEAP_YEAR (DAYS_LEAP_YEAR * SEC_PER_DAY) diff --git a/subsys/bluetooth/services/cgms/cgms.c b/subsys/bluetooth/services/cgms/cgms.c index 273944933114..24511bfc9a40 100644 --- a/subsys/bluetooth/services/cgms/cgms.c +++ b/subsys/bluetooth/services/cgms/cgms.c @@ -23,8 +23,6 @@ LOG_MODULE_REGISTER(cgms, CONFIG_BT_CGMS_LOG_LEVEL); -#define SEC_PER_DAY 86400 - #define CGMS_SVC_MEAS_ATTR_IDX 1 #define CGMS_SVC_RACP_ATTR_IDX 12 #define CGMS_SVC_SOCP_ATTR_IDX 15 diff --git a/subsys/net/lib/nrf_cloud/include/nrf_cloud_pgps_utils.h b/subsys/net/lib/nrf_cloud/include/nrf_cloud_pgps_utils.h index 38adc879b9da..910492145ca4 100644 --- a/subsys/net/lib/nrf_cloud/include/nrf_cloud_pgps_utils.h +++ b/subsys/net/lib/nrf_cloud/include/nrf_cloud_pgps_utils.h @@ -17,8 +17,6 @@ extern "C" { /* (6.1.1980 UTC - 1.1.1970 UTC) */ #define GPS_TO_UNIX_UTC_OFFSET_SECONDS (315964800UL) #define GPS_TO_UTC_LEAP_SECONDS (18UL) -#define SEC_PER_HOUR (MIN_PER_HOUR * SEC_PER_MIN) -#define SEC_PER_DAY (HOUR_PER_DAY * SEC_PER_HOUR) #define DAYS_PER_WEEK (7UL) #define SECONDS_PER_WEEK (SEC_PER_DAY * DAYS_PER_WEEK) From 1d9f7ec50caa214f06c45eb8e8a8bf6352aee92a Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Thu, 5 Dec 2024 00:10:03 +0530 Subject: [PATCH 025/109] treewide: Synchronize wifi_credentials and wifi_mgmt_ext with upstream Wi-Fi credentials lib has been moved to upstream. And Wi-Fi management extension library is merged with Wi-Fi management in upstream. Signed-off-by: Ravi Dondaputi --- CODEOWNERS | 3 - .../libraries/networking/wifi_credentials.rst | 2 +- .../libraries/networking/wifi_mgmt_ext.rst | 10 - include/net/wifi_credentials.h | 241 ----------- include/net/wifi_mgmt_ext.h | 8 - .../overlay_nrf700x_wifi_coap_no_lte.conf | 1 - .../overlay_nrf700x_wifi_mqtt_no_lte.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - .../boards/nrf7002dk_nrf5340_cpuapp_ns.conf | 1 - samples/wifi/ble_coex/prj.conf | 1 - samples/wifi/ble_coex/src/main.c | 1 - samples/wifi/promiscuous/prj.conf | 1 - .../wifi/promiscuous/src/wifi_connection.c | 1 - samples/wifi/provisioning/ble/prj.conf | 1 - samples/wifi/provisioning/ble/src/main.c | 3 +- samples/wifi/raw_tx_packet/prj.conf | 1 - .../wifi/raw_tx_packet/src/wifi_connection.c | 1 - samples/wifi/shell/prj.conf | 1 - samples/wifi/sta/prj.conf | 1 - samples/wifi/sta/src/main.c | 1 - samples/wifi/thread_coex/prj.conf | 1 - .../wifi/thread_coex/src/ot_coex_functions.h | 1 - samples/wifi/throughput/prj.conf | 1 - samples/wifi/twt/prj.conf | 1 - samples/wifi/twt/src/main.c | 1 - samples/wifi/wfa_qt_app/prj.conf | 1 - .../services/wifi_prov/wifi_prov_ble.c | 2 +- .../services/wifi_prov/wifi_prov_handler.c | 2 +- subsys/net/l2_wifi_if_conn/l2_wifi_conn.c | 1 - subsys/net/lib/CMakeLists.txt | 2 - subsys/net/lib/Kconfig | 2 - .../softap_wifi_provision.c | 3 +- .../net/lib/wifi_credentials/CMakeLists.txt | 36 -- subsys/net/lib/wifi_credentials/Kconfig | 111 ----- .../lib/wifi_credentials/wifi_credentials.c | 399 ------------------ .../wifi_credentials_backend_none.c | 39 -- .../wifi_credentials_backend_psa.c | 98 ----- .../wifi_credentials_backend_settings.c | 165 -------- .../wifi_credentials_internal.h | 60 --- .../wifi_credentials/wifi_credentials_shell.c | 340 --------------- subsys/net/lib/wifi_mgmt_ext/CMakeLists.txt | 40 -- subsys/net/lib/wifi_mgmt_ext/Kconfig | 34 -- .../wifi_cred_shell_autoconnect.c | 31 -- subsys/net/lib/wifi_mgmt_ext/wifi_mgmt_ext.c | 332 --------------- .../net/lib/wifi_credentials/CMakeLists.txt | 31 -- .../subsys/net/lib/wifi_credentials/prj.conf | 7 - .../net/lib/wifi_credentials/src/main.c | 370 ---------------- .../net/lib/wifi_credentials/testcase.yaml | 9 - .../CMakeLists.txt | 39 -- .../include/mbedtls_config.h | 0 .../lib/wifi_credentials_backend_psa/prj.conf | 7 - .../wifi_credentials_backend_psa/src/main.c | 232 ---------- .../src/normalized_crypto.h | 50 --- .../testcase.yaml | 9 - .../CMakeLists.txt | 31 -- .../prj.conf | 7 - .../src/main.c | 243 ----------- .../testcase.yaml | 9 - 64 files changed, 5 insertions(+), 3029 deletions(-) delete mode 100644 include/net/wifi_credentials.h delete mode 100644 subsys/net/lib/wifi_credentials/CMakeLists.txt delete mode 100644 subsys/net/lib/wifi_credentials/Kconfig delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials.c delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_internal.h delete mode 100644 subsys/net/lib/wifi_credentials/wifi_credentials_shell.c delete mode 100644 subsys/net/lib/wifi_mgmt_ext/CMakeLists.txt delete mode 100644 subsys/net/lib/wifi_mgmt_ext/Kconfig delete mode 100644 subsys/net/lib/wifi_mgmt_ext/wifi_cred_shell_autoconnect.c delete mode 100644 subsys/net/lib/wifi_mgmt_ext/wifi_mgmt_ext.c delete mode 100644 tests/subsys/net/lib/wifi_credentials/CMakeLists.txt delete mode 100644 tests/subsys/net/lib/wifi_credentials/prj.conf delete mode 100644 tests/subsys/net/lib/wifi_credentials/src/main.c delete mode 100644 tests/subsys/net/lib/wifi_credentials/testcase.yaml delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/CMakeLists.txt delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/include/mbedtls_config.h delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/prj.conf delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_psa/testcase.yaml delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_settings/CMakeLists.txt delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_settings/prj.conf delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c delete mode 100644 tests/subsys/net/lib/wifi_credentials_backend_settings/testcase.yaml diff --git a/CODEOWNERS b/CODEOWNERS index 72adbbda07c8..5b9d5bd28a89 100644 --- a/CODEOWNERS +++ b/CODEOWNERS @@ -347,7 +347,6 @@ /include/net/download_client* @nrfconnect/ncs-modem /include/net/downloader* @nrfconnect/ncs-modem /include/net/nrf_cloud_* @nrfconnect/ncs-nrf-cloud -/include/net/wifi_credentials.h @nrfconnect/ncs-cia /include/nfc/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-si-muffin /include/nrf_compress/ @nordicjm /include/nrf_rpc/ @nrfconnect/ncs-co-drivers @nrfconnect/ncs-si-muffin @@ -762,7 +761,6 @@ /subsys/net/lib/nrf_cloud/ @nrfconnect/ncs-nrf-cloud /subsys/net/lib/nrf_provisioning/ @nrfconnect/ncs-iot-oulu /subsys/net/lib/zzhc/ @junqingzou -/subsys/net/lib/wifi_credentials/ @nrfconnect/ncs-cia /subsys/net/lib/softap_wifi_provision/ @nrfconnect/ncs-cia /subsys/net/openthread/ @nrfconnect/ncs-co-networking @nrfconnect/ncs-thread /subsys/net/openthread/rpc/ @nrfconnect/ncs-protocols-serialization @@ -873,7 +871,6 @@ /tests/subsys/net/lib/mqtt_helper/ @nrfconnect/ncs-cia /tests/subsys/net/lib/nrf_cloud/ @nrfconnect/ncs-nrf-cloud /tests/subsys/net/lib/nrf_provisioning/ @nrfconnect/ncs-iot-oulu -/tests/subsys/net/lib/wifi_credentials*/ @nrfconnect/ncs-cia /tests/subsys/net/lib/tls_credentials*/ @nrfconnect/ncs-co-networking /tests/subsys/net/openthread/rpc/ @nrfconnect/ncs-protocols-serialization /tests/subsys/nfc/rpc/ @nrfconnect/ncs-protocols-serialization diff --git a/doc/nrf/libraries/networking/wifi_credentials.rst b/doc/nrf/libraries/networking/wifi_credentials.rst index 44141e62ad32..1fc4205cccf9 100644 --- a/doc/nrf/libraries/networking/wifi_credentials.rst +++ b/doc/nrf/libraries/networking/wifi_credentials.rst @@ -64,7 +64,7 @@ The library has the following limitations: API documentation ***************** -| Header file: :file:`include/net/wifi_credentials.h` +| Header file: :file:`include/zephyr/net/wifi_credentials.h` | Source files: :file:`subsys/net/lib/wifi_credentials` .. doxygengroup:: wifi_credentials diff --git a/doc/nrf/libraries/networking/wifi_mgmt_ext.rst b/doc/nrf/libraries/networking/wifi_mgmt_ext.rst index 48fe40d7ef7f..22397f9e27e7 100644 --- a/doc/nrf/libraries/networking/wifi_mgmt_ext.rst +++ b/doc/nrf/libraries/networking/wifi_mgmt_ext.rst @@ -53,15 +53,5 @@ Limitations The library has the following limitations: -* It can only be used with Nordic Semiconductor's ``hostap``-based Wi-Fi stack. - The Wi-Fi configuration is highly vendor-specific. * The commands ``NET_REQUEST_WIFI_CONNECT`` and ``NET_REQUEST_WIFI_CONNECT_STORED`` clear the list of configured Wi-Fi networks in RAM. Automatic connection has to be requested again after directly requesting connection to a specific network. - -API documentation -***************** - -| Header file: :file:`include/net/wifi_mgmt_ext.h` -| Source files: :file:`subsys/net/lib/wifi_mgmt_ext` - -.. doxygengroup:: wifi_mgmt_ext diff --git a/include/net/wifi_credentials.h b/include/net/wifi_credentials.h deleted file mode 100644 index 5e313f532da3..000000000000 --- a/include/net/wifi_credentials.h +++ /dev/null @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#ifndef WIFI_CREDENTIALS_H__ -#define WIFI_CREDENTIALS_H__ - -#include -#include -#include - -/** - * @defgroup wifi_credentials Wi-Fi credentials library - * @{ - * @brief Library that provides a way to store and load Wi-Fi credentials. - */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* this entry contains a BSSID */ -#define WIFI_CREDENTIALS_FLAG_BSSID BIT(0) -/* this entry is to be preferred over others */ -#define WIFI_CREDENTIALS_FLAG_FAVORITE BIT(1) -/* this entry can use the 2.4 GHz band */ -#define WIFI_CREDENTIALS_FLAG_2_4GHz BIT(2) -/* this entry can use the 5 GHz band */ -#define WIFI_CREDENTIALS_FLAG_5GHz BIT(3) -/* this entry can use the 6 GHz band */ -#define WIFI_CREDENTIALS_FLAG_6GHz BIT(4) -/* this entry requires management frame protection */ -#define WIFI_CREDENTIALS_FLAG_MFP_REQUIRED BIT(5) -/* this entry disables management frame protection */ -#define WIFI_CREDENTIALS_FLAG_MFP_DISABLED BIT(6) -/* this entry has anonymous identity configured */ -#define WIFI_CREDENTIALS_FLAG_ANONYMOUS_IDENTITY BIT(7) -/* this entry has key password configured */ -#define WIFI_CREDENTIALS_FLAG_KEY_PASSWORD BIT(8) - -#define WIFI_CREDENTIALS_MAX_PASSWORD_LEN\ - MAX(WIFI_PSK_MAX_LEN, CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH) - -/** - * @brief Wi-Fi credentials entry header - * @note Every settings entry starts with this header. - * Depending on the `type` field, the header can be casted to a larger type. - * In addition to SSID (usually a string) and BSSID (a MAC address), - * a `flags` field can be used to control some detail settings. - * - */ -struct wifi_credentials_header { - enum wifi_security_type type; - char ssid[WIFI_SSID_MAX_LEN]; - size_t ssid_len; - uint8_t bssid[WIFI_MAC_ADDR_LEN]; - uint32_t flags; - uint8_t channel; - uint32_t timeout; - char anon_id[16]; - uint8_t aid_length; - char key_passwd[16]; - uint8_t key_passwd_length; -}; - -/** - * @brief Wi-Fi Personal credentials entry - * @note Contains only the header and a password. - * For PSK security, passwords can be up to `WIFI_PSK_MAX_LEN` bytes long - * including NULL termination. For SAE security it can range up to - * `CONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH`. - * - */ -struct wifi_credentials_personal { - struct wifi_credentials_header header; - char password[WIFI_CREDENTIALS_MAX_PASSWORD_LEN]; - size_t password_len; -}; - -/** - * @brief Wi-Fi Enterprise credentials entry - * @note This functionality is not yet implemented. - */ -struct wifi_credentials_enterprise { - struct wifi_credentials_header header; - size_t identity_len; - size_t anonymous_identity_len; - size_t password_len; - size_t ca_cert_len; - size_t client_cert_len; - size_t private_key_len; - size_t private_key_pw_len; -}; - -/** - * @brief Get credentials for given SSID. - * - * @param[in] ssid SSID to look for - * @param[in] ssid_len length of SSID - * @param[out] type Wi-Fi security type - * @param[out] bssid_buf buffer to store BSSID if it was fixed - * @param[in] bssid_buf_len length of bssid_buf - * @param[out] password_buf buffer to store password - * @param[in] password_buf_len length of password_buf - * @param[out] password_len length of password - * @param[out] flags flags - * @param[out] channel channel - * @param[out] timeout timeout - * - * @return 0 Success. - * @return -ENOENT No network with this SSID was found. - * @return -EINVAL A required buffer was NULL or invalid SSID length. - * @return -EPROTO The network with this SSID is not a personal network. - */ -int wifi_credentials_get_by_ssid_personal( - const char *ssid, - size_t ssid_len, - enum wifi_security_type *type, - uint8_t *bssid_buf, - size_t bssid_buf_len, - char *password_buf, - size_t password_buf_len, - size_t *password_len, - uint32_t *flags, - uint8_t *channel, - uint32_t *timeout -); - -/** - * @brief Set credentials for given SSID. - * - * @param[in] ssid SSID to look for - * @param[in] ssid_len length of SSID - * @param[in] type Wi-Fi security type - * @param[in] bssid BSSID (may be NULL) - * @param[in] bssid_len length of BSSID buffer (either 0 or WIFI_MAC_ADDR_LEN) - * @param[in] password password - * @param[in] password_len length of password - * @param[in] flags flags - * @param[in] channel Channel - * @param[in] timeout Timeout - * - * @return 0 Success. Credentials are stored in persistent storage. - * @return -EINVAL A required buffer was NULL or security type is not supported. - * @return -ENOTSUP Security type is not supported. - * @return -ENOBUFS All slots are already taken. - */ -int wifi_credentials_set_personal( - const char *ssid, - size_t ssid_len, - enum wifi_security_type type, - const uint8_t *bssid, - size_t bssid_len, - const char *password, - size_t password_len, - uint32_t flags, - uint8_t channel, - uint32_t timeout -); - -/** - * @brief Get credentials for given SSID by struct. - * - * @param[in] ssid SSID to look for - * @param[in] ssid_len length of SSID - * @param[out] buf credentials Pointer to struct where credentials are stored - * - * @return 0 Success. - * @return -ENOENT No network with this SSID was found. - * @return -EINVAL A required buffer was NULL or too small. - * @return -EPROTO The network with this SSID is not a personal network. - */ -int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_len, - struct wifi_credentials_personal *buf); - -/** - * @brief Set credentials for given SSID by struct. - * - * @param[in] creds credentials Pointer to struct from which credentials are loaded - * - * @return 0 Success. - * @return -ENOENT No network with this SSID was found. - * @return -EINVAL A required buffer was NULL or incorrect size. - * @return -ENOBUFS All slots are already taken. - */ -int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal *creds); - -/** - * @brief Delete credentials for given SSID. - * - * @param[in] ssid SSID to look for - * @param[in] ssid_len length of SSID - * - * @return -ENOENT if No network with this SSID was found. - * @return 0 on success, otherwise a negative error code - */ -int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len); - -/** - * @brief Check if credentials storage is empty. - * - * @return true if credential storage is empty, otherwise false - */ -bool wifi_credentials_is_empty(void); - -/** - * @brief Deletes all stored Wi-Fi credentials. - * - * This function deletes all Wi-Fi credentials that have been stored in the system. - * It is typically used when you want to clear all saved networks. - * - * @return 0 on successful, otherwise a negative error code - */ -int wifi_credentials_delete_all(void); - -/** - * @brief Callback type for wifi_credentials_for_each_ssid. - * @param[in] cb_arg arguments for the callback function. Appropriate cb_arg is - * transferred by wifi_credentials_for_each_ssid. - * @param[in] ssid SSID - * @param[in] ssid_len length of SSID - */ -typedef void (*wifi_credentials_ssid_cb)(void *cb_arg, const char *ssid, size_t ssid_len); - -/** - * @brief Call callback for each registered SSID. - * - * @param cb callback - * @param cb_arg argument for callback function - */ -void wifi_credentials_for_each_ssid(wifi_credentials_ssid_cb cb, void *cb_arg); - -#ifdef __cplusplus -} -#endif - -/** @} */ - -#endif /* WIFI_CREDENTIALS_H__ */ diff --git a/include/net/wifi_mgmt_ext.h b/include/net/wifi_mgmt_ext.h index d223f487aa0a..7c6985c5d48b 100644 --- a/include/net/wifi_mgmt_ext.h +++ b/include/net/wifi_mgmt_ext.h @@ -16,14 +16,6 @@ */ -enum net_request_wifi_cmd_ext { - NET_REQUEST_WIFI_CMD_CONNECT_STORED = NET_REQUEST_WIFI_CMD_REG_DOMAIN + 100, -}; - -#define NET_REQUEST_WIFI_CONNECT_STORED \ - (_NET_WIFI_BASE | NET_REQUEST_WIFI_CMD_CONNECT_STORED) - -NET_MGMT_DEFINE_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED); /** @} */ diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_coap_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_coap_no_lte.conf index 585dc1d67f16..f41b0e42a06f 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_coap_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_coap_no_lte.conf @@ -107,7 +107,6 @@ CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=4850 ## Enable WIFI_MGMT_EXT and WIFI_CREDENTIALS for simplified Wi-Fi connection setup CONFIG_WIFI_CREDENTIALS=y -CONFIG_WIFI_MGMT_EXT=y ## Enable flash and NVS settings, required by WIFI_CREDENTIALS CONFIG_SETTINGS=y diff --git a/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_mqtt_no_lte.conf b/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_mqtt_no_lte.conf index fe0aad1a5da1..f1affe143ad1 100644 --- a/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_mqtt_no_lte.conf +++ b/samples/cellular/nrf_cloud_multi_service/overlay_nrf700x_wifi_mqtt_no_lte.conf @@ -106,7 +106,6 @@ CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=4850 ## Enable WIFI_MGMT_EXT and WIFI_CREDENTIALS for simplified Wi-Fi connection setup CONFIG_WIFI_CREDENTIALS=y -CONFIG_WIFI_MGMT_EXT=y ## Use compile-time client ID for nRF Cloud CONFIG_NRF_CLOUD_CLIENT_ID_SRC_COMPILE_TIME=y diff --git a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf index 79c0bcae3e1e..d41acfbe815c 100644 --- a/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf +++ b/samples/debug/memfault/boards/nrf7002dk_nrf5340_cpuapp.conf @@ -59,7 +59,6 @@ CONFIG_NET_TC_TX_COUNT=1 # Wi-Fi CONFIG_WIFI=y CONFIG_WIFI_NRF70=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_NET_L2_WIFI_SHELL=y CONFIG_NET_SHELL=y CONFIG_WIFI_CREDENTIALS=y diff --git a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 619550810638..c4cbedac7128 100644 --- a/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/aws_iot/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -25,7 +25,6 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y CONFIG_WIFI_NRF70=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 6c86a1fb3f29..6aaf757239a8 100644 --- a/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/azure_iot_hub/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -26,7 +26,6 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 13a147d44647..001f13b7c1c0 100644 --- a/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/coap_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -28,7 +28,6 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 # Wi-Fi CONFIG_WIFI=y CONFIG_WIFI_NRF70=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_NET_L2_WIFI_SHELL=y CONFIG_FLASH=y diff --git a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 0b588e594f65..30aa95a84d66 100644 --- a/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/download/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -26,7 +26,6 @@ CONFIG_L2_WIFI_CONNECTIVITY_AUTO_CONNECT=n CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y # Shell diff --git a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index 9eb362cb1681..16c2419291db 100644 --- a/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/https_client/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -20,7 +20,6 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y # Shell diff --git a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index e826936d5160..e43b1fbb6511 100644 --- a/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/mqtt/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -28,7 +28,6 @@ CONFIG_NRF70_MAX_TX_AGGREGATION=4 CONFIG_WIFI=y CONFIG_WIFI_NRF70=y CONFIG_WIFI_NRF70_LOG_LEVEL_ERR=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y # Shell diff --git a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf index a74c6f1af18a..4e02c91301cd 100644 --- a/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf +++ b/samples/net/udp/boards/nrf7002dk_nrf5340_cpuapp_ns.conf @@ -13,7 +13,6 @@ CONFIG_MAIN_STACK_SIZE=6144 # Wi-Fi CONFIG_WIFI=y CONFIG_WIFI_NRF70=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y # Optimize Wi-Fi stack to save some memory diff --git a/samples/wifi/ble_coex/prj.conf b/samples/wifi/ble_coex/prj.conf index b52485d1a7cf..0451c48134e2 100644 --- a/samples/wifi/ble_coex/prj.conf +++ b/samples/wifi/ble_coex/prj.conf @@ -66,7 +66,6 @@ CONFIG_NET_BUF_RX_COUNT=2 CONFIG_NET_BUF_TX_COUNT=48 CONFIG_HEAP_MEM_POOL_SIZE=230000 -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/ble_coex/src/main.c b/samples/wifi/ble_coex/src/main.c index 782ca2d73732..71c4a89b6a59 100644 --- a/samples/wifi/ble_coex/src/main.c +++ b/samples/wifi/ble_coex/src/main.c @@ -34,7 +34,6 @@ LOG_MODULE_REGISTER(coex, CONFIG_LOG_DEFAULT_LEVEL); #include #include -#include /* For net_sprint_ll_addr_buf */ #include "net_private.h" diff --git a/samples/wifi/promiscuous/prj.conf b/samples/wifi/promiscuous/prj.conf index 80b3e1efd156..49245a83c879 100644 --- a/samples/wifi/promiscuous/prj.conf +++ b/samples/wifi/promiscuous/prj.conf @@ -13,7 +13,6 @@ CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_NET_PROMISCUOUS_MODE=y CONFIG_NRF70_PROMISC_DATA_RX=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/promiscuous/src/wifi_connection.c b/samples/wifi/promiscuous/src/wifi_connection.c index 1a335973154d..624058b30e6e 100644 --- a/samples/wifi/promiscuous/src/wifi_connection.c +++ b/samples/wifi/promiscuous/src/wifi_connection.c @@ -16,7 +16,6 @@ LOG_MODULE_REGISTER(wifi_connect, CONFIG_LOG_DEFAULT_LEVEL); #include #include "net_private.h" -#include #define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_CONNECT_RESULT | \ NET_EVENT_WIFI_DISCONNECT_RESULT) diff --git a/samples/wifi/provisioning/ble/prj.conf b/samples/wifi/provisioning/ble/prj.conf index b2f27e40f2a5..dcb7132aea54 100644 --- a/samples/wifi/provisioning/ble/prj.conf +++ b/samples/wifi/provisioning/ble/prj.conf @@ -98,7 +98,6 @@ CONFIG_NANOPB=y CONFIG_BT_WIFI_PROV=y CONFIG_BT_WIFI_PROV_LOG_LEVEL_INF=y -CONFIG_WIFI_MGMT_EXT=y # Setting BT supervision timeout to 75units (750ms) to avoid timeout of BT connection when radio is granted to Wi-Fi during scan. CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=75 diff --git a/samples/wifi/provisioning/ble/src/main.c b/samples/wifi/provisioning/ble/src/main.c index 2ce6de130d4e..8c400de4ccda 100644 --- a/samples/wifi/provisioning/ble/src/main.c +++ b/samples/wifi/provisioning/ble/src/main.c @@ -17,8 +17,7 @@ #include #include -#include -#include +#include #include diff --git a/samples/wifi/raw_tx_packet/prj.conf b/samples/wifi/raw_tx_packet/prj.conf index e0ebcd5a0ff1..69d1087f930a 100644 --- a/samples/wifi/raw_tx_packet/prj.conf +++ b/samples/wifi/raw_tx_packet/prj.conf @@ -11,7 +11,6 @@ CONFIG_NRF70_RAW_DATA_TX=y # WPA supplicant CONFIG_WIFI_NM_WPA_SUPPLICANT=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/raw_tx_packet/src/wifi_connection.c b/samples/wifi/raw_tx_packet/src/wifi_connection.c index 621960d49132..c101bc80e4fb 100644 --- a/samples/wifi/raw_tx_packet/src/wifi_connection.c +++ b/samples/wifi/raw_tx_packet/src/wifi_connection.c @@ -15,7 +15,6 @@ LOG_MODULE_REGISTER(wifi_connect, CONFIG_LOG_DEFAULT_LEVEL); #include #include "net_private.h" -#include #define WIFI_SHELL_MGMT_EVENTS (NET_EVENT_WIFI_CONNECT_RESULT | \ NET_EVENT_WIFI_DISCONNECT_RESULT) diff --git a/samples/wifi/shell/prj.conf b/samples/wifi/shell/prj.conf index fc27d8b7c1a9..ba70efee554d 100644 --- a/samples/wifi/shell/prj.conf +++ b/samples/wifi/shell/prj.conf @@ -80,7 +80,6 @@ CONFIG_DATE_SHELL=y CONFIG_NET_CONFIG_AUTO_INIT=n CONFIG_POSIX_API=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/samples/wifi/sta/prj.conf b/samples/wifi/sta/prj.conf index 5a0d3a111f6b..0c227514fa44 100644 --- a/samples/wifi/sta/prj.conf +++ b/samples/wifi/sta/prj.conf @@ -11,7 +11,6 @@ CONFIG_WIFI_NM_WPA_SUPPLICANT=y CONFIG_WIFI_READY_LIB=y CONFIG_NRF_WIFI_RPU_RECOVERY=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/sta/src/main.c b/samples/wifi/sta/src/main.c index fdfb3ae458f5..5134003c752d 100644 --- a/samples/wifi/sta/src/main.c +++ b/samples/wifi/sta/src/main.c @@ -23,7 +23,6 @@ LOG_MODULE_REGISTER(sta, CONFIG_LOG_DEFAULT_LEVEL); #include #include -#include #include #if defined(CONFIG_BOARD_NRF7002DK_NRF7001_NRF5340_CPUAPP) || \ diff --git a/samples/wifi/thread_coex/prj.conf b/samples/wifi/thread_coex/prj.conf index ce4d8c92d72f..03e2012c850c 100644 --- a/samples/wifi/thread_coex/prj.conf +++ b/samples/wifi/thread_coex/prj.conf @@ -59,7 +59,6 @@ CONFIG_NET_TC_TX_COUNT=1 CONFIG_HEAP_MEM_POOL_SIZE=230000 # Below Wi-Fi configs need to be modified based on security -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/thread_coex/src/ot_coex_functions.h b/samples/wifi/thread_coex/src/ot_coex_functions.h index e57653950a56..d9242c8e7566 100644 --- a/samples/wifi/thread_coex/src/ot_coex_functions.h +++ b/samples/wifi/thread_coex/src/ot_coex_functions.h @@ -29,7 +29,6 @@ LOG_MODULE_REGISTER(ot_coex_functions, CONFIG_LOG_DEFAULT_LEVEL); #include #include -#include /* For net_sprint_ll_addr_buf */ #include "net_private.h" diff --git a/samples/wifi/throughput/prj.conf b/samples/wifi/throughput/prj.conf index b30da5bbd5f1..783b92c70d60 100644 --- a/samples/wifi/throughput/prj.conf +++ b/samples/wifi/throughput/prj.conf @@ -80,7 +80,6 @@ CONFIG_POSIX_CLOCK=y CONFIG_DATE_SHELL=y CONFIG_NET_CONFIG_AUTO_INIT=n -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/samples/wifi/twt/prj.conf b/samples/wifi/twt/prj.conf index 3aa53e680e66..ec4a570f5d7e 100644 --- a/samples/wifi/twt/prj.conf +++ b/samples/wifi/twt/prj.conf @@ -9,7 +9,6 @@ CONFIG_WIFI_NRF70=y # WPA supplicant CONFIG_WIFI_NM_WPA_SUPPLICANT=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_WIFI_CREDENTIALS_STATIC=y CONFIG_WIFI_CREDENTIALS_STATIC_SSID="Myssid" diff --git a/samples/wifi/twt/src/main.c b/samples/wifi/twt/src/main.c index 6b49a5fc74c3..40140108e4ec 100644 --- a/samples/wifi/twt/src/main.c +++ b/samples/wifi/twt/src/main.c @@ -30,7 +30,6 @@ LOG_MODULE_REGISTER(twt, CONFIG_LOG_DEFAULT_LEVEL); #include #include -#include #include "net_private.h" #include "traffic_gen.h" diff --git a/samples/wifi/wfa_qt_app/prj.conf b/samples/wifi/wfa_qt_app/prj.conf index a80a33e48c89..841cc6116926 100644 --- a/samples/wifi/wfa_qt_app/prj.conf +++ b/samples/wifi/wfa_qt_app/prj.conf @@ -84,7 +84,6 @@ CONFIG_DATE_SHELL=y CONFIG_NET_CONFIG_AUTO_INIT=n CONFIG_NET_CONFIG_SETTINGS=y -CONFIG_WIFI_MGMT_EXT=y CONFIG_WIFI_CREDENTIALS=y CONFIG_FLASH=y CONFIG_FLASH_PAGE_LAYOUT=y diff --git a/subsys/bluetooth/services/wifi_prov/wifi_prov_ble.c b/subsys/bluetooth/services/wifi_prov/wifi_prov_ble.c index dcef86be04f1..b4d492233554 100644 --- a/subsys/bluetooth/services/wifi_prov/wifi_prov_ble.c +++ b/subsys/bluetooth/services/wifi_prov/wifi_prov_ble.c @@ -21,7 +21,7 @@ #include #include -#include +#include #include #include "wifi_prov_internal.h" diff --git a/subsys/bluetooth/services/wifi_prov/wifi_prov_handler.c b/subsys/bluetooth/services/wifi_prov/wifi_prov_handler.c index 86addc12e2dd..efc34eeaf8f1 100644 --- a/subsys/bluetooth/services/wifi_prov/wifi_prov_handler.c +++ b/subsys/bluetooth/services/wifi_prov/wifi_prov_handler.c @@ -11,7 +11,7 @@ #include #include -#include +#include #include #include diff --git a/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c b/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c index c04692dfe6c1..8af948e1061a 100644 --- a/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c +++ b/subsys/net/l2_wifi_if_conn/l2_wifi_conn.c @@ -9,7 +9,6 @@ LOG_MODULE_REGISTER(l2_wifi_mgr_conn); #include #include #include -#include #include #include #include diff --git a/subsys/net/lib/CMakeLists.txt b/subsys/net/lib/CMakeLists.txt index eeaa3d8417e0..255a60142af9 100644 --- a/subsys/net/lib/CMakeLists.txt +++ b/subsys/net/lib/CMakeLists.txt @@ -29,10 +29,8 @@ add_subdirectory_ifdef(CONFIG_ICAL_PARSER icalendar_parser) add_subdirectory_ifdef(CONFIG_FTP_CLIENT ftp_client) add_subdirectory_ifdef(CONFIG_COAP_UTILS coap_utils) add_subdirectory_ifdef(CONFIG_LWM2M_CLIENT_UTILS lwm2m_client_utils) -add_subdirectory_ifdef(CONFIG_WIFI_CREDENTIALS wifi_credentials) add_subdirectory_ifdef(CONFIG_TLS_CREDENTIALS tls_credentials) add_subdirectory_ifdef(CONFIG_SOFTAP_WIFI_PROVISION softap_wifi_provision) -add_subdirectory_ifdef(CONFIG_WIFI_MGMT_EXT wifi_mgmt_ext) add_subdirectory_ifdef(CONFIG_WIFI_READY_LIB wifi_ready) add_subdirectory_ifdef(CONFIG_MQTT_HELPER mqtt_helper) add_subdirectory_ifdef(CONFIG_NRF_PROVISIONING nrf_provisioning) diff --git a/subsys/net/lib/Kconfig b/subsys/net/lib/Kconfig index 4676b446b589..b13126f68884 100644 --- a/subsys/net/lib/Kconfig +++ b/subsys/net/lib/Kconfig @@ -42,9 +42,7 @@ rsource "ftp_client/Kconfig" rsource "coap_utils/Kconfig" rsource "lwm2m_client_utils/Kconfig" rsource "tls_credentials/Kconfig" -rsource "wifi_credentials/Kconfig" rsource "softap_wifi_provision/Kconfig" -rsource "wifi_mgmt_ext/Kconfig" rsource "wifi_ready/Kconfig" rsource "mqtt_helper/Kconfig" rsource "nrf_provisioning/Kconfig" diff --git a/subsys/net/lib/softap_wifi_provision/softap_wifi_provision.c b/subsys/net/lib/softap_wifi_provision/softap_wifi_provision.c index e31edf595ba5..310b4a812cc3 100644 --- a/subsys/net/lib/softap_wifi_provision/softap_wifi_provision.c +++ b/subsys/net/lib/softap_wifi_provision/softap_wifi_provision.c @@ -20,8 +20,7 @@ #include #include #include -#include -#include +#include #include #include "pb_decode.h" diff --git a/subsys/net/lib/wifi_credentials/CMakeLists.txt b/subsys/net/lib/wifi_credentials/CMakeLists.txt deleted file mode 100644 index 055c57810a2a..000000000000 --- a/subsys/net/lib/wifi_credentials/CMakeLists.txt +++ /dev/null @@ -1,36 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -zephyr_library_named(wifi_credentials) -zephyr_library_sources(wifi_credentials.c) - -if (CONFIG_WIFI_CREDENTIALS_BACKEND_PSA) -zephyr_library_include_directories( - $/api_ns/interface/include -) -endif() - -zephyr_library_sources_ifdef( - CONFIG_WIFI_CREDENTIALS_BACKEND_SETTINGS - wifi_credentials_backend_settings.c) - -zephyr_library_sources_ifdef( - CONFIG_WIFI_CREDENTIALS_BACKEND_PSA - wifi_credentials_backend_psa.c) - -zephyr_library_sources_ifdef( - CONFIG_WIFI_CREDENTIALS_BACKEND_NONE - wifi_credentials_backend_none.c) - -zephyr_library_sources_ifdef( - CONFIG_WIFI_CREDENTIALS_SHELL - wifi_credentials_shell.c) - -if(WIFI_CREDENTIALS_STATIC_SSID) - message(WARNING - "Static Wi-Fi configuration is used, please remove before deployment!" - ) -endif() diff --git a/subsys/net/lib/wifi_credentials/Kconfig b/subsys/net/lib/wifi_credentials/Kconfig deleted file mode 100644 index 1507da4583f7..000000000000 --- a/subsys/net/lib/wifi_credentials/Kconfig +++ /dev/null @@ -1,111 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -menuconfig WIFI_CREDENTIALS - bool "WIFI credentials management" - select EXPERIMENTAL - help - Enable WiFi credentials management subsystem. - -if WIFI_CREDENTIALS - -module = WIFI_CREDENTIALS -module-str = wifi_credentials -source "subsys/logging/Kconfig.template.log_config" - -choice WIFI_CREDENTIALS_BACKEND - prompt "WiFi credentials backend" - default WIFI_CREDENTIALS_BACKEND_PSA if BUILD_WITH_TFM && !TFM_PROFILE_TYPE_MINIMAL - default WIFI_CREDENTIALS_BACKEND_SETTINGS - default WIFI_CREDENTIALS_BACKEND_NONE if WIFI_CREDENTIALS_STATIC - help - Selects whether to use PSA Protected Storage or the Zephyr settings subsystem - for credentials storage. - -config WIFI_CREDENTIALS_BACKEND_SETTINGS - bool "Zephyr Settings" - depends on SETTINGS - depends on !SETTINGS_NONE - -config WIFI_CREDENTIALS_BACKEND_PSA - bool "PSA Protected Storage" - depends on BUILD_WITH_TFM && !TFM_PROFILE_TYPE_MINIMAL - -config WIFI_CREDENTIALS_BACKEND_NONE - bool "No credentials storage" - depends on WIFI_CREDENTIALS_STATIC - -endchoice - -config WIFI_CREDENTIALS_MAX_ENTRIES - int "Number of supported WiFi credentials" - default 2 - help - This detemines how many different WiFi networks can be configured at a time. - -config WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH - int "Max. length of SAE password" - default 128 - help - There is no official limit on SAE password length, - but for example Linux 6.0 has a hardcoded limit of 128 bytes. - -config WIFI_CREDENTIALS_SHELL - bool "Shell commands to manage Wi-Fi credentials" - default y - depends on SHELL - select SHELL_GETOPT - select GETOPT_LONG - depends on !WIFI_CREDENTIALS_BACKEND_NONE - -endif # WIFI_CREDENTIALS - -if WIFI_CREDENTIALS_BACKEND_PSA - -config WIFI_CREDENTIALS_BACKEND_PSA_OFFSET - int "PSA_KEY_ID range offset" - default 0 - help - The PSA specification mandates to set key identifiers for keys - with persistent lifetime. The users of the PSA API are responsible (WIFI credentials - management is user of PSA API) to provide correct and unique identifiers. - -endif # WIFI_CREDENTIALS_BACKEND_PSA - -config WIFI_CREDENTIALS_STATIC - bool "Static Wi-Fi network configuration" - -if WIFI_CREDENTIALS_STATIC - -config WIFI_CREDENTIALS_STATIC_SSID - string "SSID of statically configured WiFi network" - -config WIFI_CREDENTIALS_STATIC_PASSWORD - string "Password of statically configured Wi-Fi network" - default "" - -choice WIFI_CREDENTIALS_STATIC_TYPE - prompt "Static Wi-Fi network security type" - default WIFI_CREDENTIALS_STATIC_TYPE_PSK - -config WIFI_CREDENTIALS_STATIC_TYPE_OPEN - bool "OPEN" - -config WIFI_CREDENTIALS_STATIC_TYPE_PSK - bool "WPA2-PSK" - -config WIFI_CREDENTIALS_STATIC_TYPE_PSK_SHA256 - bool "WPA2-PSK-SHA256" - -config WIFI_CREDENTIALS_STATIC_TYPE_SAE - bool "SAE" - -config WIFI_CREDENTIALS_STATIC_TYPE_WPA_PSK - bool "WPA-PSK" - -endchoice - -endif diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials.c b/subsys/net/lib/wifi_credentials/wifi_credentials.c deleted file mode 100644 index b61b91a114ee..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include -#include - -#include "wifi_credentials_internal.h" - -LOG_MODULE_REGISTER(wifi_credentials, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); - -K_MUTEX_DEFINE(wifi_credentials_mutex); - -/* SSID cache: maps SSIDs to their storage indices */ -static char ssid_cache[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][WIFI_SSID_MAX_LEN]; -static size_t ssid_cache_lengths[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES]; - -/** - * @brief Finds index of given SSID if it exists. - * - * @param ssid SSID to look for (buffer of WIFI_SSID_MAX_LEN length) - * @return index if entry is found, -1 otherwise - */ -static inline ssize_t lookup_idx(const uint8_t *ssid, size_t ssid_len) -{ - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (ssid_len != ssid_cache_lengths[i]) { - continue; - } - if (strncmp(ssid, ssid_cache[i], ssid_len) == 0) { - return i; - } - } - - return -1; -} - -/** - * @brief Determine whether an index is currently used for storing network credentials. - * - * @param idx credential index - * @return true if index is used, false otherwise - */ -static inline bool is_entry_used(size_t idx) -{ - return ssid_cache_lengths[idx] != 0; -} - -/** - * @brief Finds unused index to store new entry at. - * - * @return index if empty slot is found, -1 otherwise - */ -static inline ssize_t lookup_unused_idx(void) -{ - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (!is_entry_used(i)) { - return i; - } - } - - return -1; -} - -static int init(void) -{ - - int ret; - - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - - ret = wifi_credentials_backend_init(); - if (ret) { - LOG_ERR("Initializing WiFi credentials storage backend failed, err: %d", ret); - } - - k_mutex_unlock(&wifi_credentials_mutex); - - return 0; -} - -void wifi_credentials_cache_ssid(size_t idx, const struct wifi_credentials_header *buf) -{ - memcpy(ssid_cache[idx], buf->ssid, buf->ssid_len); - ssid_cache_lengths[idx] = buf->ssid_len; -} - -/** - * @brief Clear entry in SSID cache. - * - * @param idx credential index - */ -void wifi_credentials_uncache_ssid(size_t idx) -{ - ssid_cache_lengths[idx] = 0; -} - -int wifi_credentials_get_by_ssid_personal_struct(const char *ssid, size_t ssid_len, - struct wifi_credentials_personal *buf) -{ - int ret; - - if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { - LOG_ERR("Cannot retrieve WiFi credentials, SSID has invalid format"); - return -EINVAL; - } - if (buf == NULL) { - LOG_ERR("Cannot retrieve WiFi credentials, " - "destination struct pointer cannot be NULL"); - return -EINVAL; - } - - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - - ssize_t idx = lookup_idx(ssid, ssid_len); - - if (idx == -1) { - LOG_DBG("Cannot retrieve WiFi credentials, no entry found for the provided SSID"); - ret = -ENOENT; - goto exit; - } - - ret = wifi_credentials_load_entry(idx, buf, sizeof(struct wifi_credentials_personal)); - - if (ret) { - LOG_ERR("Failed to load WiFi credentials at index %d, err: %d", idx, ret); - goto exit; - } - - if (buf->header.type != WIFI_SECURITY_TYPE_NONE && - buf->header.type != WIFI_SECURITY_TYPE_PSK && - buf->header.type != WIFI_SECURITY_TYPE_PSK_SHA256 && - buf->header.type != WIFI_SECURITY_TYPE_SAE && - buf->header.type != WIFI_SECURITY_TYPE_EAP_TLS && - buf->header.type != WIFI_SECURITY_TYPE_WPA_PSK) { - LOG_ERR("Requested WiFi credentials entry is corrupted"); - ret = -EPROTO; - goto exit; - } - -exit: - k_mutex_unlock(&wifi_credentials_mutex); - - return ret; -} - -int wifi_credentials_set_personal_struct(const struct wifi_credentials_personal *creds) -{ - int ret; - - if (creds->header.ssid_len > WIFI_SSID_MAX_LEN || - creds->header.ssid_len == 0) { - LOG_ERR("Cannot set WiFi credentials, SSID has invalid format"); - return -EINVAL; - } - if (creds == NULL) { - LOG_ERR("Cannot set WiFi credentials, provided struct pointer cannot be NULL"); - return -EINVAL; - } - - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - - ssize_t idx = lookup_idx(creds->header.ssid, creds->header.ssid_len); - - if (idx == -1) { - idx = lookup_unused_idx(); - if (idx == -1) { - LOG_ERR("Cannot store WiFi credentials, no space left"); - ret = -ENOBUFS; - goto exit; - } - } - - ret = wifi_credentials_store_entry(idx, creds, sizeof(struct wifi_credentials_personal)); - - if (ret) { - LOG_ERR("Failed to store WiFi credentials at index %d, err: %d", idx, ret); - goto exit; - } - - wifi_credentials_cache_ssid(idx, &creds->header); - -exit: - k_mutex_unlock(&wifi_credentials_mutex); - - return ret; -} - -int wifi_credentials_set_personal(const char *ssid, size_t ssid_len, enum wifi_security_type type, - const uint8_t *bssid, size_t bssid_len, const char *password, - size_t password_len, uint32_t flags, uint8_t channel, - uint32_t timeout) -{ - int ret = 0; - uint8_t buf[ENTRY_MAX_LEN] = { 0 }; - - if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { - LOG_ERR("Cannot set WiFi credentials, SSID has invalid format"); - return -EINVAL; - } - if (flags & WIFI_CREDENTIALS_FLAG_BSSID && - (bssid_len != WIFI_MAC_ADDR_LEN || bssid == NULL)) { - LOG_ERR("Cannot set WiFi credentials, " - "provided flags indicated BSSID, but no BSSID provided"); - return -EINVAL; - } - if ((type != WIFI_SECURITY_TYPE_NONE && (password_len == 0 || password == NULL)) || - (password_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN)) { - LOG_ERR("Cannot set WiFi credentials, password not provided or invalid"); - return -EINVAL; - } - - /* pack entry */ - struct wifi_credentials_header *header = (struct wifi_credentials_header *)buf; - - header->type = type; - memcpy(header->ssid, ssid, ssid_len); - header->ssid_len = ssid_len; - header->flags = flags; - header->channel = channel; - header->timeout = timeout; - - if (flags & WIFI_CREDENTIALS_FLAG_BSSID) { - memcpy(header->bssid, bssid, WIFI_MAC_ADDR_LEN); - } - - switch (type) { - case WIFI_SECURITY_TYPE_NONE: - break; - case WIFI_SECURITY_TYPE_PSK: - case WIFI_SECURITY_TYPE_PSK_SHA256: - case WIFI_SECURITY_TYPE_WPA_PSK: - case WIFI_SECURITY_TYPE_SAE: { - struct wifi_credentials_personal *header_personal = - (struct wifi_credentials_personal *)buf; - - memcpy(header_personal->password, password, password_len); - header_personal->password_len = password_len; - break; - } - default: - LOG_ERR("Cannot set WiFi credentials, " - "provided security type %d is unsupported", type); - return -ENOTSUP; - } - - /* store entry */ - ret = wifi_credentials_set_personal_struct((struct wifi_credentials_personal *)buf); - - return ret; -} - -int wifi_credentials_get_by_ssid_personal(const char *ssid, size_t ssid_len, - enum wifi_security_type *type, uint8_t *bssid_buf, - size_t bssid_buf_len, char *password_buf, - size_t password_buf_len, size_t *password_len, - uint32_t *flags, uint8_t *channel, uint32_t *timeout) -{ - int ret = 0; - uint8_t buf[ENTRY_MAX_LEN] = { 0 }; - - if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { - LOG_ERR("Cannot retrieve WiFi credentials, SSID has invalid format"); - return -EINVAL; - } - if (bssid_buf_len != WIFI_MAC_ADDR_LEN || bssid_buf == NULL) { - LOG_ERR("BSSID buffer needs to be provided"); - return -EINVAL; - } - if (password_buf == NULL || password_buf_len > WIFI_CREDENTIALS_MAX_PASSWORD_LEN || - password_buf_len == 0) { - LOG_ERR("WiFi password buffer needs to be provided"); - return -EINVAL; - } - - /* load entry */ - ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, - (struct wifi_credentials_personal *)buf); - - if (ret) { - return ret; - } - - /* unpack entry*/ - struct wifi_credentials_header *header = (struct wifi_credentials_header *)buf; - - *type = header->type; - *flags = header->flags; - *channel = header->channel; - *timeout = header->timeout; - - if (header->flags & WIFI_CREDENTIALS_FLAG_BSSID) { - memcpy(bssid_buf, header->bssid, WIFI_MAC_ADDR_LEN); - } - - switch (header->type) { - case WIFI_SECURITY_TYPE_NONE: - break; - case WIFI_SECURITY_TYPE_PSK: - case WIFI_SECURITY_TYPE_PSK_SHA256: - case WIFI_SECURITY_TYPE_WPA_PSK: - case WIFI_SECURITY_TYPE_SAE: { - struct wifi_credentials_personal *header_personal = - (struct wifi_credentials_personal *)buf; - - memcpy(password_buf, header_personal->password, header_personal->password_len); - *password_len = header_personal->password_len; - break; - } - default: - LOG_ERR("Cannot get WiFi credentials, " - "the requested credentials have invalid WIFI_SECURITY_TYPE"); - ret = -EPROTO; - } - return ret; -} - -int wifi_credentials_delete_by_ssid(const char *ssid, size_t ssid_len) -{ - int ret = 0; - - if (ssid == NULL || ssid_len > WIFI_SSID_MAX_LEN || ssid_len == 0) { - LOG_ERR("Cannot delete WiFi credentials, SSID has invalid format"); - return -EINVAL; - } - - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - ssize_t idx = lookup_idx(ssid, ssid_len); - - if (idx == -1) { - LOG_DBG("WiFi credentials entry was not found"); - goto exit; - } - - ret = wifi_credentials_delete_entry(idx); - - if (ret) { - LOG_ERR("Failed to delete WiFi credentials index %d, err: %d", idx, ret); - goto exit; - } - - wifi_credentials_uncache_ssid(idx); - -exit: - k_mutex_unlock(&wifi_credentials_mutex); - return ret; -} - -void wifi_credentials_for_each_ssid(wifi_credentials_ssid_cb cb, void *cb_arg) -{ - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (is_entry_used(i)) { - cb(cb_arg, ssid_cache[i], ssid_cache_lengths[i]); - } - } - k_mutex_unlock(&wifi_credentials_mutex); -} - -bool wifi_credentials_is_empty(void) -{ - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (is_entry_used(i)) { - k_mutex_unlock(&wifi_credentials_mutex); - return false; - } - } - k_mutex_unlock(&wifi_credentials_mutex); - return true; -} - -int wifi_credentials_delete_all(void) -{ - int ret = 0; - - k_mutex_lock(&wifi_credentials_mutex, K_FOREVER); - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (is_entry_used(i)) { - ret = wifi_credentials_delete_entry(i); - if (ret) { - LOG_ERR("Failed to delete WiFi credentials index %d, err: %d", - i, ret); - break; - } - wifi_credentials_uncache_ssid(i); - } - } - - k_mutex_unlock(&wifi_credentials_mutex); - return ret; -} - -SYS_INIT(init, POST_KERNEL, CONFIG_APPLICATION_INIT_PRIORITY); diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c deleted file mode 100644 index 750d3a1f71ad..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_none.c +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include - -#include "wifi_credentials_internal.h" - -int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) -{ - ARG_UNUSED(idx); - ARG_UNUSED(buf); - ARG_UNUSED(buf_len); - - return 0; -} - -int wifi_credentials_delete_entry(size_t idx) -{ - ARG_UNUSED(idx); - - return 0; -} - -int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) -{ - ARG_UNUSED(idx); - ARG_UNUSED(buf); - ARG_UNUSED(buf_len); - - return 0; -} - -int wifi_credentials_backend_init(void) -{ - return 0; -} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c deleted file mode 100644 index dcee72ca1adf..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include "psa/crypto.h" - -#include "wifi_credentials_internal.h" - -LOG_MODULE_REGISTER(wifi_credentials_backend, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); - -#define WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN (PSA_KEY_ID_USER_MIN + \ - CONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET) - -BUILD_ASSERT((WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN + CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES) - <= PSA_KEY_ID_USER_MAX, - "WIFI credentials management PSA key id range exceeds PSA_KEY_ID_USER_MAX."); - - -int wifi_credentials_backend_init(void) -{ - psa_status_t ret; - uint8_t buf[ENTRY_MAX_LEN]; - - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - size_t length_read = 0; - size_t key_id = i + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; - - ret = psa_export_key(key_id, buf, ARRAY_SIZE(buf), &length_read); - if (ret == PSA_SUCCESS && length_read == ENTRY_MAX_LEN) { - wifi_credentials_cache_ssid(i, (struct wifi_credentials_header *)buf); - } else if (ret != PSA_ERROR_INVALID_HANDLE) { - LOG_ERR("psa_export_key failed, err: %d", ret); - return -EFAULT; - } - } - - return 0; -} - -int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) -{ - psa_status_t ret; - psa_key_attributes_t key_attributes = { 0 }; - psa_key_id_t key_id; - - psa_set_key_id(&key_attributes, idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN); - psa_set_key_usage_flags(&key_attributes, PSA_KEY_USAGE_EXPORT); - psa_set_key_lifetime(&key_attributes, PSA_KEY_LIFETIME_PERSISTENT); - psa_set_key_algorithm(&key_attributes, PSA_ALG_NONE); - psa_set_key_type(&key_attributes, PSA_KEY_TYPE_RAW_DATA); - psa_set_key_bits(&key_attributes, buf_len * 8); - - ret = psa_import_key(&key_attributes, buf, buf_len, &key_id); - if (ret == PSA_ERROR_ALREADY_EXISTS) { - LOG_ERR("psa_import_key failed, duplicate key: %d", ret); - return -EEXIST; - } else if (ret != PSA_SUCCESS) { - LOG_ERR("psa_import_key failed, err: %d", ret); - return -EFAULT; - } - - return 0; -} - -int wifi_credentials_delete_entry(size_t idx) -{ - psa_status_t ret = psa_destroy_key(idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN); - - if (ret != PSA_SUCCESS) { - LOG_ERR("psa_destroy_key failed, err: %d", ret); - return -EFAULT; - } - - return 0; -} - -int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) -{ - size_t length_read = 0; - size_t key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; - - psa_status_t ret = psa_export_key(key_id, buf, buf_len, &length_read); - - if (ret != PSA_SUCCESS) { - LOG_ERR("psa_export_key failed, err: %d", ret); - return -EFAULT; - } - - if (buf_len != length_read) { - return -EIO; - } - - return 0; -} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c b/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c deleted file mode 100644 index 1323cdf842d0..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c +++ /dev/null @@ -1,165 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include - -#include "wifi_credentials_internal.h" - -LOG_MODULE_REGISTER(wifi_credentials_backend, CONFIG_WIFI_CREDENTIALS_LOG_LEVEL); - -BUILD_ASSERT(ENTRY_MAX_LEN <= SETTINGS_MAX_VAL_LEN); - -#define WIFI_CREDENTIALS_SBE_BASE_KEY "wifi_cred" -#define WIFI_CREDENTIALS_SBE_KEY_SIZE sizeof(WIFI_CREDENTIALS_SBE_BASE_KEY "/" \ - STRINGIFY(CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES)) -#define WIFI_CREDENTIALS_SBE_KEY_FMT WIFI_CREDENTIALS_SBE_BASE_KEY "/%d" - -/* Type of the callback argument used in the function below. */ -struct zephyr_settings_backend_load_cb_arg { - uint8_t *buf; - size_t buf_len; - size_t idx; - bool found; -}; - -/* This callback function is used to retrieve credentials on demand. */ -static int zephyr_settings_backend_load_val_cb(const char *key, size_t len, - settings_read_cb read_cb, - void *cb_arg, void *param) -{ - struct zephyr_settings_backend_load_cb_arg *arg = param; - int idx = atoi(key); - - if (arg->idx != idx) { - LOG_DBG("Skipping index [%s]", key); - return 0; - } - - if (len != arg->buf_len) { - LOG_ERR("Settings error: invalid settings length"); - return -EINVAL; - } - - size_t length_read = read_cb(cb_arg, arg->buf, arg->buf_len); - - /* value validation */ - if (length_read < len) { - LOG_ERR("Settings error: entry incomplete"); - return -ENODATA; - } - - arg->found = true; - - return 0; -} - -/* This callback function is used to initialize the SSID cache. */ -static int zephyr_settings_backend_load_key_cb(const char *key, size_t len, - settings_read_cb read_cb, - void *cb_arg, void *param) -{ - ARG_UNUSED(param); - - /* key validation */ - if (!key) { - LOG_ERR("Settings error: no key"); - return -EINVAL; - } - - int idx = atoi(key); - - if ((idx == 0 && strcmp(key, "0") != 0) || idx >= CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES) { - LOG_ERR("Settings error: index too large"); - return -EINVAL; - } - - if (len < sizeof(struct wifi_credentials_header)) { - LOG_ERR("Settings error: invalid settings length"); - return -EINVAL; - } - - uint8_t buf[ENTRY_MAX_LEN]; - size_t length_read = read_cb(cb_arg, buf, ARRAY_SIZE(buf)); - - /* value validation */ - if (length_read < len) { - LOG_ERR("Settings error: entry incomplete"); - return -ENODATA; - } - - wifi_credentials_cache_ssid(idx, (struct wifi_credentials_header *)buf); - return 0; -} - -int wifi_credentials_backend_init(void) -{ - int ret = settings_subsys_init(); - - if (ret) { - LOG_ERR("Initializing settings subsystem failed: %d", ret); - return ret; - } - ret = settings_load_subtree_direct(WIFI_CREDENTIALS_SBE_BASE_KEY, - zephyr_settings_backend_load_key_cb, NULL); - - return ret; -} - -int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) -{ - char settings_name_buf[WIFI_CREDENTIALS_SBE_KEY_SIZE] = { 0 }; - - int ret = snprintk(settings_name_buf, ARRAY_SIZE(settings_name_buf), - WIFI_CREDENTIALS_SBE_KEY_FMT, idx); - - if (ret < 0 || ret == ARRAY_SIZE(settings_name_buf)) { - LOG_ERR("WiFi credentials settings key could not be generated, idx: %d", idx); - return -EFAULT; - } - - return settings_save_one(settings_name_buf, buf, buf_len); -} - -int wifi_credentials_delete_entry(size_t idx) -{ - char settings_name_buf[WIFI_CREDENTIALS_SBE_KEY_SIZE] = { 0 }; - - int ret = snprintk(settings_name_buf, ARRAY_SIZE(settings_name_buf), - WIFI_CREDENTIALS_SBE_KEY_FMT, idx); - - if (ret < 0 || ret == ARRAY_SIZE(settings_name_buf)) { - LOG_ERR("WiFi credentials settings key could not be generated, idx: %d", idx); - return -EFAULT; - } - - return settings_delete(settings_name_buf); -} - -int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) -{ - struct zephyr_settings_backend_load_cb_arg arg = { - .buf = buf, - .buf_len = buf_len, - .idx = idx, - .found = false, - }; - int ret; - - /* Browse through the settings entries with custom callback to load the whole entry. */ - ret = settings_load_subtree_direct(WIFI_CREDENTIALS_SBE_BASE_KEY, - zephyr_settings_backend_load_val_cb, &arg); - - if (ret) { - return ret; - } - if (!arg.found) { - return -ENOENT; - } - return 0; -} diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h b/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h deleted file mode 100644 index 5bff31dc2a37..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_internal.h +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include - -#define ENTRY_MAX_LEN sizeof(struct wifi_credentials_personal) - -/** - * @brief Write entry to SSID cache. - * - * @param idx credential index - * @param buf encoded settings entry - * @param buf_len length of buf - */ -void wifi_credentials_cache_ssid(size_t idx, const struct wifi_credentials_header *buf); - -/** - * @brief Clear entry in SSID cache. - * - * @param idx credential index - */ -void wifi_credentials_uncache_ssid(size_t idx); - -/** - * @brief Stores settings entry in flash. - * - * @param idx credential index - * @param buf encoded settings entry - * @param buf_len length of buf - * @return 0 on success, otherwise a negative error code - */ -int wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len); - -/** - * @brief Deletes settings entry from flash. - * - * @param idx credential index - * @return 0 on success, otherwise a negative error code - */ -int wifi_credentials_delete_entry(size_t idx); - -/** - * @brief Loads settings entry from flash. - * - * @param idx credential index - * @param buf encoded settings entry - * @param buf_len length of buf - * @return 0 on success, otherwise a negative error code - */ -int wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len); - -/** - * @brief Initialize backend. - * @note Is called by the library on system startup. - * - */ -int wifi_credentials_backend_init(void); diff --git a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c b/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c deleted file mode 100644 index b94c23c70e8c..000000000000 --- a/subsys/net/lib/wifi_credentials/wifi_credentials_shell.c +++ /dev/null @@ -1,340 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -#include -#include - -#define MAX_BANDS_STR_LEN 64 - -/* Ensure 'strnlen' is available even with -std=c99. */ -size_t strnlen(const char *buf, size_t bufsz); - -#define MACSTR "%02hhx:%02hhx:%02hhx:%02hhx:%02hhx:%02hhx" - -static void print_network_info(void *cb_arg, const char *ssid, size_t ssid_len) -{ - int ret = 0; - struct wifi_credentials_personal creds = {0}; - const struct shell *shell = (const struct shell *)cb_arg; - - ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, &creds); - if (ret) { - shell_error(shell, - "An error occurred when trying to load credentials for network \"%.*s\"" - ". err: %d", - ssid_len, ssid, ret); - return; - } - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, - " network ssid: \"%.*s\", ssid_len: %d, type: %s", ssid_len, ssid, ssid_len, - wifi_security_txt(creds.header.type)); - - if (creds.header.type == WIFI_SECURITY_TYPE_PSK || - creds.header.type == WIFI_SECURITY_TYPE_PSK_SHA256 || - creds.header.type == WIFI_SECURITY_TYPE_SAE || - creds.header.type == WIFI_SECURITY_TYPE_WPA_PSK) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, - ", password: \"%.*s\", password_len: %d", creds.password_len, - creds.password, creds.password_len); - } - -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - if (creds.header.type == WIFI_SECURITY_TYPE_EAP_TLS) { - if (creds.header.key_passwd_length > 0) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, - ", key_passwd: \"%.*s\", key_passwd_len: %d", - creds.header.key_passwd_length, creds.header.key_passwd, - creds.header.key_passwd_length); - } - if (creds.header.aid_length > 0) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, - ", anon_id: \"%.*s\", anon_id_len: %d", - creds.header.aid_length, creds.header.anon_id, - creds.header.aid_length); - } - } -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - - if (creds.header.flags & WIFI_CREDENTIALS_FLAG_BSSID) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", bssid: " MACSTR, - creds.header.bssid[0], creds.header.bssid[1], creds.header.bssid[2], - creds.header.bssid[3], creds.header.bssid[4], creds.header.bssid[5]); - } - - if (creds.header.flags & WIFI_CREDENTIALS_FLAG_2_4GHz) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", band: 2.4GHz"); - } - - if (creds.header.flags & WIFI_CREDENTIALS_FLAG_5GHz) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", band: 5GHz"); - } - - if (creds.header.channel) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", channel: %d", - creds.header.channel); - } - - if (creds.header.flags & WIFI_CREDENTIALS_FLAG_FAVORITE) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", favorite"); - } - - if (creds.header.flags & WIFI_CREDENTIALS_FLAG_MFP_REQUIRED) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", MFP_REQUIRED"); - } else if (creds.header.flags & WIFI_CREDENTIALS_FLAG_MFP_DISABLED) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", MFP_DISABLED"); - } else { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", MFP_OPTIONAL"); - } - - if (creds.header.timeout) { - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, ", timeout: %d", - creds.header.timeout); - } - - shell_fprintf(shell, SHELL_VT100_COLOR_DEFAULT, "\n"); -} - -static int cmd_add_network(const struct shell *shell, size_t argc, char *argv[]) -{ - - int opt; - int opt_index = 0; - struct getopt_state *state; - static const struct option long_options[] = { - {"ssid", required_argument, 0, 's'}, {"passphrase", required_argument, 0, 'p'}, - {"key-mgmt", required_argument, 0, 'k'}, {"ieee-80211w", required_argument, 0, 'w'}, - {"bssid", required_argument, 0, 'm'}, {"band", required_argument, 0, 'b'}, - {"channel", required_argument, 0, 'c'}, {"timeout", required_argument, 0, 't'}, - {"identity", required_argument, 0, 'a'}, {"key-passwd", required_argument, 0, 'K'}, - {"help", no_argument, 0, 'h'}, {0, 0, 0, 0}}; - char *endptr; - bool secure_connection = false; - uint8_t band; - struct wifi_credentials_personal creds = {0}; - - const uint8_t all_bands[] = {WIFI_FREQ_BAND_2_4_GHZ, WIFI_FREQ_BAND_5_GHZ, - WIFI_FREQ_BAND_6_GHZ}; - bool found = false; - char bands_str[MAX_BANDS_STR_LEN] = {0}; - size_t offset = 0; - long channel; - long mfp = WIFI_MFP_OPTIONAL; - - while ((opt = getopt_long(argc, argv, "s:p:k:w:b:c:m:t:a:K:h", long_options, &opt_index)) != - -1) { - state = getopt_state_get(); - switch (opt) { - case 's': - creds.header.ssid_len = strlen(state->optarg); - if (creds.header.ssid_len > WIFI_SSID_MAX_LEN) { - shell_warn(shell, "SSID too long (max %d characters)\n", - WIFI_SSID_MAX_LEN); - return -EINVAL; - } - memcpy(creds.header.ssid, state->optarg, creds.header.ssid_len); - break; - case 'k': - creds.header.type = atoi(state->optarg); - if (creds.header.type) { - secure_connection = true; - } - break; - case 'p': - creds.password_len = strlen(state->optarg); - if (creds.password_len < WIFI_PSK_MIN_LEN) { - shell_warn(shell, "Passphrase should be minimum %d characters\n", - WIFI_PSK_MIN_LEN); - return -EINVAL; - } - if (creds.password_len > WIFI_PSK_MAX_LEN) { - shell_warn(shell, "Passphrase too long (max %d characters)\n", - WIFI_PSK_MAX_LEN); - return -EINVAL; - } - memcpy(creds.password, state->optarg, creds.password_len); - break; - case 'c': - channel = strtol(state->optarg, &endptr, 10); - if (*endptr != '\0') { - shell_error(shell, "Invalid channel: %s\n", state->optarg); - return -EINVAL; - } - - for (band = 0; band < ARRAY_SIZE(all_bands); band++) { - offset += snprintf(bands_str + offset, sizeof(bands_str) - offset, - "%s%s", band ? "," : "", - wifi_band_txt(all_bands[band])); - if (offset >= sizeof(bands_str)) { - shell_error(shell, - "Failed to parse channel: %ld: " - "band string too long\n", - channel); - return -EINVAL; - } - - if (wifi_utils_validate_chan(all_bands[band], channel)) { - found = true; - break; - } - } - - if (!found) { - shell_error(shell, "Invalid channel: %ld, checked bands: %s\n", - channel, bands_str); - return -EINVAL; - } - - creds.header.channel = channel; - break; - case 'b': - switch (atoi(state->optarg)) { - case 2: - creds.header.flags |= WIFI_CREDENTIALS_FLAG_2_4GHz; - break; - case 5: - creds.header.flags |= WIFI_CREDENTIALS_FLAG_5GHz; - break; - case 6: - creds.header.flags |= WIFI_CREDENTIALS_FLAG_6GHz; - break; - default: - shell_error(shell, "Invalid band: %d\n", atoi(state->optarg)); - return -EINVAL; - } - break; - case 'w': - if (creds.header.type == WIFI_SECURITY_TYPE_NONE || - creds.header.type == WIFI_SECURITY_TYPE_WPA_PSK) { - shell_error(shell, "MFP not supported for security type %s", - wifi_security_txt(creds.header.type)); - return -ENOTSUP; - } - mfp = strtol(state->optarg, &endptr, 10); - if (*endptr != '\0') { - shell_error(shell, "Invalid IEEE 802.11w value: %s", state->optarg); - return -EINVAL; - } - if (mfp == WIFI_MFP_DISABLE) { - creds.header.flags |= WIFI_CREDENTIALS_FLAG_MFP_DISABLED; - } else if (mfp == WIFI_MFP_REQUIRED) { - creds.header.flags |= WIFI_CREDENTIALS_FLAG_MFP_REQUIRED; - } else if (mfp > 2) { - shell_error(shell, "Invalid IEEE 802.11w value: %s", - state->optarg); - return -EINVAL; - } - break; - case 'm': - if (net_bytes_from_str(creds.header.bssid, sizeof(creds.header.bssid), - state->optarg) < 0) { - shell_warn(shell, "Invalid MAC address\n"); - return -EINVAL; - } - creds.header.flags |= WIFI_CREDENTIALS_FLAG_BSSID; - break; - case 'a': - creds.header.aid_length = strlen(state->optarg); - if (creds.header.aid_length > WIFI_ENT_IDENTITY_MAX_LEN) { - shell_warn(shell, "anon_id too long (max %d characters)\n", - WIFI_ENT_IDENTITY_MAX_LEN); - return -EINVAL; - } - memcpy(creds.header.anon_id, state->optarg, creds.header.aid_length); - creds.header.flags |= WIFI_CREDENTIALS_FLAG_ANONYMOUS_IDENTITY; - break; - case 'K': - creds.header.key_passwd_length = strlen(state->optarg); - if (creds.header.key_passwd_length > WIFI_ENT_PSWD_MAX_LEN) { - shell_warn(shell, "key_passwd too long (max %d characters)\n", - WIFI_ENT_PSWD_MAX_LEN); - return -EINVAL; - } - memcpy(creds.header.key_passwd, state->optarg, - creds.header.key_passwd_length); - creds.header.flags |= WIFI_CREDENTIALS_FLAG_KEY_PASSWORD; - break; - case 'h': - shell_help(shell); - return -ENOEXEC; - default: - shell_error(shell, "Invalid option %c\n", state->optopt); - return -EINVAL; - } - } - if (creds.password_len > 0 && !secure_connection) { - shell_warn(shell, "Passphrase provided without security configuration\n"); - } - - if (creds.header.ssid_len == 0) { - shell_error(shell, "SSID not provided\n"); - shell_help(shell); - return -EINVAL; - } - - return wifi_credentials_set_personal_struct(&creds); -} - -static int cmd_delete_network(const struct shell *shell, size_t argc, char *argv[]) -{ - if (argc != 2) { - shell_print(shell, "Usage: wifi_cred delete \"network name\""); - return -EINVAL; - } - - if (strnlen(argv[1], WIFI_SSID_MAX_LEN + 1) > WIFI_SSID_MAX_LEN) { - shell_error(shell, "SSID too long"); - return -EINVAL; - } - - shell_print(shell, "\tDeleting network ssid: \"%s\", ssid_len: %d", argv[1], - strlen(argv[1])); - return wifi_credentials_delete_by_ssid(argv[1], strlen(argv[1])); -} - -static int cmd_list_networks(const struct shell *shell, size_t argc, char *argv[]) -{ - wifi_credentials_for_each_ssid(print_network_info, (void *)shell); - return 0; -} - - -SHELL_SUBCMD_SET_CREATE(sub_wifi_cred, (nwifi_cred)); -SHELL_SUBCMD_ADD((nwifi_cred), add, NULL, - "Add network to storage.\n" - "<-s --ssid \"\">: SSID.\n" - "[-c --channel]: Channel that needs to be scanned for connection. 0:any channel.\n" - "[-b, --band] 0: any band (2:2.4GHz, 5:5GHz, 6:6GHz]\n" - "[-p, --passphrase]: Passphrase (valid only for secure SSIDs)\n" - "[-k, --key-mgmt]: Key Management type (valid only for secure SSIDs)\n" - "0:None, 1:WPA2-PSK, 2:WPA2-PSK-256, 3:SAE-HNP, 4:SAE-H2E, 5:SAE-AUTO, 6:WAPI," - " 7:EAP-TLS, 8:WEP, 9: WPA-PSK, 10: WPA-Auto-Personal, 11: DPP\n" - "[-w, --ieee-80211w]: MFP (optional: needs security type to be specified)\n" - ": 0:Disable, 1:Optional, 2:Required.\n" - "[-m, --bssid]: MAC address of the AP (BSSID).\n" - "[-t, --timeout]: Timeout for the connection attempt (in seconds).\n" - "[-a, --identity]: Identity for enterprise mode.\n" - "[-K, --key-passwd]: Private key passwd for enterprise mode.\n" - "[-h, --help]: Print out the help for the connect command.\n", - cmd_add_network, 2, 12); -SHELL_SUBCMD_ADD((nwifi_cred), delete, NULL, "Delete network from storage.", cmd_delete_network, 0, - 0); -SHELL_SUBCMD_ADD((nwifi_cred), list, NULL, "List stored networks.", cmd_list_networks, 0, 0); - - -SHELL_CMD_REGISTER(wifi_cred, &sub_wifi_cred, "Wi-Fi Credentials commands", NULL); diff --git a/subsys/net/lib/wifi_mgmt_ext/CMakeLists.txt b/subsys/net/lib/wifi_mgmt_ext/CMakeLists.txt deleted file mode 100644 index a91041aa7b35..000000000000 --- a/subsys/net/lib/wifi_mgmt_ext/CMakeLists.txt +++ /dev/null @@ -1,40 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -zephyr_library() -zephyr_library_sources(wifi_mgmt_ext.c) -zephyr_library_sources_ifdef( - CONFIG_WIFI_CREDENTIALS_SHELL_AUTOCONNECT - wifi_cred_shell_autoconnect.c) - -if(DEFINED CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE AND NOT DEFINED CONFIG_NET_L2_WIFI_SHELL) - # Wi-Fi Enterprise test certificates handling - set(gen_inc_dir ${ZEPHYR_BINARY_DIR}/misc/generated) - set(gen_dir ${gen_inc_dir}/wifi_enterprise_test_certs) - # Create output directory for test certs - file(MAKE_DIRECTORY ${gen_dir}) - - # convert .pem files to array data at build time - zephyr_include_directories(${gen_inc_dir}) - - generate_inc_file_for_target( - app - ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client.pem - ${gen_dir}/client.pem.inc - ) - - generate_inc_file_for_target( - app - ${ZEPHYR_BASE}/samples/net/wifi/test_certs/client-key.pem - ${gen_dir}/client-key.pem.inc - ) - - generate_inc_file_for_target( - app - ${ZEPHYR_BASE}/samples/net/wifi/test_certs/ca.pem - ${gen_dir}/ca.pem.inc - ) -endif() diff --git a/subsys/net/lib/wifi_mgmt_ext/Kconfig b/subsys/net/lib/wifi_mgmt_ext/Kconfig deleted file mode 100644 index 4d619f692a85..000000000000 --- a/subsys/net/lib/wifi_mgmt_ext/Kconfig +++ /dev/null @@ -1,34 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -config WIFI_MGMT_EXT - bool "Extended commands for Wi-Fi management" - depends on WIFI_NM_WPA_SUPPLICANT - depends on WIFI_CREDENTIALS - default y - help - Extends Wi-Fi L2 stack by commands to handle - automatic connection management. - -config WIFI_CREDENTIALS_SHELL_AUTOCONNECT - bool "Shell commands to manage Wi-Fi credentials" - default y - depends on WIFI_CREDENTIALS_SHELL - depends on WIFI_MGMT_EXT - -if WIFI_MGMT_EXT - -config WIFI_MGMT_EXT_CONNECTION_TIMEOUT - int "Connection timeout" - default 30 - help - Wait period before falling back to the next entry in the list of stored SSIDs. - -module = WIFI_MGMT_EXT -module-str = wifi_mgmt_ext -source "subsys/logging/Kconfig.template.log_config" - -endif diff --git a/subsys/net/lib/wifi_mgmt_ext/wifi_cred_shell_autoconnect.c b/subsys/net/lib/wifi_mgmt_ext/wifi_cred_shell_autoconnect.c deleted file mode 100644 index b62c7f2a9f1e..000000000000 --- a/subsys/net/lib/wifi_mgmt_ext/wifi_cred_shell_autoconnect.c +++ /dev/null @@ -1,31 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include - -#include -#include -#include -#include -#include - - -static int cmd_auto_connect(const struct shell *shell, size_t argc, char *argv[]) -{ - struct net_if *iface = net_if_get_first_by_type(&NET_L2_GET_NAME(ETHERNET)); - int rc = net_mgmt(NET_REQUEST_WIFI_CONNECT_STORED, iface, NULL, 0); - - if (rc) { - shell_error(shell, - "An error occurred when trying to auto-connect to a network. err: %d", - rc); - } - return 0; -} - -SHELL_SUBCMD_ADD((nwifi_cred), - auto_connect, NULL, "Connect to any stored network.", cmd_auto_connect, 0, 0); diff --git a/subsys/net/lib/wifi_mgmt_ext/wifi_mgmt_ext.c b/subsys/net/lib/wifi_mgmt_ext/wifi_mgmt_ext.c deleted file mode 100644 index 41d78cebdc06..000000000000 --- a/subsys/net/lib/wifi_mgmt_ext/wifi_mgmt_ext.c +++ /dev/null @@ -1,332 +0,0 @@ -/* - * Copyright (c) 2023 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include - -#include -#include -#include -#include -#include - -#include "wpa_cli_zephyr.h" - -/* Ensure 'strnlen' is available even with -std=c99. */ -size_t strnlen(const char *buf, size_t bufsz); - -LOG_MODULE_REGISTER(wifi_mgmt_ext, CONFIG_WIFI_MGMT_EXT_LOG_LEVEL); - -#if defined(CONFIG_WIFI_CREDENTIALS_STATIC) -BUILD_ASSERT(sizeof(CONFIG_WIFI_CREDENTIALS_STATIC_SSID) != 1, - "CONFIG_WIFI_CREDENTIALS_STATIC_SSID required"); -#endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ - -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static const char ca_cert_test[] = { -#include - '\0'}; - -static const char client_cert_test[] = { -#include - '\0'}; - -static const char client_key_test[] = { -#include - '\0'}; - -static const char ca_cert2_test[] = { - #include - '\0'}; - -static const char client_cert2_test[] = { - #include - '\0'}; - -static const char client_key2_test[] = { - #include - '\0'}; -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - -static int __stored_creds_to_params(struct wifi_credentials_personal *creds, - struct wifi_connect_req_params *params) -{ - char *ssid = NULL; - char *psk = NULL; -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - char *key_passwd = NULL; -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - int ret; - - /* SSID */ - ssid = (char *)k_malloc(creds->header.ssid_len + 1); - if (!ssid) { - LOG_ERR("Failed to allocate memory for SSID\n"); - ret = -ENOMEM; - goto err_out; - } - memset(ssid, 0, creds->header.ssid_len + 1); - ret = snprintf(ssid, creds->header.ssid_len + 1, "%s", creds->header.ssid); - if (ret > creds->header.ssid_len) { - LOG_ERR("SSID string truncated\n"); - ret = -EINVAL; - goto err_out; - } - params->ssid = ssid; - params->ssid_length = creds->header.ssid_len; - - /* PSK (optional) */ - if (creds->password_len > 0) { - psk = (char *)k_malloc(creds->password_len + 1); - if (!psk) { - LOG_ERR("Failed to allocate memory for PSK\n"); - ret = -ENOMEM; - goto err_out; - } - memset(psk, 0, creds->password_len + 1); - ret = snprintf(psk, creds->password_len + 1, "%s", creds->password); - if (ret > creds->password_len) { - LOG_ERR("PSK string truncated\n"); - ret = -EINVAL; - goto err_out; - } - params->psk = psk; - params->psk_length = creds->password_len; - } - - /* Defaults */ - params->security = creds->header.type; -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - if (params->security == WIFI_SECURITY_TYPE_EAP_TLS) { - if (creds->header.key_passwd_length > 0) { - key_passwd = (char *)k_malloc(creds->header.key_passwd_length + 1); - if (!key_passwd) { - LOG_ERR("Failed to allocate memory for key_passwd\n"); - ret = -ENOMEM; - goto err_out; - } - memset(key_passwd, 0, creds->header.key_passwd_length + 1); - ret = snprintf(key_passwd, creds->header.key_passwd_length + 1, "%s", - creds->header.key_passwd); - if (ret > creds->header.key_passwd_length) { - LOG_ERR("key_passwd string truncated\n"); - ret = -EINVAL; - goto err_out; - } - params->key_passwd = key_passwd; - params->key_passwd_length = creds->header.key_passwd_length; - } - } -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - - /* If channel is set to 0 we default to ANY. 0 is not a valid Wi-Fi channel. */ - params->channel = (creds->header.channel != 0) ? creds->header.channel : WIFI_CHANNEL_ANY; - params->timeout = (creds->header.timeout != 0) ? creds->header.timeout - : CONFIG_WIFI_MGMT_EXT_CONNECTION_TIMEOUT; - - /* Security type (optional) */ - if (creds->header.type > WIFI_SECURITY_TYPE_MAX) { - params->security = WIFI_SECURITY_TYPE_NONE; - } - - if (creds->header.flags & WIFI_CREDENTIALS_FLAG_2_4GHz) { - params->band = WIFI_FREQ_BAND_2_4_GHZ; - } else if (creds->header.flags & WIFI_CREDENTIALS_FLAG_5GHz) { - params->band = WIFI_FREQ_BAND_5_GHZ; - } else { - params->band = WIFI_FREQ_BAND_UNKNOWN; - } - - /* MFP setting (default: optional) */ - if (creds->header.flags & WIFI_CREDENTIALS_FLAG_MFP_DISABLED) { - params->mfp = WIFI_MFP_DISABLE; - } else if (creds->header.flags & WIFI_CREDENTIALS_FLAG_MFP_REQUIRED) { - params->mfp = WIFI_MFP_REQUIRED; - } else { - params->mfp = WIFI_MFP_OPTIONAL; - } - - return 0; -err_out: - if (ssid) { - k_free(ssid); - ssid = NULL; - } - if (psk) { - k_free(psk); - psk = NULL; - } -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - if (key_passwd) { - k_free(key_passwd); - key_passwd = NULL; - } -#endif /* CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE */ - return ret; -} - -static inline const char *wpa_supp_security_txt(enum wifi_security_type security) -{ - switch (security) { - case WIFI_SECURITY_TYPE_NONE: - return "NONE"; - case WIFI_SECURITY_TYPE_PSK: - return "WPA-PSK"; - case WIFI_SECURITY_TYPE_PSK_SHA256: - return "WPA-PSK-SHA256"; - case WIFI_SECURITY_TYPE_SAE: - return "SAE"; - case WIFI_SECURITY_TYPE_UNKNOWN: - default: - return "UNKNOWN"; - } -} - -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE -static int wifi_set_enterprise_creds(struct net_if *iface) -{ - struct wifi_enterprise_creds_params params = {0}; - - params.ca_cert = (uint8_t *)ca_cert_test; - params.ca_cert_len = ARRAY_SIZE(ca_cert_test); - params.client_cert = (uint8_t *)client_cert_test; - params.client_cert_len = ARRAY_SIZE(client_cert_test); - params.client_key = (uint8_t *)client_key_test; - params.client_key_len = ARRAY_SIZE(client_key_test); - params.ca_cert2 = (uint8_t *)ca_cert2_test; - params.ca_cert2_len = ARRAY_SIZE(ca_cert2_test); - params.client_cert2 = (uint8_t *)client_cert2_test; - params.client_cert2_len = ARRAY_SIZE(client_cert2_test); - params.client_key2 = (uint8_t *)client_key2_test; - params.client_key2_len = ARRAY_SIZE(client_key2_test); - - if (net_mgmt(NET_REQUEST_WIFI_ENTERPRISE_CREDS, iface, ¶ms, sizeof(params))) { - LOG_ERR("Set enterprise credentials failed\n"); - return -1; - } - - return 0; -} -#endif - -static int add_network_from_credentials_struct_personal(struct wifi_credentials_personal *creds, - struct net_if *iface) -{ - int ret = 0; - struct wifi_connect_req_params cnx_params = {0}; - - if (__stored_creds_to_params(creds, &cnx_params)) { - ret = -ENOEXEC; - goto out; - } - -#ifdef CONFIG_WIFI_NM_WPA_SUPPLICANT_CRYPTO_ENTERPRISE - /* Load the enterprise credentials if needed */ - if (cnx_params.security == WIFI_SECURITY_TYPE_EAP_TLS) { - wifi_set_enterprise_creds(iface); - } -#endif - if (net_mgmt(NET_REQUEST_WIFI_CONNECT, iface, &cnx_params, - sizeof(struct wifi_connect_req_params))) { - LOG_ERR("Connection request failed\n"); - - return -ENOEXEC; - } - - LOG_INF("Connection requested"); - -out: - if (cnx_params.psk) { - k_free((void *)cnx_params.psk); - } - - if (cnx_params.ssid) { - k_free((void *)cnx_params.ssid); - } - - return ret; -} - -static void add_stored_network(void *cb_arg, const char *ssid, size_t ssid_len) -{ - int ret = 0; - struct wifi_credentials_personal creds; - - /* load stored data */ - ret = wifi_credentials_get_by_ssid_personal_struct(ssid, ssid_len, &creds); - - if (ret) { - LOG_ERR("Loading WiFi credentials failed for SSID [%.*s], len: %d, err: %d", - ssid_len, ssid, ssid_len, ret); - return; - } - - add_network_from_credentials_struct_personal(&creds, (struct net_if *)cb_arg); -} - -static int add_static_network_config(struct net_if *iface) -{ -#if defined(CONFIG_WIFI_CREDENTIALS_STATIC) - - struct wifi_credentials_personal creds = { - .header = { - .ssid_len = strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID), - }, - .password_len = strlen(CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD), - }; - - int ret = wifi_credentials_get_by_ssid_personal_struct( - CONFIG_WIFI_CREDENTIALS_STATIC_SSID, strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID), - &creds); - - if (!ret) { - LOG_WRN("Statically configured WiFi network was overridden by storage."); - return 0; - } - -#if defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_OPEN) - creds.header.type = WIFI_SECURITY_TYPE_NONE; -#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK) - creds.header.type = WIFI_SECURITY_TYPE_PSK; -#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_PSK_SHA256) - creds.header.type = WIFI_SECURITY_TYPE_PSK_SHA256; -#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_SAE) - creds.header.type = WIFI_SECURITY_TYPE_SAE; -#elif defined(CONFIG_WIFI_CREDENTIALS_STATIC_TYPE_WPA_PSK) - creds.header.type = WIFI_SECURITY_TYPE_WPA_PSK; -#else -#error "invalid CONFIG_WIFI_CREDENTIALS_STATIC_TYPE" -#endif - - memcpy(creds.header.ssid, CONFIG_WIFI_CREDENTIALS_STATIC_SSID, - strlen(CONFIG_WIFI_CREDENTIALS_STATIC_SSID)); - memcpy(creds.password, CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD, - strlen(CONFIG_WIFI_CREDENTIALS_STATIC_PASSWORD)); - - LOG_DBG("Adding statically configured WiFi network [%s] to internal list.", - creds.header.ssid); - - return add_network_from_credentials_struct_personal(&creds, iface); -#else - return 0; -#endif /* defined(CONFIG_WIFI_CREDENTIALS_STATIC) */ -} - -static int wifi_ext_command(uint32_t mgmt_request, struct net_if *iface, void *data, size_t len) -{ - int ret = 0; - - ret = add_static_network_config(iface); - if (ret) { - return ret; - } - - wifi_credentials_for_each_ssid(add_stored_network, iface); - - return ret; -}; - -NET_MGMT_REGISTER_REQUEST_HANDLER(NET_REQUEST_WIFI_CONNECT_STORED, wifi_ext_command); diff --git a/tests/subsys/net/lib/wifi_credentials/CMakeLists.txt b/tests/subsys/net/lib/wifi_credentials/CMakeLists.txt deleted file mode 100644 index fc30294b07dd..000000000000 --- a/tests/subsys/net/lib/wifi_credentials/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(wifi_credentials_test) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) - -test_runner_generate(src/main.c) - -target_sources(app - PRIVATE - ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/wifi_credentials.c -) - -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/include/net/) -zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/) - - -target_compile_options(app - PRIVATE - -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 - -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 -) diff --git a/tests/subsys/net/lib/wifi_credentials/prj.conf b/tests/subsys/net/lib/wifi_credentials/prj.conf deleted file mode 100644 index b89c37522f86..000000000000 --- a/tests/subsys/net/lib/wifi_credentials/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_UNITY=y diff --git a/tests/subsys/net/lib/wifi_credentials/src/main.c b/tests/subsys/net/lib/wifi_credentials/src/main.c deleted file mode 100644 index d1b119175a16..000000000000 --- a/tests/subsys/net/lib/wifi_credentials/src/main.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include -#include - -#include - -#include - -#include "wifi_credentials_internal.h" - -DEFINE_FFF_GLOBALS; - -FAKE_VALUE_FUNC(int, wifi_credentials_store_entry, size_t, const void *, size_t) -FAKE_VALUE_FUNC(int, wifi_credentials_load_entry, size_t, void *, size_t) -FAKE_VALUE_FUNC(int, wifi_credentials_delete_entry, size_t) -FAKE_VALUE_FUNC(int, wifi_credentials_backend_init) - -uint8_t fake_settings_buf[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][ENTRY_MAX_LEN]; - -int custom_wifi_credentials_store_entry(size_t idx, const void *buf, size_t buf_len) -{ - TEST_ASSERT(idx < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES); - memcpy(fake_settings_buf[idx], buf, MIN(ENTRY_MAX_LEN, buf_len)); - return 0; -} - -int custom_wifi_credentials_load_entry(size_t idx, void *buf, size_t buf_len) -{ - TEST_ASSERT(idx < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES); - memcpy(buf, fake_settings_buf[idx], MIN(ENTRY_MAX_LEN, buf_len)); - return 0; -} - -void setUp(void) -{ - RESET_FAKE(wifi_credentials_store_entry); - RESET_FAKE(wifi_credentials_load_entry); - RESET_FAKE(wifi_credentials_delete_entry); - wifi_credentials_store_entry_fake.custom_fake = - custom_wifi_credentials_store_entry; - wifi_credentials_load_entry_fake.custom_fake = - custom_wifi_credentials_load_entry; -} - -#define SSID1 "test1" -#define PSK1 "super secret" -#define SECURITY1 WIFI_SECURITY_TYPE_PSK -#define BSSID1 "abcdef" -#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID -#define CHANNEL1 1 - -#define SSID2 "test2" -#define SECURITY2 WIFI_SECURITY_TYPE_NONE -#define FLAGS2 0 -#define CHANNEL2 2 - -#define SSID3 "test3" -#define PSK3 "extremely secret" -#define SECURITY3 WIFI_SECURITY_TYPE_SAE -#define FLAGS3 0 -#define CHANNEL3 3 - -#define SSID4 "\0what's\0null\0termination\0anyway" -#define PSK4 PSK1 -#define SECURITY4 SECURITY1 -#define BSSID4 BSSID1 -#define FLAGS4 FLAGS1 -#define CHANNEL4 4 - -void tearDown(void) -{ - wifi_credentials_delete_by_ssid(SSID1, ARRAY_SIZE(SSID1)); - wifi_credentials_delete_by_ssid(SSID2, ARRAY_SIZE(SSID2)); - wifi_credentials_delete_by_ssid(SSID3, ARRAY_SIZE(SSID3)); - wifi_credentials_delete_by_ssid(SSID4, ARRAY_SIZE(SSID4)); - wifi_credentials_delete_by_ssid("", 0); -} - -/* Verify that attempting to retrieve a non-existent credentials entry raises -ENOENT. */ -void test_get_non_existing(void) -{ - int err; - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - err = wifi_credentials_get_by_ssid_personal(SSID1, sizeof(SSID1), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(-ENOENT, err); -} - -/* Verify that we can successfully set/get a network without a specified BSSID. */ -void test_single_no_bssid(void) -{ - int err; - - /* set network credentials without BSSID */ - err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, NULL, 0, - PSK1, sizeof(PSK1), 0, 0, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - /* retrieve network credentials without BSSID */ - err = wifi_credentials_get_by_ssid_personal(SSID1, sizeof(SSID1), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(0, strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf))); - TEST_ASSERT_EQUAL(0, flags); - TEST_ASSERT_EQUAL(0, channel); - TEST_ASSERT_EQUAL(SECURITY1, security); - - err = wifi_credentials_delete_by_ssid(SSID1, sizeof(SSID1)); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); -} - -/* Verify that we can successfully set/get a network with a fixed BSSID. */ -void test_single_with_bssid(void) -{ - int err; - - /* set network credentials with BSSID */ - err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, - PSK1, sizeof(PSK1), FLAGS1, CHANNEL1, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - /* retrieve network credentials with BSSID */ - err = wifi_credentials_get_by_ssid_personal(SSID1, sizeof(SSID1), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(0, strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf))); - TEST_ASSERT_EQUAL(sizeof(PSK1), psk_len); - TEST_ASSERT_EQUAL(0, strncmp(BSSID1, bssid_buf, ARRAY_SIZE(bssid_buf))); - TEST_ASSERT_EQUAL(WIFI_CREDENTIALS_FLAG_BSSID, flags); - TEST_ASSERT_EQUAL(CHANNEL1, channel); - TEST_ASSERT_EQUAL(SECURITY1, security); - - err = wifi_credentials_delete_by_ssid(SSID1, sizeof(SSID1)); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); -} - -/* Verify that we can successfully set/get an open network. */ -void test_single_without_psk(void) -{ - int err; - - /* set network credentials without PSK/BSSID */ - err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, - NULL, 0, FLAGS2, CHANNEL2, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - /* retrieve network credentials without PSK/BSSID */ - err = wifi_credentials_get_by_ssid_personal(SSID2, sizeof(SSID2), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, - &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(0, psk_len); - TEST_ASSERT_EQUAL(0, flags); - TEST_ASSERT_EQUAL(CHANNEL2, channel); - - err = wifi_credentials_delete_by_ssid(SSID2, sizeof(SSID2)); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); -} - -/* Verify that we can set/get a network that is only identified by a BSSID. */ -void test_single_without_ssid(void) -{ - int err; - - err = wifi_credentials_set_personal("", 0, SECURITY1, BSSID1, 6, - PSK1, sizeof(PSK1), FLAGS1, CHANNEL1, 0); - TEST_ASSERT_EQUAL(-EINVAL, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - err = wifi_credentials_get_by_ssid_personal("", 0, &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(-EINVAL, err); - - err = wifi_credentials_delete_by_ssid("", 0); - TEST_ASSERT_EQUAL(-EINVAL, err); -} - -/* Verify that we can handle SSIDs that contain NULL characters. */ -void test_single_garbled_ssid(void) -{ - int err; - - err = wifi_credentials_set_personal(SSID4, sizeof(SSID4), SECURITY4, BSSID4, 6, - PSK4, sizeof(PSK4), FLAGS4, CHANNEL4, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - err = wifi_credentials_get_by_ssid_personal(SSID4, sizeof(SSID4), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(0, strncmp(PSK4, psk_buf, ARRAY_SIZE(psk_buf))); - TEST_ASSERT_EQUAL(sizeof(PSK4), psk_len); - TEST_ASSERT_EQUAL(0, strncmp(BSSID4, bssid_buf, ARRAY_SIZE(bssid_buf))); - TEST_ASSERT_EQUAL(SECURITY4, security); - TEST_ASSERT_EQUAL(FLAGS4, flags); - TEST_ASSERT_EQUAL(CHANNEL4, channel); - - err = wifi_credentials_delete_by_ssid(SSID4, sizeof(SSID4)); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); -} - -/* Helper function for test_set_storage_limit, making sure that the SSID cache is correct. */ -void verify_ssid_cache_cb(void *cb_arg, const char *ssid, size_t ssid_len) -{ - static int call_count; - static const char *const ssids[] = {SSID3, SSID2}; - - TEST_ASSERT_EQUAL(0, strncmp(ssids[call_count++], ssid, ssid_len)); - TEST_ASSERT_EQUAL_PTR(NULL, cb_arg); - -} - -/* Verify that wifi_credentials behaves correctly when the storage limit is reached. */ -void test_storage_limit(void) -{ - int err; - - /* Set two networks */ - err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, - PSK1, sizeof(PSK1), FLAGS1, CHANNEL1, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, - NULL, 0, FLAGS2, CHANNEL2, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - enum wifi_security_type security = -1; - uint8_t bssid_buf[WIFI_MAC_ADDR_LEN] = ""; - char psk_buf[WIFI_CREDENTIALS_MAX_PASSWORD_LEN] = ""; - size_t psk_len = 0; - uint32_t flags = 0; - uint8_t channel = 0; - uint32_t timeout = 0; - - /* Get two networks */ - err = wifi_credentials_get_by_ssid_personal(SSID1, sizeof(SSID1), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(0, strncmp(PSK1, psk_buf, ARRAY_SIZE(psk_buf))); - TEST_ASSERT_EQUAL(sizeof(PSK1), psk_len); - TEST_ASSERT_EQUAL(0, strncmp(BSSID1, bssid_buf, ARRAY_SIZE(bssid_buf))); - TEST_ASSERT_EQUAL(SECURITY1, security); - TEST_ASSERT_EQUAL(FLAGS1, flags); - TEST_ASSERT_EQUAL(CHANNEL1, channel); - - err = wifi_credentials_get_by_ssid_personal(SSID2, sizeof(SSID2), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(SECURITY2, security); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(FLAGS2, flags); - TEST_ASSERT_EQUAL(CHANNEL2, channel); - - /* Set third network */ - err = wifi_credentials_set_personal(SSID3, sizeof(SSID3), SECURITY3, NULL, 6, - PSK3, sizeof(PSK3), FLAGS3, CHANNEL3, 0); - TEST_ASSERT_EQUAL(-ENOBUFS, err); - - /* Not enough space? Delete the first one. */ - wifi_credentials_delete_by_ssid(SSID1, ARRAY_SIZE(SSID1)); - err = wifi_credentials_set_personal(SSID3, sizeof(SSID3), SECURITY3, NULL, 6, - PSK3, sizeof(PSK3), FLAGS3, CHANNEL3, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - err = wifi_credentials_get_by_ssid_personal(SSID3, sizeof(SSID3), &security, - bssid_buf, ARRAY_SIZE(bssid_buf), - psk_buf, ARRAY_SIZE(psk_buf), &psk_len, &flags, &channel, &timeout); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - TEST_ASSERT_EQUAL(SECURITY3, security); - TEST_ASSERT_EQUAL(sizeof(PSK3), psk_len); - TEST_ASSERT_EQUAL(0, strncmp(PSK3, psk_buf, ARRAY_SIZE(psk_buf))); - TEST_ASSERT_EQUAL(FLAGS3, flags); - TEST_ASSERT_EQUAL(CHANNEL3, channel); - - wifi_credentials_for_each_ssid(verify_ssid_cache_cb, NULL); -} - -/* Verify that all entries are deleted. */ -void test_delete_all_entries(void) -{ - /* Set two networks */ - int err = wifi_credentials_set_personal(SSID1, sizeof(SSID1), SECURITY1, BSSID1, 6, - PSK1, sizeof(PSK1), FLAGS1, CHANNEL1, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - err = wifi_credentials_set_personal(SSID2, sizeof(SSID2), SECURITY2, NULL, 6, - NULL, 0, FLAGS2, CHANNEL2, 0); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - /* Delete all networks */ - err = wifi_credentials_delete_all(); - TEST_ASSERT_EQUAL(EXIT_SUCCESS, err); - - /* Verify that the storage is empty */ - TEST_ASSERT_TRUE(wifi_credentials_is_empty()); -} - -/* It is required to be added to each test. That is because unity's - * main may return nonzero, while zephyr's main currently must - * return 0 in all cases (other values are reserved). - */ -extern int unity_main(void); - -int main(void) -{ - /* use the runner from test_runner_generate() */ - (void)unity_main(); - - return 0; -} diff --git a/tests/subsys/net/lib/wifi_credentials/testcase.yaml b/tests/subsys/net/lib/wifi_credentials/testcase.yaml deleted file mode 100644 index 4b56d5e51f0d..000000000000 --- a/tests/subsys/net/lib/wifi_credentials/testcase.yaml +++ /dev/null @@ -1,9 +0,0 @@ -tests: - net.lib.wifi_credentials: - sysbuild: true - platform_allow: native_sim - integration_platforms: - - native_sim - tags: - - sysbuild - - ci_tests_subsys_net diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/CMakeLists.txt b/tests/subsys/net/lib/wifi_credentials_backend_psa/CMakeLists.txt deleted file mode 100644 index 1958e2642a1d..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/CMakeLists.txt +++ /dev/null @@ -1,39 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(wifi_credentials_test) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) - -test_runner_generate(src/main.c) - -target_sources(app - PRIVATE - ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c -) - -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/include/net/) -zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/) -zephyr_include_directories(${ZEPHYR_TRUSTED_FIRMWARE_M_MODULE_DIR}/interface/include/) - -target_compile_options(app - PRIVATE - -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 - -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 - -DCONFIG_WIFI_CREDENTIALS_LOG_LEVEL=4 - -DCONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET=5 -) - -set_property( - SOURCE ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_psa.c - PROPERTY COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/src/normalized_crypto.h" - PROPERTY COMPILE_FLAGS "-include ${CMAKE_CURRENT_SOURCE_DIR}/include/mbedtls_config.h" -) diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/include/mbedtls_config.h b/tests/subsys/net/lib/wifi_credentials_backend_psa/include/mbedtls_config.h deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/prj.conf b/tests/subsys/net/lib/wifi_credentials_backend_psa/prj.conf deleted file mode 100644 index b89c37522f86..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_UNITY=y diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c b/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c deleted file mode 100644 index fb1c119a5a5b..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/main.c +++ /dev/null @@ -1,232 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "wifi_credentials_internal.h" -#include "psa/crypto_types.h" -#include "psa/crypto_values.h" - -#define SSID1 "test1" -#define PSK1 "super secret" -#define SECURITY1 WIFI_SECURITY_TYPE_PSK -#define BSSID1 "abcdef" -#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID - -#define SSID2 "test2" -#define PSK2 NULL -#define SECURITY2 WIFI_SECURITY_TYPE_NONE -#define BSSID2 NULL -#define FLAGS2 0 - -#define WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN (PSA_KEY_ID_USER_MIN + \ - CONFIG_WIFI_CREDENTIALS_BACKEND_PSA_OFFSET) - -DEFINE_FFF_GLOBALS; - -K_MUTEX_DEFINE(wifi_credentials_mutex); - -FAKE_VOID_FUNC(wifi_credentials_cache_ssid, size_t, const struct wifi_credentials_header *); -FAKE_VALUE_FUNC(psa_status_t, psa_export_key, mbedtls_svc_key_id_t, uint8_t *, size_t, size_t *); -FAKE_VALUE_FUNC(psa_status_t, psa_import_key, psa_key_attributes_t *, uint8_t *, size_t, - mbedtls_svc_key_id_t *); -FAKE_VALUE_FUNC(psa_status_t, psa_destroy_key, mbedtls_svc_key_id_t); -FAKE_VOID_FUNC(psa_set_key_id, psa_key_attributes_t *, uint32_t); -FAKE_VOID_FUNC(psa_set_key_usage_flags, psa_key_attributes_t *, psa_key_usage_t); -FAKE_VOID_FUNC(psa_set_key_lifetime, psa_key_attributes_t *, psa_key_lifetime_t); -FAKE_VOID_FUNC(psa_set_key_algorithm, psa_key_attributes_t *, psa_algorithm_t); -FAKE_VOID_FUNC(psa_set_key_type, psa_key_attributes_t *, psa_key_type_t); -FAKE_VOID_FUNC(psa_set_key_bits, psa_key_attributes_t *, size_t); - -static const struct wifi_credentials_personal example1 = { - .header = { - .ssid = SSID1, - .ssid_len = strlen(SSID1), - .type = SECURITY1, - .bssid = BSSID1, - .flags = FLAGS1, - }, - .password = PSK1, - .password_len = strlen(PSK1), -}; - -static const struct wifi_credentials_personal example2 = { - .header = { - .ssid = SSID2, - .ssid_len = strlen(SSID2), - .type = SECURITY2, - .flags = FLAGS2, - }, -}; - -static size_t idx; - -psa_status_t custom_psa_export_key(mbedtls_svc_key_id_t key, uint8_t *data, size_t data_size, - size_t *data_length) -{ - /* confirm that we read the requested amount of data */ - *data_length = data_size; - return PSA_SUCCESS; -} - -static void custom_psa_set_key_id(psa_key_attributes_t *attributes, mbedtls_svc_key_id_t key) -{ - TEST_ASSERT_EQUAL(key, idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN); -} - -void custom_psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits) -{ - TEST_ASSERT_EQUAL(bits, sizeof(struct wifi_credentials_personal) * 8); -} - -void custom_psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type) -{ - TEST_ASSERT_EQUAL(type, PSA_KEY_TYPE_RAW_DATA); -} - -void custom_psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg) -{ - TEST_ASSERT_EQUAL(alg, PSA_ALG_NONE); -} - -void custom_psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime) -{ - TEST_ASSERT_EQUAL(lifetime, PSA_KEY_LIFETIME_PERSISTENT); -} - -void custom_psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags) -{ - TEST_ASSERT_EQUAL(usage_flags, PSA_KEY_USAGE_EXPORT); -} - -void setUp(void) -{ - RESET_FAKE(wifi_credentials_cache_ssid); - RESET_FAKE(psa_export_key); - RESET_FAKE(psa_import_key); - RESET_FAKE(psa_destroy_key); - psa_export_key_fake.custom_fake = custom_psa_export_key; - psa_set_key_id_fake.custom_fake = custom_psa_set_key_id; - psa_set_key_usage_flags_fake.custom_fake = custom_psa_set_key_usage_flags; - psa_set_key_lifetime_fake.custom_fake = custom_psa_set_key_lifetime; - psa_set_key_algorithm_fake.custom_fake = custom_psa_set_key_algorithm; - psa_set_key_type_fake.custom_fake = custom_psa_set_key_type; - psa_set_key_bits_fake.custom_fake = custom_psa_set_key_bits; - idx = 0; -} - -void tearDown(void) -{ -} - -void test_init(void) -{ - int ret; - - ret = wifi_credentials_backend_init(); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, psa_export_key_fake.call_count); - TEST_ASSERT_EQUAL(CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES, - wifi_credentials_cache_ssid_fake.call_count); -} - -void test_add(void) -{ - int ret = wifi_credentials_store_entry(idx, &example1, - sizeof(struct wifi_credentials_personal)); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL_PTR(&example1, psa_import_key_fake.arg1_val); - TEST_ASSERT_EQUAL(sizeof(struct wifi_credentials_personal), psa_import_key_fake.arg2_val); - - idx++; - - ret = wifi_credentials_store_entry(idx, &example2, - sizeof(struct wifi_credentials_personal)); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL_PTR(&example2, psa_import_key_fake.arg1_val); - TEST_ASSERT_EQUAL(sizeof(struct wifi_credentials_personal), psa_import_key_fake.arg2_val); - - TEST_ASSERT_EQUAL(2, psa_import_key_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_id_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_usage_flags_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_lifetime_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_algorithm_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_type_fake.call_count); - TEST_ASSERT_EQUAL(2, psa_set_key_bits_fake.call_count); -} - -void test_get(void) -{ - int ret; - psa_key_id_t key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; - uint8_t buf[ENTRY_MAX_LEN]; - - ret = wifi_credentials_load_entry(idx, buf, ARRAY_SIZE(buf)); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(key_id, psa_export_key_fake.arg0_val); - TEST_ASSERT_EQUAL_PTR(buf, psa_export_key_fake.arg1_val); - TEST_ASSERT_EQUAL(ARRAY_SIZE(buf), psa_export_key_fake.arg2_val); - - idx++; - key_id = idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN; - - ret = wifi_credentials_load_entry(idx, buf, ARRAY_SIZE(buf)); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(key_id, psa_export_key_fake.arg0_val); - TEST_ASSERT_EQUAL_PTR(buf, psa_export_key_fake.arg1_val); - TEST_ASSERT_EQUAL(ARRAY_SIZE(buf), psa_export_key_fake.arg2_val); - - TEST_ASSERT_EQUAL(2, psa_export_key_fake.call_count); -} - -void test_delete(void) -{ - int ret; - - ret = wifi_credentials_delete_entry(idx); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN, - psa_destroy_key_fake.arg0_val); - - idx++; - - ret = wifi_credentials_delete_entry(1); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(idx + WIFI_CREDENTIALS_BACKEND_PSA_KEY_ID_USER_MIN, - psa_destroy_key_fake.arg0_val); - - TEST_ASSERT_EQUAL(2, psa_destroy_key_fake.call_count); -} - -/* It is required to be added to each test. That is because unity's - * main may return nonzero, while zephyr's main currently must - * return 0 in all cases (other values are reserved). - */ -extern int unity_main(void); - -int main(void) -{ - /* use the runner from test_runner_generate() */ - (void)unity_main(); - - return 0; -} diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h b/tests/subsys/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h deleted file mode 100644 index eee86d56a888..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/src/normalized_crypto.h +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#ifndef PSA_CRYPTO_H -#define PSA_CRYPTO_H - -#include "zephyr/types.h" -#include "psa/crypto_types.h" -#include "psa/crypto_values.h" - -struct psa_client_key_attributes_s { - uint16_t type; - uint16_t bits; - uint32_t lifetime; - psa_key_id_t id; - uint32_t usage; - uint32_t alg; -}; - -struct psa_key_attributes_s { - struct psa_client_key_attributes_s client; -}; - -typedef struct psa_key_attributes_s psa_key_attributes_t; - - -psa_status_t psa_import_key(const psa_key_attributes_t *attributes, - const uint8_t *data, - size_t data_length, - mbedtls_svc_key_id_t *key); - -psa_status_t psa_export_key(mbedtls_svc_key_id_t key, - uint8_t *data, - size_t data_size, - size_t *data_length); - - -psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key); -void psa_set_key_id(psa_key_attributes_t *attributes, mbedtls_svc_key_id_t key); -void psa_set_key_bits(psa_key_attributes_t *attributes, size_t bits); -void psa_set_key_type(psa_key_attributes_t *attributes, psa_key_type_t type); -void psa_set_key_algorithm(psa_key_attributes_t *attributes, psa_algorithm_t alg); -void psa_set_key_lifetime(psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime); -psa_status_t psa_destroy_key(mbedtls_svc_key_id_t key); -void psa_set_key_usage_flags(psa_key_attributes_t *attributes, psa_key_usage_t usage_flags); - -#endif diff --git a/tests/subsys/net/lib/wifi_credentials_backend_psa/testcase.yaml b/tests/subsys/net/lib/wifi_credentials_backend_psa/testcase.yaml deleted file mode 100644 index 0e4104567a91..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_psa/testcase.yaml +++ /dev/null @@ -1,9 +0,0 @@ -tests: - net.lib.wifi_credentials_backend_psa: - sysbuild: true - platform_allow: native_sim - integration_platforms: - - native_sim - tags: - - sysbuild - - ci_tests_subsys_net diff --git a/tests/subsys/net/lib/wifi_credentials_backend_settings/CMakeLists.txt b/tests/subsys/net/lib/wifi_credentials_backend_settings/CMakeLists.txt deleted file mode 100644 index 27ccdc2cad68..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_settings/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -cmake_minimum_required(VERSION 3.20.0) - -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) -project(wifi_credentials_test) - -FILE(GLOB app_sources src/*.c) -target_sources(app PRIVATE ${app_sources}) - -test_runner_generate(src/main.c) - -target_sources(app - PRIVATE - ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/wifi_credentials_backend_settings.c -) - -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/include/net/) -zephyr_include_directories(${ZEPHYR_BASE}/subsys/testsuite/include) -zephyr_include_directories(${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/wifi_credentials/) - -target_compile_options(app - PRIVATE - -DCONFIG_WIFI_CREDENTIALS_MAX_ENTRIES=2 - -DCONFIG_WIFI_CREDENTIALS_SAE_PASSWORD_LENGTH=128 - -DCONFIG_WIFI_CREDENTIALS_LOG_LEVEL=4 -) diff --git a/tests/subsys/net/lib/wifi_credentials_backend_settings/prj.conf b/tests/subsys/net/lib/wifi_credentials_backend_settings/prj.conf deleted file mode 100644 index b89c37522f86..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_settings/prj.conf +++ /dev/null @@ -1,7 +0,0 @@ -# -# Copyright (c) 2022 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -CONFIG_UNITY=y diff --git a/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c b/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c deleted file mode 100644 index 0ee60c5ebec8..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_settings/src/main.c +++ /dev/null @@ -1,243 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include - -#include "wifi_credentials_internal.h" - -#define MAX_KEY_LEN 16 - -#define SSID1 "test1" -#define PSK1 "super secret" -#define SECURITY1 WIFI_SECURITY_TYPE_PSK -#define BSSID1 "abcdef" -#define FLAGS1 WIFI_CREDENTIALS_FLAG_BSSID - -#define SSID2 "test2" -#define PSK2 NULL -#define SECURITY2 WIFI_SECURITY_TYPE_NONE -#define BSSID2 NULL -#define FLAGS2 0 - -DEFINE_FFF_GLOBALS; - -K_MUTEX_DEFINE(wifi_credentials_mutex); - -FAKE_VALUE_FUNC(int, settings_subsys_init); -FAKE_VALUE_FUNC(int, settings_save_one, const char *, const void *, size_t); -FAKE_VALUE_FUNC(int, settings_delete, const char *); -FAKE_VALUE_FUNC(int, settings_load_subtree_direct, const char *, settings_load_direct_cb, void *); -FAKE_VOID_FUNC(wifi_credentials_cache_ssid, size_t, const struct wifi_credentials_header *); - -static uint8_t fake_settings_buf[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][ENTRY_MAX_LEN]; -static char fake_settings_buf_keys[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES][MAX_KEY_LEN]; -static size_t fake_settings_buf_lens[CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES]; - -typedef int (*settings_set_cb)(const char *key, size_t len, settings_read_cb read_cb, void *cb_arg); - -static const struct wifi_credentials_personal example1 = { - .header = { - .ssid = SSID1, - .ssid_len = strlen(SSID1), - .type = SECURITY1, - .bssid = BSSID1, - .flags = FLAGS1, - }, - .password = PSK1, - .password_len = strlen(PSK1), -}; - -static const struct wifi_credentials_personal example2 = { - .header = { - .ssid = SSID2, - .ssid_len = strlen(SSID2), - .type = SECURITY2, - .flags = FLAGS2, - }, -}; - -/** - * @brief load content of given settings index to given buffer - * - * @param cb_arg size_t *idx - * @param data destination - * @param len length - * @return ssize_t MIN(length, length_available) - */ -ssize_t custom_settings_read_cb(void *cb_arg, void *data, size_t len) -{ - size_t *idx = cb_arg; - - TEST_ASSERT(len <= ENTRY_MAX_LEN); - memcpy(data, fake_settings_buf[*idx], len); - return len; -} - -static int custom_settings_save_one(const char *name, const void *value, size_t val_len) -{ - TEST_ASSERT(strlen(name) < MAX_KEY_LEN); - TEST_ASSERT(val_len <= ENTRY_MAX_LEN); - - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (strlen(fake_settings_buf_keys[i]) == 0 || - strcmp(name, fake_settings_buf_keys[i]) == 0) { - strcpy(fake_settings_buf_keys[i], name); - memcpy(fake_settings_buf[i], value, val_len); - fake_settings_buf_lens[i] = val_len; - return 0; - } - } - return -ENOBUFS; -} - -static int custom_settings_delete(const char *name) -{ - TEST_ASSERT(strlen(name) < MAX_KEY_LEN); - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (strcmp(name, fake_settings_buf_keys[i]) == 0) { - memset(fake_settings_buf_keys[i], 0, MAX_KEY_LEN); - memset(fake_settings_buf[i], 0, ENTRY_MAX_LEN); - fake_settings_buf_lens[i] = 0; - return 0; - } - } - return -ENOENT; -} - -static int custom_settings_load_subtree_direct(const char *subtree, settings_load_direct_cb cb, - void *param) -{ - size_t subtree_len = strlen(subtree); - - TEST_ASSERT(subtree_len < MAX_KEY_LEN); - - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (strncmp(subtree, fake_settings_buf_keys[i], subtree_len) == 0) { - const char *key = fake_settings_buf_keys[i] + subtree_len + 1; - - cb(key, fake_settings_buf_lens[i], custom_settings_read_cb, &i, param); - } - } - return 0; -} - -static void custom_wifi_credentials_cache_ssid(size_t idx, - const struct wifi_credentials_header *buf) -{ - char name[16] = ""; - - snprintk(name, ARRAY_SIZE(name), "wifi_cred/%d", idx); - for (size_t i = 0; i < CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES; ++i) { - if (strcmp(name, fake_settings_buf_keys[i]) == 0) { - TEST_ASSERT_EQUAL(0, memcmp(buf, &fake_settings_buf[i], - sizeof(struct wifi_credentials_header))); - return; - } - } - TEST_ASSERT(false); -} - -void setUp(void) -{ - RESET_FAKE(settings_save_one); - RESET_FAKE(settings_delete); - RESET_FAKE(settings_load_subtree_direct); - RESET_FAKE(wifi_credentials_cache_ssid); - settings_save_one_fake.custom_fake = custom_settings_save_one; - settings_delete_fake.custom_fake = custom_settings_delete; - settings_load_subtree_direct_fake.custom_fake = custom_settings_load_subtree_direct; - wifi_credentials_cache_ssid_fake.custom_fake = custom_wifi_credentials_cache_ssid; - memset(fake_settings_buf_lens, 0, ARRAY_SIZE(fake_settings_buf_lens) * sizeof(size_t)); - memset(fake_settings_buf_keys, 0, CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES * MAX_KEY_LEN); - memset(fake_settings_buf, 0, CONFIG_WIFI_CREDENTIALS_MAX_ENTRIES * ENTRY_MAX_LEN); -} - -void tearDown(void) -{ -} - -void test_init(void) -{ - int ret; - - ret = wifi_credentials_store_entry(0, &example1, sizeof(struct wifi_credentials_personal)); - TEST_ASSERT_EQUAL(0, ret); - ret = wifi_credentials_store_entry(1, &example2, sizeof(struct wifi_credentials_personal)); - TEST_ASSERT_EQUAL(0, ret); - - ret = wifi_credentials_backend_init(); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(1, settings_subsys_init_fake.call_count); - TEST_ASSERT_EQUAL(2, wifi_credentials_cache_ssid_fake.call_count); - TEST_ASSERT_EQUAL(0, wifi_credentials_cache_ssid_fake.arg0_history[0]); - TEST_ASSERT_EQUAL(1, wifi_credentials_cache_ssid_fake.arg0_history[1]); -} - -void test_add(void) -{ - int ret = wifi_credentials_store_entry(0, "abc", 3); - - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(1, settings_save_one_fake.call_count); - TEST_ASSERT_EQUAL(0, strcmp("wifi_cred/0", fake_settings_buf_keys[0])); - TEST_ASSERT_EQUAL(0, strcmp("abc", fake_settings_buf[0])); - TEST_ASSERT_EQUAL(3, fake_settings_buf_lens[0]); -} - -void test_get(void) -{ - int ret; - - ret = wifi_credentials_store_entry(0, &example1, sizeof(struct wifi_credentials_personal)); - TEST_ASSERT_EQUAL(0, ret); - ret = wifi_credentials_store_entry(1, &example2, sizeof(struct wifi_credentials_personal)); - TEST_ASSERT_EQUAL(0, ret); - - char buf[ENTRY_MAX_LEN] = { 0 }; - - ret = wifi_credentials_load_entry(0, buf, ARRAY_SIZE(buf)); - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(0, memcmp(&example1, buf, ARRAY_SIZE(buf))); - ret = wifi_credentials_load_entry(1, buf, ARRAY_SIZE(buf)); - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(0, memcmp(&example2, buf, ARRAY_SIZE(buf))); -} - -void test_delete(void) -{ - int ret; - - ret = wifi_credentials_store_entry(0, "abc", 3); - TEST_ASSERT_EQUAL(0, ret); - - ret = wifi_credentials_delete_entry(0); - TEST_ASSERT_EQUAL(0, ret); - TEST_ASSERT_EQUAL(1, settings_delete_fake.call_count); -} - -/* It is required to be added to each test. That is because unity's - * main may return nonzero, while zephyr's main currently must - * return 0 in all cases (other values are reserved). - */ -extern int unity_main(void); - -int main(void) -{ - /* use the runner from test_runner_generate() */ - (void)unity_main(); - - return 0; -} diff --git a/tests/subsys/net/lib/wifi_credentials_backend_settings/testcase.yaml b/tests/subsys/net/lib/wifi_credentials_backend_settings/testcase.yaml deleted file mode 100644 index c6efa17d6bdc..000000000000 --- a/tests/subsys/net/lib/wifi_credentials_backend_settings/testcase.yaml +++ /dev/null @@ -1,9 +0,0 @@ -tests: - net.lib.wifi_credentials_backend_settings: - sysbuild: true - platform_allow: native_sim - integration_platforms: - - native_sim - tags: - - sysbuild - - ci_tests_subsys_net From 4827ed643cf48ef1180ccf779424f12497d51f88 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Thu, 16 Jan 2025 11:24:07 +0100 Subject: [PATCH 026/109] openthread: Add default file system configuration Add default file system configuration depending on flash driver. Signed-off-by: Maciej Baczmanski --- subsys/net/openthread/Kconfig.defconfig | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/subsys/net/openthread/Kconfig.defconfig b/subsys/net/openthread/Kconfig.defconfig index d6e6df3b900e..7e2b0f4a852d 100644 --- a/subsys/net/openthread/Kconfig.defconfig +++ b/subsys/net/openthread/Kconfig.defconfig @@ -248,4 +248,11 @@ config OPENTHREAD_NUM_MESSAGE_BUFFERS default 96 if OPENTHREAD_FTD default 64 +# File system configuration +config ZMS + default y if SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM + +config NVS + default y if !(SOC_FLASH_NRF_RRAM || SOC_FLASH_NRF_MRAM) + endif # NET_L2_OPENTHREAD From bc339619a94fd2fb1da311d59fa87d8055c29ea4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 16 Jan 2025 11:42:26 +0100 Subject: [PATCH 027/109] tests: benchmarks: idle_spim_loopback: Enable dma_fast_region for spi120 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This region region is no longer enabled by default. It must be enabled explicitly when actually used. Signed-off-by: Andrzej Głąbek --- .../boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tests/benchmarks/multicore/idle_spim_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay b/tests/benchmarks/multicore/idle_spim_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay index f75dec6ad33b..c987cfb5c701 100644 --- a/tests/benchmarks/multicore/idle_spim_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay +++ b/tests/benchmarks/multicore/idle_spim_loopback/boards/nrf54h20dk_nrf54h20_cpuapp_fast.overlay @@ -69,6 +69,10 @@ }; }; +&dma_fast_region { + status = "okay"; +}; + &exmif { status = "disabled"; }; From 3a427bfa41aac8b551180b76b018d53a7620620a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 16 Jan 2025 11:58:02 +0100 Subject: [PATCH 028/109] samples: bluetooth: Set CONFIG_BT_SMP_SC_PAIR_ONLY=n when needed MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit LE legacy pairing is no longer enabled by default. Samples that use it, need to disable the BT_SMP_SC_PAIR_ONLY Kconfig option. See Zephyr PR 73217. Signed-off-by: Andrzej Głąbek --- samples/bluetooth/central_nfc_pairing/prj.conf | 1 + samples/bluetooth/peripheral_nfc_pairing/prj.conf | 1 + samples/bluetooth/peripheral_power_profiling/prj.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/samples/bluetooth/central_nfc_pairing/prj.conf b/samples/bluetooth/central_nfc_pairing/prj.conf index f8a095497e1a..de02cba29d10 100644 --- a/samples/bluetooth/central_nfc_pairing/prj.conf +++ b/samples/bluetooth/central_nfc_pairing/prj.conf @@ -10,6 +10,7 @@ CONFIG_NCS_SAMPLES_DEFAULTS=y CONFIG_BT=y CONFIG_BT_CENTRAL=y CONFIG_BT_SMP=y +CONFIG_BT_SMP_SC_PAIR_ONLY=n CONFIG_BT_GATT_CLIENT=y # Enable the BLE modules from NCS diff --git a/samples/bluetooth/peripheral_nfc_pairing/prj.conf b/samples/bluetooth/peripheral_nfc_pairing/prj.conf index 3c8ddccfec47..e0271c42d6be 100644 --- a/samples/bluetooth/peripheral_nfc_pairing/prj.conf +++ b/samples/bluetooth/peripheral_nfc_pairing/prj.conf @@ -25,6 +25,7 @@ CONFIG_NFC_TNEP_CH=y CONFIG_BT=y CONFIG_BT_SMP=y CONFIG_BT_SMP_APP_PAIRING_ACCEPT=y +CONFIG_BT_SMP_SC_PAIR_ONLY=n CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="Nordic_NFC_pairing" diff --git a/samples/bluetooth/peripheral_power_profiling/prj.conf b/samples/bluetooth/peripheral_power_profiling/prj.conf index 7e3bce03328b..551f72a50c5d 100644 --- a/samples/bluetooth/peripheral_power_profiling/prj.conf +++ b/samples/bluetooth/peripheral_power_profiling/prj.conf @@ -6,6 +6,7 @@ CONFIG_BT=y CONFIG_BT_SMP=y +CONFIG_BT_SMP_SC_PAIR_ONLY=n CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="Nordic_Power_Profiling" CONFIG_BT_EXT_ADV=y From 6ea23c8aa256ccedc3ac9f64adb19c582b73e981 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 16 Jan 2025 13:18:04 +0100 Subject: [PATCH 029/109] suit: Increase the default number of mbedTLS keys SUIT unit tests rely on the automatically assigned volatile key IDs. Since the key IDs changes with the amount of allowed keys, we should not change it without regenerating all test payloads. The new Zephyr brings a Kconfig to control this variable and changes the default amount from 32 to 16, so the SUIT test platform needs to override it back to the previous default value. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- subsys/suit/platform/Kconfig | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/subsys/suit/platform/Kconfig b/subsys/suit/platform/Kconfig index 5a00feb91ac3..d7f6d15bf78b 100644 --- a/subsys/suit/platform/Kconfig +++ b/subsys/suit/platform/Kconfig @@ -64,6 +64,11 @@ config MBEDTLS_PSA_CRYPTO_C config MBEDTLS_ENTROPY_POLL_ZEPHYR default y +# Increase the default number of key slots, to keep the same volatile key IDs +config MBEDTLS_PSA_KEY_SLOT_COUNT + int + default 32 + config SUIT_DEFAULT_MBEDTLS_CONFIG bool "Use default mbedTLS configuration file" default y From ae14d6ff66563ffbb43e5ccf6e3109187caeb89c Mon Sep 17 00:00:00 2001 From: Aleksandr Khromykh Date: Wed, 15 Jan 2025 16:20:43 +0100 Subject: [PATCH 030/109] Bluetooth: Mesh: adapting configuration parameters Commit adapts configuration ble mesh, trusted storage and mbedtls psa parameters to be able to run mesh samples and tests. Signed-off-by: Aleksandr Khromykh --- subsys/bluetooth/mesh/Kconfig | 37 +++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 55cca2e5a97e..1b0cc7040660 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -15,6 +15,43 @@ config BT_MESH_SETTINGS_WORKQ_STACK_SIZE endif +if BT_MESH_USES_MBEDTLS_PSA + +config BT_MESH_MBEDTLS_BACKEND_ENABLE + bool + default y + imply NRF_SECURITY + imply MBEDTLS_ENABLE_HEAP + +config MBEDTLS_HEAP_SIZE + default 1024 + +if BT_SETTINGS + +config BT_MESH_PSA_CRYPTO_STORAGE + bool + default y + imply TRUSTED_STORAGE + select MBEDTLS_PSA_CRYPTO_STORAGE_C + +choice TRUSTED_STORAGE_BACKEND_AEAD_KEY + default TRUSTED_STORAGE_BACKEND_AEAD_KEY_HASH_UID + +endchoice # TRUSTED_STORAGE_BACKEND_AEAD_KEY + +endif # BT_SETTINGS + +if BT_LONG_WQ +# There is no clear undestanding where this parameter should be adapted for ble mesh purposes. +# This place has been chosen as temporary solution. +# JIRA task NCSDK-31391 was created to solve the issue later. +config BT_LONG_WQ_STACK_SIZE + default 4096 + +endif # BT_LONG_WQ + +endif # BT_MESH_USES_MBEDTLS_PSA + if BT_MESH_ADV_EXT # Set the optimal advertiser configuration to improve performance of the Relay, GATT and Friend From 2e12bba2958d069797ce3d0ee8734c810e730ce9 Mon Sep 17 00:00:00 2001 From: Maciej Baczmanski Date: Thu, 16 Jan 2025 09:18:39 +0100 Subject: [PATCH 031/109] samples: matter: remove `zephyr,priority` phandle Remove `zephyr,priority` as it is not needed after switching to ipc,icbmsg. Signed-off-by: Maciej Baczmanski --- .../matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- applications/matter_weather_station/app.overlay | 5 ----- .../light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- .../light_bulb/boards/nrf7002dk_nrf5340_cpuapp.overlay | 5 ----- .../light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- .../light_switch/boards/nrf7002dk_nrf5340_cpuapp.overlay | 5 ----- samples/matter/lock/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp.overlay | 5 ----- .../lock/boards/nrf7002dk_nrf5340_cpuapp_nrf7001.overlay | 5 ----- .../smoke_co_alarm/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- .../matter/template/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- .../matter/template/boards/nrf7002dk_nrf5340_cpuapp.overlay | 5 ----- .../window_covering/boards/nrf5340dk_nrf5340_cpuapp.overlay | 5 ----- 13 files changed, 65 deletions(-) diff --git a/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay b/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay index d941f278a4d7..a9a324ae42ac 100644 --- a/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/applications/matter_bridge/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -12,11 +12,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; diff --git a/applications/matter_weather_station/app.overlay b/applications/matter_weather_station/app.overlay index 6ad93e4cb38d..3850c2657e65 100644 --- a/applications/matter_weather_station/app.overlay +++ b/applications/matter_weather_station/app.overlay @@ -65,11 +65,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - &i2c1 { bme688@76 { compatible = "bosch,bme680"; diff --git a/samples/matter/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay index 77d60d7e72ee..2b5e970e0e6f 100644 --- a/samples/matter/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/light_bulb/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -28,11 +28,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - &pwm0 { pinctrl-0 = <&pwm0_default_alt>; pinctrl-1 = <&pwm0_sleep_alt>; diff --git a/samples/matter/light_bulb/boards/nrf7002dk_nrf5340_cpuapp.overlay b/samples/matter/light_bulb/boards/nrf7002dk_nrf5340_cpuapp.overlay index fe746730297a..5d12a3842fb8 100644 --- a/samples/matter/light_bulb/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/samples/matter/light_bulb/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -29,11 +29,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - &pwm0 { pinctrl-0 = <&pwm0_default_alt>; pinctrl-1 = <&pwm0_sleep_alt>; diff --git a/samples/matter/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay index b2f9923aa7e7..6f64906bedb1 100644 --- a/samples/matter/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/light_switch/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -12,11 +12,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; diff --git a/samples/matter/light_switch/boards/nrf7002dk_nrf5340_cpuapp.overlay b/samples/matter/light_switch/boards/nrf7002dk_nrf5340_cpuapp.overlay index 280120007ef4..91e8cd7a3411 100644 --- a/samples/matter/light_switch/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/samples/matter/light_switch/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -15,8 +15,3 @@ watchdog0 = &wdt0; }; }; - -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; diff --git a/samples/matter/lock/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/lock/boards/nrf5340dk_nrf5340_cpuapp.overlay index b2f9923aa7e7..6f64906bedb1 100644 --- a/samples/matter/lock/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/lock/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -12,11 +12,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; diff --git a/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp.overlay b/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp.overlay index 280120007ef4..91e8cd7a3411 100644 --- a/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -15,8 +15,3 @@ watchdog0 = &wdt0; }; }; - -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; diff --git a/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp_nrf7001.overlay b/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp_nrf7001.overlay index 837e117d126a..91e8cd7a3411 100644 --- a/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp_nrf7001.overlay +++ b/samples/matter/lock/boards/nrf7002dk_nrf5340_cpuapp_nrf7001.overlay @@ -15,8 +15,3 @@ watchdog0 = &wdt0; }; }; - -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; diff --git a/samples/matter/smoke_co_alarm/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/smoke_co_alarm/boards/nrf5340dk_nrf5340_cpuapp.overlay index fe200de812e0..87390a483316 100644 --- a/samples/matter/smoke_co_alarm/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/smoke_co_alarm/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -12,11 +12,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; diff --git a/samples/matter/template/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/template/boards/nrf5340dk_nrf5340_cpuapp.overlay index b2f9923aa7e7..6f64906bedb1 100644 --- a/samples/matter/template/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/template/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -12,11 +12,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; diff --git a/samples/matter/template/boards/nrf7002dk_nrf5340_cpuapp.overlay b/samples/matter/template/boards/nrf7002dk_nrf5340_cpuapp.overlay index 79e4b79812f0..1f222f086634 100644 --- a/samples/matter/template/boards/nrf7002dk_nrf5340_cpuapp.overlay +++ b/samples/matter/template/boards/nrf7002dk_nrf5340_cpuapp.overlay @@ -16,8 +16,3 @@ }; }; - -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; diff --git a/samples/matter/window_covering/boards/nrf5340dk_nrf5340_cpuapp.overlay b/samples/matter/window_covering/boards/nrf5340dk_nrf5340_cpuapp.overlay index 765764531f5e..dda97825f5d1 100644 --- a/samples/matter/window_covering/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ b/samples/matter/window_covering/boards/nrf5340dk_nrf5340_cpuapp.overlay @@ -31,11 +31,6 @@ }; }; -/* Set IPC thread priority to the highest value to not collide with other threads. */ -&ipc0 { - zephyr,priority = <0 PRIO_COOP>; -}; - /* Disable unused peripherals to reduce power consumption */ &adc { status = "disabled"; From 561c473df2f3b8089d0527e8550d4fb16e1e29f2 Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 16 Jan 2025 01:14:04 +0530 Subject: [PATCH 032/109] net: lib: hostap_crypto: Remove legacy crypto hostap has now removed support for CRYTPO, only CRYPTO_ALT is supported as the MbedTLS shim. Switch to ALT version of legacy PSA for TF-M/54L builds. Signed-off-by: Chaitanya Tata --- subsys/net/lib/hostap_crypto/CMakeLists.txt | 42 ------------------ subsys/net/lib/hostap_crypto/Kconfig | 48 +-------------------- 2 files changed, 1 insertion(+), 89 deletions(-) diff --git a/subsys/net/lib/hostap_crypto/CMakeLists.txt b/subsys/net/lib/hostap_crypto/CMakeLists.txt index 074a20f4277c..c09a61233644 100644 --- a/subsys/net/lib/hostap_crypto/CMakeLists.txt +++ b/subsys/net/lib/hostap_crypto/CMakeLists.txt @@ -22,48 +22,6 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMISSING_SYSCALL_NAMES") # For src/utils includes target_link_libraries(hostap_crypto INTERFACE hostap) -if(DEFINED CONFIG_HOSTAP_CRYPTO_LEGACY OR - DEFINED CONFIG_HOSTAP_CRYPTO_LEGACY_PSA) - zephyr_library_sources( - ${HOSTAP_SRC_BASE}/crypto/aes-internal.c - ${HOSTAP_SRC_BASE}/crypto/aes-wrap.c - ${HOSTAP_SRC_BASE}/crypto/aes-unwrap.c - ${HOSTAP_SRC_BASE}/crypto/rc4.c - ${HOSTAP_SRC_BASE}/crypto/sha1-internal.c - ${HOSTAP_SRC_BASE}/crypto/sha1-prf.c - ${HOSTAP_SRC_BASE}/crypto/sha1-tlsprf.c - ${HOSTAP_SRC_BASE}/crypto/sha256-prf.c - ${HOSTAP_SRC_BASE}/crypto/sha256-kdf.c - ${HOSTAP_SRC_BASE}/crypto/sha384-prf.c - ${HOSTAP_SRC_BASE}/crypto/sha384-kdf.c - ${HOSTAP_SRC_BASE}/crypto/sha512-internal.c - ${HOSTAP_SRC_BASE}/crypto/sha512.c - ${HOSTAP_SRC_BASE}/crypto/sha512-prf.c - ${HOSTAP_SRC_BASE}/crypto/sha512-kdf.c - ) - - zephyr_library_sources_ifdef(CONFIG_HOSTAP_WPA3 - ${HOSTAP_SRC_BASE}/crypto/sha256-kdf.c - ) - - zephyr_library_sources_ifndef(CONFIG_HOSTAP_CRYPTO_ENTERPRISE - ${HOSTAP_SRC_BASE}/crypto/tls_none.c - ) - - zephyr_library_sources_ifdef(CONFIG_HOSTAP_CRYPTO_ENTERPRISE - # common - ${HOSTAP_SRC_BASE}/crypto/sha384-tlsprf.c - ${HOSTAP_SRC_BASE}/crypto/sha256-tlsprf.c - ${HOSTAP_SRC_BASE}/crypto/sha1-tlsprf.c - ${HOSTAP_SRC_BASE}/crypto/sha1-tprf.c - ${HOSTAP_SRC_BASE}/crypto/ms_funcs.c - ${HOSTAP_SRC_BASE}/crypto/aes-eax.c - # MD4 removed from MbedTLS - ${HOSTAP_SRC_BASE}/crypto/md4-internal.c - ${HOSTAP_SRC_BASE}/crypto/aes-encblock.c - ) -endif() - if(DEFINED CONFIG_HOSTAP_CRYPTO_ALT_LEGACY) zephyr_include_directories( ${HOSTAP_BASE}/port/mbedtls diff --git a/subsys/net/lib/hostap_crypto/Kconfig b/subsys/net/lib/hostap_crypto/Kconfig index 440ee011d116..0f064c83450f 100644 --- a/subsys/net/lib/hostap_crypto/Kconfig +++ b/subsys/net/lib/hostap_crypto/Kconfig @@ -13,59 +13,13 @@ endchoice choice HOSTAP_CRYPTO_BACKEND prompt "WPA supplicant crypto implementation" default HOSTAP_CRYPTO_ALT_PSA if SOC_SERIES_NRF54HX - default HOSTAP_CRYPTO_LEGACY_PSA if SOC_SERIES_NRF54LX || BUILD_WITH_TFM + default HOSTAP_CRYPTO_ALT_LEGACY_PSA if SOC_SERIES_NRF54LX || BUILD_WITH_TFM default HOSTAP_CRYPTO_ALT_LEGACY help Select the crypto implementation to use for WPA supplicant. HOSTAP_CRYPTO_ALT supports enterprise mode and DPP. -config HOSTAP_CRYPTO_LEGACY - bool "Legacy Crypto support for WiFi using nRF security" - select MBEDTLS - select NRF_SECURITY - select MBEDTLS_CIPHER_MODE_CBC - select MBEDTLS_CIPHER_MODE_CTR - select MBEDTLS_LEGACY_CRYPTO_C - select MBEDTLS_SHA1_C - select MBEDTLS_ECP_C - select MBEDTLS_CTR_DRBG_C - select MBEDTLS_PK_C - select MBEDTLS_PKCS5_C - select MBEDTLS_PK_PARSE_C - select MBEDTLS_CMAC_C - select MBEDTLS_CIPHER_PADDING_PKCS7 - select MBEDTLS_PK_WRITE_C - select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED - select MBEDTLS_ECP_DP_SECP256R1_ENABLED - -config HOSTAP_CRYPTO_LEGACY_PSA - bool "PSA Crypto support for WiFi using nRF security" - select MBEDTLS - select NRF_SECURITY - select PSA_WANT_GENERATE_RANDOM - # Legacy crypto, still needed - select MBEDTLS_SHA1_C - select MBEDTLS_LEGACY_CRYPTO_C - select MBEDTLS_CMAC_C - select MBEDTLS_GCM_C - select MBEDTLS_TLS_LIBRARY - select MBEDTLS_PK_C - select MBEDTLS_PK_WRITE_C - select MBEDTLS_X509_LIBRARY - select MBEDTLS_X509_CRT_PARSE_C - select MBEDTLS_CIPHER_C - select MBEDTLS_CIPHER_MODE_CTR - select MBEDTLS_CIPHER_MODE_CBC - select MBEDTLS_SSL_TLS_C - select MBEDTLS_ECP_C - select MBEDTLS_CTR_DRBG_C - select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED - select MBEDTLS_MD_C - select MBEDTLS_CIPHER_PADDING_PKCS7 - select MBEDTLS_PKCS5_C - select MBEDTLS_ECP_DP_SECP256R1_ENABLED - config HOSTAP_CRYPTO_ALT_LEGACY bool "Legacy Crypto support for WiFi using nRF security" select MBEDTLS From 566ae316036a3030538f5d08fc3c0dab3ab3c24d Mon Sep 17 00:00:00 2001 From: Chaitanya Tata Date: Thu, 16 Jan 2025 01:16:55 +0530 Subject: [PATCH 033/109] net: lib: hostap_crypto: Fix 54L/TF-M build Add the missing legacy ALT case. Signed-off-by: Chaitanya Tata --- subsys/net/lib/hostap_crypto/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/subsys/net/lib/hostap_crypto/CMakeLists.txt b/subsys/net/lib/hostap_crypto/CMakeLists.txt index c09a61233644..8b3968ab0e82 100644 --- a/subsys/net/lib/hostap_crypto/CMakeLists.txt +++ b/subsys/net/lib/hostap_crypto/CMakeLists.txt @@ -22,7 +22,8 @@ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMISSING_SYSCALL_NAMES") # For src/utils includes target_link_libraries(hostap_crypto INTERFACE hostap) -if(DEFINED CONFIG_HOSTAP_CRYPTO_ALT_LEGACY) +if(DEFINED CONFIG_HOSTAP_CRYPTO_ALT_LEGACY OR + DEFINED CONFIG_HOSTAP_CRYPTO_ALT_LEGACY_PSA) zephyr_include_directories( ${HOSTAP_BASE}/port/mbedtls ) From 41fce5756addf5b4e771f946949a961882dae2d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 20 Jan 2025 09:23:26 +0100 Subject: [PATCH 034/109] treewide: Update after removal of CONFIG_NET_SOCKETS_POSIX_NAMES MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This deprecated option was finally removed. See Zephyr PR 82398. Remove references to it and, where needed, replace it with POSIX_API. Signed-off-by: Andrzej Głąbek --- doc/zephyr/zephyr.doxyfile.in | 1 - ext/curl/Kconfig | 2 +- ext/iperf3/Kconfig | 2 +- lib/nrf_modem_lib/Kconfig | 1 - lib/nrf_modem_lib/sanity.c | 4 ++++ samples/cellular/modem_shell/prj.conf | 1 - .../modem_shell/src/gnss/gnss_supl_support.c | 4 ---- samples/wifi/shell/sample.yaml | 13 ------------- subsys/net/lib/mqtt_helper/Kconfig | 1 - tests/subsys/net/lib/downloader/CMakeLists.txt | 2 +- tests/subsys/net/lib/mqtt_helper/CMakeLists.txt | 2 +- tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt | 6 +++--- tests/subsys/net/lib/nrf_cloud/cloud/prj.conf | 3 +-- tests/subsys/net/lib/nrf_cloud/fota_common/prj.conf | 2 +- .../subsys/net/lib/nrf_provisioning/CMakeLists.txt | 2 +- 15 files changed, 14 insertions(+), 32 deletions(-) diff --git a/doc/zephyr/zephyr.doxyfile.in b/doc/zephyr/zephyr.doxyfile.in index 33bcbf875872..c6d821b7b782 100644 --- a/doc/zephyr/zephyr.doxyfile.in +++ b/doc/zephyr/zephyr.doxyfile.in @@ -2448,7 +2448,6 @@ PREDEFINED = __DOXYGEN__ \ CONFIG_NET_L2_IEEE802154_MGMT \ CONFIG_NET_L2_IEEE802154_SECURITY \ CONFIG_NET_MGMT_EVENT \ - CONFIG_NET_SOCKETS_POSIX_NAMES \ CONFIG_NET_TCP \ CONFIG_NET_UDP \ CONFIG_SCHED_CPU_MASK \ diff --git a/ext/curl/Kconfig b/ext/curl/Kconfig index 27a785339c47..340913d42630 100644 --- a/ext/curl/Kconfig +++ b/ext/curl/Kconfig @@ -10,7 +10,7 @@ config NRF_CURL_PROMPTLESS config NRF_CURL bool "Curl" if !NRF_CURL_PROMPTLESS - depends on POSIX_API && !PTHREAD_IPC && !NET_SOCKETS_POSIX_NAMES && NEWLIB_LIBC + depends on POSIX_API && !PTHREAD_IPC && NEWLIB_LIBC imply NEWLIB_LIBC_FLOAT_PRINTF help Curl support for NRF. diff --git a/ext/iperf3/Kconfig b/ext/iperf3/Kconfig index 224388edd1c7..e970a0dcf9bf 100644 --- a/ext/iperf3/Kconfig +++ b/ext/iperf3/Kconfig @@ -12,7 +12,7 @@ config NRF_IPERF3_PROMPTLESS config NRF_IPERF3 bool "Iperf3 NRF integration" if !NRF_IPERF3_PROMPTLESS - depends on POSIX_API && !PTHREAD_IPC && !NET_SOCKETS_POSIX_NAMES && NEWLIB_LIBC && CJSON_LIB + depends on POSIX_API && !PTHREAD_IPC && NEWLIB_LIBC && CJSON_LIB help Enable Iperf3 NRF integration diff --git a/lib/nrf_modem_lib/Kconfig b/lib/nrf_modem_lib/Kconfig index c7098f138a04..f00560133c5b 100644 --- a/lib/nrf_modem_lib/Kconfig +++ b/lib/nrf_modem_lib/Kconfig @@ -9,7 +9,6 @@ menuconfig NRF_MODEM_LIB select EXPERIMENTAL if SOC_NRF9280_CPUAPP select NRF_MODEM imply NET_SOCKETS_OFFLOAD - imply NET_SOCKETS_POSIX_NAMES if !POSIX_API # The modem must be turned on to achieve low power consumption. # But disable it for ZTEST's as some tests have HW # resource-conflicts with NRF_MODEM_LIB. diff --git a/lib/nrf_modem_lib/sanity.c b/lib/nrf_modem_lib/sanity.c index 226e36f5516c..647e65826a10 100644 --- a/lib/nrf_modem_lib/sanity.c +++ b/lib/nrf_modem_lib/sanity.c @@ -161,19 +161,23 @@ BUILD_ASSERT(NRF_SPROTO_DTLS1v2 == IPPROTO_DTLS_1_2, "Socket value not aligned w BUILD_ASSERT(SOL_TLS == NRF_SOL_SECURE, "Socket value not aligned with modemlib."); BUILD_ASSERT(SOL_SOCKET == NRF_SOL_SOCKET, "Socket value not aligned with modemlib."); +#if defined(CONFIG_POSIX_API) BUILD_ASSERT(MSG_DONTWAIT == NRF_MSG_DONTWAIT, "Socket value not aligned with modemlib."); BUILD_ASSERT(MSG_PEEK == NRF_MSG_PEEK, "Socket value not aligned with modemlib."); BUILD_ASSERT(MSG_WAITALL == NRF_MSG_WAITALL, "Socket value not aligned with modemlib."); +#endif BUILD_ASSERT(AI_CANONNAME == NRF_AI_CANONNAME, "Socket value not aligned with modemlib."); BUILD_ASSERT(AI_NUMERICSERV == NRF_AI_NUMERICSERV, "Socket value not aligned with modemlib."); BUILD_ASSERT(AI_PDNSERV == NRF_AI_PDNSERV, "Socket value not aligned with modemlib."); +#if defined(CONFIG_POSIX_API) BUILD_ASSERT(POLLIN == NRF_POLLIN, "Socket value not aligned with modemlib."); BUILD_ASSERT(POLLOUT == NRF_POLLOUT, "Socket value not aligned with modemlib."); BUILD_ASSERT(POLLERR == NRF_POLLERR, "Socket value not aligned with modemlib."); BUILD_ASSERT(POLLHUP == NRF_POLLHUP, "Socket value not aligned with modemlib."); BUILD_ASSERT(POLLNVAL == NRF_POLLNVAL, "Socket value not aligned with modemlib."); +#endif BUILD_ASSERT(DNS_EAI_ADDRFAMILY == NRF_EAI_ADDRFAMILY, "Socket value not aligned with modemlib."); BUILD_ASSERT(DNS_EAI_AGAIN == NRF_EAI_AGAIN, "Socket value not aligned with modemlib."); diff --git a/samples/cellular/modem_shell/prj.conf b/samples/cellular/modem_shell/prj.conf index 566219fcf8e3..31734950f5a0 100644 --- a/samples/cellular/modem_shell/prj.conf +++ b/samples/cellular/modem_shell/prj.conf @@ -69,7 +69,6 @@ CONFIG_NETWORKING=y CONFIG_NET_NATIVE=n CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_OFFLOAD=y -CONFIG_NET_SOCKETS_POSIX_NAMES=n CONFIG_NET_IPV4=y CONFIG_NET_IPV6=y diff --git a/samples/cellular/modem_shell/src/gnss/gnss_supl_support.c b/samples/cellular/modem_shell/src/gnss/gnss_supl_support.c index 240151e4162d..060ee745e8fc 100644 --- a/samples/cellular/modem_shell/src/gnss/gnss_supl_support.c +++ b/samples/cellular/modem_shell/src/gnss/gnss_supl_support.c @@ -7,15 +7,11 @@ #include #include #include -#if !defined(CONFIG_NET_SOCKETS_POSIX_NAMES) #include #include #include #include #include -#else -#include -#endif #include #include "mosh_print.h" diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index 737977d0ecba..03bb097e220b 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -224,19 +224,6 @@ tests: - ci_build - sysbuild - ci_samples_wifi - sample.nrf7002.shell.posix_names: - sysbuild: true - build_only: true - extra_args: - - CONFIG_POSIX_API=n - - CONIFG_NET_SOCKETS_POSIX_NAMES=y - integration_platforms: - - nrf7002dk/nrf5340/cpuapp - platform_allow: nrf7002dk/nrf5340/cpuapp - tags: - - ci_build - - sysbuild - - ci_samples_wifi sample.nrf7002_ns.shell: sysbuild: true build_only: true diff --git a/subsys/net/lib/mqtt_helper/Kconfig b/subsys/net/lib/mqtt_helper/Kconfig index ec4bc282b906..b272166d77c8 100644 --- a/subsys/net/lib/mqtt_helper/Kconfig +++ b/subsys/net/lib/mqtt_helper/Kconfig @@ -5,7 +5,6 @@ menuconfig MQTT_HELPER bool "MQTT helper library" - select NET_SOCKETS_POSIX_NAMES if !POSIX_API select MQTT_LIB help Convenience library that simplifies Zephyr MQTT API and socket handling. diff --git a/tests/subsys/net/lib/downloader/CMakeLists.txt b/tests/subsys/net/lib/downloader/CMakeLists.txt index 63a742c1ee6f..2f28fa451f46 100644 --- a/tests/subsys/net/lib/downloader/CMakeLists.txt +++ b/tests/subsys/net/lib/downloader/CMakeLists.txt @@ -38,7 +38,7 @@ target_compile_options(app -DCONFIG_DOWNLOADER_MAX_FILENAME_SIZE=256 -DCONFIG_DOWNLOADER_TRANSPORT_PARAMS_SIZE=256 -DCONFIG_DOWNLOADER_STACK_SIZE=2048 - -DCONFIG_NET_SOCKETS_POSIX_NAMES=y + -DCONFIG_POSIX_API=y -DCONFIG_NET_IPV6=y -DCONFIG_NET_IPV4=y -DCONFIG_COAP_MAX_RETRANSMIT=2 diff --git a/tests/subsys/net/lib/mqtt_helper/CMakeLists.txt b/tests/subsys/net/lib/mqtt_helper/CMakeLists.txt index d0e808fd334e..c4b9515e18ad 100644 --- a/tests/subsys/net/lib/mqtt_helper/CMakeLists.txt +++ b/tests/subsys/net/lib/mqtt_helper/CMakeLists.txt @@ -30,7 +30,7 @@ target_include_directories(app PRIVATE ${ZEPHYR_NRF_MODULE_DIR}/include/zephyr/n # Options that cannot be passed through Kconfig fragments. target_compile_options(app PRIVATE -DCONFIG_MQTT_LIB_TLS=1 - -DCONFIG_NET_SOCKETS_POSIX_NAMES=1 + -DCONFIG_POSIX_API=1 -DCONFIG_MQTT_HELPER_HOSTNAME="test-some-hostname.com" -DCONFIG_MQTT_HELPER_STATIC_IP_ADDRESS="" -DCONFIG_MQTT_HELPER_PORT=8883 diff --git a/tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt b/tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt index f002e99f74e5..ae7022224ad8 100644 --- a/tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt +++ b/tests/subsys/net/lib/nrf_cloud/cloud/CMakeLists.txt @@ -52,8 +52,8 @@ if (CONFIG_NRF_CLOUD_MQTT OR CONFIG_NRF_CLOUD_FOTA OR CONFIG_NRF_MODEM_LIB) ) # This code file has functions/structs/variables defined when - # NET_SOCKETS_POSIX_NAMES=y in zephyr/net/socket.h, so - # it needs to be excluded when NET_SOCKETS_POSIX_NAMES=n + # POSIX_API=y in zephyr/net/socket.h, so it needs to be excluded + # when POSIX_API=n set_source_files_properties( ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/downloader/src/downloader.c DIRECTORY ${ZEPHYR_NRF_MODULE_DIR}/subsys/net/lib/downloader/ @@ -64,7 +64,7 @@ if (CONFIG_NRF_CLOUD_MQTT OR CONFIG_NRF_CLOUD_FOTA OR CONFIG_NRF_MODEM_LIB) if (CONFIG_NRF_MODEM_LIB) - # Similarly, these files need to be excluded when NET_SOCKETS_POSIX_NAMES=n + # Similarly, these files need to be excluded when POSIX_API=n set_source_files_properties( ${ZEPHYR_NRF_MODULE_DIR}/lib/nrf_modem_lib/sanity.c ${ZEPHYR_NRF_MODULE_DIR}/lib/nrf_modem_lib/nrf9x_sockets.c diff --git a/tests/subsys/net/lib/nrf_cloud/cloud/prj.conf b/tests/subsys/net/lib/nrf_cloud/cloud/prj.conf index b04fef6cf005..ba2ca10947dd 100644 --- a/tests/subsys/net/lib/nrf_cloud/cloud/prj.conf +++ b/tests/subsys/net/lib/nrf_cloud/cloud/prj.conf @@ -10,9 +10,8 @@ CONFIG_ZTEST=y # Network CONFIG_NETWORKING=y -# Disable sockets and POSIX wrappers +# Disable sockets CONFIG_NET_SOCKETS=n -CONFIG_NET_SOCKETS_POSIX_NAMES=n # Dependencies CONFIG_NEWLIB_LIBC=y diff --git a/tests/subsys/net/lib/nrf_cloud/fota_common/prj.conf b/tests/subsys/net/lib/nrf_cloud/fota_common/prj.conf index d6788fc07fde..7c49e0802388 100644 --- a/tests/subsys/net/lib/nrf_cloud/fota_common/prj.conf +++ b/tests/subsys/net/lib/nrf_cloud/fota_common/prj.conf @@ -11,7 +11,7 @@ CONFIG_NRF_CLOUD_MQTT=y CONFIG_NETWORKING=y CONFIG_NET_SOCKETS=y -CONFIG_NET_SOCKETS_POSIX_NAMES=y +CONFIG_POSIX_API=y CONFIG_NRF_MODEM_LIB=y CONFIG_NRF_CLOUD_CONNECTION_POLL_THREAD=n CONFIG_FLASH=y diff --git a/tests/subsys/net/lib/nrf_provisioning/CMakeLists.txt b/tests/subsys/net/lib/nrf_provisioning/CMakeLists.txt index 4edb00870ed7..a49f35c36a68 100644 --- a/tests/subsys/net/lib/nrf_provisioning/CMakeLists.txt +++ b/tests/subsys/net/lib/nrf_provisioning/CMakeLists.txt @@ -42,7 +42,7 @@ elseif(CONFIG_NRF_PROVISIONING_COAP) -DCONFIG_COAP_CLIENT_MESSAGE_HEADER_SIZE=48 -DCONFIG_COAP_CLIENT_MESSAGE_SIZE=512 -DCONFIG_COAP_CLIENT_STACK_SIZE=1024 - -DCONFIG_NET_SOCKETS_POSIX_NAMES=y + -DCONFIG_POSIX_API=y -DCONFIG_MODEM_INFO_BUFFER_SIZE=128 -DCONFIG_COAP_CLIENT_MAX_REQUESTS=2 -DCONFIG_COAP_CLIENT_BLOCK_SIZE=256 From 359c36fca9a98cbb5f147900af3174c2e5290ce1 Mon Sep 17 00:00:00 2001 From: Georgios Vasilakis Date: Wed, 4 Dec 2024 12:55:36 +0100 Subject: [PATCH 035/109] samples: suit: smp_transfer: Use PRNG entropy This sample require entropy from Zephyr, in nRF54h20 this is provided by PSA RNG driver and from the secure domain. The PSA RNG driver brings IPC dependencies which increase the flash footprint of this sample and this was not an acceptable increase for the mainttainers of the sample. It was concluded that as a temporary solution this sample will keep using the non cryptographically secure, deterministic software RNG. The dependency on the PRNG node needs to be removed later and it is tracked in NCSDK-30805. Signed-off-by: Georgios Vasilakis --- .../sysbuild/recovery_hci_ipc.overlay | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/samples/suit/smp_transfer/sysbuild/recovery_hci_ipc.overlay b/samples/suit/smp_transfer/sysbuild/recovery_hci_ipc.overlay index 5d0abbea4925..b06fa93c52ef 100644 --- a/samples/suit/smp_transfer/sysbuild/recovery_hci_ipc.overlay +++ b/samples/suit/smp_transfer/sysbuild/recovery_hci_ipc.overlay @@ -6,6 +6,24 @@ #include "nrf54h20dk_nrf54h20_memory_map.dtsi" +/ { + chosen { + zephyr,entropy = &prng; + }; + + /delete-node/ psa-rng; + + prng: prng { + compatible = "nordic,entropy-prng"; + status = "okay"; + }; + +}; + +&cpusec_cpurad_ipc { + status = "disabled"; +}; + &uart135 { status = "disabled"; }; From 194d010182403e04f6461f6a2d5cab5805d0738e Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Fri, 17 Jan 2025 15:08:23 +0100 Subject: [PATCH 036/109] suit: Use legacy PRNG in recovery app Use legacy recovery PRNG in SUIT recovery application since the PSA variant consumes more memory and the recovery application is meant to be minimal. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- samples/suit/recovery/prj.conf | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/samples/suit/recovery/prj.conf b/samples/suit/recovery/prj.conf index 2f464c8d020b..0344ebbb466b 100644 --- a/samples/suit/recovery/prj.conf +++ b/samples/suit/recovery/prj.conf @@ -95,7 +95,7 @@ CONFIG_EARLY_CONSOLE=n CONFIG_ARM_MPU=n CONFIG_TIMESLICING=n -CONFIG_COMMON_LIBC_MALLOC=n +CONFIG_COMMON_LIBC_MALLOC=y CONFIG_LOG=n CONFIG_ASSERT=n @@ -115,3 +115,5 @@ CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n CONFIG_BT_CTLR_PRIVACY=n CONFIG_BT_CTLR_PHY_2M=n + +CONFIG_MBEDTLS_PSA_CRYPTO_LEGACY_RNG=y From a62cebe90d07b24b9abdaf45531bd5d4f393b2a7 Mon Sep 17 00:00:00 2001 From: Robert Lubos Date: Tue, 21 Jan 2025 09:52:21 +0100 Subject: [PATCH 037/109] net: lib: Switch to zsock_* API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use zsock_* socket functions and related symbols instead of POSIX ones to avoid dependency on the POSIX subsystem. Signed-off-by: Robert Lubos Signed-off-by: Andrzej Głąbek --- subsys/net/lib/downloader/src/dl_socket.c | 45 ++++----- subsys/net/lib/ftp_client/src/ftp_client.c | 91 ++++++++++--------- subsys/net/lib/mqtt_helper/mqtt_helper.c | 46 ++++------ .../net/lib/nrf_cloud/include/nrf_cloud_dns.h | 7 +- subsys/net/lib/nrf_cloud/src/nrf_cloud.c | 18 ++-- subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c | 21 +++-- subsys/net/lib/nrf_cloud/src/nrf_cloud_rest.c | 2 +- .../lib/nrf_cloud/src/nrf_cloud_transport.c | 11 +-- subsys/net/lib/rest_client/src/rest_client.c | 49 +++++----- .../lib/mqtt_helper/src/mqtt_helper_test.c | 36 ++++---- 10 files changed, 155 insertions(+), 171 deletions(-) diff --git a/subsys/net/lib/downloader/src/dl_socket.c b/subsys/net/lib/downloader/src/dl_socket.c index 92c648f0bbe1..57b425c1c8c8 100644 --- a/subsys/net/lib/downloader/src/dl_socket.c +++ b/subsys/net/lib/downloader/src/dl_socket.c @@ -4,11 +4,7 @@ * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -#if defined(CONFIG_POSIX_API) -#include -#else #include -#endif #include #include #include @@ -48,15 +44,16 @@ static int socket_sectag_set(int fd, const int *const sec_tag_list, uint8_t sec_ verify = TLS_PEER_VERIFY_REQUIRED; - err = setsockopt(fd, SOL_TLS, TLS_PEER_VERIFY, &verify, sizeof(verify)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_PEER_VERIFY, &verify, + sizeof(verify)); if (err) { LOG_ERR("Failed to setup peer verification, errno %d", errno); return -errno; } LOG_INF("Setting up TLS credentials, sec tag count %u", sec_tag_count); - err = setsockopt(fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, - sizeof(sec_tag_t) * sec_tag_count); + err = zsock_setsockopt(fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, + sizeof(sec_tag_t) * sec_tag_count); if (err) { LOG_ERR("Failed to setup socket security tag list, errno %d", errno); return -errno; @@ -71,7 +68,8 @@ static int socket_tls_hostname_set(int fd, const char *const hostname) int err; - err = setsockopt(fd, SOL_TLS, TLS_HOSTNAME, hostname, strlen(hostname)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_HOSTNAME, hostname, + strlen(hostname)); if (err) { LOG_ERR("Failed to setup TLS hostname (%s), errno %d", hostname, errno); return -errno; @@ -85,7 +83,8 @@ static int socket_pdn_id_set(int fd, uint32_t pdn_id) int err; LOG_INF("Binding to PDN ID: %d", pdn_id); - err = setsockopt(fd, SOL_SOCKET, SO_BINDTOPDN, &pdn_id, sizeof(pdn_id)); + err = zsock_setsockopt(fd, SOL_SOCKET, SO_BINDTOPDN, &pdn_id, + sizeof(pdn_id)); if (err) { LOG_ERR("Failed to bind socket to PDN ID %d, err %d", pdn_id, errno); return -ENETDOWN; @@ -99,7 +98,8 @@ static int socket_dtls_cid_enable(int fd) int err; uint32_t dtls_cid = TLS_DTLS_CID_ENABLED; - err = setsockopt(fd, SOL_TLS, TLS_DTLS_CID, &dtls_cid, sizeof(dtls_cid)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_DTLS_CID, &dtls_cid, + sizeof(dtls_cid)); if (err) { err = -errno; LOG_ERR("Failed to enable TLS_DTLS_CID: %d", err); @@ -128,8 +128,8 @@ static int dl_socket_host_lookup(const char *const hostname, uint32_t pdn_id, st int err; char pdnserv[4]; char *servname = NULL; - struct addrinfo *ai; - struct addrinfo hints = { + struct zsock_addrinfo *ai; + struct zsock_addrinfo hints = { .ai_family = family, }; @@ -147,7 +147,7 @@ static int dl_socket_host_lookup(const char *const hostname, uint32_t pdn_id, st servname = pdnserv; } - err = getaddrinfo(hostname, servname, &hints, &ai); + err = zsock_getaddrinfo(hostname, servname, &hints, &ai); if (err) { /* We expect this to fail on IPv6 sometimes */ LOG_INF("Failed to resolve hostname %s on %s, err %d", hostname, @@ -156,7 +156,7 @@ static int dl_socket_host_lookup(const char *const hostname, uint32_t pdn_id, st } memcpy(sa, ai->ai_addr, ai->ai_addrlen); - freeaddrinfo(ai); + zsock_freeaddrinfo(ai); return 0; } @@ -184,7 +184,7 @@ static int dl_socket_create_and_connect(int *fd, int proto, int type, uint16_t p LOG_DBG("family: %d, type: %d, proto: %d", remote_addr->sa_family, type, proto); - *fd = socket(remote_addr->sa_family, type, proto); + *fd = zsock_socket(remote_addr->sa_family, type, proto); if (*fd < 0) { err = -errno; LOG_ERR("Failed to create socket, errno %d", -err); @@ -232,13 +232,14 @@ static int dl_socket_create_and_connect(int *fd, int proto, int type, uint16_t p } else { sin_addr = &((struct sockaddr_in *)remote_addr)->sin_addr; } - inet_ntop(remote_addr->sa_family, sin_addr, ip_addr_str, sizeof(ip_addr_str)); + zsock_inet_ntop(remote_addr->sa_family, sin_addr, ip_addr_str, + sizeof(ip_addr_str)); LOG_INF("Connecting to %s", ip_addr_str); } LOG_DBG("fd %d, addrlen %d, fam %s, port %d", *fd, addrlen, str_family(remote_addr->sa_family), port); - err = connect(*fd, remote_addr, addrlen); + err = zsock_connect(*fd, remote_addr, addrlen); if (err) { err = -errno; /* Make sure that ECONNRESET is not returned as it has a special meaning @@ -310,7 +311,7 @@ int dl_socket_close(int *fd) int err = 0; if (*fd >= 0) { - err = close(*fd); + err = zsock_close(*fd); if (err && errno != EBADF) { err = -errno; LOG_ERR("Failed to close socket, errno %d", -err); @@ -329,7 +330,7 @@ int dl_socket_send(int fd, void *buf, size_t len) size_t off = 0; while (len) { - sent = send(fd, (uint8_t *)buf + off, len, 0); + sent = zsock_send(fd, (uint8_t *)buf + off, len, 0); if (sent < 0) { return -errno; } @@ -352,7 +353,7 @@ int dl_socket_send_timeout_set(int fd, uint32_t timeout_ms) return 0; } - err = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo)); + err = zsock_setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo)); if (err) { LOG_WRN("Failed to set socket timeout, errno %d", errno); return -errno; @@ -372,7 +373,7 @@ int dl_socket_recv_timeout_set(int fd, uint32_t timeout_ms) return -EINVAL; } - err = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo)); + err = zsock_setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo)); if (err) { LOG_WRN("Failed to set socket timeout, errno %d", errno); return -errno; @@ -389,7 +390,7 @@ ssize_t dl_socket_recv(int fd, void *buf, size_t len) return -EINVAL; } - err = recv(fd, buf, len, 0); + err = zsock_recv(fd, buf, len, 0); if (err < 0) { return -errno; } diff --git a/subsys/net/lib/ftp_client/src/ftp_client.c b/subsys/net/lib/ftp_client/src/ftp_client.c index fa7aed86b1db..de13604c1f08 100644 --- a/subsys/net/lib/ftp_client/src/ftp_client.c +++ b/subsys/net/lib/ftp_client/src/ftp_client.c @@ -127,9 +127,9 @@ static int establish_data_channel(const char *pasv_msg) /* open data socket */ if (client.sec_tag <= 0) { - client.data_sock = socket(client.family, SOCK_STREAM, IPPROTO_TCP); + client.data_sock = zsock_socket(client.family, SOCK_STREAM, IPPROTO_TCP); } else { - client.data_sock = socket(client.family, SOCK_STREAM, IPPROTO_TLS_1_2); + client.data_sock = zsock_socket(client.family, SOCK_STREAM, IPPROTO_TLS_1_2); } if (client.data_sock < 0) { LOG_ERR("socket(data) failed: %d", -errno); @@ -138,11 +138,11 @@ static int establish_data_channel(const char *pasv_msg) if (client.sec_tag != INVALID_SEC_TAG) { sec_tag_t sec_tag_list[] = { client.sec_tag }; - ret = setsockopt(client.data_sock, SOL_TLS, TLS_SEC_TAG_LIST, - sec_tag_list, sizeof(sec_tag_t)); + ret = zsock_setsockopt(client.data_sock, SOL_TLS, TLS_SEC_TAG_LIST, + sec_tag_list, sizeof(sec_tag_t)); if (ret) { LOG_ERR("set tag list failed: %d", -errno); - close(client.data_sock); + zsock_close(client.data_sock); return -errno; } @@ -151,16 +151,16 @@ static int establish_data_channel(const char *pasv_msg) /* Connect to remote host */ if (client.family == AF_INET) { client.remote.sin_port = htons(data_port); - ret = connect(client.data_sock, (struct sockaddr *)&client.remote, - sizeof(struct sockaddr_in)); + ret = zsock_connect(client.data_sock, (struct sockaddr *)&client.remote, + sizeof(struct sockaddr_in)); } else { client.remote6.sin6_port = htons(data_port); - ret = connect(client.data_sock, (struct sockaddr *)&client.remote6, - sizeof(struct sockaddr_in6)); + ret = zsock_connect(client.data_sock, (struct sockaddr *)&client.remote6, + sizeof(struct sockaddr_in6)); } if (ret < 0) { LOG_ERR("connect(data) failed: %d", -errno); - close(client.data_sock); + zsock_close(client.data_sock); return -errno; } @@ -194,10 +194,10 @@ static void close_connection(int code, int error) } /* Should be impossble, just in case */ if (client.data_sock != INVALID_SOCKET) { - close(client.data_sock); + zsock_close(client.data_sock); } if (client.cmd_sock != INVALID_SOCKET) { - close(client.cmd_sock); + zsock_close(client.cmd_sock); client.cmd_sock = INVALID_SOCKET; client.data_sock = INVALID_SOCKET; client.connected = false; @@ -214,7 +214,7 @@ static int do_ftp_send_ctrl(const uint8_t *message, int length) LOG_DBG("%s", (char *)message); while (offset < length) { - ret = send(client.cmd_sock, message + offset, length - offset, 0); + ret = zsock_send(client.cmd_sock, message + offset, length - offset, 0); if (ret < 0) { LOG_ERR("send cmd failed: %d", -errno); ret = -errno; @@ -247,7 +247,7 @@ static int do_ftp_send_data(const char *pasv_msg, uint8_t *message, uint16_t len } while (offset < length) { - ret = send(client.data_sock, message + offset, length - offset, 0); + ret = zsock_send(client.data_sock, message + offset, length - offset, 0); if (ret < 0) { LOG_ERR("send data failed: %d", -errno); ret = -errno; @@ -258,7 +258,7 @@ static int do_ftp_send_data(const char *pasv_msg, uint8_t *message, uint16_t len ret = 0; } - close(client.data_sock); + zsock_close(client.data_sock); ftp_inactivity = false; return ret; } @@ -268,12 +268,12 @@ static int do_ftp_send_data(const char *pasv_msg, uint8_t *message, uint16_t len static int do_ftp_recv_ctrl(bool post_result, int success_code) { int ret; - struct pollfd fds[1]; + struct zsock_pollfd fds[1]; /* Receive FTP control message */ fds[0].fd = client.cmd_sock; - fds[0].events = POLLIN; - ret = poll(fds, 1, MSEC_PER_SEC * CONFIG_FTP_CLIENT_LISTEN_TIME); + fds[0].events = ZSOCK_POLLIN; + ret = zsock_poll(fds, 1, MSEC_PER_SEC * CONFIG_FTP_CLIENT_LISTEN_TIME); if (ret < 0) { LOG_ERR("poll(ctrl) failed: (%d)", -errno); close_connection(FTP_CODE_903, -errno); @@ -283,22 +283,22 @@ static int do_ftp_recv_ctrl(bool post_result, int success_code) LOG_DBG("poll(ctrl) timeout"); return -ETIMEDOUT; /* allow retry */ } - if ((fds[0].revents & POLLHUP) == POLLHUP) { + if ((fds[0].revents & ZSOCK_POLLHUP) == ZSOCK_POLLHUP) { LOG_ERR("POLLHUP"); close_connection(FTP_CODE_901, -ECONNRESET); return -ECONNRESET; } - if ((fds[0].revents & POLLNVAL) == POLLNVAL) { + if ((fds[0].revents & ZSOCK_POLLNVAL) == ZSOCK_POLLNVAL) { LOG_ERR("POLLNVAL"); close_connection(FTP_CODE_902, -ECONNABORTED); return -ECONNABORTED; } - if ((fds[0].revents & POLLIN) != POLLIN) { + if ((fds[0].revents & ZSOCK_POLLIN) != ZSOCK_POLLIN) { LOG_ERR("POLL 0x%08x", fds[0].revents); close_connection(FTP_CODE_904, -EAGAIN); return -EAGAIN; } - ret = recv(client.cmd_sock, ctrl_buf, sizeof(ctrl_buf), 0); + ret = zsock_recv(client.cmd_sock, ctrl_buf, sizeof(ctrl_buf), 0); if (ret <= 0) { LOG_ERR("recv(ctrl) failed: (%d)", -errno); return -errno; /* allow retry */ @@ -319,7 +319,7 @@ static int do_ftp_recv_ctrl(bool post_result, int success_code) static void do_ftp_recv_data(const char *pasv_msg) { int ret; - struct pollfd fds[1]; + struct zsock_pollfd fds[1]; char data_buf[FTP_MAX_BUFFER_SIZE]; /* Establish data channel */ @@ -330,18 +330,18 @@ static void do_ftp_recv_data(const char *pasv_msg) /* Receive FTP data message */ fds[0].fd = client.data_sock; - fds[0].events = POLLIN; + fds[0].events = ZSOCK_POLLIN; do { - ret = poll(fds, 1, MSEC_PER_SEC * CONFIG_FTP_CLIENT_LISTEN_TIME); + ret = zsock_poll(fds, 1, MSEC_PER_SEC * CONFIG_FTP_CLIENT_LISTEN_TIME); if (ret <= 0) { LOG_ERR("poll(data) failed: (%d)", -errno); break; } - if ((fds[0].revents & POLLIN) != POLLIN) { + if ((fds[0].revents & ZSOCK_POLLIN) != ZSOCK_POLLIN) { LOG_DBG("No more data"); break; } - ret = recv(client.data_sock, data_buf, sizeof(data_buf), 0); + ret = zsock_recv(client.data_sock, data_buf, sizeof(data_buf), 0); if (ret < 0) { LOG_ERR("recv(data) failed: (%d)", -errno); break; @@ -354,7 +354,7 @@ static void do_ftp_recv_data(const char *pasv_msg) LOG_DBG("DATA received %d", ret); } while (true); - close(client.data_sock); + zsock_close(client.data_sock); ftp_inactivity = false; } @@ -442,12 +442,13 @@ int ftp_open(const char *hostname, uint16_t port, int sec_tag) return -EINVAL; } int ret; - struct addrinfo *ai; + struct zsock_addrinfo *ai; /* Resolve the hostname in the preferred IP version .*/ - ret = getaddrinfo(hostname, NULL, NULL, &ai); + ret = zsock_getaddrinfo(hostname, NULL, NULL, &ai); if (ret) { - LOG_ERR("Failed to resolve hostname (\"%s\"): %s", hostname, gai_strerror(ret)); + LOG_ERR("Failed to resolve hostname (\"%s\"): %s", + hostname, zsock_gai_strerror(ret)); return -EHOSTUNREACH; } client.family = ai->ai_family; @@ -456,13 +457,13 @@ int ftp_open(const char *hostname, uint16_t port, int sec_tag) } else { memcpy(&client.remote6, ai->ai_addr, sizeof(client.remote6)); } - freeaddrinfo(ai); + zsock_freeaddrinfo(ai); /* open control socket */ if (sec_tag == INVALID_SEC_TAG) { - client.cmd_sock = socket(client.family, SOCK_STREAM, IPPROTO_TCP); + client.cmd_sock = zsock_socket(client.family, SOCK_STREAM, IPPROTO_TCP); } else { - client.cmd_sock = socket(client.family, SOCK_STREAM, IPPROTO_TLS_1_2); + client.cmd_sock = zsock_socket(client.family, SOCK_STREAM, IPPROTO_TLS_1_2); } if (client.cmd_sock < 0) { LOG_ERR("socket(ctrl) failed: %d", -errno); @@ -471,11 +472,11 @@ int ftp_open(const char *hostname, uint16_t port, int sec_tag) if (sec_tag != INVALID_SEC_TAG) { sec_tag_t sec_tag_list[] = { sec_tag }; - ret = setsockopt(client.cmd_sock, SOL_TLS, TLS_SEC_TAG_LIST, - sec_tag_list, sizeof(sec_tag_t)); + ret = zsock_setsockopt(client.cmd_sock, SOL_TLS, TLS_SEC_TAG_LIST, + sec_tag_list, sizeof(sec_tag_t)); if (ret) { LOG_ERR("set tag list failed: %d", -errno); - close(client.cmd_sock); + zsock_close(client.cmd_sock); return -errno; } client.sec_tag = sec_tag; @@ -484,23 +485,25 @@ int ftp_open(const char *hostname, uint16_t port, int sec_tag) /* Connect to remote host */ if (client.family == AF_INET) { client.remote.sin_port = htons(port); - ret = connect(client.cmd_sock, (struct sockaddr *)&client.remote, - sizeof(struct sockaddr_in)); + ret = zsock_connect(client.cmd_sock, + (struct sockaddr *)&client.remote, + sizeof(struct sockaddr_in)); } else { client.remote6.sin6_port = htons(port); - ret = connect(client.cmd_sock, (struct sockaddr *)&client.remote6, - sizeof(struct sockaddr_in6)); + ret = zsock_connect(client.cmd_sock, + (struct sockaddr *)&client.remote6, + sizeof(struct sockaddr_in6)); } if (ret < 0) { LOG_ERR("connect(ctrl) failed: %d", -errno); - close(client.cmd_sock); + zsock_close(client.cmd_sock); return -errno; } /* Receive server greeting */ ret = do_ftp_recv_ctrl(true, FTP_CODE_220); if (ret != FTP_CODE_220) { - close(client.cmd_sock); + zsock_close(client.cmd_sock); return ret; } @@ -508,7 +511,7 @@ int ftp_open(const char *hostname, uint16_t port, int sec_tag) sprintf(ctrl_buf, CMD_OPTS, "UTF8 ON"); ret = do_ftp_send_ctrl(ctrl_buf, strlen(ctrl_buf)); if (ret) { - close(client.cmd_sock); + zsock_close(client.cmd_sock); return ret; } (void)do_ftp_recv_ctrl(true, FTP_CODE_ANY); diff --git a/subsys/net/lib/mqtt_helper/mqtt_helper.c b/subsys/net/lib/mqtt_helper/mqtt_helper.c index 7c55fed9d9cf..7d463f09eab7 100644 --- a/subsys/net/lib/mqtt_helper/mqtt_helper.c +++ b/subsys/net/lib/mqtt_helper/mqtt_helper.c @@ -3,17 +3,9 @@ * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ - #include #include -#if defined(CONFIG_POSIX_API) -#include -#include -#include -#include -#else #include -#endif /* CONFIG_POSIX_API */ #include #include @@ -386,9 +378,9 @@ static int broker_init(struct sockaddr_storage *broker, struct mqtt_helper_conn_params *conn_params) { int err; - struct addrinfo *result; - struct addrinfo *addr; - struct addrinfo hints = { + struct zsock_addrinfo *result; + struct zsock_addrinfo *addr; + struct zsock_addrinfo hints = { .ai_socktype = SOCK_STREAM }; char addr_str[NET_IPV6_ADDR_LEN]; @@ -401,7 +393,7 @@ static int broker_init(struct sockaddr_storage *broker, LOG_DBG("Resolving IP address for %s", conn_params->hostname.ptr); } - err = getaddrinfo(conn_params->hostname.ptr, NULL, &hints, &result); + err = zsock_getaddrinfo(conn_params->hostname.ptr, NULL, &hints, &result); if (err) { LOG_ERR("getaddrinfo() failed, error %d", err); return -err; @@ -418,8 +410,8 @@ static int broker_init(struct sockaddr_storage *broker, broker6->sin6_family = addr->ai_family; broker6->sin6_port = htons(CONFIG_MQTT_HELPER_PORT); - inet_ntop(addr->ai_family, &broker6->sin6_addr, addr_str, - sizeof(addr_str)); + zsock_inet_ntop(addr->ai_family, &broker6->sin6_addr, + addr_str, sizeof(addr_str)); LOG_DBG("IPv6 Address found %s (%s)", addr_str, net_family2str(addr->ai_family)); break; @@ -431,8 +423,8 @@ static int broker_init(struct sockaddr_storage *broker, broker4->sin_family = addr->ai_family; broker4->sin_port = htons(CONFIG_MQTT_HELPER_PORT); - inet_ntop(addr->ai_family, &broker4->sin_addr, addr_str, - sizeof(addr_str)); + zsock_inet_ntop(addr->ai_family, &broker4->sin_addr, + addr_str, sizeof(addr_str)); LOG_DBG("IPv4 Address found %s (%s)", addr_str, net_family2str(addr->ai_family)); break; @@ -443,7 +435,7 @@ static int broker_init(struct sockaddr_storage *broker, addr = addr->ai_next; } - freeaddrinfo(result); + zsock_freeaddrinfo(result); return err; } @@ -552,7 +544,8 @@ static int client_connect(struct mqtt_helper_conn_params *conn_params) int sock = mqtt_client.transport.tcp.sock; #endif /* CONFIG_MQTT_LIB_TLS */ - err = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); + err = zsock_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, + sizeof(timeout)); if (err == -1) { LOG_WRN("Failed to set timeout, errno: %d", errno); @@ -730,13 +723,13 @@ int mqtt_helper_deinit(void) MQTT_HELPER_STATIC void mqtt_helper_poll_loop(void) { int ret; - struct pollfd fds[1] = {0}; + struct zsock_pollfd fds[1] = {0}; LOG_DBG("Waiting for connection_poll_sem"); k_sem_take(&connection_poll_sem, K_FOREVER); LOG_DBG("Took connection_poll_sem"); - fds[0].events = POLLIN; + fds[0].events = ZSOCK_POLLIN; #if defined(CONFIG_MQTT_LIB_TLS) fds[0].fd = mqtt_client.transport.tls.sock; #else @@ -754,7 +747,8 @@ MQTT_HELPER_STATIC void mqtt_helper_poll_loop(void) LOG_DBG("Polling on socket fd: %d", fds[0].fd); } - ret = poll(fds, ARRAY_SIZE(fds), mqtt_keepalive_time_left(&mqtt_client)); + ret = zsock_poll(fds, ARRAY_SIZE(fds), + mqtt_keepalive_time_left(&mqtt_client)); if (ret < 0) { LOG_ERR("poll() returned an error (%d), errno: %d", ret, -errno); break; @@ -773,7 +767,7 @@ MQTT_HELPER_STATIC void mqtt_helper_poll_loop(void) continue; } - if ((fds[0].revents & POLLIN) == POLLIN) { + if ((fds[0].revents & ZSOCK_POLLIN) == ZSOCK_POLLIN) { ret = mqtt_input(&mqtt_client); if (ret) { LOG_ERR("Cloud MQTT input error: %d", ret); @@ -791,9 +785,9 @@ MQTT_HELPER_STATIC void mqtt_helper_poll_loop(void) } } - if ((fds[0].revents & POLLNVAL) == POLLNVAL) { + if ((fds[0].revents & ZSOCK_POLLNVAL) == ZSOCK_POLLNVAL) { if (mqtt_state_verify(MQTT_STATE_DISCONNECTING)) { - /* POLLNVAL is to be expected while + /* ZSOCK_POLLNVAL is to be expected while * disconnecting, as the socket will be closed * by the MQTT library and become invalid. */ @@ -807,13 +801,13 @@ MQTT_HELPER_STATIC void mqtt_helper_poll_loop(void) break; } - if ((fds[0].revents & POLLHUP) == POLLHUP) { + if ((fds[0].revents & ZSOCK_POLLHUP) == ZSOCK_POLLHUP) { LOG_ERR("Socket error: POLLHUP"); LOG_ERR("Connection was unexpectedly closed"); break; } - if ((fds[0].revents & POLLERR) == POLLERR) { + if ((fds[0].revents & ZSOCK_POLLERR) == ZSOCK_POLLERR) { LOG_ERR("Socket error: POLLERR"); LOG_ERR("Connection was unexpectedly closed"); break; diff --git a/subsys/net/lib/nrf_cloud/include/nrf_cloud_dns.h b/subsys/net/lib/nrf_cloud/include/nrf_cloud_dns.h index 3f2e45d4d58a..5fb58aebebd9 100644 --- a/subsys/net/lib/nrf_cloud/include/nrf_cloud_dns.h +++ b/subsys/net/lib/nrf_cloud/include/nrf_cloud_dns.h @@ -10,12 +10,7 @@ #define NRF_CLOUD_NET_UTIL_H_ #include - -#if defined(CONFIG_POSIX_API) -#include -#else #include -#endif #ifdef __cplusplus extern "C" { @@ -60,7 +55,7 @@ typedef int (*nrf_cloud_connect_host_cb)(struct sockaddr *const addr); * socket ID of the successful connection. * @return int Either a negative error code on failure, or a nonnegative socket ID on success. */ -int nrf_cloud_connect_host(const char *host_name, uint16_t port, struct addrinfo *hints, +int nrf_cloud_connect_host(const char *host_name, uint16_t port, struct zsock_addrinfo *hints, nrf_cloud_connect_host_cb connect_cb); /** @endcond */ diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud.c index e39bd1032707..28918f503ff2 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud.c @@ -3,11 +3,7 @@ * * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause */ -#if defined(CONFIG_POSIX_API) -#include -#else #include -#endif #include #include #include @@ -587,7 +583,7 @@ static int start_connection_poll(void) void nrf_cloud_run(void) { int ret; - struct pollfd fds[1]; + struct zsock_pollfd fds[1]; struct nrf_cloud_evt evt; start: @@ -611,7 +607,7 @@ void nrf_cloud_run(void) } fds[0].fd = nct_socket_get(); - fds[0].events = POLLIN; + fds[0].events = ZSOCK_POLLIN; /* Only disconnect events will occur below */ evt.type = NRF_CLOUD_EVT_TRANSPORT_DISCONNECTED; @@ -619,7 +615,7 @@ void nrf_cloud_run(void) while (true) { fds[0].revents = 0; - ret = poll(fds, ARRAY_SIZE(fds), nct_keepalive_time_left()); + ret = zsock_poll(fds, ARRAY_SIZE(fds), nct_keepalive_time_left()); /* If poll returns 0 the timeout has expired. */ if (ret == 0) { @@ -640,7 +636,7 @@ void nrf_cloud_run(void) break; } - if ((fds[0].revents & POLLIN) == POLLIN) { + if ((fds[0].revents & ZSOCK_POLLIN) == ZSOCK_POLLIN) { ret = nrf_cloud_process(); if ((ret < 0) && (ret != -EAGAIN)) { LOG_DBG("Disconnecting; nrf_cloud_process returned an error: %d", @@ -657,7 +653,7 @@ void nrf_cloud_run(void) continue; } - if ((fds[0].revents & POLLNVAL) == POLLNVAL) { + if ((fds[0].revents & ZSOCK_POLLNVAL) == ZSOCK_POLLNVAL) { LOG_DBG("Socket error: POLLNVAL"); if (nfsm_get_disconnect_requested()) { LOG_DBG("The cloud socket was disconnected by request"); @@ -670,14 +666,14 @@ void nrf_cloud_run(void) break; } - if ((fds[0].revents & POLLHUP) == POLLHUP) { + if ((fds[0].revents & ZSOCK_POLLHUP) == ZSOCK_POLLHUP) { LOG_DBG("Socket error: POLLHUP"); LOG_DBG("Connection was closed by the cloud"); evt.status = NRF_CLOUD_DISCONNECT_CLOSED_BY_REMOTE; break; } - if ((fds[0].revents & POLLERR) == POLLERR) { + if ((fds[0].revents & ZSOCK_POLLERR) == ZSOCK_POLLERR) { LOG_DBG("Socket error: POLLERR"); LOG_DBG("Cloud connection was unexpectedly closed"); evt.status = NRF_CLOUD_DISCONNECT_MISC; diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c index 23d12787d8bf..e2ff840908ad 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c @@ -15,13 +15,14 @@ LOG_MODULE_REGISTER(nrf_cloud_dns, CONFIG_NRF_CLOUD_LOG_LEVEL); static int nrf_cloud_try_addresses(const char *const host_name, uint16_t port, - struct addrinfo *hints, nrf_cloud_connect_host_cb connect_cb) + struct zsock_addrinfo *hints, + nrf_cloud_connect_host_cb connect_cb) { int err = 0; - struct addrinfo *info; - struct addrinfo *result; + struct zsock_addrinfo *info; + struct zsock_addrinfo *result; - err = getaddrinfo(host_name, NULL, hints, &info); + err = zsock_getaddrinfo(host_name, NULL, hints, &info); if (err) { LOG_DBG("getaddrinfo for %s, port: %d failed: %d, errno: %d", host_name, port, err, errno); @@ -47,8 +48,9 @@ static int nrf_cloud_try_addresses(const char *const host_name, uint16_t port, break; } - inet_ntop(sa->sa_family, (void *)&((struct sockaddr_in *)sa)->sin_addr, - ip, sizeof(ip)); + zsock_inet_ntop(sa->sa_family, + (void *)&((struct sockaddr_in *)sa)->sin_addr, + ip, sizeof(ip)); LOG_DBG("Trying IP address and port for server %s: %s, port: %d", host_name, ip, port); @@ -66,15 +68,16 @@ static int nrf_cloud_try_addresses(const char *const host_name, uint16_t port, /* Pass the socket back to the initial caller, if creating/connecting it was * successful. */ - freeaddrinfo(result); + zsock_freeaddrinfo(result); return sock; } - freeaddrinfo(result); + zsock_freeaddrinfo(result); return -ECONNREFUSED; } -int nrf_cloud_connect_host(const char *hostname, uint16_t port, struct addrinfo *hints, +int nrf_cloud_connect_host(const char *hostname, uint16_t port, + struct zsock_addrinfo *hints, nrf_cloud_connect_host_cb connect_cb) { int sock; diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_rest.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_rest.c index 4beec1177a5a..7ebd8b83ad3b 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_rest.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_rest.c @@ -994,7 +994,7 @@ int nrf_cloud_rest_disconnect(struct nrf_cloud_rest_context *const rest_ctx) return -ENOTCONN; } - int err = close(rest_ctx->connect_socket); + int err = zsock_close(rest_ctx->connect_socket); if (err) { LOG_ERR("Failed to close socket, error: %d", errno); err = -EIO; diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_transport.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_transport.c index 2705c48fbc31..fadd1b312931 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_transport.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_transport.c @@ -20,14 +20,7 @@ #include #include #include - -#if defined(CONFIG_POSIX_API) -#include -#include -#include -#else #include -#endif /* defined(CONFIG_POSIX_API) */ LOG_MODULE_REGISTER(nrf_cloud_transport, CONFIG_NRF_CLOUD_LOG_LEVEL); @@ -968,7 +961,7 @@ int nct_connect(void) int err = 0; const char *const host_name = NRF_CLOUD_HOSTNAME; uint16_t port = htons(NRF_CLOUD_PORT); - struct addrinfo hints = { + struct zsock_addrinfo hints = { .ai_socktype = SOCK_STREAM }; int sock = nrf_cloud_connect_host(host_name, port, &hints, &nct_connect_host_cb); @@ -994,7 +987,7 @@ int nct_connect(void) .tv_sec = CONFIG_NRF_CLOUD_SEND_TIMEOUT_SEC }; - err = setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); + err = zsock_setsockopt(sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); if (err == -1) { LOG_ERR("Failed to set timeout, errno: %d", errno); err = 0; diff --git a/subsys/net/lib/rest_client/src/rest_client.c b/subsys/net/lib/rest_client/src/rest_client.c index 4cff6745b501..04a8002ee6ea 100644 --- a/subsys/net/lib/rest_client/src/rest_client.c +++ b/subsys/net/lib/rest_client/src/rest_client.c @@ -10,14 +10,7 @@ #include #include -#if defined(CONFIG_POSIX_API) -#include -#include -#include -#include -#else #include -#endif #include #include #include @@ -87,13 +80,15 @@ static int rest_client_sckt_tls_setup(int fd, const char *const tls_hostname, verify = tls_peer_verify; } - err = setsockopt(fd, SOL_TLS, TLS_PEER_VERIFY, &verify, sizeof(verify)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_PEER_VERIFY, &verify, + sizeof(verify)); if (err) { LOG_ERR("Failed to setup peer verification, error: %d", errno); return err; } - err = setsockopt(fd, SOL_TLS, TLS_SEC_TAG_LIST, tls_sec_tag, sizeof(tls_sec_tag)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_SEC_TAG_LIST, tls_sec_tag, + sizeof(tls_sec_tag)); if (err) { LOG_ERR("Failed to setup TLS sec tag, error: %d", errno); return err; @@ -105,14 +100,16 @@ static int rest_client_sckt_tls_setup(int fd, const char *const tls_hostname, cache = TLS_SESSION_CACHE_DISABLED; } - err = setsockopt(fd, SOL_TLS, TLS_SESSION_CACHE, &cache, sizeof(cache)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_SESSION_CACHE, &cache, + sizeof(cache)); if (err) { LOG_ERR("Unable to set session cache, errno %d", errno); return err; } if (tls_hostname) { - err = setsockopt(fd, SOL_TLS, TLS_HOSTNAME, tls_hostname, strlen(tls_hostname)); + err = zsock_setsockopt(fd, SOL_TLS, TLS_HOSTNAME, tls_hostname, + strlen(tls_hostname)); if (err) { LOG_ERR("Failed to setup TLS hostname, error: %d", errno); return err; @@ -130,13 +127,15 @@ static int rest_client_sckt_timeouts_set(int fd, int32_t timeout_ms) /* Send TO also affects TCP connect */ timeout.tv_sec = timeout_ms / MSEC_PER_SEC; timeout.tv_usec = (timeout_ms % MSEC_PER_SEC) * USEC_PER_MSEC; - err = setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); + err = zsock_setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, &timeout, + sizeof(timeout)); if (err) { LOG_ERR("Failed to set socket send timeout, error: %d", errno); return err; } - err = setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, sizeof(timeout)); + err = zsock_setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &timeout, + sizeof(timeout)); if (err) { LOG_ERR("Failed to set socket recv timeout, error: %d", errno); return err; @@ -154,10 +153,10 @@ static int rest_client_sckt_connect(int *const fd, int32_t *timeout_ms) { int ret; - struct addrinfo *addr_info; + struct zsock_addrinfo *addr_info; char peer_addr[INET6_ADDRSTRLEN]; char portstr[6] = { 0 }; - struct addrinfo hints = { + struct zsock_addrinfo hints = { .ai_flags = AI_NUMERICSERV, /* Let getaddrinfo() set port to addrinfo */ .ai_family = AF_UNSPEC, /* Both IPv4 and IPv6 addresses accepted */ .ai_socktype = SOCK_STREAM, @@ -177,17 +176,17 @@ static int rest_client_sckt_connect(int *const fd, LOG_DBG("Doing getaddrinfo() with connect addr %s port %s", hostname, portstr); - ret = getaddrinfo(hostname, portstr, &hints, &addr_info); + ret = zsock_getaddrinfo(hostname, portstr, &hints, &addr_info); if (ret) { LOG_ERR("getaddrinfo() failed, error: %d", ret); return -EFAULT; } sa = addr_info->ai_addr; - inet_ntop(sa->sa_family, - (void *)&((struct sockaddr_in *)sa)->sin_addr, - peer_addr, - INET6_ADDRSTRLEN); + zsock_inet_ntop(sa->sa_family, + (void *)&((struct sockaddr_in *)sa)->sin_addr, + peer_addr, + INET6_ADDRSTRLEN); LOG_DBG("getaddrinfo() %s", peer_addr); if (*timeout_ms != SYS_FOREVER_MS) { @@ -203,7 +202,7 @@ static int rest_client_sckt_connect(int *const fd, } proto = (sec_tag == REST_CLIENT_SEC_TAG_NO_SEC) ? IPPROTO_TCP : IPPROTO_TLS_1_2; - *fd = socket(addr_info->ai_family, SOCK_STREAM, proto); + *fd = zsock_socket(addr_info->ai_family, SOCK_STREAM, proto); if (*fd == -1) { LOG_ERR("Failed to open socket, error: %d", errno); ret = -ENOTCONN; @@ -227,7 +226,7 @@ static int rest_client_sckt_connect(int *const fd, LOG_DBG("Connecting to %s port %s", hostname, portstr); - ret = connect(*fd, addr_info->ai_addr, addr_info->ai_addrlen); + ret = zsock_connect(*fd, addr_info->ai_addr, addr_info->ai_addrlen); if (ret) { LOG_ERR("Failed to connect socket, error: %d", errno); if (errno == ETIMEDOUT) { @@ -253,10 +252,10 @@ static int rest_client_sckt_connect(int *const fd, clean_up: - freeaddrinfo(addr_info); + zsock_freeaddrinfo(addr_info); if (ret) { if (*fd > -1) { - (void)close(*fd); + (void)zsock_close(*fd); *fd = -1; } } @@ -270,7 +269,7 @@ static void rest_client_close_connection(struct rest_client_req_context *const r int ret; if (!req_ctx->keep_alive) { - ret = close(req_ctx->connect_socket); + ret = zsock_close(req_ctx->connect_socket); if (ret) { LOG_WRN("Failed to close socket, error: %d", errno); } else { diff --git a/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c b/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c index 76567ee6f53c..8e19c4d2d33a 100644 --- a/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c +++ b/tests/subsys/net/lib/mqtt_helper/src/mqtt_helper_test.c @@ -280,13 +280,13 @@ void test_mqtt_helper_connect_when_disconnected(void) */ struct zsock_addrinfo *test_res = NULL; - __cmock_getaddrinfo_ExpectAndReturn(NULL, NULL, NULL, NULL, 0); - __cmock_getaddrinfo_IgnoreArg_host(); - __cmock_getaddrinfo_IgnoreArg_hints(); - __cmock_getaddrinfo_IgnoreArg_res(); - __cmock_getaddrinfo_ReturnThruPtr_res(&test_res); + __cmock_zsock_getaddrinfo_ExpectAndReturn(NULL, NULL, NULL, NULL, 0); + __cmock_zsock_getaddrinfo_IgnoreArg_host(); + __cmock_zsock_getaddrinfo_IgnoreArg_hints(); + __cmock_zsock_getaddrinfo_IgnoreArg_res(); + __cmock_zsock_getaddrinfo_ReturnThruPtr_res(&test_res); - __cmock_freeaddrinfo_ExpectAnyArgs(); + __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_mqtt_connect_ExpectAndReturn(&mqtt_client, 0); mqtt_state = MQTT_STATE_DISCONNECTED; @@ -301,7 +301,7 @@ void test_mqtt_helper_connect_when_disconnected_mqtt_api_error(void) __cmock_mqtt_client_init_Expect(&mqtt_client); - __cmock_freeaddrinfo_ExpectAnyArgs(); + __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_mqtt_connect_ExpectAndReturn(&mqtt_client, -2); /* Make getddrinfo return a pointer that points to NULL. Otherwise the unit under test @@ -310,11 +310,11 @@ void test_mqtt_helper_connect_when_disconnected_mqtt_api_error(void) */ struct zsock_addrinfo *test_res = NULL; - __cmock_getaddrinfo_ExpectAndReturn(NULL, NULL, NULL, NULL, 0); - __cmock_getaddrinfo_IgnoreArg_host(); - __cmock_getaddrinfo_IgnoreArg_hints(); - __cmock_getaddrinfo_IgnoreArg_res(); - __cmock_getaddrinfo_ReturnThruPtr_res(&test_res); + __cmock_zsock_getaddrinfo_ExpectAndReturn(NULL, NULL, NULL, NULL, 0); + __cmock_zsock_getaddrinfo_IgnoreArg_host(); + __cmock_zsock_getaddrinfo_IgnoreArg_hints(); + __cmock_zsock_getaddrinfo_IgnoreArg_res(); + __cmock_zsock_getaddrinfo_ReturnThruPtr_res(&test_res); mqtt_state = MQTT_STATE_DISCONNECTED; @@ -557,8 +557,8 @@ void test_mqtt_helper_poll_loop_disconnecting(void) void test_mqtt_helper_poll_loop_timeout(void) { /* Let poll() return 0 first and then -ENOTCONN on subsequent call to end the test. */ - __cmock_poll_ExpectAnyArgsAndReturn(0); - __cmock_poll_ExpectAnyArgsAndReturn(-ENOTCONN); + __cmock_zsock_poll_ExpectAnyArgsAndReturn(0); + __cmock_zsock_poll_ExpectAnyArgsAndReturn(-ENOTCONN); __cmock_mqtt_live_ExpectAndReturn(&mqtt_client, 0); /* mqtt_abort() should be called when the connection is dropped. */ @@ -576,7 +576,7 @@ void test_mqtt_helper_poll_loop_timeout(void) */ void test_mqtt_helper_poll_loop_pollin(void) { - __cmock_poll_Stub(poll_stub_pollin); + __cmock_zsock_poll_Stub(poll_stub_pollin); __cmock_mqtt_input_ExpectAndReturn(&mqtt_client, 0); /* mqtt_abort() should be called when the poll fails (after the second call). */ @@ -593,7 +593,7 @@ void test_mqtt_helper_poll_loop_pollin(void) */ void test_mqtt_helper_poll_loop_pollnval(void) { - __cmock_poll_Stub(poll_stub_pollnval); + __cmock_zsock_poll_Stub(poll_stub_pollnval); __cmock_mqtt_abort_ExpectAndReturn(&mqtt_client, 0); mqtt_state = MQTT_STATE_CONNECTED; @@ -607,7 +607,7 @@ void test_mqtt_helper_poll_loop_pollnval(void) */ void test_mqtt_helper_poll_loop_pollhup(void) { - __cmock_poll_Stub(poll_stub_pollhup); + __cmock_zsock_poll_Stub(poll_stub_pollhup); __cmock_mqtt_abort_ExpectAndReturn(&mqtt_client, 0); mqtt_state = MQTT_STATE_CONNECTED; @@ -621,7 +621,7 @@ void test_mqtt_helper_poll_loop_pollhup(void) */ void test_mqtt_helper_poll_loop_pollerr(void) { - __cmock_poll_Stub(poll_stub_pollerr); + __cmock_zsock_poll_Stub(poll_stub_pollerr); __cmock_mqtt_abort_ExpectAndReturn(&mqtt_client, 0); mqtt_state = MQTT_STATE_CONNECTED; From d73cd2190ae53938ec95bcd74f992dac2ee30441 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 29 Jan 2025 13:34:03 +0100 Subject: [PATCH 038/109] lib: pdn: Switch to zsock_* API MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Use zsock_* socket functions instead of POSIX ones to avoid dependency on the POSIX subsystem. Signed-off-by: Andrzej Głąbek --- lib/pdn/pdn.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/pdn/pdn.c b/lib/pdn/pdn.c index ca9a467911e7..598da3d1a68c 100644 --- a/lib/pdn/pdn.c +++ b/lib/pdn/pdn.c @@ -674,9 +674,9 @@ static int pdn_sa_family_from_ip_string(const char *src) { char buf[INET6_ADDRSTRLEN]; - if (inet_pton(AF_INET, src, buf)) { + if (zsock_inet_pton(AF_INET, src, buf)) { return AF_INET; - } else if (inet_pton(AF_INET6, src, buf)) { + } else if (zsock_inet_pton(AF_INET6, src, buf)) { return AF_INET6; } return -1; @@ -758,10 +758,10 @@ int pdn_dynamic_info_get(uint32_t cid, struct pdn_dynamic_info *pdn_info) if (family == AF_INET) { addr = &(pdn_info->dns_addr4_primary); - (void)inet_pton(AF_INET, dns_addr_str, addr); + (void)zsock_inet_pton(AF_INET, dns_addr_str, addr); } else if (family == AF_INET6) { addr6 = &(pdn_info->dns_addr6_primary); - (void)inet_pton(AF_INET6, dns_addr_str, addr6); + (void)zsock_inet_pton(AF_INET6, dns_addr_str, addr6); } /* Read secondary DNS address */ @@ -781,10 +781,10 @@ int pdn_dynamic_info_get(uint32_t cid, struct pdn_dynamic_info *pdn_info) if (family == AF_INET) { addr = &(pdn_info->dns_addr4_secondary); - (void)inet_pton(AF_INET, dns_addr_str, addr); + (void)zsock_inet_pton(AF_INET, dns_addr_str, addr); } else if (family == AF_INET6) { addr6 = &(pdn_info->dns_addr6_secondary); - (void)inet_pton(AF_INET6, dns_addr_str, addr6); + (void)zsock_inet_pton(AF_INET6, dns_addr_str, addr6); } /* Read link MTU if exists: From 8122e24bc259415cf430caebb167e1033d7df026 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Mon, 20 Jan 2025 16:19:48 +0100 Subject: [PATCH 039/109] bluetooth: mesh: PSA requires RNG enabled PSA requires RNG to be enabled. Signed-off-by: alperen sener --- subsys/bluetooth/mesh/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/bluetooth/mesh/Kconfig b/subsys/bluetooth/mesh/Kconfig index 1b0cc7040660..caa9d7c993c6 100644 --- a/subsys/bluetooth/mesh/Kconfig +++ b/subsys/bluetooth/mesh/Kconfig @@ -22,6 +22,7 @@ config BT_MESH_MBEDTLS_BACKEND_ENABLE default y imply NRF_SECURITY imply MBEDTLS_ENABLE_HEAP + imply PSA_WANT_GENERATE_RANDOM config MBEDTLS_HEAP_SIZE default 1024 From 652854b4ca781cbed6dce6d72eb8735aa3bab503 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Mon, 20 Jan 2025 15:58:12 +0100 Subject: [PATCH 040/109] samples: bluetooth: mesh: Update mesh sample configs for MBEDTLS PSA Increasing the stack sizes for increased requirement due to MBEDTLS PSA. And removing BT_TINYCRYPT_ECC and BT_ECC since MBEDTLS is default now. Signed-off-by: alperen sener --- .../boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../dfu/distributor/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../dfu/distributor/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ samples/bluetooth/mesh/dfu/distributor/prj.conf | 3 +-- .../mesh/dfu/target/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/dfu/target/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ samples/bluetooth/mesh/dfu/target/prj.conf | 2 -- .../mesh/light/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ samples/bluetooth/mesh/light/overlay-dfu.conf | 2 +- samples/bluetooth/mesh/light/prj.conf | 2 +- .../mesh/light_ctrl/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/light_ctrl/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/light_ctrl/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../mesh/light_dimmer/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/light_dimmer/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/light_dimmer/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../mesh/light_switch/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/light_switch/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/light_switch/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../mesh/sensor_client/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/sensor_client/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/sensor_client/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../mesh/sensor_server/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../mesh/sensor_server/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../mesh/sensor_server/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ .../silvair_enocean/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 2 ++ .../silvair_enocean/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 2 ++ .../silvair_enocean/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 2 ++ 35 files changed, 65 insertions(+), 6 deletions(-) diff --git a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/ble_peripheral_lbs_coex/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/chat/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/dfu/distributor/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/dfu/distributor/prj.conf b/samples/bluetooth/mesh/dfu/distributor/prj.conf index 2e887d6a6e85..3514dbde197a 100644 --- a/samples/bluetooth/mesh/dfu/distributor/prj.conf +++ b/samples/bluetooth/mesh/dfu/distributor/prj.conf @@ -18,6 +18,7 @@ CONFIG_LOG=y CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="Mesh DFU Distributor" CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y +CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=3072 CONFIG_MCUBOOT_GENERATE_CONFIRMED_IMAGE=y CONFIG_MCUBOOT_IMGTOOL_SIGN_VERSION="1.0.0+0" @@ -28,8 +29,6 @@ CONFIG_BT_L2CAP_TX_BUF_COUNT=8 CONFIG_BT_OBSERVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_SETTINGS=y -CONFIG_BT_ECC=y -CONFIG_BT_TINYCRYPT_ECC=y CONFIG_BT_BUF_CMD_TX_COUNT=4 # Disable unused Bluetooth features diff --git a/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/dfu/target/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/dfu/target/prj.conf b/samples/bluetooth/mesh/dfu/target/prj.conf index 88baadbbf674..8d69b45f8250 100644 --- a/samples/bluetooth/mesh/dfu/target/prj.conf +++ b/samples/bluetooth/mesh/dfu/target/prj.conf @@ -33,8 +33,6 @@ CONFIG_BT_L2CAP_TX_BUF_COUNT=8 CONFIG_BT_OBSERVER=y CONFIG_BT_PERIPHERAL=y CONFIG_BT_SETTINGS=y -CONFIG_BT_ECC=y -CONFIG_BT_TINYCRYPT_ECC=y # Disable unused Bluetooth features CONFIG_BT_CTLR_LE_ENC=n diff --git a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4af79acbeec5..b6b4e45f2f70 100644 --- a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -18,3 +18,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.conf index 82f571bd3cfb..153a16959be6 100644 --- a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -18,3 +18,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.conf index 4c81ab396c98..6412354a7c26 100644 --- a/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/light/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -18,3 +18,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light/overlay-dfu.conf b/samples/bluetooth/mesh/light/overlay-dfu.conf index dbfbc6761700..06d91369c41f 100644 --- a/samples/bluetooth/mesh/light/overlay-dfu.conf +++ b/samples/bluetooth/mesh/light/overlay-dfu.conf @@ -8,7 +8,7 @@ CONFIG_BOOTLOADER_MCUBOOT=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU=y CONFIG_NCS_SAMPLE_MCUMGR_BT_OTA_DFU_SPEEDUP=y - +CONFIG_MCUMGR_TRANSPORT_WORKQUEUE_STACK_SIZE=3072 # Enable Extended Advertiser to advertise BT SMP service CONFIG_BT_EXT_ADV=y CONFIG_BT_EXT_ADV_MAX_ADV_SET=6 diff --git a/samples/bluetooth/mesh/light/prj.conf b/samples/bluetooth/mesh/light/prj.conf index d899577df685..0d7b8d34bb13 100644 --- a/samples/bluetooth/mesh/light/prj.conf +++ b/samples/bluetooth/mesh/light/prj.conf @@ -11,7 +11,7 @@ CONFIG_LOG_MODE_DEFERRED=y # General configuration CONFIG_NCS_APPLICATION_BOOT_BANNER_STRING="Mesh Light" -CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048 +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=3072 CONFIG_FLASH=y CONFIG_FLASH_MAP=y CONFIG_NVS=y diff --git a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/light_ctrl/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/light_dimmer/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/light_switch/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_client/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/sensor_server/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l05_cpuapp.conf index 4267f46ce685..13b39eeabfb5 100644 --- a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l10_cpuapp.conf index f4821a1a3fb5..55120e85651f 100644 --- a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 diff --git a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e12c92c7ae50..995706b02555 100644 --- a/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/mesh/silvair_enocean/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -17,3 +17,5 @@ CONFIG_ZMS_LOOKUP_CACHE_SIZE=512 CONFIG_SETTINGS_ZMS_NAME_CACHE=y CONFIG_SETTINGS_ZMS_NAME_CACHE_SIZE=512 CONFIG_ZMS_LOOKUP_CACHE_FOR_SETTINGS=y +CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096 +CONFIG_BT_RX_STACK_SIZE=5120 From f7e47afe341fb9c02c8400d8c80e7745ae7531ea Mon Sep 17 00:00:00 2001 From: alperen sener Date: Tue, 21 Jan 2025 10:49:07 +0100 Subject: [PATCH 041/109] scripts: quarantine: nRF52832 is added for mesh light ctrl sample Quarantine nRF52832 for light ctrl sample. To be handled after upmerged. Signed-off-by: alperen sener --- scripts/quarantine.yaml | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml index bf2bdc087790..c831b86c6908 100644 --- a/scripts/quarantine.yaml +++ b/scripts/quarantine.yaml @@ -40,3 +40,10 @@ platforms: - nrf54h20dk/nrf54h20/cpuapp comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31493" + +- scenarios: + - sample.bluetooth.mesh.light_ctrl + - sample.bluetooth.mesh.light_ctrl.emds + platforms: + - nrf52dk/nrf52832 + comment: "To be fixed after upmerge. Footprint should be reduced. NCSDK-31428" From 483c99d6952167c445c543a65077efe4c0fda489 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Tue, 21 Jan 2025 11:58:19 +0100 Subject: [PATCH 042/109] suit: Enable crypto in BT variant For now BT stack requires an entropy source, that is delivered by the NRF_SECURITY module. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- samples/suit/smp_transfer/sysbuild/smp_transfer_bt.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/samples/suit/smp_transfer/sysbuild/smp_transfer_bt.conf b/samples/suit/smp_transfer/sysbuild/smp_transfer_bt.conf index cfd9a3dc3857..91d48e221b3d 100644 --- a/samples/suit/smp_transfer/sysbuild/smp_transfer_bt.conf +++ b/samples/suit/smp_transfer/sysbuild/smp_transfer_bt.conf @@ -20,6 +20,9 @@ CONFIG_MCUMGR_TRANSPORT_BT_CONN_PARAM_CONTROL=y # Enable logs over UART CONFIG_LOG=y +# Enable entropy source +CONFIG_NRF_SECURITY=y + # Enable the mcumgr Packet Reassembly feature over Bluetooth and its configuration dependencies. # MCUmgr buffer size is optimized to fit one SMP packet divided into five Bluetooth Write Commands, # transmitted with the maximum possible MTU value: 498 bytes. From 90891d78019fe1b07b6c05a49a105ef6d953759e Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Tue, 21 Jan 2025 13:09:40 +0200 Subject: [PATCH 043/109] samples: lwm2m_client: Enable ZVFS event fd Enable Zephyr's ZVFS event file descriptor Signed-off-by: Juha Ylinen --- samples/cellular/lwm2m_client/prj.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/cellular/lwm2m_client/prj.conf b/samples/cellular/lwm2m_client/prj.conf index 4383b4aa8b25..aa0e6b9503ae 100644 --- a/samples/cellular/lwm2m_client/prj.conf +++ b/samples/cellular/lwm2m_client/prj.conf @@ -165,3 +165,7 @@ CONFIG_NET_SOCKETPAIR=y CONFIG_LWM2M_TICKLESS=y # Enable Release Assistance Indication CONFIG_LWM2M_CLIENT_UTILS_RAI=y + +# Enable Zephyr's ZVFS event file descriptor +CONFIG_ZVFS_EVENTFD=y +CONFIG_ZVFS_EVENTFD_MAX=2 From dcbd8cb1a5778824bc8247cde721233cafed5bf7 Mon Sep 17 00:00:00 2001 From: Juha Ylinen Date: Tue, 21 Jan 2025 13:25:34 +0200 Subject: [PATCH 044/109] net: lib: lwm2m_client_utils: Use zsock_* API One setsockopt() call was not using zsock_* socket functions. Signed-off-by: Juha Ylinen --- subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_rai.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_rai.c b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_rai.c index 22a0c18366b7..7271be6db8e0 100644 --- a/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_rai.c +++ b/subsys/net/lib/lwm2m_client_utils/lwm2m/lwm2m_rai.c @@ -141,7 +141,7 @@ static void lwm2m_set_socket_state(int sock_fd, enum lwm2m_socket_states state) } LOG_DBG("Set socket option SO_RAI with value %s\n", opt_names[state]); - ret = setsockopt(sock_fd, SOL_SOCKET, SO_RAI, &optval, sizeof(optval)); + ret = zsock_setsockopt(sock_fd, SOL_SOCKET, SO_RAI, &optval, sizeof(optval)); if (ret < 0) { ret = -errno; From 338728075f11ecd0004c70fde89e154c0a4603fd Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Tue, 21 Jan 2025 14:22:03 +0100 Subject: [PATCH 045/109] applications: nrf_desktop: Rename cdc-acm-uart node Renamed cdc-acm-uart node to board-cdc-acm-uart node due to the changes in the Zephyr. Jira: NCSDK-31374 Signed-off-by: Mateusz Kapala --- .../configuration/nrf52840dongle_nrf52840/app.overlay | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay b/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay index 692637514335..f03b07a3b244 100644 --- a/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay +++ b/applications/nrf_desktop/configuration/nrf52840dongle_nrf52840/app.overlay @@ -8,7 +8,7 @@ / { chosen { - ncs,ble-qos-uart = &cdc_acm_uart; + ncs,ble-qos-uart = &board_cdc_acm_uart; }; /* Configure DTS nodes used for USB next HID support. */ @@ -38,6 +38,6 @@ num-isoout-endpoints = <0>; }; -&cdc_acm_uart { - status = "okay"; +&board_cdc_acm_uart { + status = "okay"; }; From 65de2f857fcca160c131f198d3120be0411ae28b Mon Sep 17 00:00:00 2001 From: alperen sener Date: Tue, 21 Jan 2025 16:58:05 +0100 Subject: [PATCH 046/109] tests: bluetooth: mesh: add persistante storage selection Adding CONFIG_NVS for EMDS overlayfile. Without explicit config for storage backend trusted storage fails to build. Signed-off-by: alperen sener --- tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf b/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf index 89bac05b4347..ad13130948ff 100644 --- a/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf +++ b/tests/subsys/bluetooth/mesh/models/overlay-mesh-emds.conf @@ -6,6 +6,7 @@ CONFIG_BT_SETTINGS=y CONFIG_FLASH_MAP=y +CONFIG_NVS=y CONFIG_EMDS=y CONFIG_BT_MESH_PLVL_SRV=y CONFIG_BT_MESH_LIGHT_HUE_SRV=y From a8fa76a6f9e3645d86d8c90a02bd2a5d309cc6f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 22 Jan 2025 08:50:53 +0100 Subject: [PATCH 047/109] applications: asset_tracker_v2: Enable POSIX APIs in LWM2M configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... so that lwm2m_integration.c that uses POSIX socket functions can be compiled after removal of CONFIG_NET_SOCKETS_POSIX_NAMES. Signed-off-by: Andrzej Głąbek --- applications/asset_tracker_v2/overlay-lwm2m.conf | 1 + 1 file changed, 1 insertion(+) diff --git a/applications/asset_tracker_v2/overlay-lwm2m.conf b/applications/asset_tracker_v2/overlay-lwm2m.conf index a66f4292aaf1..b3419fdd2aec 100644 --- a/applications/asset_tracker_v2/overlay-lwm2m.conf +++ b/applications/asset_tracker_v2/overlay-lwm2m.conf @@ -13,6 +13,7 @@ CONFIG_LWM2M_RW_JSON_SUPPORT=n CONFIG_LWM2M_SECURITY_INSTANCE_COUNT=3 CONFIG_COAP_INIT_ACK_TIMEOUT_MS=4000 CONFIG_BASE64=y +CONFIG_POSIX_API=y # Transmission buffers. CONFIG_LWM2M_ENGINE_MAX_OBSERVER=5 From 6cd410fd0109b7283278655aa1573c9bca71ee65 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 22 Jan 2025 08:52:24 +0100 Subject: [PATCH 048/109] application: asset_tracker_v2: Enable ZVFS event fd MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable Zephyr's ZVFS event file descriptor. Signed-off-by: Andrzej Głąbek --- applications/asset_tracker_v2/overlay-lwm2m.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/applications/asset_tracker_v2/overlay-lwm2m.conf b/applications/asset_tracker_v2/overlay-lwm2m.conf index b3419fdd2aec..b15f97e6d4fb 100644 --- a/applications/asset_tracker_v2/overlay-lwm2m.conf +++ b/applications/asset_tracker_v2/overlay-lwm2m.conf @@ -14,6 +14,8 @@ CONFIG_LWM2M_SECURITY_INSTANCE_COUNT=3 CONFIG_COAP_INIT_ACK_TIMEOUT_MS=4000 CONFIG_BASE64=y CONFIG_POSIX_API=y +CONFIG_ZVFS_EVENTFD=y +CONFIG_ZVFS_EVENTFD_MAX=2 # Transmission buffers. CONFIG_LWM2M_ENGINE_MAX_OBSERVER=5 From b343c0e5fda01f41ebe010bef89f7434a9cc7d51 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 22 Jan 2025 08:51:40 +0100 Subject: [PATCH 049/109] samples: cellular: Enable POSIX APIs in relevant samples MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... that use POSIX socket functions, so that those samples can be built after removal of CONFIG_NET_SOCKETS_POSIX_NAMES. Signed-off-by: Andrzej Głąbek --- samples/cellular/battery/prj.conf | 1 + samples/cellular/nidd/prj.conf | 1 + samples/cellular/udp/prj.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/samples/cellular/battery/prj.conf b/samples/cellular/battery/prj.conf index 38f05f94e5c5..01a707f321c3 100644 --- a/samples/cellular/battery/prj.conf +++ b/samples/cellular/battery/prj.conf @@ -12,6 +12,7 @@ CONFIG_NETWORKING=y CONFIG_NET_NATIVE=n CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_OFFLOAD=y +CONFIG_POSIX_API=y # Modem library CONFIG_NRF_MODEM_LIB=y diff --git a/samples/cellular/nidd/prj.conf b/samples/cellular/nidd/prj.conf index 60a49e091705..9f145fdf4714 100644 --- a/samples/cellular/nidd/prj.conf +++ b/samples/cellular/nidd/prj.conf @@ -12,6 +12,7 @@ CONFIG_NETWORKING=y CONFIG_NET_NATIVE=n CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_OFFLOAD=y +CONFIG_POSIX_API=y # LTE link control CONFIG_LTE_LINK_CONTROL=y diff --git a/samples/cellular/udp/prj.conf b/samples/cellular/udp/prj.conf index 9307ea553abf..62ca562a16d8 100644 --- a/samples/cellular/udp/prj.conf +++ b/samples/cellular/udp/prj.conf @@ -14,6 +14,7 @@ CONFIG_NETWORKING=y CONFIG_NET_NATIVE=n CONFIG_NET_SOCKETS=y CONFIG_NET_SOCKETS_OFFLOAD=y +CONFIG_POSIX_API=y # LTE link control CONFIG_LTE_LINK_CONTROL=y From 2e66c19f0c678631516ee3b023d73db8fb093bd7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 22 Jan 2025 08:58:48 +0100 Subject: [PATCH 050/109] samples: nrf_rpc: protocols_serialization: Fix configurations MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The BT_USE_PSA_API option was removed in upstream Zephyr as no longer needed after the PSA crypto API had been made the default one for crypto operations in BT crypto/host modules. See Zephyr commit da9ab6f5937c49a3c0bfc58e99799c57f9a2f6b3. The BT_ECC is no longer user-configurable. See Zephyr commit d3c8cb4b7918fa3683a426350ba3886bc4924d86. In the client sample, add missing BT_HCI option that is the dependency of many other BT_* options that are to be enabled. Signed-off-by: Andrzej Głąbek --- .../protocols_serialization/client/snippets/ble/ble.conf | 1 + samples/nrf_rpc/protocols_serialization/server/Kconfig | 6 +----- .../protocols_serialization/server/snippets/ble/ble.conf | 1 - 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/samples/nrf_rpc/protocols_serialization/client/snippets/ble/ble.conf b/samples/nrf_rpc/protocols_serialization/client/snippets/ble/ble.conf index e5a65b429746..8616047183a5 100644 --- a/samples/nrf_rpc/protocols_serialization/client/snippets/ble/ble.conf +++ b/samples/nrf_rpc/protocols_serialization/client/snippets/ble/ble.conf @@ -17,6 +17,7 @@ CONFIG_BT_DEVICE_APPEARANCE=833 CONFIG_BT_MAX_CONN=1 CONFIG_BT_MAX_PAIRED=1 CONFIG_BT_CTLR=n +CONFIG_BT_HCI=y CONFIG_BT_SHELL=y # Enable the NUS service diff --git a/samples/nrf_rpc/protocols_serialization/server/Kconfig b/samples/nrf_rpc/protocols_serialization/server/Kconfig index 75df033f0a66..169c705f228b 100644 --- a/samples/nrf_rpc/protocols_serialization/server/Kconfig +++ b/samples/nrf_rpc/protocols_serialization/server/Kconfig @@ -27,12 +27,8 @@ if SOC_NRF54L15 config BT_CTLR_ECDH default n -config BT_USE_PSA_API - default y if BT_TINYCRYPT_ECC - select PSA_WANT_ALG_ECB_NO_PADDING - config BT_LONG_WQ_STACK_SIZE - default 2048 if BT_USE_PSA_API + default 2048 endif diff --git a/samples/nrf_rpc/protocols_serialization/server/snippets/ble/ble.conf b/samples/nrf_rpc/protocols_serialization/server/snippets/ble/ble.conf index f92938c4daa6..0fb6ff35f8c9 100644 --- a/samples/nrf_rpc/protocols_serialization/server/snippets/ble/ble.conf +++ b/samples/nrf_rpc/protocols_serialization/server/snippets/ble/ble.conf @@ -14,7 +14,6 @@ CONFIG_BT_PERIPHERAL=y CONFIG_BT_MAX_CONN=1 CONFIG_BT_MAX_PAIRED=1 CONFIG_BT_SMP=n -CONFIG_BT_ECC=n CONFIG_BT_DEVICE_APPEARANCE=833 # BT Device name must be the same as on the client side From 6bacc6c4565fc1e72911edb1055eb50817517be1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 22 Jan 2025 09:22:43 +0100 Subject: [PATCH 051/109] bluetooth: Remove references to BT_TINYCRYPT_ECC MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This Kconfig option was renamed to BT_SEND_ECC_EMULATION and then finally removed. See Zephyr PR 84268. Signed-off-by: Andrzej Głąbek --- samples/bluetooth/hci_lpuart/boards/nrf9160dk_nrf52840.conf | 1 - samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf | 1 - subsys/bluetooth/Kconfig.discovery | 1 - subsys/bluetooth/controller/hci_internal.c | 2 +- tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf | 2 -- tests/bluetooth/tester/prj.conf | 1 - 6 files changed, 1 insertion(+), 7 deletions(-) diff --git a/samples/bluetooth/hci_lpuart/boards/nrf9160dk_nrf52840.conf b/samples/bluetooth/hci_lpuart/boards/nrf9160dk_nrf52840.conf index c4ea3fddf698..c52ddfabad97 100644 --- a/samples/bluetooth/hci_lpuart/boards/nrf9160dk_nrf52840.conf +++ b/samples/bluetooth/hci_lpuart/boards/nrf9160dk_nrf52840.conf @@ -4,7 +4,6 @@ CONFIG_GPIO=y CONFIG_MAIN_STACK_SIZE=1024 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 CONFIG_BT_MAX_CONN=16 -CONFIG_BT_TINYCRYPT_ECC=n CONFIG_BT_CTLR_DTM_HCI=y CONFIG_BT_CTLR_ASSERT_HANDLER=y diff --git a/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf b/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf index 668e2d91e88b..6a0d77b28fcd 100644 --- a/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf +++ b/samples/bluetooth/hci_lpuart/boards/thingy91_nrf52840.conf @@ -5,7 +5,6 @@ CONFIG_MAIN_STACK_SIZE=1024 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 CONFIG_BT_WAIT_NOP=y CONFIG_BT_MAX_CONN=16 -CONFIG_BT_TINYCRYPT_ECC=n CONFIG_BT_CTLR_DTM_HCI=y CONFIG_BT_CTLR_ASSERT_HANDLER=y diff --git a/subsys/bluetooth/Kconfig.discovery b/subsys/bluetooth/Kconfig.discovery index 376fc3980192..3bcffa2f37a9 100644 --- a/subsys/bluetooth/Kconfig.discovery +++ b/subsys/bluetooth/Kconfig.discovery @@ -39,7 +39,6 @@ config BT_GATT_DM_WORKQ_STACK_SIZE # requirements. int default 1300 if BT_GATT_CACHING - default 1140 if BT_TINYCRYPT_ECC default 1024 config BT_GATT_DM_WORKQ_PRIO diff --git a/subsys/bluetooth/controller/hci_internal.c b/subsys/bluetooth/controller/hci_internal.c index ac0770d792e6..8dbdcb26f92f 100644 --- a/subsys/bluetooth/controller/hci_internal.c +++ b/subsys/bluetooth/controller/hci_internal.c @@ -572,7 +572,7 @@ void hci_internal_supported_commands(sdc_hci_ip_supported_commands_t *cmds) cmds->hci_le_request_peer_sca = 1; #endif -#if (defined(CONFIG_BT_HCI_RAW) && defined(CONFIG_BT_TINYCRYPT_ECC)) || defined(CONFIG_BT_CTLR_ECDH) +#if defined(CONFIG_BT_CTLR_ECDH) cmds->hci_le_read_local_p256_public_key = 1; cmds->hci_le_generate_dhkey_v1 = 1; cmds->hci_le_generate_dhkey_v2 = 1; diff --git a/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf b/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf index 09f03ef8f00a..74172ad33195 100644 --- a/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf +++ b/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf @@ -24,8 +24,6 @@ CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_DEVICE_NAME="Broadcast Audio Sink" -CONFIG_BT_TINYCRYPT_ECC=y - # Shell related defines CONFIG_SHELL=y CONFIG_SHELL_BACKEND_DUMMY=y diff --git a/tests/bluetooth/tester/prj.conf b/tests/bluetooth/tester/prj.conf index 3cf8a0e34913..7ce695af62d3 100644 --- a/tests/bluetooth/tester/prj.conf +++ b/tests/bluetooth/tester/prj.conf @@ -46,7 +46,6 @@ CONFIG_BT_DEVICE_NAME="Tester" CONFIG_BT_DEVICE_NAME_MAX=32 CONFIG_BT_DEVICE_NAME_DYNAMIC=y CONFIG_BT_DEVICE_NAME_GATT_WRITABLE=y -CONFIG_BT_TINYCRYPT_ECC=y CONFIG_BT_TESTING=y # Mesh Protocol Configs From 5f7f4dd24204139b44fc2288068cfffa208d782c Mon Sep 17 00:00:00 2001 From: Maciej Perkowski Date: Wed, 22 Jan 2025 11:06:15 +0100 Subject: [PATCH 052/109] quarantine: add revision values to nrf91 an nr54h entires add revision values to nrf91 an nr54h entires. modify llext entry. Full extended names are now required. Signed-off-by: Maciej Perkowski --- scripts/quarantine.yaml | 4 +- scripts/quarantine_integration.yaml | 80 +++++++++++----------- scripts/quarantine_windows_mac.yaml | 2 +- scripts/quarantine_zephyr.yaml | 48 ++++++------- scripts/quarantine_zephyr_integration.yaml | 30 ++++---- 5 files changed, 82 insertions(+), 82 deletions(-) diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml index c831b86c6908..5a7d14d4cc97 100644 --- a/scripts/quarantine.yaml +++ b/scripts/quarantine.yaml @@ -26,7 +26,7 @@ - sample.benchmark.coremark.heap_memory - sample.benchmark.coremark.multiple_threads platforms: - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31409" - scenarios: @@ -38,7 +38,7 @@ - sample.openthread.cli - sample.openthread.cli.singleprotocol platforms: - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31493" - scenarios: diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index dccb085b0470..905430418709 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -109,7 +109,7 @@ - applications.matter_bridge.br_ble.memory_profiling - applications.matter_bridge.release.br_ble.nrf54h20.wifi platforms: - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" @@ -240,7 +240,7 @@ - sample.cellular.modem_shell_debug - sample.cellular.modem_shell_modem_uart_trace platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -266,7 +266,7 @@ - sample.cellular.location.nrf7002ek_wifi - sample.cellular.location.pgps platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -283,7 +283,7 @@ - sample.cellular.http_update.full_modem_update - sample.cellular.http_update.modem_delta_update platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -297,7 +297,7 @@ - samples.cellular.nidd - sample.cellular.udp platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - thingy91/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" @@ -307,28 +307,28 @@ - sample.cellular.battery - sample.cellular.modem_callbacks platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.net.azure_iot_hub platforms: - nrf7002dk/nrf5340/cpuapp - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf9161dk/nrf9161/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.net.azure_iot_hub.dps platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.net.coap_client platforms: - nrf7002dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - thingy91/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" @@ -352,20 +352,20 @@ - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.hw_id.device_id platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.debug.memfault - sample.debug.memfault.etb platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - thingy91/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" @@ -399,7 +399,7 @@ - applications.serial_lte_modem - applications.serial_lte_modem.lwm2m_carrier platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -567,7 +567,7 @@ - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -579,7 +579,7 @@ - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -591,7 +591,7 @@ - nrf54l15dk/nrf54l05/cpuapp - nrf54l15dk/nrf54l10/cpuapp - nrf54l15dk/nrf54l15/cpuapp - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -636,7 +636,7 @@ - scenarios: - sample.cellular.nrf7002ek_wifi.scan platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -654,19 +654,19 @@ - scenarios: - sample.cellular.nrf_cloud_rest_device_message platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.cellular.nrf_cloud_rest_cell_pos platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - sample.cellular.nrf_cloud_rest_fota platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -687,7 +687,7 @@ - examples.nrfx_pwm.common_mode - examples.nrfx_gppi.fork platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - nrf5340dk/nrf5340/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" @@ -710,7 +710,7 @@ - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -718,7 +718,7 @@ platforms: - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -726,7 +726,7 @@ platforms: - nrf5340dk/nrf5340/cpuapp - nrf52dk/nrf52832 - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -975,8 +975,8 @@ - applications.asset_tracker_v2.memfault-low-power - applications.asset_tracker_v2.memfault.sysbuild - applications.asset_tracker_v2.nrf7002ek_wifi-debug.sysbuild - - applications.asset_tracker_v2.nrf7002ek_wifi.nrf9160dk - - applications.asset_tracker_v2.nrf7002ek_wifi.nrf9160dk.sysbuild + - applications.asset_tracker_v2.nrf7002ek_wifi.nrf9160dk@0.14.0 + - applications.asset_tracker_v2.nrf7002ek_wifi.nrf9160dk@0.14.0.sysbuild - applications.asset_tracker_v2.nrf_cloud - applications.asset_tracker_v2.nrf_cloud-no-agnss - applications.asset_tracker_v2.nrf_cloud-no-agnss.sysbuild @@ -985,7 +985,7 @@ - applications.asset_tracker_v2.nrf7002ek_wifi-debug - applications.asset_tracker_v2.nrf7002ek_wifi.nrf9161dk platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1019,7 +1019,7 @@ - applications.asset_tracker_v2.cloud.cloud_codec.json_common.aws - applications.asset_tracker_v2.cloud.cloud_codec.json_common.azure platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" @@ -1031,7 +1031,7 @@ - asset_tracker_v2.lwm2m_integration - asset_tracker_v2.ui_module_test.tester platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" @@ -1106,7 +1106,7 @@ - tfm.psa_test_storage_lvl1 platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1126,7 +1126,7 @@ - tfm.regression_ipc_lvl2.oberon - tfm.regression_sfn_lvl1 platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1164,7 +1164,7 @@ - net.lib.aws_fota.aws_fota_json platforms: - nrf52840dk/nrf52840 - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" @@ -1182,7 +1182,7 @@ - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1191,7 +1191,7 @@ - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1206,7 +1206,7 @@ - lpuart.two_chip_test_busy_sim - lpuart.two_chip_test_debug platforms: - - nrf9160dk/nrf52840 + - nrf9160dk@0.14.0/nrf52840 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1216,7 +1216,7 @@ - lpuart.two_chip_test_busy_sim - lpuart.two_chip_test_debug platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1259,7 +1259,7 @@ - sample.nrf7002_eks.raw_scan - sample.nrf7002_eks.scan platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1290,7 +1290,7 @@ - dfu.target_stream.store_progress platforms: - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1422,13 +1422,13 @@ - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: - bootloader.bl_validation.negative platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - nrf5340dk/nrf5340/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" diff --git a/scripts/quarantine_windows_mac.yaml b/scripts/quarantine_windows_mac.yaml index ce16961b75cd..e6071bb5fefe 100644 --- a/scripts/quarantine_windows_mac.yaml +++ b/scripts/quarantine_windows_mac.yaml @@ -28,7 +28,7 @@ - scenarios: - applications.asset_tracker_v2.*.sysbuild platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "https://nordicsemi.atlassian.net/browse/NCSDK-26461" - scenarios: diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index d6a0ab97ebf4..9cea7440dec9 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -80,14 +80,14 @@ - sample.mgmt.osdp.peripheral_device_sc platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf54l15dk/nrf54l15/cpuapp comment: "https://nordicsemi.atlassian.net/browse/NCSDK-24928" - scenarios: - examples.nrfx_uarte.tx_rx_non_blocking platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - nrf52840dk/nrf52840 comment: "https://nordicsemi.atlassian.net/browse/NRFX-3395" @@ -95,7 +95,7 @@ - examples.nrfx_uarte.rx_double_buffered platforms: - nrf52840dk/nrf52840 - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - nrf5340dk/nrf5340/cpuapp - nrf52833dk/nrf52833 comment: "https://nordicsemi.atlassian.net/browse/NRFX-3468" @@ -112,7 +112,7 @@ platforms: - nrf52840dk/nrf52840 - nrf52833dk/nrf52833 - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "https://nordicsemi.atlassian.net/browse/NRFX-3813" - scenarios: @@ -130,7 +130,7 @@ - scenarios: - arch.interrupt.gen_isr_table.riscv_no_direct platforms: - - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuflpr comment: "https://nordicsemi.atlassian.net/browse/NCSDK-27981" @@ -144,7 +144,7 @@ - scenarios: - sample.net.sockets.http.server platforms: - - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpurad comment: "to be fixed in https://github.com/zephyrproject-rtos/zephyr/pull/73777" - scenarios: @@ -155,14 +155,14 @@ comment: "Test not aligned for nrf54l15 but selected due to jedec,spi-nor" - scenarios: - - llext.simple.* + - llext.* platforms: - - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpurad - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpunet - - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr - nrf54l15dk/nrf54l15/cpuflpr - - qemu_cortex_m3 + - qemu_cortex_m3/ti_lm3s6965 comment: "overflow, to report/fix in the upstream @permac and put ticket # here" - scenarios: @@ -172,7 +172,7 @@ - scenarios: - storage.flash_map platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "https://nordicsemi.atlassian.net/browse/NCSDK-29462" - scenarios: @@ -209,14 +209,14 @@ - libraries.encoding.jwt platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf54l15dk/nrf54l15/cpuapp comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-15508" - scenarios: - net.mqtt.tls platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf5340dk/nrf5340/cpuapp/ns comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-24922" @@ -224,7 +224,7 @@ - net.socket.register.tls platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-18853" - scenarios: @@ -244,7 +244,7 @@ - scenarios: - sample.drivers.crypto.mbedtls platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf5340dk/nrf5340/cpuapp/ns comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-15306" @@ -252,21 +252,21 @@ - sample.net.sockets.websocket_client platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-24929" - scenarios: - sample.psa_crypto platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Won't be fixed - https://nordicsemi.atlassian.net/browse/NCSDK-22771" - scenarios: - sample.net.sockets.http.server platforms: - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Same reason as in https://nordicsemi.atlassian.net/browse/NCSDK-22771" - scenarios: @@ -360,7 +360,7 @@ - drivers.gpio.build - sample.perf platforms: - - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr comment: "region RAM/FLASH overflowed" - scenarios: @@ -419,16 +419,16 @@ - libraries.libc.newlib_nano.thread_safety.userspace.stress - libraries.libc.newlib.thread_safety.userspace.stress platforms: - - nrf54h20dk/nrf54h20/cpurad - - nrf54h20dk/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpuapp comment: "region FLASH overflowed" - scenarios: - libraries.cmsis_dsp.matrix.unary_f64 - libraries.cmsis_dsp.matrix.unary_f64.fpu platforms: - - nrf54h20dk/nrf54h20/cpuapp - - nrf54h20dk/nrf54h20/cpurad + - nrf54h20dk@0.9.0/nrf54h20/cpuapp + - nrf54h20dk@0.9.0/nrf54h20/cpurad comment: "Won't be fixed, 'rodata will not fit in region FLASH' - no ticket" - scenarios: @@ -449,5 +449,5 @@ - scenarios: - drivers.hwinfo.api platforms: - - nrf54h20dk/nrf54h20/cpuppr + - nrf54h20dk@0.9.0/nrf54h20/cpuppr comment: Unsupported device diff --git a/scripts/quarantine_zephyr_integration.yaml b/scripts/quarantine_zephyr_integration.yaml index 3f11ac298f0b..dc3622842378 100644 --- a/scripts/quarantine_zephyr_integration.yaml +++ b/scripts/quarantine_zephyr_integration.yaml @@ -24,7 +24,7 @@ - net.lwm2m.lwm2m_registry - net.lwm2m.block_transfer platforms: - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 - native_sim comment: "Configurations excluded to limit resources usage in integration builds" @@ -40,7 +40,7 @@ - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -100,8 +100,8 @@ - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - nrf5340dk/nrf5340/cpunet - - nrf9160dk/nrf9160 - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160 + - nrf9160dk@0.14.0/nrf9160/ns - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" @@ -131,8 +131,8 @@ platforms: - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - - nrf9160dk/nrf9160 - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160 + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -140,7 +140,7 @@ - sample.tfm.secure_partition - sample.tfm_ipc platforms: - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns - nrf5340dk/nrf5340/cpuapp/ns comment: "Configurations excluded to limit resources usage in integration builds" @@ -200,7 +200,7 @@ platforms: - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpunet - - nrf9160dk/nrf9160 + - nrf9160dk@0.14.0/nrf9160 comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -212,7 +212,7 @@ platforms: - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -225,8 +225,8 @@ - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - nrf5340dk/nrf5340/cpunet - - nrf9160dk/nrf9160 - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160 + - nrf9160dk@0.14.0/nrf9160/ns - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" @@ -239,8 +239,8 @@ - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - nrf5340dk/nrf5340/cpunet - - nrf9160dk/nrf9160 - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160 + - nrf9160dk@0.14.0/nrf9160/ns comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -251,8 +251,8 @@ - nrf5340dk/nrf5340/cpuapp - nrf5340dk/nrf5340/cpuapp/ns - nrf5340dk/nrf5340/cpunet - - nrf9160dk/nrf9160 - - nrf9160dk/nrf9160/ns + - nrf9160dk@0.14.0/nrf9160 + - nrf9160dk@0.14.0/nrf9160/ns - qemu_cortex_m3 comment: "Configurations excluded to limit resources usage in integration builds" From 93554af35d910391a7631ccf64a8803bc33ec763 Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Mon, 20 Jan 2025 13:33:41 +0100 Subject: [PATCH 053/109] applications: nrf5340_audio: Upmerge fixes - Changed to using overlay files for each application - Updated use of upstream API - OCT-3172 Signed-off-by: Alexander Svensen --- Kconfig.nrf | 1 + applications/nrf5340_audio/Kconfig | 18 --- .../broadcast_sink/Kconfig.defaults | 109 ------------------ .../overlay-broadcast_sink.conf | 66 +++++++++++ .../overlay-broadcast_source.conf | 27 +++++ applications/nrf5340_audio/prj.conf | 1 + applications/nrf5340_audio/sample.yaml | 8 +- .../scanning/bt_mgmt_scan_for_broadcast.c | 2 +- .../bt_stream/broadcast/broadcast_source.c | 16 +-- .../src/bluetooth/bt_stream/le_audio.h | 8 +- .../bt_stream/unicast/Kconfig.defaults | 3 - .../bt_stream/unicast/unicast_client.c | 2 +- .../bt_stream/unicast/unicast_server.c | 8 +- .../tools/buildprog/buildprog.py | 32 ++++- .../buildprog/nrf5340_audio_dk_devices.py | 5 + .../unicast_client/Kconfig.defaults | 80 ------------- .../overlay-unicast_client.conf | 42 +++++++ .../unicast_server/Kconfig.defaults | 100 ---------------- .../overlay-unicast_server.conf | 48 ++++++++ 19 files changed, 240 insertions(+), 336 deletions(-) delete mode 100644 applications/nrf5340_audio/broadcast_sink/Kconfig.defaults create mode 100644 applications/nrf5340_audio/broadcast_sink/overlay-broadcast_sink.conf create mode 100644 applications/nrf5340_audio/broadcast_source/overlay-broadcast_source.conf delete mode 100644 applications/nrf5340_audio/unicast_client/Kconfig.defaults create mode 100644 applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf delete mode 100644 applications/nrf5340_audio/unicast_server/Kconfig.defaults create mode 100644 applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf diff --git a/Kconfig.nrf b/Kconfig.nrf index 3b3dea7b299d..eb8b5e73dc6b 100644 --- a/Kconfig.nrf +++ b/Kconfig.nrf @@ -118,6 +118,7 @@ config NRF_SECURITY_ENABLER imply NRF_SECURITY if BT_CRYPTO || BT_HOST_CRYPTO || BT_MESH_USES_MBEDTLS_PSA || BT_FAST_PAIR_CRYPTO_PSA imply ENTROPY_GENERATOR if BOARD_NATIVE_SIM imply PSA_WANT_GENERATE_RANDOM if BT_HOST_CRYPTO_PRNG + depends on !SOC_NRF5340_CPUNET rsource "samples/Kconfig" rsource "subsys/Kconfig" diff --git a/applications/nrf5340_audio/Kconfig b/applications/nrf5340_audio/Kconfig index ba8552c498e5..6997b4fb3806 100644 --- a/applications/nrf5340_audio/Kconfig +++ b/applications/nrf5340_audio/Kconfig @@ -39,24 +39,6 @@ config TRANSPORT_CIS endchoice #----------------------------------------------------------------------------# -if (TRANSPORT_BIS && AUDIO_DEV = 1) -rsource "broadcast_sink/Kconfig.defaults" -endif # TRANSPORT_BIS && AUDIO_DEV = 1 - -if (TRANSPORT_BIS && AUDIO_DEV = 2) -rsource "broadcast_source/Kconfig.defaults" -endif # TRANSPORT_BIS && AUDIO_DEV = 2 - -if (TRANSPORT_CIS && AUDIO_DEV = 1) -rsource "unicast_server/Kconfig.defaults" -endif # TRANSPORT_CIS && AUDIO_DEV = 1 - -if (TRANSPORT_CIS && AUDIO_DEV = 2) -rsource "unicast_client/Kconfig.defaults" -endif # TRANSPORT_CIS && AUDIO_DEV = 2 - - - rsource "Kconfig.defaults" rsource "src/audio/Kconfig" rsource "src/bluetooth/Kconfig" diff --git a/applications/nrf5340_audio/broadcast_sink/Kconfig.defaults b/applications/nrf5340_audio/broadcast_sink/Kconfig.defaults deleted file mode 100644 index 3dcf65b596b3..000000000000 --- a/applications/nrf5340_audio/broadcast_sink/Kconfig.defaults +++ /dev/null @@ -1,109 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -## ACL related configs ## -config BT_OBSERVER - default y - -config BT_PERIPHERAL - default y - -config BT_BUF_ACL_TX_COUNT - default 18 - -config BT_CAP_ACCEPTOR - default y if BT_AUDIO_SCAN_DELEGATOR - select BT_CSIP_SET_MEMBER - select BT_CAP_ACCEPTOR_SET_MEMBER - select BT_GAP_PERIPHERAL_PREF_PARAMS - select BT_VCP_VOL_REND - -config BT_PERIPHERAL_PREF_MIN_INT - default 64 - -config BT_PERIPHERAL_PREF_MAX_INT - default 69 - -config BT_PERIPHERAL_PREF_LATENCY - default 0 - -config BT_PERIPHERAL_PREF_TIMEOUT - default 200 - -# Generic Audio Sink - 0x0840 -config BT_DEVICE_APPEARANCE - default 2112 - -config BT_PER_ADV_SYNC_MAX - default 2 - -config BT_SMP - default y - - -## ISO related configs ## -config BT_ISO_SYNC_RECEIVER - default y - -config BT_BAP_BROADCAST_SINK - default y - -config BT_BAP_SCAN_DELEGATOR - default y - -config BT_BAP_BROADCAST_SNK_STREAM_COUNT - default 2 - -config BT_BAP_BROADCAST_SNK_COUNT - default 2 - -config BT_ISO_MAX_CHAN - default 2 - -config BT_ISO_MAX_BIG - default 2 - -config BT_AUDIO_RX - default y - -config BT_PER_ADV_SYNC_TRANSFER_RECEIVER - default y if BT_AUDIO_SCAN_DELEGATOR - select SETTINGS - select BT_SETTINGS - select FLASH - select FLASH_MAP - select NVS - -config NVS_LOG_LEVEL - default 2 - -config BT_DEVICE_NAME - default "NRF5340_BIS_HEADSET" - -## PACS related configs ## -config BT_PAC_SNK_NOTIFIABLE - default y - -config BT_PAC_SNK - default y - -config BT_PAC_SRC_NOTIFIABLE - default y - -config BT_PAC_SRC - default y - -## Audio related configs ## -config AUDIO_MUTE - default n - -config AUDIO_TEST_TONE - default n - - -## LC3 related configs ## -config LC3_DEC_CHAN_MAX - default 1 diff --git a/applications/nrf5340_audio/broadcast_sink/overlay-broadcast_sink.conf b/applications/nrf5340_audio/broadcast_sink/overlay-broadcast_sink.conf new file mode 100644 index 000000000000..e18101ba7865 --- /dev/null +++ b/applications/nrf5340_audio/broadcast_sink/overlay-broadcast_sink.conf @@ -0,0 +1,66 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_TRANSPORT_BIS=y + +## ACL related configs ## +CONFIG_BT_OBSERVER=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_SMP=y +CONFIG_BT_AUDIO=y +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_CACHING=n + +CONFIG_SETTINGS=y +CONFIG_BT_SETTINGS=y +CONFIG_FLASH=y +CONFIG_FLASH_MAP=y +CONFIG_NVS=y + +CONFIG_BT_BUF_ACL_TX_COUNT=18 + +CONFIG_BT_CAP_ACCEPTOR=y +CONFIG_BT_CSIP_SET_MEMBER=y +CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y +CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=y +CONFIG_BT_VCP_VOL_REND=y + +CONFIG_BT_PERIPHERAL_PREF_MIN_INT=64 +CONFIG_BT_PERIPHERAL_PREF_MAX_INT=69 +CONFIG_BT_PERIPHERAL_PREF_LATENCY=0 +CONFIG_BT_PERIPHERAL_PREF_TIMEOUT=200 + +# Generic Audio Sink - 0x0840 +CONFIG_BT_DEVICE_APPEARANCE=2112 +CONFIG_BT_PER_ADV_SYNC_MAX=2 + +## ISO related configs ## +CONFIG_BT_BAP_BROADCAST_SNK_STREAM_COUNT=2 +CONFIG_BT_BAP_BROADCAST_SNK_COUNT=2 +CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_BIG=2 + +CONFIG_BT_PER_ADV_SYNC_TRANSFER_RECEIVER=y + +## PACS related configs ## +CONFIG_BT_PAC_SNK_NOTIFIABLE=y +CONFIG_BT_PAC_SNK=y +CONFIG_BT_PAC_SRC_NOTIFIABLE=y +CONFIG_BT_PAC_SRC=y + +## Audio related configs ## +CONFIG_AUDIO_MUTE=n +CONFIG_AUDIO_TEST_TONE=n + +CONFIG_BT_ISO_SYNC_RECEIVER=y +CONFIG_BT_BAP_SCAN_DELEGATOR=y +CONFIG_BT_BAP_BROADCAST_SINK=y + +## LC3 related configs ## +CONFIG_LC3_DEC_CHAN_MAX=1 + + + diff --git a/applications/nrf5340_audio/broadcast_source/overlay-broadcast_source.conf b/applications/nrf5340_audio/broadcast_source/overlay-broadcast_source.conf new file mode 100644 index 000000000000..814436987c20 --- /dev/null +++ b/applications/nrf5340_audio/broadcast_source/overlay-broadcast_source.conf @@ -0,0 +1,27 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_TRANSPORT_BIS=y + +CONFIG_BT_CAP_INITIATOR=y +CONFIG_BT_AUDIO=y + +CONFIG_BT_DEVICE_APPEARANCE=2181 + +CONFIG_BT_ISO_BROADCASTER=y + +CONFIG_BT_BAP_BROADCAST_SOURCE=y + +CONFIG_BT_ISO_TX_BUF_COUNT=2 + +CONFIG_BT_BAP_BROADCAST_SRC_STREAM_COUNT=2 + +CONFIG_BT_ISO_MAX_CHAN=2 + +CONFIG_BT_ISO_MAX_BIG=2 + +CONFIG_LC3_ENC_CHAN_MAX=2 +CONFIG_ENTROPY_GENERATOR=y diff --git a/applications/nrf5340_audio/prj.conf b/applications/nrf5340_audio/prj.conf index b1dc911a59a3..0b3b57fce736 100644 --- a/applications/nrf5340_audio/prj.conf +++ b/applications/nrf5340_audio/prj.conf @@ -17,6 +17,7 @@ CONFIG_STACK_USAGE=y CONFIG_THREAD_RUNTIME_STATS=y CONFIG_STACK_SENTINEL=y CONFIG_INIT_STACKS=y +CONFIG_BT=y # Uart driver CONFIG_SERIAL=y diff --git a/applications/nrf5340_audio/sample.yaml b/applications/nrf5340_audio/sample.yaml index d00781c62251..5c9363c5f3fa 100644 --- a/applications/nrf5340_audio/sample.yaml +++ b/applications/nrf5340_audio/sample.yaml @@ -11,33 +11,37 @@ common: - ci_build - sysbuild tests: - applications.nrf5340_audio.default: - extra_args: [] applications.nrf5340_audio.headset_unicast: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=1 + - EXTRA_CONF_FILE=unicast_server/overlay-unicast_server.conf applications.nrf5340_audio.gateway_unicast: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=2 + - EXTRA_CONF_FILE=unicast_client/overlay-unicast_client.conf applications.nrf5340_audio.headset_broadcast: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=1 - CONFIG_TRANSPORT_BIS=y + - EXTRA_CONF_FILE=broadcast_sink/overlay-broadcast_sink.conf applications.nrf5340_audio.gateway_broadcast: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=2 - CONFIG_TRANSPORT_BIS=y + - EXTRA_CONF_FILE=broadcast_source/overlay-broadcast_source.conf applications.nrf5340_audio.headset_unicast_sd_card: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=1 - CONFIG_SD_CARD_PLAYBACK=y + - EXTRA_CONF_FILE=unicast_server/overlay-unicast_server.conf applications.nrf5340_audio.headset_dfu: extra_args: - FILE_SUFFIX=release - CONFIG_AUDIO_DEV=1 - FILE_SUFFIX=fota + - EXTRA_CONF_FILE=unicast_server/overlay-unicast_server.conf diff --git a/applications/nrf5340_audio/src/bluetooth/bt_management/scanning/bt_mgmt_scan_for_broadcast.c b/applications/nrf5340_audio/src/bluetooth/bt_management/scanning/bt_mgmt_scan_for_broadcast.c index 351162269e57..cce523a97eba 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_management/scanning/bt_mgmt_scan_for_broadcast.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_management/scanning/bt_mgmt_scan_for_broadcast.c @@ -425,7 +425,7 @@ void bt_mgmt_broadcast_code_ptr_get(uint8_t **broadcast_code_ptr) void bt_mgmt_scan_delegator_init(void) { if (!scan_dlg_cb_registered) { - bt_bap_scan_delegator_register_cb(&scan_delegator_cbs); + bt_bap_scan_delegator_register(&scan_delegator_cbs); scan_dlg_cb_registered = true; } diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c index 1dd9d7d50594..4d3134032c4b 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/broadcast/broadcast_source.c @@ -51,6 +51,7 @@ static struct bt_bap_lc3_preset lc3_preset = BT_BAP_LC3_BROADCAST_PRESET_NRF5340 static bool initialized; static bool delete_broadcast_src[CONFIG_BT_ISO_MAX_BIG]; +static uint32_t stored_broadcast_id; static int metadata_u8_add(uint8_t buffer[], uint8_t *index, uint8_t type, uint8_t value) { @@ -263,14 +264,15 @@ int broadcast_source_ext_adv_populate(uint8_t big_index, bool fixed_id, uint32_t if (!fixed_id) { /* Use a random broadcast ID */ - ret = bt_cap_initiator_broadcast_get_id(broadcast_sources[big_index], - &broadcast_id); + ret = bt_rand(&broadcast_id, BT_AUDIO_BROADCAST_ID_SIZE); if (ret) { - LOG_ERR("Unable to get broadcast ID: %d", ret); + LOG_WRN("Unable to generate broadcast ID: %d\n", ret); return ret; } } + stored_broadcast_id = broadcast_id; + sys_put_le16(BT_UUID_BROADCAST_AUDIO_VAL, ext_adv_data->brdcst_id_buf); sys_put_le24(broadcast_id, &ext_adv_data->brdcst_id_buf[BROADCAST_SOURCE_ADV_ID_START]); @@ -596,8 +598,6 @@ static uint8_t audio_map_location_get(struct bt_bap_stream *bap_stream) int broadcast_source_id_get(uint8_t big_index, uint32_t *broadcast_id) { - int ret; - if (big_index >= CONFIG_BT_ISO_MAX_BIG) { LOG_ERR("Failed to get broadcast ID for BIG %d out of %d", big_index, CONFIG_BT_ISO_MAX_BIG); @@ -614,11 +614,7 @@ int broadcast_source_id_get(uint8_t big_index, uint32_t *broadcast_id) return -EINVAL; } - ret = bt_cap_initiator_broadcast_get_id(broadcast_sources[big_index], broadcast_id); - if (ret) { - LOG_ERR("Unable to get broadcast ID: %d", ret); - return ret; - } + *broadcast_id = stored_broadcast_id; return 0; } diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h index 658a947aa0b1..d578d5bca598 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/le_audio.h @@ -36,10 +36,10 @@ BT_AUDIO_CODEC_CFG_DURATION_10, _loc, \ LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), 1, \ _stream_context), \ - BT_AUDIO_CODEC_QOS_UNFRAMED(10000u, LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), \ - CONFIG_BT_AUDIO_RETRANSMITS, \ - CONFIG_BT_AUDIO_MAX_TRANSPORT_LATENCY_MS, \ - CONFIG_BT_AUDIO_PRESENTATION_DELAY_US)) + BT_BAP_QOS_CFG_UNFRAMED(10000u, LE_AUDIO_SDU_SIZE_OCTETS(_bitrate), \ + CONFIG_BT_AUDIO_RETRANSMITS, \ + CONFIG_BT_AUDIO_MAX_TRANSPORT_LATENCY_MS, \ + CONFIG_BT_AUDIO_PRESENTATION_DELAY_US)) /** * @brief Callback for receiving Bluetooth LE Audio data. diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/Kconfig.defaults b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/Kconfig.defaults index cbeaf9b90bf9..fd607265d15d 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/Kconfig.defaults +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/Kconfig.defaults @@ -55,6 +55,3 @@ config NVS config NVS_LOG_LEVEL default 2 - -config BT_ASCS_MAX_ASE_SRC_COUNT - default 1 diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c index 26aabe4b25fb..e98330a844fc 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_client.c @@ -1112,7 +1112,7 @@ static void check_and_update_pd_in_group(struct stream_index idx, uint32_t new_p } static void stream_configured_cb(struct bt_bap_stream *stream, - const struct bt_audio_codec_qos_pref *pref) + const struct bt_bap_qos_cfg_pref *pref) { int ret; uint32_t new_pres_dly_us; diff --git a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c index 01323fa6b67d..2b90e87d7f9b 100644 --- a/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c +++ b/applications/nrf5340_audio/src/bluetooth/bt_stream/unicast/unicast_server.c @@ -138,7 +138,7 @@ static enum bt_audio_dir caps_dirs[] = { #endif /* (CONFIG_BT_AUDIO_TX) */ }; -static const struct bt_audio_codec_qos_pref qos_pref = BT_AUDIO_CODEC_QOS_PREF( +static const struct bt_bap_qos_cfg_pref qos_pref = BT_BAP_QOS_CFG_PREF( true, BT_GAP_LE_PHY_2M, CONFIG_BT_AUDIO_RETRANSMITS, BLE_ISO_LATENCY_MS, CONFIG_AUDIO_MIN_PRES_DLY_US, CONFIG_AUDIO_MAX_PRES_DLY_US, CONFIG_BT_AUDIO_PREFERRED_MIN_PRES_DLY_US, CONFIG_BT_AUDIO_PREFERRED_MAX_PRES_DLY_US); @@ -168,7 +168,7 @@ BUILD_ASSERT(CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT <= 1, static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec, struct bt_bap_stream **stream, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { int ret; LOG_DBG("LC3 config callback"); @@ -224,14 +224,14 @@ static int lc3_config_cb(struct bt_conn *conn, const struct bt_bap_ep *ep, enum static int lc3_reconfig_cb(struct bt_bap_stream *stream, enum bt_audio_dir dir, const struct bt_audio_codec_cfg *codec, - struct bt_audio_codec_qos_pref *const pref, struct bt_bap_ascs_rsp *rsp) + struct bt_bap_qos_cfg_pref *const pref, struct bt_bap_ascs_rsp *rsp) { LOG_DBG("ASE Codec Reconfig: stream %p", (void *)stream); return 0; } -static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_audio_codec_qos *qos, +static int lc3_qos_cb(struct bt_bap_stream *stream, const struct bt_bap_qos_cfg *qos, struct bt_bap_ascs_rsp *rsp) { enum bt_audio_dir dir; diff --git a/applications/nrf5340_audio/tools/buildprog/buildprog.py b/applications/nrf5340_audio/tools/buildprog/buildprog.py index 5b954aff1a23..ee18c2c44ce7 100644 --- a/applications/nrf5340_audio/tools/buildprog/buildprog.py +++ b/applications/nrf5340_audio/tools/buildprog/buildprog.py @@ -27,6 +27,7 @@ AudioDevice, SelectFlags, Core, + Transport, ) from program import program_threads_run @@ -45,6 +46,11 @@ TARGET_DEV_HEADSET_FOLDER = NRF5340_AUDIO_FOLDER / "build/dev_headset" TARGET_DEV_GATEWAY_FOLDER = NRF5340_AUDIO_FOLDER / "build/dev_gateway" +UNICAST_SERVER_OVERLAY = NRF5340_AUDIO_FOLDER / "unicast_server/overlay-unicast_server.conf" +UNICAST_CLIENT_OVERLAY = NRF5340_AUDIO_FOLDER / "unicast_client/overlay-unicast_client.conf" +BROADCAST_SINK_OVERLAY = NRF5340_AUDIO_FOLDER / "broadcast_sink/overlay-broadcast_sink.conf" +BROADCAST_SOURCE_OVERLAY = NRF5340_AUDIO_FOLDER / "broadcast_source/overlay-broadcast_source.conf" + TARGET_RELEASE_FOLDER = "build_release" TARGET_DEBUG_FOLDER = "build_debug" @@ -130,16 +136,26 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType, user_specific_bt_name = ( "AUDIO_DEV_" + getpass.getuser())[:MAX_USER_NAME_LEN].upper() device_flag += " -DCONFIG_BT_DEVICE_NAME=\\\"" + user_specific_bt_name + "\\\"" + if options.transport == Transport.broadcast.name: + if device == AudioDevice.headset: + overlay_flag = (f" -DEXTRA_CONF_FILE={BROADCAST_SINK_OVERLAY}") + elif device == AudioDevice.gateway: + overlay_flag = (f" -DEXTRA_CONF_FILE={BROADCAST_SOURCE_OVERLAY}") + elif options.transport == Transport.unicast.name: + if device == AudioDevice.headset: + overlay_flag = (f" -DEXTRA_CONF_FILE={UNICAST_SERVER_OVERLAY}") + elif device == AudioDevice.gateway: + overlay_flag = (f" -DEXTRA_CONF_FILE={UNICAST_CLIENT_OVERLAY}") if os.name == 'nt': release_flag = release_flag.replace('\\', '/') if pristine: build_cmd += " -p" - return build_cmd, dest_folder, device_flag, release_flag + return build_cmd, dest_folder, device_flag, release_flag, overlay_flag def __build_module(build_config, options): - build_cmd, dest_folder, device_flag, release_flag = __build_cmd_get( + build_cmd, dest_folder, device_flag, release_flag, overlay_flag = __build_cmd_get( build_config.core, build_config.device, build_config.build, @@ -153,7 +169,7 @@ def __build_module(build_config, options): # Only add compiler flags if folder doesn't exist already if not dest_folder.exists(): - west_str = west_str + device_flag + release_flag + west_str = west_str + device_flag + release_flag + overlay_flag print("Run: " + west_str) @@ -180,7 +196,7 @@ def __find_snr(): def __populate_hex_paths(dev, options): """Poplulate hex paths where relevant""" - _, temp_dest_folder, _, _ = __build_cmd_get( + _, temp_dest_folder, _, _, _ = __build_cmd_get( Core.app, dev.nrf5340_audio_dk_dev, options.build, options.pristine, options ) @@ -293,6 +309,14 @@ def __main(): help="Set to generate a user specific Bluetooth device name.\ Note that this will put the computer user name on air in clear text", ) + parser.add_argument( + "-t", + "--transport", + type=str, + choices=[i.name for i in Transport], + default=Transport.unicast.name, + help="Select the transport type", + ) options = parser.parse_args(args=sys.argv[1:]) diff --git a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py index d550292c3ab7..638e5c28fd39 100644 --- a/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py +++ b/applications/nrf5340_audio/tools/buildprog/nrf5340_audio_dk_devices.py @@ -47,6 +47,11 @@ class Channel(Enum): right = 1 NA = auto() +class Transport(str, Enum): + """Transport type""" + broadcast = "broadcast" + unicast = "unicast" + @dataclass class DeviceConf: diff --git a/applications/nrf5340_audio/unicast_client/Kconfig.defaults b/applications/nrf5340_audio/unicast_client/Kconfig.defaults deleted file mode 100644 index 99f22f3f64e6..000000000000 --- a/applications/nrf5340_audio/unicast_client/Kconfig.defaults +++ /dev/null @@ -1,80 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -config UTF8 - default y - -## ACL related configs ## -config BT_MAX_CONN - default 2 - -# Generic Audio Source - 0x0880 -config BT_DEVICE_APPEARANCE - default 2176 - -config BT_MAX_PAIRED - default 2 - -config BT_GATT_DYNAMIC_DB - default y - - -## ISO related configs ## -config BT_ISO_MAX_CHAN - default 4 - -config BT_BAP_UNICAST - default y - -config BT_BAP_UNICAST_CLIENT - default y - -config BT_CAP_INITIATOR - default y - -config BT_CSIP_SET_COORDINATOR - default y - -config BT_ISO_TX_BUF_COUNT - default 2 - -config BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT - default 4 - -config BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT - default 2 - -config BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT - default 2 - -config BT_VCP_VOL_CTLR - default y - -config BT_MCS - default y - -config BT_MPL - default y - -config MCTL - default y - -config MCTL_LOCAL_PLAYER_CONTROL - default y - -config MCTL_LOCAL_PLAYER_REMOTE_CONTROL - default y - - -## LC3 related configs ## -config LC3_BITRATE - default BT_AUDIO_BITRATE_UNICAST_SINK - -config LC3_ENC_CHAN_MAX - default 2 - -config LC3_DEC_CHAN_MAX - default 1 diff --git a/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf b/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf new file mode 100644 index 000000000000..36c6c85696d2 --- /dev/null +++ b/applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf @@ -0,0 +1,42 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +CONFIG_BT_CENTRAL=y + +CONFIG_BT_GATT_DYNAMIC_DB=y +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y +CONFIG_BT_GATT_CACHING=n +CONFIG_BT_MAX_CONN=2 +CONFIG_BT_MAX_PAIRED=2 +CONFIG_BT_EXT_ADV=y + +CONFIG_BT_AUDIO=y +CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_BAP_UNICAST_CLIENT=y +CONFIG_BT_CAP_INITIATOR=y +CONFIG_BT_CSIP_SET_COORDINATOR=y +CONFIG_BT_DEVICE_APPEARANCE=2176 + +CONFIG_BT_ISO_TX_BUF_COUNT=4 +# Support an ISO channel per ASE +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_VCP_VOL_CTLR=y +CONFIG_BT_BAP_UNICAST_CLIENT_GROUP_STREAM_COUNT=4 +CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SNK_COUNT=2 +CONFIG_BT_BAP_UNICAST_CLIENT_ASE_SRC_COUNT=2 +CONFIG_BT_MCS=y +CONFIG_BT_MPL=y +CONFIG_UTF8=y +CONFIG_MCTL=y +CONFIG_MCTL_LOCAL_PLAYER_CONTROL=y +CONFIG_MCTL_LOCAL_PLAYER_REMOTE_CONTROL=y + +CONFIG_LC3_ENC_CHAN_MAX=2 +CONFIG_LC3_DEC_CHAN_MAX=1 +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=2048 diff --git a/applications/nrf5340_audio/unicast_server/Kconfig.defaults b/applications/nrf5340_audio/unicast_server/Kconfig.defaults deleted file mode 100644 index a8e785adda32..000000000000 --- a/applications/nrf5340_audio/unicast_server/Kconfig.defaults +++ /dev/null @@ -1,100 +0,0 @@ -# -# Copyright (c) 2023 Nordic Semiconductor ASA -# -# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause -# - -## ACL related configs ## -config BT_MAX_CONN - default 4 - -config BT_MAX_PAIRED - default 4 - -config BT_PERIPHERAL - default y - -config BT_GATT_AUTO_RESUBSCRIBE - default n - -config BT_GATT_AUTO_SEC_REQ - default n - - -## ISO related configs ## -config BT_ISO_PERIPHERAL - default y - -config BT_BAP_UNICAST - default y - -config BT_BAP_UNICAST_SERVER - default y - -config BT_ISO_MAX_CHAN - default 2 - -# Earbud - 0x0941 -config BT_DEVICE_APPEARANCE - default 2369 - -config BT_GAP_PERIPHERAL_PREF_PARAMS - default n - -config BT_ASCS - default y - -config BT_ASCS_MAX_ASE_SNK_COUNT - default 1 - -config BT_ASCS_MAX_ASE_SRC_COUNT - default 1 if STREAM_BIDIRECTIONAL - default 0 if !STREAM_BIDIRECTIONAL - -config BT_VCP_VOL_REND - default y - -config BT_MCC - default y - -config BT_MCC_READ_MEDIA_STATE - default y - -config BT_MCC_SET_MEDIA_CONTROL_POINT - default y - -# For fixing compatibility issue with Android 14 -config BT_PAC_SNK - default y - -config BT_PAC_SNK_NOTIFIABLE - default y - -config BT_PAC_SRC - default y - -config BT_PAC_SRC_NOTIFIABLE - default y - -config BT_CSIP_SET_MEMBER - default y - -config BT_CAP_ACCEPTOR - default y - -config BT_CAP_ACCEPTOR_SET_MEMBER - default y - -config BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE - default 25 - - -## LC3 related configs ## -config LC3_BITRATE - default BT_AUDIO_BITRATE_UNICAST_SRC - -config LC3_ENC_CHAN_MAX - default 1 - -config LC3_DEC_CHAN_MAX - default 1 diff --git a/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf b/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf new file mode 100644 index 000000000000..795f6113fec7 --- /dev/null +++ b/applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf @@ -0,0 +1,48 @@ +# +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + + +CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y +CONFIG_BT_GATT_AUTO_RESUBSCRIBE=n +CONFIG_BT_GATT_AUTO_SEC_REQ=n +CONFIG_BT_GATT_AUTO_UPDATE_MTU=y +CONFIG_BT_GATT_CACHING=n +CONFIG_BT_GATT_CLIENT=y +CONFIG_BT_GATT_DYNAMIC_DB=y + +CONFIG_BT_MAX_CONN=4 +CONFIG_BT_MAX_PAIRED=4 +CONFIG_BT_EXT_ADV=y + +CONFIG_BT_AUDIO=y + +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_ISO_PERIPHERAL=y +CONFIG_BT_BAP_UNICAST_SERVER=y +CONFIG_BT_CAP_ACCEPTOR=y +CONFIG_BT_CAP_ACCEPTOR_SET_MEMBER=y +CONFIG_BT_PAC_SNK=y +CONFIG_BT_PAC_SNK_NOTIFIABLE=y +CONFIG_BT_PAC_SRC=y +CONFIG_BT_PAC_SRC_NOTIFIABLE=y +CONFIG_BT_CSIP_SET_MEMBER=y +CONFIG_BT_DEVICE_APPEARANCE=2369 + +CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ASCS=y +CONFIG_BT_ASCS_MAX_ASE_SNK_COUNT=1 +CONFIG_BT_ASCS_MAX_ASE_SRC_COUNT=1 +CONFIG_BT_VCP_VOL_REND=y +CONFIG_BT_MCC=y +CONFIG_BT_MCC_READ_MEDIA_STATE=y +CONFIG_BT_MCC_SET_MEDIA_CONTROL_POINT=y +CONFIG_BT_GAP_PERIPHERAL_PREF_PARAMS=n +CONFIG_BT_AUDIO_CODEC_CFG_MAX_METADATA_SIZE=25 + +CONFIG_LC3_ENC_CHAN_MAX=1 +CONFIG_LC3_DEC_CHAN_MAX=1 +CONFIG_MBEDTLS_ENABLE_HEAP=y +CONFIG_MBEDTLS_HEAP_SIZE=2048 From 9ccbcc3264b8acdee17d063d6d3961c25079cdc7 Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Wed, 22 Jan 2025 13:21:13 +0100 Subject: [PATCH 054/109] samples: matter: Add workaround for building Matter Lock Do not treat warnings as errors while the variable may be uninitialized for Matter Lock. In the door-lock-server implementation, there is a warning that the C++ "optional" variable may be uninitialized, but actually, it is wrongly interpreted by the Zephyr toolchain. Signed-off-by: Arkadiusz Balys --- samples/matter/lock/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/samples/matter/lock/CMakeLists.txt b/samples/matter/lock/CMakeLists.txt index a9b5746bd5d2..3e06c01b38a6 100644 --- a/samples/matter/lock/CMakeLists.txt +++ b/samples/matter/lock/CMakeLists.txt @@ -48,6 +48,11 @@ if(CONFIG_THREAD_WIFI_SWITCHING) ) endif() +# Do not treat warnings as errors while the variable may be uninitialized for this sample. +# In the door-lock-server implementation, there is a warning that the C++ "optional" +# variable may be uninitialized, but actually, it is wrongly interpreted by the Zephyr toolchain. +target_compile_options(app PRIVATE -Wno-error=maybe-uninitialized) + chip_configure_data_model(app INCLUDE_SERVER BYPASS_IDL From 501de04e912b92f6f98a12c2a37e8c50b93e7f0c Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Thu, 23 Jan 2025 10:07:23 +0100 Subject: [PATCH 055/109] suit: Fix warnings in unit tests Fix warnings in SUIT unit tests. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- .../app_specific/suit_plat_retrieve_manifest_app/src/main.c | 4 ++-- .../subsys/suit/unit/suit_plat_memptr_size_update/src/main.c | 2 -- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/tests/subsys/suit/unit/app_specific/suit_plat_retrieve_manifest_app/src/main.c b/tests/subsys/suit/unit/app_specific/suit_plat_retrieve_manifest_app/src/main.c index 225b338f1661..77b63c9733b2 100644 --- a/tests/subsys/suit/unit/app_specific/suit_plat_retrieve_manifest_app/src/main.c +++ b/tests/subsys/suit/unit/app_specific/suit_plat_retrieve_manifest_app/src/main.c @@ -13,8 +13,8 @@ ZTEST_SUITE(suit_platform_retrieve_manifest_tests, NULL, NULL, NULL, NULL, NULL) ZTEST(suit_platform_retrieve_manifest_tests, test_retrieve_manifest_app_specific) { struct zcbor_string dummy_component_id = {0}; - uint8_t *envelope = NULL; - size_t envelope_len = 0; + const uint8_t **envelope = NULL; + size_t *envelope_len = NULL; /* Simply return SUIT_ERR_UNSUPPORTED_COMPONENT_ID unconditionally */ zassert_equal(suit_plat_retrieve_manifest_domain_specific(&dummy_component_id, diff --git a/tests/subsys/suit/unit/suit_plat_memptr_size_update/src/main.c b/tests/subsys/suit/unit/suit_plat_memptr_size_update/src/main.c index e8d0d39f1890..02f6fd115210 100644 --- a/tests/subsys/suit/unit/suit_plat_memptr_size_update/src/main.c +++ b/tests/subsys/suit/unit/suit_plat_memptr_size_update/src/main.c @@ -18,8 +18,6 @@ #define TEST_COMPONENT_SIZE_SMALLER ((size_t)128) #define TEST_COMPONENT_SIZE_BIGGER ((size_t)512) -static size_t smaller_component_size = 128, bigger_component_size = 512; - static void test_before(void *data) { /* Reset mocks */ From a4507ee26ddb98ffd8709143185889493badb5c2 Mon Sep 17 00:00:00 2001 From: Arkadiusz Balys Date: Tue, 26 Nov 2024 11:57:48 +0100 Subject: [PATCH 056/109] samples: Aligned ram0x overlays in Multicore Tests/Matter samples The cpuapp_ram0x_region has been changed in the global dtsi file in Zephyr and we need to align all dts overlay entries to that change. Signed-off-by: Arkadiusz Balys --- .../matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi | 6 +++--- .../nrf54h20dk_nrf54h20_cpuapp_ram_high_usage.overlay | 4 ++-- .../boards/nrf54h20dk_nrf54h20_cpuapp_ram_low_usage.overlay | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/samples/matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi b/samples/matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi index 4974d98bcfe0..c427b864f06f 100644 --- a/samples/matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi +++ b/samples/matter/common/dts/nrf54h20/nrf54h20_ram_allocation.dtsi @@ -10,9 +10,9 @@ &cpuapp_ram0x_region{ status = "okay"; - reg = <0x2f010000 DT_SIZE_K(512)>; - ranges = <0x0 0x2f010000 0x6e000>; + reg = <0x2f011000 DT_SIZE_K(516)>; + ranges = <0x0 0x2f011000 0x6e000>; cpuapp_data: memory@1000 { - reg = <0x1000 DT_SIZE_K(508)>; + reg = <0x1000 DT_SIZE_K(512)>; }; }; diff --git a/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_high_usage.overlay b/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_high_usage.overlay index 1ad3bda2f5b2..c53b1d72f905 100644 --- a/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_high_usage.overlay +++ b/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_high_usage.overlay @@ -5,8 +5,8 @@ */ &cpuapp_ram0x_region { - reg = <0x2f010000 0x91000>; - ranges = <0x0 0x2f010000 0x91000>; + reg = <0x2f011000 0x91000>; + ranges = <0x0 0x2f011000 0x91000>; }; &cpuapp_data { diff --git a/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_low_usage.overlay b/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_low_usage.overlay index 9b9b89f73c24..3e05d1f1c411 100644 --- a/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_low_usage.overlay +++ b/tests/benchmarks/multicore/idle/boards/nrf54h20dk_nrf54h20_cpuapp_ram_low_usage.overlay @@ -5,8 +5,8 @@ */ &cpuapp_ram0x_region { - reg = <0x2f010000 0x21000>; - ranges = <0x0 0x2f010000 0x21000>; + reg = <0x2f011000 0x21000>; + ranges = <0x0 0x2f011000 0x21000>; }; &cpuapp_data { From 74e800349d9187295b4c1fd4d964327138fddc41 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Fri, 24 Jan 2025 09:14:46 +0000 Subject: [PATCH 057/109] samples: bluetooth: Update channel sounding samples for new enum In upstream zephyr BT_LE_CS_INITIATOR_SNR_CONTROL_NOT_USED and BT_LE_CS_REFLECTOR_SNR_CONTROL_NOT_USED have been replaced with a common BT_LE_CS_SNR_CONTROL_NOT_USED. Signed-off-by: Sean Madigan --- samples/bluetooth/channel_sounding_ras_initiator/src/main.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/samples/bluetooth/channel_sounding_ras_initiator/src/main.c b/samples/bluetooth/channel_sounding_ras_initiator/src/main.c index 95ad1cfd3592..022298ab9723 100644 --- a/samples/bluetooth/channel_sounding_ras_initiator/src/main.c +++ b/samples/bluetooth/channel_sounding_ras_initiator/src/main.c @@ -464,8 +464,8 @@ int main(void) .phy = BT_LE_CS_PROCEDURE_PHY_1M, .tx_power_delta = 0x80, .preferred_peer_antenna = BT_LE_CS_PROCEDURE_PREFERRED_PEER_ANTENNA_1, - .snr_control_initiator = BT_LE_CS_INITIATOR_SNR_CONTROL_NOT_USED, - .snr_control_reflector = BT_LE_CS_REFLECTOR_SNR_CONTROL_NOT_USED, + .snr_control_initiator = BT_LE_CS_SNR_CONTROL_NOT_USED, + .snr_control_reflector = BT_LE_CS_SNR_CONTROL_NOT_USED, }; err = bt_le_cs_set_procedure_parameters(connection, &procedure_params); From fdc106cedb345b16a21bf5550f2590bc298661c0 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Fri, 24 Jan 2025 09:15:47 +0000 Subject: [PATCH 058/109] samples: bluetooth: Update kconfigs in iso_combined_bis_and_cis The dependencies for ISO kconfigs have changed so now we need to manually select CONFIG_BT_CENTRAL and CONFIG_BT_PERIPHERAL. Signed-off-by: Sean Madigan --- samples/bluetooth/iso_combined_bis_and_cis/prj.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/bluetooth/iso_combined_bis_and_cis/prj.conf b/samples/bluetooth/iso_combined_bis_and_cis/prj.conf index 3cc708932774..b857296809fb 100644 --- a/samples/bluetooth/iso_combined_bis_and_cis/prj.conf +++ b/samples/bluetooth/iso_combined_bis_and_cis/prj.conf @@ -7,6 +7,8 @@ CONFIG_RING_BUFFER=y CONFIG_BT=y CONFIG_BT_ISO_BROADCASTER=y CONFIG_BT_ISO_CENTRAL=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="Nordic_ISO" From 3da33b907f82f723f8584127db6220690879a9cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2025 10:57:06 +0100 Subject: [PATCH 059/109] tests: event_manager_proxy: Remove no longer needed overlays MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit After switching IPC to icbmsg, the `zephyr,priority` property is no longer present in the IPC node and there is no need to adjust the WQ priority. Signed-off-by: Andrzej Głąbek --- .../boards/nrf5340dk_nrf5340_cpuapp.overlay | 10 ---------- .../remote/boards/nrf5340dk_nrf5340_cpunet.overlay | 10 ---------- 2 files changed, 20 deletions(-) delete mode 100644 tests/subsys/event_manager_proxy/boards/nrf5340dk_nrf5340_cpuapp.overlay delete mode 100644 tests/subsys/event_manager_proxy/remote/boards/nrf5340dk_nrf5340_cpunet.overlay diff --git a/tests/subsys/event_manager_proxy/boards/nrf5340dk_nrf5340_cpuapp.overlay b/tests/subsys/event_manager_proxy/boards/nrf5340dk_nrf5340_cpuapp.overlay deleted file mode 100644 index ac5d195aa7e2..000000000000 --- a/tests/subsys/event_manager_proxy/boards/nrf5340dk_nrf5340_cpuapp.overlay +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -&ipc0 { - zephyr,priority = <0 PRIO_PREEMPT>; -}; diff --git a/tests/subsys/event_manager_proxy/remote/boards/nrf5340dk_nrf5340_cpunet.overlay b/tests/subsys/event_manager_proxy/remote/boards/nrf5340dk_nrf5340_cpunet.overlay deleted file mode 100644 index ac5d195aa7e2..000000000000 --- a/tests/subsys/event_manager_proxy/remote/boards/nrf5340dk_nrf5340_cpunet.overlay +++ /dev/null @@ -1,10 +0,0 @@ -/* - * Copyright (c) 2022 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#include - -&ipc0 { - zephyr,priority = <0 PRIO_PREEMPT>; -}; From 6bca0dddc31ca0e6f89dfa2eea3c858ecbe65db8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2025 13:32:17 +0100 Subject: [PATCH 060/109] applications|samples: Disable NCS boot banner in mcuboot on Thingy:53 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ... as it is not used anyway. This saves some flash bytes and makes the the mcuboot image fit its partition again. Signed-off-by: Andrzej Głąbek --- .../sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf | 1 + .../sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf | 1 + .../shell/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf | 1 + 3 files changed, 3 insertions(+) diff --git a/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf index f280710d4b39..04646b8473f2 100644 --- a/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf +++ b/applications/machine_learning/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -53,6 +53,7 @@ CONFIG_USB_CDC_ACM=y CONFIG_CBPRINTF_NANO=y CONFIG_TIMESLICING=n CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n CONFIG_CONSOLE=n CONFIG_CONSOLE_HANDLER=n CONFIG_UART_CONSOLE=n diff --git a/samples/bluetooth/peripheral_status/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/samples/bluetooth/peripheral_status/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf index e1065667897d..c584aa911a24 100644 --- a/samples/bluetooth/peripheral_status/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf +++ b/samples/bluetooth/peripheral_status/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -47,6 +47,7 @@ CONFIG_USB_CDC_ACM=y CONFIG_CBPRINTF_NANO=y CONFIG_TIMESLICING=n CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n CONFIG_CONSOLE=n CONFIG_CONSOLE_HANDLER=n CONFIG_UART_CONSOLE=n diff --git a/samples/wifi/shell/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf b/samples/wifi/shell/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf index a181ad338238..3e5337b86d9f 100644 --- a/samples/wifi/shell/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf +++ b/samples/wifi/shell/sysbuild/mcuboot/boards/thingy53_nrf5340_cpuapp.conf @@ -55,6 +55,7 @@ CONFIG_USB_CDC_ACM=y CONFIG_CBPRINTF_NANO=y CONFIG_TIMESLICING=n CONFIG_BOOT_BANNER=n +CONFIG_NCS_BOOT_BANNER=n CONFIG_CONSOLE=n CONFIG_CONSOLE_HANDLER=n CONFIG_UART_CONSOLE=n From 4c1089f81f8be5e3be43056d3da92feddac2b4a2 Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Fri, 24 Jan 2025 15:47:20 +0100 Subject: [PATCH 061/109] samples: nrf_auraconfig: Upmerge API fix - Change API and defines based on changes in upstream Zephyr - OCT-3172 Signed-off-by: Alexander Svensen --- .../bluetooth/nrf_auraconfig/src/nrf_auraconfig.c | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/samples/bluetooth/nrf_auraconfig/src/nrf_auraconfig.c b/samples/bluetooth/nrf_auraconfig/src/nrf_auraconfig.c index efb277b81e2a..7a3aa370fc35 100644 --- a/samples/bluetooth/nrf_auraconfig/src/nrf_auraconfig.c +++ b/samples/bluetooth/nrf_auraconfig/src/nrf_auraconfig.c @@ -720,18 +720,18 @@ static void context_print(const struct shell *shell) } } -static void codec_qos_print(const struct shell *shell, struct bt_audio_codec_qos *qos) +static void codec_qos_print(const struct shell *shell, struct bt_bap_qos_cfg *qos) { - if (qos->phy == BT_AUDIO_CODEC_QOS_1M || qos->phy == BT_AUDIO_CODEC_QOS_2M) { + if (qos->phy == BT_BAP_QOS_CFG_1M || qos->phy == BT_BAP_QOS_CFG_2M) { shell_print(shell, "\t\t\tPHY: %dM", qos->phy); - } else if (qos->phy == BT_AUDIO_CODEC_QOS_CODED) { + } else if (qos->phy == BT_BAP_QOS_CFG_CODED) { shell_print(shell, "\t\t\tPHY: LE Coded"); } else { shell_print(shell, "\t\t\tPHY: Unknown"); } shell_print(shell, "\t\t\tFraming: %s", - (qos->framing == BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED ? "unframed" : "framed")); + (qos->framing == BT_BAP_QOS_CFG_FRAMING_UNFRAMED ? "unframed" : "framed")); shell_print(shell, "\t\t\tRTN: %d", qos->rtn); shell_print(shell, "\t\t\tSDU size: %d", qos->sdu); shell_print(shell, "\t\t\tMax Transport Latency: %d ms", qos->latency); @@ -1829,8 +1829,7 @@ static int cmd_phy(const struct shell *shell, size_t argc, char **argv) uint8_t phy = (uint8_t)atoi(argv[1]); - if (phy != BT_AUDIO_CODEC_QOS_1M && phy != BT_AUDIO_CODEC_QOS_2M && - phy != BT_AUDIO_CODEC_QOS_CODED) { + if (phy != BT_BAP_QOS_CFG_1M && phy != BT_BAP_QOS_CFG_2M && phy != BT_BAP_QOS_CFG_CODED) { shell_error(shell, "Invalid PHY"); return -EINVAL; } @@ -1865,11 +1864,11 @@ static int cmd_framing(const struct shell *shell, size_t argc, char **argv) if (strcasecmp(argv[1], "unframed") == 0) { broadcast_param[big_index].subgroups[sub_index].group_lc3_preset.qos.framing = - BT_AUDIO_CODEC_QOS_FRAMING_UNFRAMED; + BT_BAP_QOS_CFG_FRAMING_UNFRAMED; broadcast_param[big_index].subgroups[sub_index].preset_name = "Custom"; } else if (strcasecmp(argv[1], "framed") == 0) { broadcast_param[big_index].subgroups[sub_index].group_lc3_preset.qos.framing = - BT_AUDIO_CODEC_QOS_FRAMING_FRAMED; + BT_BAP_QOS_CFG_FRAMING_FRAMED; broadcast_param[big_index].subgroups[sub_index].preset_name = "Custom"; } else { shell_error(shell, "Invalid framing type"); From 861e3803006d0a6c101343229ebfe0cc88b538c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Tue, 21 Jan 2025 23:26:55 +0000 Subject: [PATCH 062/109] samples: bluetooth/DTM and Radio Test - add GPPI config explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The CONFIG_NRFX_GPPI symbol was only added for specific boards but the GPPI implementation is used unconditionally on all platforms. Align configuration files in DTM and RT to reflect this situation. Signed-off-by: Michał Grochala --- .../direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf | 2 -- .../direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf | 2 -- .../direct_test_mode/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 1 - .../direct_test_mode/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 1 - .../direct_test_mode/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 1 - samples/bluetooth/direct_test_mode/prj.conf | 1 + samples/bluetooth/direct_test_mode/prj_hci.conf | 1 + samples/bluetooth/direct_test_mode/prj_usb.conf | 1 + .../radio_test/boards/nrf54l15dk_nrf54l05_cpuapp.conf | 1 - .../radio_test/boards/nrf54l15dk_nrf54l10_cpuapp.conf | 1 - .../radio_test/boards/nrf54l15dk_nrf54l15_cpuapp.conf | 1 - samples/peripheral/radio_test/prj.conf | 1 + 12 files changed, 4 insertions(+), 10 deletions(-) diff --git a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf index 17bb72276140..43e7a0d3862a 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf +++ b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet.conf @@ -9,6 +9,4 @@ CONFIG_IPC_SERVICE=y CONFIG_IPC_SERVICE_BACKEND_RPMSG=y CONFIG_MBOX=y -CONFIG_NRFX_GPPI=y - CONFIG_HEAP_MEM_POOL_SIZE=4096 diff --git a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf index 4440ff36ff9d..70722896c341 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf +++ b/samples/bluetooth/direct_test_mode/boards/nrf5340dk_nrf5340_cpunet_hci.conf @@ -8,8 +8,6 @@ CONFIG_IPC_SERVICE=y CONFIG_IPC_SERVICE_BACKEND_RPMSG=y CONFIG_MBOX=y -CONFIG_NRFX_GPPI=y - CONFIG_HEAP_MEM_POOL_SIZE=4096 CONFIG_NRF_RPC=y diff --git a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l05_cpuapp.conf index c6d7d4e891d8..2bc1bb232846 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -12,4 +12,3 @@ CONFIG_NRFX_TIMER2=n # Use necessary peripherals CONFIG_NRFX_TIMER20=y CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l10_cpuapp.conf index c6d7d4e891d8..2bc1bb232846 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -12,4 +12,3 @@ CONFIG_NRFX_TIMER2=n # Use necessary peripherals CONFIG_NRFX_TIMER20=y CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l15_cpuapp.conf index c6d7d4e891d8..2bc1bb232846 100644 --- a/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/bluetooth/direct_test_mode/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -12,4 +12,3 @@ CONFIG_NRFX_TIMER2=n # Use necessary peripherals CONFIG_NRFX_TIMER20=y CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/bluetooth/direct_test_mode/prj.conf b/samples/bluetooth/direct_test_mode/prj.conf index 8788565a4e08..68f23de67550 100644 --- a/samples/bluetooth/direct_test_mode/prj.conf +++ b/samples/bluetooth/direct_test_mode/prj.conf @@ -23,6 +23,7 @@ CONFIG_LOG_BACKEND_RTT=y CONFIG_NRFX_TIMER0=y CONFIG_NRFX_TIMER1=y CONFIG_NRFX_TIMER2=y +CONFIG_NRFX_GPPI=y CONFIG_CLOCK_CONTROL=y CONFIG_FEM_AL_LIB=y diff --git a/samples/bluetooth/direct_test_mode/prj_hci.conf b/samples/bluetooth/direct_test_mode/prj_hci.conf index b92c82e9ec58..5713f6ffbd83 100644 --- a/samples/bluetooth/direct_test_mode/prj_hci.conf +++ b/samples/bluetooth/direct_test_mode/prj_hci.conf @@ -23,6 +23,7 @@ CONFIG_LOG_BACKEND_RTT=y CONFIG_NRFX_TIMER0=y CONFIG_NRFX_TIMER1=y CONFIG_NRFX_TIMER2=y +CONFIG_NRFX_GPPI=y CONFIG_CLOCK_CONTROL=y CONFIG_FEM_AL_LIB=y diff --git a/samples/bluetooth/direct_test_mode/prj_usb.conf b/samples/bluetooth/direct_test_mode/prj_usb.conf index 8f5c63293a29..a4db7f9246f8 100644 --- a/samples/bluetooth/direct_test_mode/prj_usb.conf +++ b/samples/bluetooth/direct_test_mode/prj_usb.conf @@ -23,6 +23,7 @@ CONFIG_LOG_BACKEND_RTT=y CONFIG_NRFX_TIMER0=y CONFIG_NRFX_TIMER1=y CONFIG_NRFX_TIMER2=y +CONFIG_NRFX_GPPI=y CONFIG_CLOCK_CONTROL=y CONFIG_FEM_AL_LIB=y diff --git a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l05_cpuapp.conf b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l05_cpuapp.conf index e029d65ce7bf..0e189be2079b 100644 --- a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l05_cpuapp.conf +++ b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l05_cpuapp.conf @@ -9,4 +9,3 @@ CONFIG_NRFX_TIMER0=n # Enable the necessary drivers CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l10_cpuapp.conf b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l10_cpuapp.conf index e029d65ce7bf..0e189be2079b 100644 --- a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l10_cpuapp.conf +++ b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l10_cpuapp.conf @@ -9,4 +9,3 @@ CONFIG_NRFX_TIMER0=n # Enable the necessary drivers CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l15_cpuapp.conf index e029d65ce7bf..0e189be2079b 100644 --- a/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l15_cpuapp.conf +++ b/samples/peripheral/radio_test/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -9,4 +9,3 @@ CONFIG_NRFX_TIMER0=n # Enable the necessary drivers CONFIG_NRFX_TIMER10=y -CONFIG_NRFX_GPPI=y diff --git a/samples/peripheral/radio_test/prj.conf b/samples/peripheral/radio_test/prj.conf index c130dc5293b8..5b73af78fff9 100644 --- a/samples/peripheral/radio_test/prj.conf +++ b/samples/peripheral/radio_test/prj.conf @@ -10,6 +10,7 @@ CONFIG_SHELL=y CONFIG_DYNAMIC_INTERRUPTS=y CONFIG_NRFX_TIMER0=y +CONFIG_NRFX_GPPI=y CONFIG_CLOCK_CONTROL=y CONFIG_ENTROPY_GENERATOR=y From 589f5b068ba27dbd09a297c7d543a2f6aa57e365 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Fri, 24 Jan 2025 17:36:46 +0100 Subject: [PATCH 063/109] boards: thingy91x: Use default memory partitioning files MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To align with upstream boards that use nRF53 and nRF91 and to get node labels for shared memory regions (cpuapp_cpunet_ipc_shm and cpunet_cpuapp_ipc_shm) defined. Signed-off-by: Andrzej Głąbek --- .../nrf5340_shared_sram_planning_conf.dts | 30 --------- .../thingy91x_nrf5340_cpuapp_common.dts | 63 +----------------- .../thingy91x/thingy91x_nrf5340_cpuapp_ns.dts | 2 +- .../thingy91x/thingy91x_nrf5340_cpunet.dts | 4 +- .../thingy91x/thingy91x_nrf9151_common.dts | 66 +------------------ .../nordic/thingy91x/thingy91x_nrf9151_ns.dts | 2 +- 6 files changed, 8 insertions(+), 159 deletions(-) delete mode 100644 boards/nordic/thingy91x/nrf5340_shared_sram_planning_conf.dts diff --git a/boards/nordic/thingy91x/nrf5340_shared_sram_planning_conf.dts b/boards/nordic/thingy91x/nrf5340_shared_sram_planning_conf.dts deleted file mode 100644 index a3b9276ffd22..000000000000 --- a/boards/nordic/thingy91x/nrf5340_shared_sram_planning_conf.dts +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ - -/* Default shared SRAM planning when building for nRF5340. - * This file is included by both nRF5340 CPUAPP (Application MCU) - * and nRF5340 CPUNET (Network MCU). - * - 64 kB SRAM allocated as Shared memory (sram0_shared) - * - Region defined after the image SRAM of Application MCU - */ - -/ { - chosen { - /* shared memory reserved for the inter-processor communication */ - zephyr,ipc_shm = &sram0_shared; - }; - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_shared: memory@20070000 { - /* SRAM allocated to shared memory */ - reg = <0x20070000 0x10000>; - }; - }; -}; diff --git a/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_common.dts b/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_common.dts index 7358bb1948d4..d48cfd95f138 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_common.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_common.dts @@ -129,41 +129,9 @@ pinctrl-names = "default", "sleep"; }; +/* Include default memory partition configuration file. */ /* This is not the layout that's actually used! It's overridden by Partition Manager. */ -&flash0 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x00010000>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x40000>; - }; - slot0_ns_partition: partition@50000 { - label = "image-0-nonsecure"; - reg = <0x00050000 0x30000>; - }; - slot1_partition: partition@80000 { - label = "image-1"; - reg = <0x00080000 0x40000>; - }; - slot1_ns_partition: partition@c0000 { - label = "image-1-nonsecure"; - reg = <0x000c0000 0x30000>; - }; - /* 0xf0000 to 0xf7fff reserved for TF-M partitions */ - storage_partition: partition@f8000 { - label = "storage"; - reg = <0x000f8000 0x00008000>; - }; - }; -}; +#include &ieee802154 { status = "okay"; @@ -178,30 +146,6 @@ zephyr_udc0: &usbd { }; }; -/ { - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_image: image@20000000 { - /* Zephyr image(s) memory */ - reg = <0x20000000 DT_SIZE_K(448)>; - }; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - reg = <0x20000000 0x40000>; - }; - - sram0_ns: image_ns@20040000 { - /* Non-Secure image memory */ - reg = <0x20040000 0x30000>; - }; - }; -}; - / { sram0_ns@2007fc00 { compatible = "zephyr,memory-region", "mmio-sram"; @@ -239,6 +183,3 @@ zephyr_udc0: &usbd { zephyr,bt-c2h-uart = &rtt0; }; }; - -/* Include partition configuration file */ -#include "nrf5340_shared_sram_planning_conf.dts" diff --git a/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_ns.dts b/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_ns.dts index ed2b031bed46..37da30812a4d 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_ns.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf5340_cpuapp_ns.dts @@ -12,7 +12,7 @@ compatible = "nordic,nrf5340-dk-nrf5340-cpuapp"; chosen { - zephyr,sram = &sram0_ns; + zephyr,sram = &sram0_ns_app; zephyr,flash = &flash0; zephyr,code-partition = &slot0_ns_partition; zephyr,entropy = &psa_rng; diff --git a/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts b/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts index e61f83382c80..015b892b57ff 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf5340_cpunet.dts @@ -81,5 +81,5 @@ status = "okay"; }; -/* Include shared RAM configuration file */ -#include "nrf5340_shared_sram_planning_conf.dts" +/* Include default shared RAM configuration file */ +#include diff --git a/boards/nordic/thingy91x/thingy91x_nrf9151_common.dts b/boards/nordic/thingy91x/thingy91x_nrf9151_common.dts index b1b6b6a61222..69cf3fc7f59c 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf9151_common.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf9151_common.dts @@ -175,68 +175,6 @@ pinctrl-names = "default", "sleep"; }; +/* Include default memory partition configuration file. */ /* This is not the layout that's actually used! It's overridden by Partition Manager. */ -&flash0 { - /* - * For more information, see: - * http://docs.zephyrproject.org/devices/dts/flash_partitions.html - */ - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x10000>; - }; - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x30000>; - }; - slot0_ns_partition: partition@40000 { - label = "image-0-nonsecure"; - reg = <0x00040000 0x40000>; - }; - slot1_partition: partition@80000 { - label = "image-1"; - reg = <0x00080000 0x30000>; - }; - slot1_ns_partition: partition@b0000 { - label = "image-1-nonsecure"; - reg = <0x000b0000 0x40000>; - }; - scratch_partition: partition@f0000 { - label = "image-scratch"; - reg = <0x000f0000 0xa000>; - }; - storage_partition: partition@fa000 { - label = "storage"; - reg = <0x000fa000 0x00006000>; - }; - }; -}; - -/ { - - reserved-memory { - #address-cells = <1>; - #size-cells = <1>; - ranges; - - sram0_s: image_s@20000000 { - /* Secure image memory */ - reg = <0x20000000 DT_SIZE_K(64)>; - }; - - sram0_bsd: image_bsd@20010000 { - /* BSD (shared) memory */ - reg = <0x20010000 DT_SIZE_K(64)>; - }; - - sram0_ns: image_ns@20020000 { - /* Non-Secure image memory */ - reg = <0x20020000 DT_SIZE_K(128)>; - }; - }; -}; +#include diff --git a/boards/nordic/thingy91x/thingy91x_nrf9151_ns.dts b/boards/nordic/thingy91x/thingy91x_nrf9151_ns.dts index 419ae0a76eb0..7ba41da613ac 100644 --- a/boards/nordic/thingy91x/thingy91x_nrf9151_ns.dts +++ b/boards/nordic/thingy91x/thingy91x_nrf9151_ns.dts @@ -10,7 +10,7 @@ / { chosen { zephyr,flash = &flash0; - zephyr,sram = &sram0_ns; + zephyr,sram = &sram0_ns_app; zephyr,code-partition = &slot0_ns_partition; zephyr,wifi = &nordic_wlan0; }; From fd273d3654912093117edc04a855bc8a117fe50e Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Fri, 24 Jan 2025 16:09:29 +0000 Subject: [PATCH 064/109] samples: nrf5340: empty_app_core: Use new DT node to check lfxo enabled CONFIG_SOC_ENABLE_LFXO has been deprecated in zephyr in favour of a DT_NODE, so update the handling of this in empty_app_core sample. Signed-off-by: Sean Madigan --- samples/nrf5340/empty_app_core/src/main.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/samples/nrf5340/empty_app_core/src/main.c b/samples/nrf5340/empty_app_core/src/main.c index df490a7a8e35..764f7bdfe69e 100644 --- a/samples/nrf5340/empty_app_core/src/main.c +++ b/samples/nrf5340/empty_app_core/src/main.c @@ -10,6 +10,8 @@ #include #include +#define LFXO_NODE DT_NODELABEL(lfxo) + /** @brief Power OFF entire RAM and suspend CPU forever. * * Function operates only on `register` variables, so GCC will not use @@ -59,7 +61,11 @@ static int network_gpio_allow(void) * and P0.01 (XL2), as they need to stay configured with the value * Peripheral. */ - uint32_t start_pin = (IS_ENABLED(CONFIG_SOC_ENABLE_LFXO) ? 2 : 0); +#if DT_NODE_HAS_PROP(LFXO_NODE, load_capacitors) || defined(CONFIG_SOC_ENABLE_LFXO) + uint32_t start_pin = 2; +#else + uint32_t start_pin = 0; +#endif /* Allow the network core to use all GPIOs. */ for (uint32_t i = start_pin; i < P0_PIN_NUM; i++) { From ce4b1947edbacf36faca61af4715eb3b4f73401e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 25 Jan 2025 10:22:48 +0100 Subject: [PATCH 065/109] tests: download_client: Update after zsock_close_ctx() signature change MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Now the function requires additional parameter with the socket number. Signed-off-by: Andrzej Głąbek --- tests/subsys/net/lib/download_client/src/mock/socket.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/subsys/net/lib/download_client/src/mock/socket.c b/tests/subsys/net/lib/download_client/src/mock/socket.c index 1583389570a7..c9b84549179a 100644 --- a/tests/subsys/net/lib/download_client/src/mock/socket.c +++ b/tests/subsys/net/lib/download_client/src/mock/socket.c @@ -48,10 +48,10 @@ static ssize_t mock_socket_offload_write(void *obj, const void *buffer, size_t c return mock_socket_offload_sendto(obj, buffer, count, 0, NULL, 0); } -static int mock_socket_offload_close(void *obj) +static int mock_socket_offload_close2(void *obj, int fd) { k_sleep(K_MSEC(50)); - return zsock_close_ctx(obj); + return zsock_close_ctx(obj, fd); } static int mock_socket_offload_ioctl(void *obj, unsigned int request, va_list args) @@ -141,7 +141,7 @@ static const struct socket_op_vtable mock_socket_fd_op_vtable = { .fd_vtable = { .read = mock_socket_offload_read, .write = mock_socket_offload_write, - .close = mock_socket_offload_close, + .close2 = mock_socket_offload_close2, .ioctl = mock_socket_offload_ioctl, }, .bind = mock_socket_offload_bind, From 70f05d829e219c9c5216b0f1434dd02974191284 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 25 Jan 2025 10:35:45 +0100 Subject: [PATCH 066/109] samples: bluetooth: conn_time_sync: Enable nrfx_gppi explicitly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This sample uses the nrfx_gppi helper (see timed_led_toggle.c) but does not enable it in its configuration. For nRF52 and nRF53, this module is enabled by the UART driver, but this is not the case for nRF54H. Enable the module explicitly to avoid such discrepancies. Signed-off-by: Andrzej Głąbek --- samples/bluetooth/conn_time_sync/prj.conf | 2 ++ 1 file changed, 2 insertions(+) diff --git a/samples/bluetooth/conn_time_sync/prj.conf b/samples/bluetooth/conn_time_sync/prj.conf index a90029f7f011..24d416b59707 100644 --- a/samples/bluetooth/conn_time_sync/prj.conf +++ b/samples/bluetooth/conn_time_sync/prj.conf @@ -22,3 +22,5 @@ CONFIG_CONSOLE_GETCHAR=y CONFIG_BT_CTLR_SDC_CONN_ANCHOR_POINT_REPORT=y CONFIG_BT_HCI_VS_EVT_USER=y + +CONFIG_NRFX_GPPI=y From e9f2b0a61beb1c177d893b5aabae94f717d1f9cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Sat, 25 Jan 2025 10:58:12 +0100 Subject: [PATCH 067/109] samples: wifi: twt: Remove assignment to CONFIG_NET_TCP_ACK_TIMEOUT MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This option was deprecated and has been finally removed. See Zephyr PR 82722. Signed-off-by: Andrzej Głąbek --- samples/wifi/twt/prj.conf | 1 - 1 file changed, 1 deletion(-) diff --git a/samples/wifi/twt/prj.conf b/samples/wifi/twt/prj.conf index ec4a570f5d7e..1e1db3148d27 100644 --- a/samples/wifi/twt/prj.conf +++ b/samples/wifi/twt/prj.conf @@ -36,7 +36,6 @@ CONFIG_HEAP_MEM_POOL_SIZE=210000 CONFIG_NET_TC_TX_COUNT=1 # Below configs will increase tcp connection timeout -CONFIG_NET_TCP_ACK_TIMEOUT=60000 CONFIG_NET_TCP_INIT_RETRANSMISSION_TIMEOUT=1000 CONFIG_NET_SOCKETS_CONNECT_TIMEOUT=10000 CONFIG_NET_TCP_RETRY_COUNT=10 From 5e550ab377c2af4f58f6fcad869a78237f6a97f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Mon, 27 Jan 2025 09:25:02 +0100 Subject: [PATCH 068/109] samples: bluetooth: iso_time_sync: Update configuration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Since the dependencies of `BT_ISO_CENTRAL/PERIPHERAL` options have changed and they no longer select `BT_CENTRAL/PERIPHERAL` options but rather depend on them, the latter must be explicitly enabled. Also enable the nrfx_gppi helper explicitly as the sample uses it (see controller_time_*.c). For nRF54H it will not be enabled by the UART driver like it happens for nRF52 and nRF53. Signed-off-by: Andrzej Głąbek --- samples/bluetooth/iso_time_sync/prj.conf | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/samples/bluetooth/iso_time_sync/prj.conf b/samples/bluetooth/iso_time_sync/prj.conf index a301daaf51d4..f29213d091d1 100644 --- a/samples/bluetooth/iso_time_sync/prj.conf +++ b/samples/bluetooth/iso_time_sync/prj.conf @@ -4,6 +4,8 @@ CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_OBSERVER=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y CONFIG_BT_DEVICE_NAME="Nordic_ISO" CONFIG_BT_MAX_CONN=5 @@ -18,6 +20,8 @@ CONFIG_BT_CTLR_CONN_ISO_STREAMS=4 CONFIG_BT_ISO_TX_MTU=6 CONFIG_BT_ISO_RX_MTU=23 +CONFIG_NRFX_GPPI=y + CONFIG_CONSOLE=y CONFIG_CONSOLE_SUBSYS=y CONFIG_CONSOLE_HANDLER=y From 77b5579e7a58d93e1b28cbffd74c2c060f2e6ca9 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Mon, 27 Jan 2025 17:49:22 +0530 Subject: [PATCH 069/109] net: lib: nrf70_fw_ext: Rectify the BUILD_ONLY flag name The BUILD_ONLY flag name has been unified in upstream zephyr. Update the flags in downstream accordingly. Signed-off-by: Ravi Dondaputi --- subsys/net/lib/nrf70_fw_ext/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/net/lib/nrf70_fw_ext/CMakeLists.txt b/subsys/net/lib/nrf70_fw_ext/CMakeLists.txt index 3a9d43bdaf5b..fa4029208539 100644 --- a/subsys/net/lib/nrf70_fw_ext/CMakeLists.txt +++ b/subsys/net/lib/nrf70_fw_ext/CMakeLists.txt @@ -4,7 +4,7 @@ # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause # -if(CONFIG_NRF_WIFI_BUILD_ONLY_MODE) +if(CONFIG_BUILD_ONLY_NO_BLOBS) return() endif() From 54dbb46423f4491971c5ea9d03ff8db0321cb786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 28 Jan 2025 09:39:57 +0100 Subject: [PATCH 070/109] wifi: samples: Shell: Set CONFIG_HOSTAP_CRYPTO_ALT_LEGACY_PSA MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Previously there may have been a CONFIG_HOSTAP_CRYPTO_LEGACY_PSA config but this is causing build-failures. This commit updates shell-sample to use CONFIG_HOSTAP_CRYPTO_ALT_LEGACY_PSA as extra_args Signed-off-by: Frank Audun Kvamtrø --- samples/wifi/shell/sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index 03bb097e220b..776a32c1b985 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -457,7 +457,7 @@ tests: - ci_samples_wifi sample.nrf7002.shell.psa: build_only: true - extra_args: CONFIG_HOSTAP_CRYPTO_LEGACY_PSA=y + extra_args: CONFIG_HOSTAP_CRYPTO_ALT_LEGACY_PSA=y integration_platforms: - nrf7002dk/nrf5340/cpuapp platform_allow: nrf7002dk/nrf5340/cpuapp From 5cf3ef9a80ff4901e67172299d622b64b1560fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 28 Jan 2025 10:53:19 +0100 Subject: [PATCH 071/109] wifi: Add internal support for DES for CONFIG_HOSTAP_CRYPTO_ENTERPRISE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Adds des-internal.c if CONFIG_HOSTAP_CRYPTO_ENTERPRISE is set Signed-off-by: Frank Audun Kvamtrø --- subsys/net/lib/hostap_crypto/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/hostap_crypto/CMakeLists.txt b/subsys/net/lib/hostap_crypto/CMakeLists.txt index 8b3968ab0e82..fc25f5f246c8 100644 --- a/subsys/net/lib/hostap_crypto/CMakeLists.txt +++ b/subsys/net/lib/hostap_crypto/CMakeLists.txt @@ -43,6 +43,7 @@ if(DEFINED CONFIG_HOSTAP_CRYPTO_ALT_LEGACY OR ) zephyr_library_sources_ifdef(CONFIG_HOSTAP_CRYPTO_ENTERPRISE + ${HOSTAP_SRC_BASE}/crypto/des-internal.c ${HOSTAP_SRC_BASE}/crypto/ms_funcs.c ${HOSTAP_SRC_BASE}/crypto/aes-eax.c ${HOSTAP_SRC_BASE}/crypto/md4-internal.c From 973599f5cdbc8fb703b8cf76d39e72ed291fd50d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 28 Jan 2025 12:23:27 +0100 Subject: [PATCH 072/109] wifi: Enable MBEDTLS_SSL_SERVER_NAME_INDICATION for enterprise MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Setting the Mbed TLS named configuration for server name indication MBEDTLS_SSL_SERVER_NAME_INDICATION for WIFI enterprise. -Note that Zephyr has a misnamed configuration MBEDTLS_SERVER_NAME_INDICATION (missing infix label SSL_) Signed-off-by: Frank Audun Kvamtrø --- subsys/net/lib/hostap_crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/hostap_crypto/Kconfig b/subsys/net/lib/hostap_crypto/Kconfig index 0f064c83450f..f0fa6ed66de5 100644 --- a/subsys/net/lib/hostap_crypto/Kconfig +++ b/subsys/net/lib/hostap_crypto/Kconfig @@ -110,6 +110,7 @@ config HOSTAP_CRYPTO_ENTERPRISE select MBEDTLS_X509_CRL_PARSE_C select MBEDTLS_TLS_VERSION_1_2 select MBEDTLS_RSA_C + select MBEDTLS_SSL_SERVER_NAME_INDICATION default y endif From 07744342d044a1869f043cb9ea0f95beb948fcf5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 28 Jan 2025 13:30:27 +0100 Subject: [PATCH 073/109] tests: nrfx_integration_tests: Kconfig: Use NRFX_GPPI to enable PPIs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable the nrfx_gppi helper via the NRFX_GPPI option as this will cause all available PPI, DPPI, and PPIB instances to be enabled in respective drivers. Signed-off-by: Andrzej Głąbek --- tests/drivers/nrfx_integration_test/Kconfig | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/drivers/nrfx_integration_test/Kconfig b/tests/drivers/nrfx_integration_test/Kconfig index 26dbc3ea32d8..b3775f55a876 100644 --- a/tests/drivers/nrfx_integration_test/Kconfig +++ b/tests/drivers/nrfx_integration_test/Kconfig @@ -12,7 +12,6 @@ config NRFX_ALL_DRIVERS select NRFX_ADC if HAS_HW_NRF_ADC select NRFX_CLOCK if HAS_HW_NRF_CLOCK && !CLOCK_CONTROL_MPSL select NRFX_COMP if HAS_HW_NRF_COMP - select NRFX_DPPI if HAS_HW_NRF_DPPIC select NRFX_EGU0 if HAS_HW_NRF_EGU0 select NRFX_EGU1 if HAS_HW_NRF_EGU1 select NRFX_EGU2 if HAS_HW_NRF_EGU2 @@ -25,6 +24,7 @@ config NRFX_ALL_DRIVERS select NRFX_GPIOTE30 if HAS_HW_NRF_GPIOTE30 select NRFX_GPIOTE130 if HAS_HW_NRF_GPIOTE130 select NRFX_GPIOTE131 if HAS_HW_NRF_GPIOTE131 + select NRFX_GPPI select NRFX_I2S if HAS_HW_NRF_I2S select NRFX_IPC if HAS_HW_NRF_IPC select NRFX_LPCOMP if HAS_HW_NRF_LPCOMP @@ -35,7 +35,6 @@ config NRFX_ALL_DRIVERS || $(dt_has_compat,$(DT_COMPAT_NORDIC_NRF91_FLASH_CONTROLLER)) select NRFX_PDM if HAS_HW_NRF_PDM select NRFX_POWER if HAS_HW_NRF_POWER - select NRFX_PPI if HAS_HW_NRF_PPI select NRFX_PWM0 if HAS_HW_NRF_PWM0 select NRFX_PWM1 if HAS_HW_NRF_PWM1 select NRFX_PWM2 if HAS_HW_NRF_PWM2 From 110782f5391dc93eedac02eecfbbc9d19c1e21c0 Mon Sep 17 00:00:00 2001 From: alperen sener Date: Tue, 28 Jan 2025 14:02:37 +0100 Subject: [PATCH 074/109] tests: bluetooth: mesh: Add setting kconfig for the test case Settings configuration should be done explicitly otherwise trusted storage fails to build. Signed-off-by: alperen sener --- tests/subsys/bluetooth/mesh/models/testcase.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/subsys/bluetooth/mesh/models/testcase.yaml b/tests/subsys/bluetooth/mesh/models/testcase.yaml index 7c66984784c8..af80c97e6d53 100644 --- a/tests/subsys/bluetooth/mesh/models/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/models/testcase.yaml @@ -24,7 +24,9 @@ tests: # no-settings build. These should be listed here, and be wrapped # in an #ifdef CONFIG_BT_SETTINGS in main.c. extra_configs: + - CONFIG_SETTINGS=y - CONFIG_BT_SETTINGS=y + - CONFIG_NVS=y - CONFIG_BT_MESH_SCENE_SRV=y - CONFIG_BT_MESH_SCHEDULER_SRV=y tags: sysbuild From 53ba636208ebed7d073d27db19825325f44302a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 27 Jan 2025 13:22:22 +0100 Subject: [PATCH 075/109] mesh: tests: Deprecate usage of TinyCrypt in tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Changing from using CONFIG_BT_MESH_USES_TINYCRYPT to CONFIG_BT_MESH_USES_MBEDTLS_PSA for mesh tests because TinyCrypt is deprecated -Adding boards/native_sim.conf for mesh tests to enable usage of builtin Mbed TLS (nrf_security not supported): -light_ctrl -light_hue -scheduler_model/action_planning -scheduler_model/message_validity -scheduler_model/timing Signed-off-by: Frank Audun Kvamtrø --- tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt | 2 +- .../subsys/bluetooth/mesh/light_ctrl/boards/native_sim.conf | 5 +++++ tests/subsys/bluetooth/mesh/light_hue/CMakeLists.txt | 2 +- tests/subsys/bluetooth/mesh/light_hue/boards/native_sim.conf | 5 +++++ .../mesh/scheduler_model/action_planning/CMakeLists.txt | 2 +- .../scheduler_model/action_planning/boards/native_sim.conf | 5 +++++ .../mesh/scheduler_model/message_validity/CMakeLists.txt | 2 +- .../scheduler_model/message_validity/boards/native_sim.conf | 5 +++++ .../bluetooth/mesh/scheduler_model/timing/CMakeLists.txt | 2 +- .../mesh/scheduler_model/timing/boards/native_sim.conf | 5 +++++ tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt | 2 +- .../bluetooth/mesh/sensor_subsys/boards/native_sim.conf | 5 +++++ .../bluetooth/mesh/silvair_enocean_model/CMakeLists.txt | 2 +- .../mesh/silvair_enocean_model/boards/native_sim.conf | 5 +++++ tests/subsys/bluetooth/mesh/time_model/CMakeLists.txt | 2 +- .../subsys/bluetooth/mesh/time_model/boards/native_sim.conf | 5 +++++ 16 files changed, 48 insertions(+), 8 deletions(-) create mode 100644 tests/subsys/bluetooth/mesh/light_ctrl/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/light_hue/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/scheduler_model/action_planning/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/scheduler_model/message_validity/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/scheduler_model/timing/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/sensor_subsys/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/silvair_enocean_model/boards/native_sim.conf create mode 100644 tests/subsys/bluetooth/mesh/time_model/boards/native_sim.conf diff --git a/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt b/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt index 9c792a7f8fc8..425a772d826d 100644 --- a/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/light_ctrl/CMakeLists.txt @@ -60,7 +60,7 @@ target_compile_options(app -DCONFIG_BT_MESH_LIGHT_CTRL_AMB_LIGHT_LEVEL_TIMEOUT=20 -DCONFIG_BT_MESH_SENSOR_CHANNELS_MAX=1 -DCONFIG_BT_MESH_SENSOR_CHANNEL_ENCODED_SIZE_MAX=4 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_linker_sources(SECTIONS ${ZEPHYR_NRF_MODULE_DIR}/subsys/bluetooth/mesh/sensor_types.ld) diff --git a/tests/subsys/bluetooth/mesh/light_ctrl/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/light_ctrl/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/light_ctrl/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/light_hue/CMakeLists.txt b/tests/subsys/bluetooth/mesh/light_hue/CMakeLists.txt index 516e37b8dadb..19779323eac5 100644 --- a/tests/subsys/bluetooth/mesh/light_hue/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/light_hue/CMakeLists.txt @@ -28,7 +28,7 @@ target_compile_options(app -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_BASE=3000 -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_PER_HOP=50 -DCONFIG_BT_LOG_LEVEL=0 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/light_hue/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/light_hue/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/light_hue/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt index c170bb0c970b..387c8811df82 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/CMakeLists.txt @@ -33,7 +33,7 @@ target_compile_options(app -DCONFIG_BT_MESH_MODEL_LOG_LEVEL=0 -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_BASE=0 -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_PER_HOP=0 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/scheduler_model/action_planning/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt index d74d26a14aed..96d2daf2c09c 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/CMakeLists.txt @@ -34,7 +34,7 @@ target_compile_options(app -DCONFIG_BT_MESH_MODEL_LOG_LEVEL=0 -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_BASE=0 -DCONFIG_BT_MESH_MOD_ACKD_TIMEOUT_PER_HOP=0 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/scheduler_model/message_validity/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt b/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt index dae05039b157..2a6ea40d013e 100644 --- a/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/scheduler_model/timing/CMakeLists.txt @@ -29,7 +29,7 @@ target_compile_options(app -DCONFIG_BT_MESH_MODEL_GROUP_COUNT=5 -DCONFIG_BT_LOG_LEVEL=0 -DCONFIG_BT_MESH_SCHEDULER_SRV=1 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/scheduler_model/timing/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/scheduler_model/timing/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/scheduler_model/timing/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt b/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt index 039fcf1ca0f7..fca2605c31c5 100644 --- a/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/sensor_subsys/CMakeLists.txt @@ -28,7 +28,7 @@ target_compile_options(app -DCONFIG_BT_MESH_SENSOR_CHANNELS_MAX=5 -DCONFIG_BT_MESH_SENSOR_CHANNEL_ENCODED_SIZE_MAX=4 -DCONFIG_BT_LOG_LEVEL=0 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_linker_sources(SECTIONS sensor_types.ld) diff --git a/tests/subsys/bluetooth/mesh/sensor_subsys/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/sensor_subsys/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/sensor_subsys/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt b/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt index 44f4ed7f1a6a..6612b48e6f0f 100644 --- a/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/silvair_enocean_model/CMakeLists.txt @@ -29,7 +29,7 @@ target_compile_options(app -DCONFIG_BT_MESH_SILVAIR_ENOCEAN_AUTO_COMMISSION=1 -DCONFIG_BT_MESH_MODEL_KEY_COUNT=1 -DCONFIG_BT_MESH_MODEL_GROUP_COUNT=1 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/silvair_enocean_model/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/silvair_enocean_model/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/silvair_enocean_model/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y diff --git a/tests/subsys/bluetooth/mesh/time_model/CMakeLists.txt b/tests/subsys/bluetooth/mesh/time_model/CMakeLists.txt index a567bb27755c..4eb4f5dbfcd7 100644 --- a/tests/subsys/bluetooth/mesh/time_model/CMakeLists.txt +++ b/tests/subsys/bluetooth/mesh/time_model/CMakeLists.txt @@ -31,7 +31,7 @@ target_compile_options(app -DCONFIG_BT_MESH_TIME_SRV=1 -DCONFIG_BT_MESH_TIME_SRV_CLOCK_ACCURACY=500 -DCONFIG_BT_MESH_TIME_MESH_HOP_UNCERTAINTY=30 - -DCONFIG_BT_MESH_USES_TINYCRYPT + -DCONFIG_BT_MESH_USES_MBEDTLS_PSA=1 ) zephyr_ld_options( diff --git a/tests/subsys/bluetooth/mesh/time_model/boards/native_sim.conf b/tests/subsys/bluetooth/mesh/time_model/boards/native_sim.conf new file mode 100644 index 000000000000..ea81401fcb11 --- /dev/null +++ b/tests/subsys/bluetooth/mesh/time_model/boards/native_sim.conf @@ -0,0 +1,5 @@ +# nrf_security only supports Cortex-M via PSA crypto libraries. +# Enforcing usage of built-in Mbed TLS for native simulator. +CONFIG_MBEDTLS=y +CONFIG_MBEDTLS_BUILTIN=y +CONFIG_BT_MESH_USES_MBEDTLS_PSA=y From d11f18080a1a2ebecb2c67a2c08b424336eeebf1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 27 Jan 2025 13:27:45 +0100 Subject: [PATCH 076/109] mesh: Add link to mbedTLS for simulator tests to find psa/crypto.h MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Fixes issues with some zephyr-located tests for BLE mesh. Signed-off-by: Frank Audun Kvamtrø --- subsys/bluetooth/mesh/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/subsys/bluetooth/mesh/CMakeLists.txt b/subsys/bluetooth/mesh/CMakeLists.txt index 047cdcc8b28b..95411e9e21c3 100644 --- a/subsys/bluetooth/mesh/CMakeLists.txt +++ b/subsys/bluetooth/mesh/CMakeLists.txt @@ -80,3 +80,7 @@ zephyr_linker_sources(SECTIONS sensor_types.ld) zephyr_linker_sources(SECTIONS scene_types.ld) zephyr_library_sources_ifdef(CONFIG_BT_MESH_RPL_STORAGE_MODE_EMDS rpl.c) + +if (CONFIG_BT_MESH_USES_MBEDTLS_PSA AND (NOT CONFIG_SOC_FAMILY_NORDIC_NRF)) + zephyr_library_link_libraries(mbedTLS) +endif() From f6086f9b2deb191a10c8da63cd1b527176194edb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Tue, 28 Jan 2025 18:53:24 +0100 Subject: [PATCH 077/109] ble: mesh: tests: Disabling QEMU target for BLE mesh test-cases MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -QEMU target is not setting SOC_FAMILY_NORDIC_NRF so it doesn't build with PSA crypto enabled. Disabling qemu_cortex_m3 for: -light_ctrl -light_hue -sensor_subsys -silvair_enocean_model Signed-off-by: Frank Audun Kvamtrø --- tests/subsys/bluetooth/mesh/light_ctrl/testcase.yaml | 3 +-- tests/subsys/bluetooth/mesh/light_hue/testcase.yaml | 3 +-- tests/subsys/bluetooth/mesh/sensor_subsys/testcase.yaml | 2 -- .../subsys/bluetooth/mesh/silvair_enocean_model/testcase.yaml | 2 -- 4 files changed, 2 insertions(+), 8 deletions(-) diff --git a/tests/subsys/bluetooth/mesh/light_ctrl/testcase.yaml b/tests/subsys/bluetooth/mesh/light_ctrl/testcase.yaml index 04e33d8fecfc..293982fe66ac 100644 --- a/tests/subsys/bluetooth/mesh/light_ctrl/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/light_ctrl/testcase.yaml @@ -3,10 +3,9 @@ tests: sysbuild: true platform_allow: - native_sim - - qemu_cortex_m3 tags: - bluetooth - ci_build - sysbuild integration_platforms: - - qemu_cortex_m3 + - native_sim diff --git a/tests/subsys/bluetooth/mesh/light_hue/testcase.yaml b/tests/subsys/bluetooth/mesh/light_hue/testcase.yaml index fad7d7a9cc70..be5c2a93dbc6 100644 --- a/tests/subsys/bluetooth/mesh/light_hue/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/light_hue/testcase.yaml @@ -3,10 +3,9 @@ tests: sysbuild: true platform_allow: - native_sim - - qemu_cortex_m3 tags: - bluetooth - ci_build - sysbuild integration_platforms: - - qemu_cortex_m3 + - native_sim diff --git a/tests/subsys/bluetooth/mesh/sensor_subsys/testcase.yaml b/tests/subsys/bluetooth/mesh/sensor_subsys/testcase.yaml index 72e43413976c..5c1aa8fb625f 100644 --- a/tests/subsys/bluetooth/mesh/sensor_subsys/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/sensor_subsys/testcase.yaml @@ -3,11 +3,9 @@ tests: sysbuild: true platform_allow: - native_sim - - qemu_cortex_m3 tags: - bluetooth - ci_build - sysbuild integration_platforms: - native_sim - - qemu_cortex_m3 diff --git a/tests/subsys/bluetooth/mesh/silvair_enocean_model/testcase.yaml b/tests/subsys/bluetooth/mesh/silvair_enocean_model/testcase.yaml index b920836cddb6..7419f0177cf2 100644 --- a/tests/subsys/bluetooth/mesh/silvair_enocean_model/testcase.yaml +++ b/tests/subsys/bluetooth/mesh/silvair_enocean_model/testcase.yaml @@ -3,11 +3,9 @@ tests: sysbuild: true platform_allow: - native_sim - - qemu_cortex_m3 tags: - bluetooth - ci_build - sysbuild integration_platforms: - native_sim - - qemu_cortex_m3 From b2d2485b39baa1d04e980644474225bb19a87297 Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 29 Jan 2025 14:52:01 +0100 Subject: [PATCH 078/109] suit: Remove dependency between dfu_target and SSF The dfu_target uses suit_dfu library and does not use SSF services directly. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- subsys/dfu/dfu_target/src/dfu_target_suit.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/subsys/dfu/dfu_target/src/dfu_target_suit.c b/subsys/dfu/dfu_target/src/dfu_target_suit.c index 09a817c87440..caa59c790e9a 100644 --- a/subsys/dfu/dfu_target/src/dfu_target_suit.c +++ b/subsys/dfu/dfu_target/src/dfu_target_suit.c @@ -9,9 +9,6 @@ #include #include #include -#ifdef CONFIG_SSF_SUIT_SERVICE_ENABLED -#include -#endif /* CONFIG_SSF_SUIT_SERVICE_ENABLED */ #include #ifdef CONFIG_DFU_TARGET_SUIT_CACHE_PROCESSING #include @@ -197,7 +194,7 @@ int dfu_target_suit_reset(void) return rc; } - suit_ssf_err_t err = suit_dfu_cleanup(); + int err = suit_dfu_cleanup(); stream_flash_in_use = false; stream_buf_bytes = 0; @@ -215,7 +212,7 @@ int dfu_target_suit_reboot(void) { k_msleep(CONFIG_DFU_TARGET_REBOOT_RESET_DELAY_MS); - suit_ssf_err_t err = suit_dfu_update_start(); + int err = suit_dfu_update_start(); if (err < 0) { LOG_ERR("Failed to start firmware upgrade!"); From 9651aba96d6b347d38712a9964428f1a9fe079ce Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 29 Jan 2025 14:53:42 +0100 Subject: [PATCH 079/109] suit: Link envelope info with platform error lib Since envelope info library includes directly the platform error header, it is far easier to link them in CMake than remember to manually link platform error with each file that uses envelope info interface. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- subsys/suit/envelope_info/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/suit/envelope_info/CMakeLists.txt b/subsys/suit/envelope_info/CMakeLists.txt index 2ab75e3b2517..29e7bf958ccd 100644 --- a/subsys/suit/envelope_info/CMakeLists.txt +++ b/subsys/suit/envelope_info/CMakeLists.txt @@ -8,11 +8,11 @@ zephyr_interface_library_named(suit_envelope_info) target_include_directories(suit_envelope_info INTERFACE include) +target_link_libraries(suit_envelope_info INTERFACE suit_platform_err) zephyr_library() zephyr_library_sources(src/suit_envelope_info.c) zephyr_library_link_libraries(suit_envelope_info) -zephyr_library_link_libraries(suit_platform_err) zephyr_library_link_libraries(suit_utils) zephyr_library_link_libraries(suit_memory_layout_interface) From e75cc9f737469d6c2ea144df4ee69124cd09997d Mon Sep 17 00:00:00 2001 From: Tomasz Chyrowicz Date: Wed, 29 Jan 2025 14:55:51 +0100 Subject: [PATCH 080/109] tests: Disable SSF if interface is mocked The test uses SSF interface mock instead, so disable the SSF to avoid two implementations of the same interface. Ref: NCSDK-31359 Signed-off-by: Tomasz Chyrowicz --- .../dfu/dfu_target/suit/boards/nrf54h20dk_nrf54h20_cpuapp.conf | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/subsys/dfu/dfu_target/suit/boards/nrf54h20dk_nrf54h20_cpuapp.conf b/tests/subsys/dfu/dfu_target/suit/boards/nrf54h20dk_nrf54h20_cpuapp.conf index e9a2c8ac775f..182cacb2ddae 100644 --- a/tests/subsys/dfu/dfu_target/suit/boards/nrf54h20dk_nrf54h20_cpuapp.conf +++ b/tests/subsys/dfu/dfu_target/suit/boards/nrf54h20dk_nrf54h20_cpuapp.conf @@ -8,3 +8,6 @@ CONFIG_LOG=y CONFIG_LOG_BACKEND_UART=y CONFIG_LOG_MODE_DEFERRED=y + +# Disable SUIT SSF service and use mocks instead +CONFIG_SSF_SUIT_SERVICE_ENABLED=n From c45b0ec65fb94304737dbf0f57da919a5c29e18f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Wed, 29 Jan 2025 19:02:44 +0100 Subject: [PATCH 081/109] quarantine_zephyr: Add new secure_storage samples/tests for nRF54H20 PPR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Those fail to build due to RAM overflows. Signed-off-by: Andrzej Głąbek --- scripts/quarantine_zephyr.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index 9cea7440dec9..04e47f55e6e3 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -359,6 +359,12 @@ - net.http.server.crime - drivers.gpio.build - sample.perf + - sample.psa.its.secure_storage.entropy_not_secure + - sample.psa.persistent_key.secure_storage.entropy_not_secure + - secure_storage.psa.crypto.secure_storage + - secure_storage.psa.its.secure_storage.custom.both + - secure_storage.psa.its.secure_storage.custom.store + - secure_storage.psa.its.secure_storage.store.settings platforms: - nrf54h20dk@0.9.0/nrf54h20/cpuppr comment: "region RAM/FLASH overflowed" From 9e0e0ffc9cb52b8835a9ca79410f2478c69370e3 Mon Sep 17 00:00:00 2001 From: Tommi Rantanen Date: Thu, 30 Jan 2025 11:43:45 +0200 Subject: [PATCH 082/109] tests: lib: date_time: Fix cmock generation due to sntp param rename sntp_query()'s time parameter was renamed to ts so corresponding change needed to cmock usage. Signed-off-by: Tommi Rantanen --- tests/lib/date_time/src/main.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/lib/date_time/src/main.c b/tests/lib/date_time/src/main.c index 5bdd5c3e97ee..233fc6034b06 100644 --- a/tests/lib/date_time/src/main.c +++ b/tests/lib/date_time/src/main.c @@ -483,8 +483,8 @@ void test_date_time_initial_auto_update_at_1s_from_boot(void) __cmock_sntp_query_ExpectAndReturn(NULL, 5000, NULL, 0); __cmock_sntp_query_IgnoreArg_ctx(); - __cmock_sntp_query_IgnoreArg_time(); - __cmock_sntp_query_ReturnThruPtr_time(&sntp_time_value); + __cmock_sntp_query_IgnoreArg_ts(); + __cmock_sntp_query_ReturnThruPtr_ts(&sntp_time_value); __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_sntp_close_ExpectAnyArgs(); @@ -859,8 +859,8 @@ void test_date_time_update_all_retry_ntp_fail(void) __cmock_sntp_init_ExpectAnyArgsAndReturn(0); __cmock_sntp_query_ExpectAndReturn(NULL, 5000, NULL, -1); __cmock_sntp_query_IgnoreArg_ctx(); - __cmock_sntp_query_IgnoreArg_time(); - __cmock_sntp_query_ReturnThruPtr_time(&sntp_time_value); + __cmock_sntp_query_IgnoreArg_ts(); + __cmock_sntp_query_ReturnThruPtr_ts(&sntp_time_value); __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_sntp_close_ExpectAnyArgs(); @@ -899,8 +899,8 @@ void test_date_time_update_all_retry_ntp_fail(void) __cmock_sntp_init_ExpectAnyArgsAndReturn(0); __cmock_sntp_query_ExpectAndReturn(NULL, 5000, NULL, -1); __cmock_sntp_query_IgnoreArg_ctx(); - __cmock_sntp_query_IgnoreArg_time(); - __cmock_sntp_query_ReturnThruPtr_time(&sntp_time_value); + __cmock_sntp_query_IgnoreArg_ts(); + __cmock_sntp_query_ReturnThruPtr_ts(&sntp_time_value); __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_sntp_close_ExpectAnyArgs(); @@ -925,8 +925,8 @@ void test_date_time_update_all_retry_ntp_fail(void) __cmock_sntp_init_ExpectAnyArgsAndReturn(0); __cmock_sntp_query_ExpectAndReturn(NULL, 5000, NULL, -1); __cmock_sntp_query_IgnoreArg_ctx(); - __cmock_sntp_query_IgnoreArg_time(); - __cmock_sntp_query_ReturnThruPtr_time(&sntp_time_value); + __cmock_sntp_query_IgnoreArg_ts(); + __cmock_sntp_query_ReturnThruPtr_ts(&sntp_time_value); __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_sntp_close_ExpectAnyArgs(); @@ -939,8 +939,8 @@ void test_date_time_update_all_retry_ntp_fail(void) __cmock_sntp_init_ExpectAnyArgsAndReturn(0); __cmock_sntp_query_ExpectAndReturn(NULL, 5000, NULL, -1); __cmock_sntp_query_IgnoreArg_ctx(); - __cmock_sntp_query_IgnoreArg_time(); - __cmock_sntp_query_ReturnThruPtr_time(&sntp_time_value); + __cmock_sntp_query_IgnoreArg_ts(); + __cmock_sntp_query_ReturnThruPtr_ts(&sntp_time_value); __cmock_zsock_freeaddrinfo_ExpectAnyArgs(); __cmock_sntp_close_ExpectAnyArgs(); From 43a32acdebb9e71ad4dbc0a10c6cb7edf20c474f Mon Sep 17 00:00:00 2001 From: Alexander Svensen Date: Thu, 30 Jan 2025 10:55:29 +0100 Subject: [PATCH 083/109] tests: bsim: nrf_auraconfig: upmerge fixes - Set missing configs to get tests running - Changed define for broadcast_code as per migration guide - OCT-3172 --- tests/bluetooth/bsim/nrf_auraconfig/prj.conf | 2 ++ .../bluetooth/bsim/nrf_auraconfig/tester/include/nac_test.h | 2 +- tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf | 5 +++++ .../bsim/nrf_auraconfig/tester/src/nrf_auraconfig_test.c | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/tests/bluetooth/bsim/nrf_auraconfig/prj.conf b/tests/bluetooth/bsim/nrf_auraconfig/prj.conf index aa1ae4b366c7..7127891cc3a0 100644 --- a/tests/bluetooth/bsim/nrf_auraconfig/prj.conf +++ b/tests/bluetooth/bsim/nrf_auraconfig/prj.conf @@ -158,3 +158,5 @@ CONFIG_MODULE_SD_CARD_LOG_LEVEL_WRN=y CONFIG_BT_LE_AUDIO_TX_LOG_LEVEL_ERR=y CONFIG_DRAGOON_BUILD_FROM_SOURCE_OVERRIDE=y + +CONFIG_ENTROPY_GENERATOR=y diff --git a/tests/bluetooth/bsim/nrf_auraconfig/tester/include/nac_test.h b/tests/bluetooth/bsim/nrf_auraconfig/tester/include/nac_test.h index 92dc6a1b88b9..b6691851020c 100644 --- a/tests/bluetooth/bsim/nrf_auraconfig/tester/include/nac_test.h +++ b/tests/bluetooth/bsim/nrf_auraconfig/tester/include/nac_test.h @@ -37,7 +37,7 @@ struct nac_test_values_big { uint8_t phy; uint32_t pd_us; bool encryption; - uint8_t broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE + 1]; + uint8_t broadcast_code[BT_ISO_BROADCAST_CODE_SIZE + 1]; uint8_t num_subgroups; bool high_quality; bool std_quality; diff --git a/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf b/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf index 74172ad33195..05659f6133ce 100644 --- a/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf +++ b/tests/bluetooth/bsim/nrf_auraconfig/tester/prj.conf @@ -3,14 +3,19 @@ CONFIG_LOG=y CONFIG_LOG_MODE_IMMEDIATE=y CONFIG_DRAGOON_BUILD_FROM_SOURCE_OVERRIDE=y +CONFIG_ENTROPY_GENERATOR=y +CONFIG_BT_GATT_DYNAMIC_DB=y CONFIG_BT_AUDIO=y CONFIG_BT_PBP=y CONFIG_BT_SMP=y CONFIG_BT_PAC_SNK=y +CONFIG_BT_OBSERVER=y CONFIG_BT_PERIPHERAL=y +CONFIG_BT_ISO_PERIPHERAL=y CONFIG_BT_BAP_BROADCAST_SINK=y CONFIG_BT_BAP_SCAN_DELEGATOR=y +CONFIG_BT_ISO_SYNC_RECEIVER=y CONFIG_BT_ISO_MAX_CHAN=4 # Allocate 2 RX buffers per channel diff --git a/tests/bluetooth/bsim/nrf_auraconfig/tester/src/nrf_auraconfig_test.c b/tests/bluetooth/bsim/nrf_auraconfig/tester/src/nrf_auraconfig_test.c index d04afdab9377..b1149c68c2cc 100644 --- a/tests/bluetooth/bsim/nrf_auraconfig/tester/src/nrf_auraconfig_test.c +++ b/tests/bluetooth/bsim/nrf_auraconfig/tester/src/nrf_auraconfig_test.c @@ -90,7 +90,7 @@ static const struct bt_audio_codec_cap codec_cap = BT_AUDIO_CODEC_CAP_LC3( static const uint32_t bis_index_mask = BIT_MASK(ARRAY_SIZE(streams) + 1U); static uint32_t requested_bis_sync; static uint32_t bis_index_bitfield; -static uint8_t sink_broadcast_code[BT_AUDIO_BROADCAST_CODE_SIZE]; +static uint8_t sink_broadcast_code[BT_ISO_BROADCAST_CODE_SIZE]; static char broadcast_name_target[ADV_NAME_MAX + 1]; From 54392e60ca2d21633c97b467aea6cfbb8e5b316e Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 30 Jan 2025 10:52:02 +0000 Subject: [PATCH 084/109] tests: subsys: dfu: dfu_target_stream: Fix size Fixes an issue with this test wrongly using 0 as the area size Signed-off-by: Jamie McCrae --- tests/subsys/dfu/dfu_target_stream/src/main.c | 35 ++++++++++--------- 1 file changed, 19 insertions(+), 16 deletions(-) diff --git a/tests/subsys/dfu/dfu_target_stream/src/main.c b/tests/subsys/dfu/dfu_target_stream/src/main.c index e2f873c91438..93632e434345 100644 --- a/tests/subsys/dfu/dfu_target_stream/src/main.c +++ b/tests/subsys/dfu/dfu_target_stream/src/main.c @@ -12,8 +12,7 @@ #include #define FLASH_BASE (64*1024) -#define FLASH_SIZE DT_REG_SIZE(SOC_NV_FLASH_NODE) -#define FLASH_AVAILABLE (FLASH_SIZE-FLASH_BASE) +#define FLASH_AVAILABLE (16*1024) #define TEST_ID_1 "test_1" #define TEST_ID_2 "test_2" @@ -41,11 +40,15 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream) /* Null checks */ err = DFU_TARGET_STREAM_INIT(NULL, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_true(err < 0, "Unexpected success: %d", err); err = DFU_TARGET_STREAM_INIT(TEST_ID_1, NULL, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); + zassert_true(err < 0, "Unexpected success: %d", err); + + err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, NULL, sizeof(sbuf), + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_true(err < 0, "Unexpected success: %d", err); err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, NULL, sizeof(sbuf), @@ -54,14 +57,14 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream) /* Expected successful call */ err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Call _init again without calling "complete". This should result * in an error since only one id is supported simultaneously */ err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_true(err < 0, "Unexpected success: %d", err); /* Perform write, and verify offset */ @@ -85,7 +88,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream) * should be deleted. */ err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Read out the data to ensure that it was written correctly */ @@ -108,7 +111,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) zassert_equal(err, 0, "Unexpected failure: %d", err); err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Perform write, and verify offset */ @@ -126,7 +129,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) * verify that the offsets are the same. */ err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); err = dfu_target_stream_offset_get(&second_offset); @@ -142,7 +145,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) * verify that the offset is now 0, since we had a succesfull 'done'. */ err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); err = dfu_target_stream_offset_get(&second_offset); @@ -159,7 +162,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) /* Re-initialize dfu target, for 'TEST_ID_1' */ err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Verify that offset is 0 */ @@ -184,7 +187,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) * loaded is 0 even though it was just retained an non-0 for TEST_ID_1 */ err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); err = dfu_target_stream_offset_get(&first_offset); @@ -207,7 +210,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) zassert_equal(err, 0, "Unexpected failure: %d", err); err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Check that last erased page offset was set correctly when loading */ @@ -236,7 +239,7 @@ ZTEST(dfu_target_stream_test, test_dfu_target_stream_save_progress) err = dfu_target_stream_done(false); zassert_equal(err, 0, "Unexpected failure: %d", err); err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); zassert_equal(err, 0, "Unexpected failure: %d", err); /* Check that last erased page offset was set correctly when loading */ @@ -272,14 +275,14 @@ static void reset_stream_progress(const struct device *dev) int err; err = DFU_TARGET_STREAM_INIT(TEST_ID_1, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); __ASSERT(err == 0, "Unable to initialiae test stream %s: %d", TEST_ID_1, err); err = dfu_target_stream_reset(); __ASSERT(err == 0, "Unable to reset test stream %s: %d", TEST_ID_1, err); err = DFU_TARGET_STREAM_INIT(TEST_ID_2, fdev, sbuf, sizeof(sbuf), - FLASH_BASE, 0, NULL); + FLASH_BASE, FLASH_AVAILABLE, NULL); __ASSERT(err == 0, "Unable to initialiae test stream %s: %d", TEST_ID_2, err); err = dfu_target_stream_reset(); From 98f8bb80181af8b1505cc6c4f04fbb98ff1ee5b8 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Thu, 30 Jan 2025 11:48:07 +0000 Subject: [PATCH 085/109] bootloader: bl_validation: Do not output on external use Output uses logging, which has no guarantee of even being enabled or supported Signed-off-by: Jamie McCrae --- .../bootloader/bl_validation/bl_validation.c | 135 ++++++++++++------ 1 file changed, 95 insertions(+), 40 deletions(-) diff --git a/subsys/bootloader/bl_validation/bl_validation.c b/subsys/bootloader/bl_validation/bl_validation.c index c75a0b9909ba..eaa0e698dd66 100644 --- a/subsys/bootloader/bl_validation/bl_validation.c +++ b/subsys/bootloader/bl_validation/bl_validation.c @@ -202,16 +202,19 @@ static bool validate_signature(const uint32_t fw_src_address, const uint32_t fw_ int init_retval = bl_crypto_init(); if (init_retval) { - LOG_ERR("bl_crypto_init() returned %d.", init_retval); + if (!external) { + LOG_ERR("bl_crypto_init() returned %d.", init_retval); + } return false; } init_retval = verify_public_keys(); if (init_retval) { - LOG_ERR("verify_public_keys() returned %d.", init_retval); - if (init_retval == -EHASHFF) { - LOG_INF("A public key contains 0xFFFF, which is " - "unsupported"); + if (!external) { + LOG_ERR("verify_public_keys() returned %d.", init_retval); + if (init_retval == -EHASHFF) { + LOG_INF("A public key contains 0xFFFF, which is unsupported"); + } } return false; } @@ -230,19 +233,25 @@ static bool validate_signature(const uint32_t fw_src_address, const uint32_t fw_ if (read_retval != SB_PUBLIC_KEY_HASH_LEN) { if (read_retval == -EINVAL) { - LOG_INF("Key %d has been invalidated, try next.", - key_data_idx); + if (!external) { + LOG_INF("Key %d has been invalidated, try next.", + key_data_idx); + } continue; } else { - LOG_ERR("public_key_data_read failed: %d.", - read_retval); + if (!external) { + LOG_ERR("public_key_data_read failed: %d.", + read_retval); + } return false; } } - LOG_INF("Verifying signature against key %d.", key_data_idx); - LOG_INF("Hash: 0x%02x...%02x", key_data[0], - key_data[SB_PUBLIC_KEY_HASH_LEN-1]); + if (!external) { + LOG_INF("Verifying signature against key %d.", key_data_idx); + LOG_INF("Hash: 0x%02x...%02x", key_data[0], + key_data[SB_PUBLIC_KEY_HASH_LEN-1]); + } int retval = rot_verify(fw_val_info->public_key, key_data, fw_val_info->signature, @@ -251,22 +260,32 @@ static bool validate_signature(const uint32_t fw_src_address, const uint32_t fw_ if (retval == 0) { for (uint32_t i = 0; i < key_data_idx; i++) { - LOG_INF("Invalidating key %d.", i); + if (!external) { + LOG_INF("Invalidating key %d.", i); + } invalidate_public_key(i); } - LOG_INF("Firmware signature verified."); + if (!external) { + LOG_INF("Firmware signature verified."); + } return true; } else if (retval == -EHASHINV) { - LOG_WRN("Public key didn't match, try next."); + if (!external) { + LOG_WRN("Public key didn't match, try next."); + } continue; } else { - LOG_ERR("Firmware validation failed with error %d.", - retval); + if (!external) { + LOG_ERR("Firmware validation failed with error %d.", + retval); + } return false; } } - LOG_ERR("Failed to validate signature."); + if (!external) { + LOG_ERR("Failed to validate signature."); + } return false; } @@ -279,7 +298,9 @@ static bool validate_hash(const uint32_t fw_src_address, const uint32_t fw_size, int retval = bl_crypto_init(); if (retval) { - LOG_ERR("bl_crypto_init() returned %d.", retval); + if (!external) { + LOG_ERR("bl_crypto_init() returned %d.", retval); + } return false; } @@ -287,12 +308,16 @@ static bool validate_hash(const uint32_t fw_src_address, const uint32_t fw_size, fw_val_info->hash); if (retval != 0) { - LOG_ERR("Firmware validation failed with error %d.", - retval); + if (!external) { + LOG_ERR("Firmware validation failed with error %d.", + retval); + } return false; } - LOG_INF("Firmware hash verified."); + if (!external) { + LOG_INF("Firmware hash verified."); + } return true; } @@ -309,37 +334,51 @@ static bool validate_firmware(uint32_t fw_dst_address, uint32_t fw_src_address, const uint32_t fw_src_end = (fw_src_address + fwinfo->size); if (!fwinfo) { - LOG_ERR("NULL parameter."); + if (!external) { + LOG_ERR("NULL parameter."); + } return false; } if (!fw_info_check((uint32_t)fwinfo)) { - LOG_ERR("Invalid firmware info format."); + if (!external) { + LOG_ERR("Invalid firmware info format."); + } return false; } if (fw_dst_address != fwinfo->address) { - LOG_ERR("The firmware doesn't belong at destination addr."); + if (!external) { + LOG_ERR("The firmware doesn't belong at destination addr."); + } return false; } if (!external && (fw_src_address != fw_dst_address)) { - LOG_ERR("src and dst must be equal for local calls."); + if (!external) { + LOG_ERR("src and dst must be equal for local calls."); + } return false; } if (fw_info_find(fw_src_address) != fwinfo) { - LOG_ERR("Firmware info doesn't point to itself."); + if (!external) { + LOG_ERR("Firmware info doesn't point to itself."); + } return false; } if (fwinfo->valid != CONFIG_FW_INFO_VALID_VAL) { - LOG_ERR("Firmware has been invalidated: 0x%x.", - fwinfo->valid); + if (!external) { + LOG_ERR("Firmware has been invalidated: 0x%x.", + fwinfo->valid); + } return false; } - LOG_INF("Trying to get Firmware version"); + if (!external) { + LOG_INF("Trying to get Firmware version"); + } #if defined(CONFIG_NRFX_NVMC) uint16_t stored_version; @@ -350,8 +389,10 @@ static bool validate_firmware(uint32_t fw_dst_address, uint32_t fw_src_address, int err = get_monotonic_version(&stored_version); if (err) { - LOG_ERR("Cannot read the firmware version. %d", err); - LOG_INF("We assume this is due to the firmware version not being enabled."); + if (!external) { + LOG_ERR("Cannot read the firmware version. %d", err); + LOG_INF("We assume this is due to the firmware version not being enabled."); + } /* * Errors in reading the firmware version are assumed to be @@ -365,8 +406,10 @@ static bool validate_firmware(uint32_t fw_dst_address, uint32_t fw_src_address, } if (fwinfo->version < stored_version) { - LOG_ERR("Firmware version (%u) is smaller than monotonic counter (%u).", - fwinfo->version, stored_version); + if (!external) { + LOG_ERR("Firmware version (%u) is smaller than monotonic counter (%u).", + fwinfo->version, stored_version); + } return false; } @@ -375,19 +418,25 @@ static bool validate_firmware(uint32_t fw_dst_address, uint32_t fw_src_address, "B0's slots aren't the same size. Check pm.yml."); if ((fwinfo->size > (PM_S0_SIZE)) || (fwinfo->total_size > fwinfo->size)) { - LOG_ERR("Invalid size or total_size in firmware info."); + if (!external) { + LOG_ERR("Invalid size or total_size in firmware info."); + } return false; } #endif if (!region_within(fwinfo_address, fwinfo_end, fw_src_address, fw_src_end)) { - LOG_ERR("Firmware info is not within signed region."); + if (!external) { + LOG_ERR("Firmware info is not within signed region."); + } return false; } if (!within(fwinfo->boot_address, fw_dst_address, fw_dst_end)) { - LOG_ERR("Boot address is not within signed region."); + if (!external) { + LOG_ERR("Boot address is not within signed region."); + } return false; } @@ -398,19 +447,25 @@ static bool validate_firmware(uint32_t fw_dst_address, uint32_t fw_src_address, const uint32_t reset_vector = ((const uint32_t *)(fw_src_address + stack_ptr_offset))[1]; if (!within(reset_vector, fw_dst_address, fw_dst_end)) { - LOG_ERR("Reset handler is not within signed region."); + if (!external) { + LOG_ERR("Reset handler is not within signed region."); + } return false; } fw_val_info = validation_info_find(fw_src_address + fwinfo->size, 4); if (!fw_val_info) { - LOG_ERR("Could not find valid firmware validation info."); + if (!external) { + LOG_ERR("Could not find valid firmware validation info."); + } return false; } if (fw_val_info->address != fwinfo->address) { - LOG_ERR("Validation info doesn't belong to this firmware."); + if (!external) { + LOG_ERR("Validation info doesn't belong to this firmware."); + } return false; } From 34b34db5e769096d0325c5bd7972f170766612b1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Thu, 30 Jan 2025 15:57:42 +0100 Subject: [PATCH 086/109] quarantine: Update platform names, add new entries MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - `native_sim/native` needs to be used now instead of `native_sim` - add entries for failing samples and tests that are to be handled after the upmerge: * sample.mcumgr.smp_svr.ram_load.* * nrf_modem_dect_phy_pcc_event * secure_storage.psa.its.secure_storage.* * sample.net.prometheus - remove `native_posix` Signed-off-by: Maciej Perkowski Signed-off-by: Andrzej Głąbek --- scripts/quarantine_integration.yaml | 5 +-- scripts/quarantine_no_optimization.yaml | 2 +- scripts/quarantine_windows_mac.yaml | 4 +-- scripts/quarantine_zephyr.yaml | 36 +++++++++++++++++----- scripts/quarantine_zephyr_integration.yaml | 17 +++++----- 5 files changed, 39 insertions(+), 25 deletions(-) diff --git a/scripts/quarantine_integration.yaml b/scripts/quarantine_integration.yaml index 905430418709..0ed70ee19940 100644 --- a/scripts/quarantine_integration.yaml +++ b/scripts/quarantine_integration.yaml @@ -953,7 +953,7 @@ - applications.asset_tracker_v2.debug - applications.asset_tracker_v2.nrf_cloud platforms: - - native_sim + - native_sim/native comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -1464,6 +1464,3 @@ - thingy53/nrf5340/cpuapp/ns comment: "Configurations excluded to limit resources usage in integration builds" -- platforms: - - native_posix - comment: "native_posix will be removed soon - native_sim platform is the default simulator now" diff --git a/scripts/quarantine_no_optimization.yaml b/scripts/quarantine_no_optimization.yaml index c9b4970ed4ba..b8b97201901d 100644 --- a/scripts/quarantine_no_optimization.yaml +++ b/scripts/quarantine_no_optimization.yaml @@ -8,5 +8,5 @@ - scenarios: - nrf5340_audio.sd_card_test platforms: - - native_sim + - native_sim/native comment: "https://nordicsemi.atlassian.net/browse/NCSDK-30885" diff --git a/scripts/quarantine_windows_mac.yaml b/scripts/quarantine_windows_mac.yaml index e6071bb5fefe..5ad30267040b 100644 --- a/scripts/quarantine_windows_mac.yaml +++ b/scripts/quarantine_windows_mac.yaml @@ -9,8 +9,8 @@ - platforms: - native_.* - - qemu_cortex_m3 - - qemu_x86 + - qemu_cortex_m3.* + - qemu_x86.* comment: "Cannot build samples for Native POSIX and QEMU on Windows OS" - scenarios: diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index 04e47f55e6e3..a5eaf920660f 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -57,7 +57,7 @@ - sample.modules.lvgl.demo_widgets - sample.smf.smf_calculator platforms: - - native_sim + - native_sim/native - native_sim/native/64 comment: "https://nordicsemi.atlassian.net/browse/NCSDK-24924" @@ -193,16 +193,29 @@ - net.sockets.tls13.psk_kex.tickets - net.sockets.tls13.ephemeral_kex.tickets platforms: - - native_sim + - native_sim/native comment: "https://nordicsemi.atlassian.net/browse/NCSDK-30873" - scenarios: - drivers.power_domain.build.pm - drivers.power_domain.build platforms: - - native_sim + - native_sim/native comment: "https://nordicsemi.atlassian.net/browse/NCSDK-30877" +- scenarios: + - sample.mcumgr.smp_svr.ram_load.* + platforms: + - nrf52840dk/nrf52840 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-24488" + +- scenarios: + - net.iface.iid.stable + platforms: + - nrf9160dk@0.14.0/nrf9160/ns + - nrf5340dk/nrf5340/cpuapp/ns + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31574" + # --------------------------------- Won't fix section ----------------------------------- - scenarios: @@ -448,12 +461,19 @@ - nrf54l15dk/nrf54l15/cpuapp comment: "partition manager configuration need to be fixed/provided" -- platforms: - - native_posix - comment: "native_posix will be removed soon - native_sim platform is the default simulator now" - - scenarios: - drivers.hwinfo.api platforms: - nrf54h20dk@0.9.0/nrf54h20/cpuppr - comment: Unsupported device + comment: "Unsupported device" + +- scenarios: + - secure_storage.psa.its.secure_storage.* + platforms: + - qemu_cortex_m3/ti_lm3s6965 + - mps2/an521/cpu0 + comment: "redundant due to natve_sim already in scope" + +- scenarios: + - sample.net.prometheus + comment: "not compatible with NCS (Frank Audun Kvamtro)" diff --git a/scripts/quarantine_zephyr_integration.yaml b/scripts/quarantine_zephyr_integration.yaml index dc3622842378..3d8885c7b9b9 100644 --- a/scripts/quarantine_zephyr_integration.yaml +++ b/scripts/quarantine_zephyr_integration.yaml @@ -9,7 +9,7 @@ - modem.modem_cmux - modem.modem_ppp platforms: - - native_sim + - native_sim/native comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -25,7 +25,7 @@ - net.lwm2m.block_transfer platforms: - nrf9160dk@0.14.0/nrf9160 - - native_sim + - native_sim/native comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -80,7 +80,7 @@ - bluetooth.shell.audio.no_vcs_vcp_vol_ctlr - bluetooth.shell.audio.no_voc platforms: - - native_sim + - native_sim/native comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -94,7 +94,7 @@ - crypto.tinycrypt.hmac_prng platforms: - mps2_an521 - - native_sim + - native_sim/native - nrf52840dk/nrf52840 - nrf52dk/nrf52832 - nrf5340dk/nrf5340/cpuapp @@ -108,7 +108,7 @@ - scenarios: - crypto.hash platforms: - - native_sim + - native_sim/native comment: "Configurations excluded to limit resources usage in integration builds" - scenarios: @@ -147,7 +147,7 @@ - scenarios: - net.conn_mgr.conn platforms: - - native_sim + - native_sim/native - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" @@ -156,7 +156,7 @@ - net.conn_mgr.dad - net.conn_mgr.nodad platforms: - - native_sim + - native_sim/native - nrf52840dk/nrf52840 - nrf5340dk/nrf5340/cpuapp comment: "Configurations excluded to limit resources usage in integration builds" @@ -269,6 +269,3 @@ - nrf52dk/nrf52832 comment: "Configurations excluded to limit resources usage in integration builds" -- platforms: - - native_posix - comment: "native_posix will be removed soon - native_sim platform is the default simulator now" From ab514939be8135e856199a9a1c6fec0374b9a6fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Grochala?= Date: Thu, 30 Jan 2025 15:36:00 +0000 Subject: [PATCH 087/109] esb: Fix DPPIC instance selection for nRF54 SoCs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit So far when building for nRF54L15 static DPPI channels were assigned. After adding nRF54L15 support in the DPPI driver this code is unused for nRF54L15 and the common DPPI allocator used hardcoded DPPIC instance. This commit parameterizes the DDPIC instance number depending on the SoC and enables the coresponding instances in the ESB samples' configurations. ESB uses hardcoded instance number per SoC. TODO: Allow selection of the DPPIC instance in one place e.g. Kconfig based on the DTS. Signed-off-by: Michał Grochala --- .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 8 ++++++++ .../boards/nrf54l15dk_nrf54l15_cpuapp.conf | 8 ++++++++ subsys/esb/esb_dppi.c | 4 ++-- subsys/esb/esb_peripherals.h | 19 +++++++++++++------ 4 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 samples/esb/esb_prx/boards/nrf54l15dk_nrf54l15_cpuapp.conf create mode 100644 samples/esb/esb_ptx/boards/nrf54l15dk_nrf54l15_cpuapp.conf diff --git a/samples/esb/esb_prx/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/esb/esb_prx/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..5384eb4fe476 --- /dev/null +++ b/samples/esb/esb_prx/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Enable DPPI driver +CONFIG_NRFX_DPPI10=y diff --git a/samples/esb/esb_ptx/boards/nrf54l15dk_nrf54l15_cpuapp.conf b/samples/esb/esb_ptx/boards/nrf54l15dk_nrf54l15_cpuapp.conf new file mode 100644 index 000000000000..5384eb4fe476 --- /dev/null +++ b/samples/esb/esb_ptx/boards/nrf54l15dk_nrf54l15_cpuapp.conf @@ -0,0 +1,8 @@ +# +# Copyright (c) 2025 Nordic Semiconductor +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause +# + +# Enable DPPI driver +CONFIG_NRFX_DPPI10=y diff --git a/subsys/esb/esb_dppi.c b/subsys/esb/esb_dppi.c index 223b8b11d615..a3968a60f3cc 100644 --- a/subsys/esb/esb_dppi.c +++ b/subsys/esb/esb_dppi.c @@ -217,7 +217,7 @@ int esb_ppi_init(void) #else - nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(ESB_DPPIC_INSTANCE_NO); err = nrfx_dppi_channel_alloc(&dppi, &radio_address_timer_stop); if (err != NRFX_SUCCESS) { @@ -309,7 +309,7 @@ void esb_ppi_deinit(void) #else - nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(0); + nrfx_dppi_t dppi = NRFX_DPPI_INSTANCE(ESB_DPPIC_INSTANCE_NO); err = nrfx_dppi_channel_free(&dppi, radio_address_timer_stop); if (err != NRFX_SUCCESS) { diff --git a/subsys/esb/esb_peripherals.h b/subsys/esb/esb_peripherals.h index a52e1fd67a04..da04b2fc04d2 100644 --- a/subsys/esb/esb_peripherals.h +++ b/subsys/esb/esb_peripherals.h @@ -26,8 +26,8 @@ extern "C" { /** The ESB Radio interrupt number. */ #define ESB_RADIO_IRQ_NUMBER RADIO_0_IRQn - /** DPPIC instance used by ESB. */ - #define ESB_DPPIC NRF_DPPIC020 + /** DPPIC instance number used by ESB. */ + #define ESB_DPPIC_INSTANCE_NO 020 /** ESB EGU instance configuration. */ #define ESB_EGU NRF_EGU020 @@ -47,8 +47,8 @@ extern "C" { /** The ESB Radio interrupt number. */ #define ESB_RADIO_IRQ_NUMBER RADIO_0_IRQn - /** DPPIC instance used by ESB. */ - #define ESB_DPPIC NRF_DPPIC10 + /** DPPIC instance number used by ESB. */ + #define ESB_DPPIC_INSTANCE_NO 10 /** ESB EGU instance configuration. */ #define ESB_EGU NRF_EGU10 @@ -66,8 +66,8 @@ extern "C" { /** The ESB Radio interrupt number. */ #define ESB_RADIO_IRQ_NUMBER RADIO_IRQn - /** DPPIC instance used by ESB. */ - #define ESB_DPPIC NRF_DPPIC + /** DPPIC instance number used by ESB. */ + #define ESB_DPPIC_INSTANCE_NO 0 /** ESB EGU instance configuration. */ #define ESB_EGU NRF_EGU0 @@ -80,6 +80,13 @@ extern "C" { #endif +/** ESB DPPIC instance number. */ +#if ESB_DPPIC_INSTANCE_NO +#define ESB_DPPIC NRFX_CONCAT_2(NRF_DPPIC, ESB_DPPIC_INSTANCE_NO) +#else +#define ESB_DPPIC NRF_DPPIC +#endif /* ESB_DPPIC_INSTANCE_NO */ + /** ESB timer instance number. */ #if defined(CONFIG_ESB_SYS_TIMER_INSTANCE_LEADING_ZERO) #define ESB_TIMER_INSTANCE_NO NRFX_CONCAT_2(0, CONFIG_ESB_SYS_TIMER_INSTANCE) From 6bba6785f6b697969ecdd66c69b092b04879a45d Mon Sep 17 00:00:00 2001 From: Markus Lassila Date: Tue, 28 Jan 2025 11:27:08 +0200 Subject: [PATCH 088/109] applications: serial_lte_modem: Fix SLM in upmerge. - Change posix names to zsock. - Remove CONFIG_x_NRF_HW_ASYNC usage. - Correct size for the external flash. Signed-off-by: Markus Lassila --- .../boards/nrf9131ek_nrf9131_ns.conf | 2 - .../boards/nrf9151dk_nrf9151_ns.conf | 10 +- .../boards/nrf9160dk_nrf9160_ns.conf | 10 +- .../boards/nrf9161dk_nrf9161_ns.conf | 10 +- .../boards/thingy91_nrf9160_ns.conf | 2 - .../boards/thingy91x_nrf9151_ns.conf | 2 - .../doc/SOCKET_AT_commands.rst | 3 +- .../serial_lte_modem/doc/slm_description.rst | 31 +-- .../serial_lte_modem/overlay-full_fota.conf | 1 + .../src/http_c/slm_at_httpc.c | 51 ++--- .../serial_lte_modem/src/mqtt_c/slm_at_mqtt.c | 20 +- .../serial_lte_modem/src/slm_at_fota.c | 4 +- .../serial_lte_modem/src/slm_at_icmp.c | 70 +++---- .../serial_lte_modem/src/slm_at_socket.c | 189 +++++++++--------- .../serial_lte_modem/src/slm_at_tcp_proxy.c | 175 ++++++++-------- .../serial_lte_modem/src/slm_at_udp_proxy.c | 116 +++++------ applications/serial_lte_modem/src/slm_ppp.c | 30 +-- applications/serial_lte_modem/src/slm_util.c | 24 +-- applications/serial_lte_modem/src/slm_util.h | 2 +- samples/cellular/modem_shell/overlay-ppp.conf | 2 - 20 files changed, 361 insertions(+), 393 deletions(-) diff --git a/applications/serial_lte_modem/boards/nrf9131ek_nrf9131_ns.conf b/applications/serial_lte_modem/boards/nrf9131ek_nrf9131_ns.conf index 13159e9815fb..647d6cf453d5 100644 --- a/applications/serial_lte_modem/boards/nrf9131ek_nrf9131_ns.conf +++ b/applications/serial_lte_modem/boards/nrf9131ek_nrf9131_ns.conf @@ -8,7 +8,5 @@ # This file is merged with prj.conf in the application folder, and options # set here will take precedence if they are present in both files. -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y CONFIG_SLM_POWER_PIN=28 CONFIG_SLM_INDICATE_PIN=0 diff --git a/applications/serial_lte_modem/boards/nrf9151dk_nrf9151_ns.conf b/applications/serial_lte_modem/boards/nrf9151dk_nrf9151_ns.conf index 0a14fd6b653a..252d13d5415e 100644 --- a/applications/serial_lte_modem/boards/nrf9151dk_nrf9151_ns.conf +++ b/applications/serial_lte_modem/boards/nrf9151dk_nrf9151_ns.conf @@ -8,16 +8,10 @@ # This file is merged with prj.conf in the application folder, and options # set here will take precedence if they are present in both files. -# Use UART_0 (when working with PC terminal) -# unmask the following config -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y +# When working with PC terminal, unmask the following config. CONFIG_SLM_POWER_PIN=8 CONFIG_SLM_INDICATE_PIN=0 -# Use UART_2 (when working with external MCU) -# unmask the following config -#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 -#CONFIG_UART_2_NRF_HW_ASYNC=y +# When working with external MCU, unmask the following config. #CONFIG_SLM_POWER_PIN=31 #CONFIG_SLM_INDICATE_PIN=30 diff --git a/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf b/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf index a48775798126..7ad12b67f52e 100644 --- a/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf +++ b/applications/serial_lte_modem/boards/nrf9160dk_nrf9160_ns.conf @@ -8,16 +8,10 @@ # This file is merged with prj.conf in the application folder, and options # set here will take precedence if they are present in both files. -# Use UART_0 (when working with PC terminal) -# unmask the following config -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y +# When working with PC terminal, unmask the following config. CONFIG_SLM_POWER_PIN=6 CONFIG_SLM_INDICATE_PIN=2 -# Use UART_2 (when working with external MCU) -# unmask the following config -#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 -#CONFIG_UART_2_NRF_HW_ASYNC=y +# When working with external MCU, unmask the following config. #CONFIG_SLM_POWER_PIN=31 #CONFIG_SLM_INDICATE_PIN=30 diff --git a/applications/serial_lte_modem/boards/nrf9161dk_nrf9161_ns.conf b/applications/serial_lte_modem/boards/nrf9161dk_nrf9161_ns.conf index 1976ebdbf4ca..f215becdd39f 100644 --- a/applications/serial_lte_modem/boards/nrf9161dk_nrf9161_ns.conf +++ b/applications/serial_lte_modem/boards/nrf9161dk_nrf9161_ns.conf @@ -8,16 +8,10 @@ # This file is merged with prj.conf in the application folder, and options # set here will take precedence if they are present in both files. -# Use UART_0 (when working with PC terminal) -# unmask the following config -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y +# When working with PC terminal, unmask the following config. CONFIG_SLM_POWER_PIN=8 CONFIG_SLM_INDICATE_PIN=0 -# Use UART_2 (when working with external MCU) -# unmask the following config -#CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 -#CONFIG_UART_2_NRF_HW_ASYNC=y +# When working with external MCU, unmask the following config. #CONFIG_SLM_POWER_PIN=31 #CONFIG_SLM_INDICATE_PIN=30 diff --git a/applications/serial_lte_modem/boards/thingy91_nrf9160_ns.conf b/applications/serial_lte_modem/boards/thingy91_nrf9160_ns.conf index 4359e6b6affe..17f2c971e25c 100644 --- a/applications/serial_lte_modem/boards/thingy91_nrf9160_ns.conf +++ b/applications/serial_lte_modem/boards/thingy91_nrf9160_ns.conf @@ -9,8 +9,6 @@ # set here will take precedence if they are present in both files. # Configuration related to external sensors. -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y CONFIG_SLM_POWER_PIN=26 # Increase buffer space as hardware flow control is not used with Thingy:91. diff --git a/applications/serial_lte_modem/boards/thingy91x_nrf9151_ns.conf b/applications/serial_lte_modem/boards/thingy91x_nrf9151_ns.conf index 5658e19b164f..2fddb69fa7e4 100644 --- a/applications/serial_lte_modem/boards/thingy91x_nrf9151_ns.conf +++ b/applications/serial_lte_modem/boards/thingy91x_nrf9151_ns.conf @@ -9,8 +9,6 @@ # set here will take precedence if they are present in both files. # Configuration related to external sensors. -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 -CONFIG_UART_0_NRF_HW_ASYNC=y CONFIG_SLM_POWER_PIN=26 # Increase buffer space as hardware flow control is not necessarily used with Thingy:91 X. diff --git a/applications/serial_lte_modem/doc/SOCKET_AT_commands.rst b/applications/serial_lte_modem/doc/SOCKET_AT_commands.rst index 57f4bf041e63..c7d30f9030ae 100644 --- a/applications/serial_lte_modem/doc/SOCKET_AT_commands.rst +++ b/applications/serial_lte_modem/doc/SOCKET_AT_commands.rst @@ -1235,7 +1235,8 @@ Response syntax * The ```` value is an error code when the poll fails. * The ```` value is an integer. It is the handle of a socket that have events returned, so-called ``revents``. -* The ```` value is a hexadecimal string. It represents the returned events, which could be a combination of POLLIN, POLLERR, POLLHUP and POLLNVAL. +* The ```` value is a hexadecimal string. + It represents the returned events, which could be a combination of ``ZSOCK_POLLIN``, ``ZSOCK_POLLERR``, ``ZSOCK_POLLHUP`` and ``ZSOCK_POLLNVAL``. Examples ~~~~~~~~ diff --git a/applications/serial_lte_modem/doc/slm_description.rst b/applications/serial_lte_modem/doc/slm_description.rst index 1f1ff3c352ec..74520274600c 100644 --- a/applications/serial_lte_modem/doc/slm_description.rst +++ b/applications/serial_lte_modem/doc/slm_description.rst @@ -452,17 +452,10 @@ To connect with an external MCU using UART_2, change the configuration files for * In the :file:`nrf9151dk_nrf9151_ns.conf` file:: - # Use UART_0 (when working with PC terminal) - # unmask the following config - #CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - #CONFIG_UART_0_NRF_HW_ASYNC=y - #CONFIG_SLM_POWER_PIN=8 + # When working with PC terminal, unmask the following config. #CONFIG_SLM_INDICATE_PIN=0 - # Use UART_2 (when working with external MCU) - # unmask the following config - CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 - CONFIG_UART_2_NRF_HW_ASYNC=y + # When working with external MCU, unmask the following config. CONFIG_SLM_POWER_PIN=31 CONFIG_SLM_INDICATE_PIN=30 @@ -493,17 +486,11 @@ To connect with an external MCU using UART_2, change the configuration files for * In the :file:`nrf9161dk_nrf9161_ns.conf` file:: - # Use UART_0 (when working with PC terminal) - # unmask the following config - #CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - #CONFIG_UART_0_NRF_HW_ASYNC=y + # When working with PC terminal, unmask the following config. #CONFIG_SLM_POWER_PIN=8 #CONFIG_SLM_INDICATE_PIN=0 - # Use UART_2 (when working with external MCU) - # unmask the following config - CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 - CONFIG_UART_2_NRF_HW_ASYNC=y + # When working with external MCU, unmask the following config. CONFIG_SLM_POWER_PIN=31 CONFIG_SLM_INDICATE_PIN=30 @@ -535,17 +522,11 @@ To connect with an external MCU using UART_2, change the configuration files for * In the :file:`nrf9160dk_nrf9160_ns.conf` file:: - # Use UART_0 (when working with PC terminal) - # unmask the following config - #CONFIG_UART_0_NRF_HW_ASYNC_TIMER=2 - #CONFIG_UART_0_NRF_HW_ASYNC=y + # When working with PC terminal, unmask the following config. #CONFIG_SLM_POWER_PIN=6 #CONFIG_SLM_INDICATE_PIN=2 - # Use UART_2 (when working with external MCU) - # unmask the following config - CONFIG_UART_2_NRF_HW_ASYNC_TIMER=2 - CONFIG_UART_2_NRF_HW_ASYNC=y + # When working with external MCU, unmask the following config. CONFIG_SLM_POWER_PIN=31 CONFIG_SLM_INDICATE_PIN=30 diff --git a/applications/serial_lte_modem/overlay-full_fota.conf b/applications/serial_lte_modem/overlay-full_fota.conf index 9e7ebc5e06f4..d3b9e482b6df 100644 --- a/applications/serial_lte_modem/overlay-full_fota.conf +++ b/applications/serial_lte_modem/overlay-full_fota.conf @@ -18,6 +18,7 @@ CONFIG_MBEDTLS_LEGACY_CRYPTO_C=y CONFIG_MBEDTLS_SHA256_C=y CONFIG_FMFU_FDEV=y CONFIG_ZCBOR=y +CONFIG_STREAM_FLASH_INSPECT=n # Enable full FOTA support CONFIG_SLM_FULL_FOTA=y diff --git a/applications/serial_lte_modem/src/http_c/slm_at_httpc.c b/applications/serial_lte_modem/src/http_c/slm_at_httpc.c index 352298132ee2..e0dd54a6115a 100644 --- a/applications/serial_lte_modem/src/http_c/slm_at_httpc.c +++ b/applications/serial_lte_modem/src/http_c/slm_at_httpc.c @@ -130,7 +130,7 @@ static int headers_cb(int sock, struct http_request *req, void *user_data) len = strlen(httpc.headers); while (offset < len) { - ret = send(sock, httpc.headers + offset, len - offset, 0); + ret = zsock_send(sock, httpc.headers + offset, len - offset, 0); if (ret < 0) { LOG_ERR("send header fail: %d", -errno); return -errno; @@ -153,7 +153,7 @@ int do_send_payload(const uint8_t *data, int len) /* Start to send payload */ while (offset < len) { - ret = send(httpc.fd, data + offset, len - offset, 0); + ret = zsock_send(httpc.fd, data + offset, len - offset, 0); if (ret < 0) { LOG_ERR("Fail to send payload: %d, sent: %d", ret, offset); httpc.total_sent = -errno; @@ -223,12 +223,12 @@ static int do_http_connect(void) /* Open socket */ if (httpc.sec_tag == INVALID_SEC_TAG) { - ret = socket(httpc.family, SOCK_STREAM, IPPROTO_TCP); + ret = zsock_socket(httpc.family, SOCK_STREAM, IPPROTO_TCP); } else { - ret = socket(httpc.family, SOCK_STREAM, IPPROTO_TLS_1_2); + ret = zsock_socket(httpc.family, SOCK_STREAM, IPPROTO_TLS_1_2); } if (ret < 0) { - LOG_ERR("socket() failed: %d", -errno); + LOG_ERR("zsock_socket() failed: %d", -errno); return ret; } httpc.fd = ret; @@ -244,7 +244,8 @@ static int do_http_connect(void) int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(httpc.fd, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_NATIVE, &tls_native, + sizeof(tls_native)); if (ret) { ret = errno; goto exit_cli; @@ -252,38 +253,38 @@ static int do_http_connect(void) #endif sec_tag_t sec_tag_list[] = { httpc.sec_tag }; - ret = setsockopt(httpc.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { - LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); ret = -errno; goto exit_cli; } - ret = setsockopt(httpc.fd, SOL_TLS, TLS_PEER_VERIFY, &httpc.peer_verify, + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_PEER_VERIFY, &httpc.peer_verify, sizeof(httpc.peer_verify)); if (ret) { - LOG_ERR("setsockopt(TLS_PEER_VERIFY) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_PEER_VERIFY) error: %d", -errno); ret = -errno; goto exit_cli; } if (httpc.hostname_verify) { - ret = setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, httpc.host, + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, httpc.host, strlen(httpc.host)); } else { - ret = setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, NULL, 0); + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_HOSTNAME, NULL, 0); } if (ret) { - LOG_ERR("setsockopt(TLS_HOSTNAME) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_HOSTNAME) error: %d", -errno); ret = -errno; goto exit_cli; } if (!IS_ENABLED(CONFIG_SLM_NATIVE_TLS)) { int session_cache = TLS_SESSION_CACHE_ENABLED; - ret = setsockopt(httpc.fd, SOL_TLS, TLS_SESSION_CACHE, &session_cache, + ret = zsock_setsockopt(httpc.fd, SOL_TLS, TLS_SESSION_CACHE, &session_cache, sizeof(session_cache)); if (ret) { - LOG_ERR("setsockopt(TLS_SESSION_CACHE) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SESSION_CACHE) error: %d", -errno); ret = -errno; goto exit_cli; } @@ -291,15 +292,15 @@ static int do_http_connect(void) } LOG_DBG("Configuring socket timeout (%lld s)", timeo.tv_sec); - ret = setsockopt(httpc.fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo)); + ret = zsock_setsockopt(httpc.fd, SOL_SOCKET, SO_SNDTIMEO, &timeo, sizeof(timeo)); if (ret) { - LOG_ERR("setsockopt(SO_SNDTIMEO) error: %d", -errno); + LOG_ERR("zsock_setsockopt(SO_SNDTIMEO) error: %d", -errno); ret = -errno; goto exit_cli; } - ret = setsockopt(httpc.fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo)); + ret = zsock_setsockopt(httpc.fd, SOL_SOCKET, SO_RCVTIMEO, &timeo, sizeof(timeo)); if (ret) { - LOG_ERR("setsockopt(SO_SNDTIMEO) error: %d", -errno); + LOG_ERR("zsock_setsockopt(SO_SNDTIMEO) error: %d", -errno); ret = -errno; goto exit_cli; } @@ -310,13 +311,13 @@ static int do_http_connect(void) goto exit_cli; } if (sa.sa_family == AF_INET) { - ret = connect(httpc.fd, &sa, sizeof(struct sockaddr_in)); + ret = zsock_connect(httpc.fd, &sa, sizeof(struct sockaddr_in)); } else { - ret = connect(httpc.fd, &sa, sizeof(struct sockaddr_in6)); + ret = zsock_connect(httpc.fd, &sa, sizeof(struct sockaddr_in6)); } if (ret) { - LOG_ERR("connect() failed: %d", -errno); + LOG_ERR("zsock_connect() failed: %d", -errno); ret = -errno; goto exit_cli; } @@ -325,7 +326,7 @@ static int do_http_connect(void) return 0; exit_cli: - close(httpc.fd); + zsock_close(httpc.fd); httpc.fd = INVALID_SOCKET; rsp_send("\r\n#XHTTPCCON: 0\r\n"); @@ -338,10 +339,10 @@ static int do_http_disconnect(void) if (httpc.fd == INVALID_SOCKET) { return 0; } - int ret = close(httpc.fd); + int ret = zsock_close(httpc.fd); if (ret) { - LOG_WRN("close() failed: %d", -errno); + LOG_WRN("zsock_close() failed: %d", -errno); ret = -errno; } httpc.fd = INVALID_SOCKET; diff --git a/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c b/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c index 4bc5ccbdc2f8..aeb73848741e 100644 --- a/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c +++ b/applications/serial_lte_modem/src/mqtt_c/slm_at_mqtt.c @@ -213,7 +213,7 @@ void mqtt_evt_handler(struct mqtt_client *const c, const struct mqtt_evt *evt) static void mqtt_thread_fn(void *arg1, void *arg2, void *arg3) { int err = 0; - struct pollfd fds; + struct zsock_pollfd fds; ARG_UNUSED(arg1); ARG_UNUSED(arg2); @@ -225,20 +225,20 @@ static void mqtt_thread_fn(void *arg1, void *arg2, void *arg3) fds.fd = client.transport.tls.sock; } #endif - fds.events = POLLIN; + fds.events = ZSOCK_POLLIN; while (true) { if (!ctx.connected) { LOG_WRN("MQTT disconnected"); err = 0; break; } - err = poll(&fds, 1, mqtt_keepalive_time_left(&client)); + err = zsock_poll(&fds, 1, mqtt_keepalive_time_left(&client)); if (err < 0) { LOG_ERR("ERROR: poll %d", errno); break; } - if ((fds.revents & POLLIN) == POLLIN) { + if ((fds.revents & ZSOCK_POLLIN) == ZSOCK_POLLIN) { err = mqtt_input(&client); if (err != 0) { LOG_ERR("ERROR: mqtt_input %d", err); @@ -259,18 +259,18 @@ static void mqtt_thread_fn(void *arg1, void *arg2, void *arg3) * determines to be inactive or non-responsive at any time, regardless of the * Keep Alive value provided by that Client. */ - if ((fds.revents & POLLERR) == POLLERR) { - LOG_ERR("POLLERR"); + if ((fds.revents & ZSOCK_POLLERR) == ZSOCK_POLLERR) { + LOG_ERR("ZSOCK_POLLERR"); err = -EIO; break; } - if ((fds.revents & POLLHUP) == POLLHUP) { - LOG_ERR("POLLHUP"); + if ((fds.revents & ZSOCK_POLLHUP) == ZSOCK_POLLHUP) { + LOG_ERR("ZSOCK_POLLHUP"); err = -ECONNRESET; break; } - if ((fds.revents & POLLNVAL) == POLLNVAL) { - LOG_ERR("POLLNVAL"); + if ((fds.revents & ZSOCK_POLLNVAL) == ZSOCK_POLLNVAL) { + LOG_ERR("ZSOCK_POLLNVAL"); err = -ENOTCONN; break; } diff --git a/applications/serial_lte_modem/src/slm_at_fota.c b/applications/serial_lte_modem/src/slm_at_fota.c index 962b9ee5f8b0..0acb4b2da39b 100644 --- a/applications/serial_lte_modem/src/slm_at_fota.c +++ b/applications/serial_lte_modem/src/slm_at_fota.c @@ -63,7 +63,8 @@ static char hostname[URI_HOST_MAX]; static uint8_t fmfu_buf[FMFU_BUF_SIZE]; /* External flash device for full modem firmware storage */ -static const struct device *flash_dev = DEVICE_DT_GET_ONE(jedec_spi_nor); +#define FLASH_NODE DT_COMPAT_GET_ANY_STATUS_OKAY(jedec_spi_nor) +static const struct device *flash_dev = DEVICE_DT_GET(FLASH_NODE); /* dfu_target specific configurations */ static struct dfu_target_fmfu_fdev fdev; @@ -334,6 +335,7 @@ static int handle_at_fota(enum at_parser_cmd_type cmd_type, struct at_parser *pa #if defined(CONFIG_SLM_FULL_FOTA) else if (op == SLM_FOTA_START_FULL_FOTA) { fdev.dev = flash_dev; + fdev.size = DT_PROP(FLASH_NODE, size) / 8; full_modem_fota_params.buf = fmfu_buf; full_modem_fota_params.len = sizeof(fmfu_buf); full_modem_fota_params.dev = &fdev; diff --git a/applications/serial_lte_modem/src/slm_at_icmp.c b/applications/serial_lte_modem/src/slm_at_icmp.c index 62b1e5731ed5..1a6967e42d89 100644 --- a/applications/serial_lte_modem/src/slm_at_icmp.c +++ b/applications/serial_lte_modem/src/slm_at_icmp.c @@ -29,8 +29,8 @@ LOG_MODULE_REGISTER(slm_icmp, CONFIG_SLM_LOG_LEVEL); /**@ ICMP Ping command arguments */ static struct ping_argv_t { - struct addrinfo *src; - struct addrinfo *dest; + struct zsock_addrinfo *src; + struct zsock_addrinfo *dest; uint16_t len; uint16_t waitms; uint16_t count; @@ -112,9 +112,9 @@ static uint32_t send_ping_wait_reply(void) uint8_t *data = NULL; uint8_t rep = 0; uint8_t header_len = 0; - struct addrinfo *si = ping_argv.src; + struct zsock_addrinfo *si = ping_argv.src; const int alloc_size = ICMP_DEFAULT_LINK_MTU; - struct pollfd fds[1]; + struct zsock_pollfd fds[1]; int dpllen, pllen, len; int fd; int plseqnr; @@ -237,9 +237,9 @@ static uint32_t send_ping_wait_reply(void) errno = 0; delta_t = 0; - fd = socket(AF_PACKET, SOCK_RAW, 0); + fd = zsock_socket(AF_PACKET, SOCK_RAW, 0); if (fd < 0) { - LOG_ERR("socket() failed: (%d)", -errno); + LOG_ERR("zsock_socket() failed: (%d)", -errno); free(buf); return (uint32_t)delta_t; } @@ -249,7 +249,7 @@ static uint32_t send_ping_wait_reply(void) if (ping_argv.pdn != 0) { int pdn = ping_argv.pdn; - if (setsockopt(fd, SOL_SOCKET, SO_BINDTOPDN, &pdn, sizeof(int))) { + if (zsock_setsockopt(fd, SOL_SOCKET, SO_BINDTOPDN, &pdn, sizeof(int))) { LOG_WRN("Unable to set socket SO_BINDTOPDN, abort"); goto close_end; } @@ -264,7 +264,7 @@ static uint32_t send_ping_wait_reply(void) tv.tv_sec = (ping_argv.waitms / 1000); tv.tv_usec = (ping_argv.waitms % 1000) * 1000; - if (setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (struct timeval *)&tv, + if (zsock_setsockopt(fd, SOL_SOCKET, SO_SNDTIMEO, (struct timeval *)&tv, sizeof(struct timeval)) < 0) { LOG_WRN("Unable to set socket SO_SNDTIMEO, continue"); } @@ -272,7 +272,7 @@ static uint32_t send_ping_wait_reply(void) /* Just for sure, let's put the timeout for rcv as well * (should not be needed for non-blocking socket): */ - if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, + if (zsock_setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, (struct timeval *)&tv, sizeof(struct timeval)) < 0) { LOG_WRN("Unable to set socket SO_RCVTIMEO, continue"); } @@ -281,19 +281,19 @@ static uint32_t send_ping_wait_reply(void) start_t = k_uptime_get(); timeout = ping_argv.waitms; - ret = send(fd, buf, total_length, 0); + ret = zsock_send(fd, buf, total_length, 0); if (ret <= 0) { - LOG_ERR("send() failed: (%d)", -errno); + LOG_ERR("zsock_send() failed: (%d)", -errno); goto close_end; } - /* Now after send(), calculate how much there's still time left */ + /* Now after zsock_send(), calculate how much there's still time left */ delta_t = k_uptime_delta(&start_t); timeout = ping_argv.waitms - (int32_t)delta_t; wait_for_data: fds[0].fd = fd; - fds[0].events = POLLIN; + fds[0].events = ZSOCK_POLLIN; do { if (timeout <= 0) { @@ -302,18 +302,18 @@ static uint32_t send_ping_wait_reply(void) goto close_end; } - ret = poll(fds, 1, timeout); + ret = zsock_poll(fds, 1, timeout); if (ret == 0) { LOG_WRN("Pinging result: no ping response in given timeout msec"); delta_t = 0; goto close_end; } else if (ret < 0) { - LOG_ERR("poll() failed: (%d) (%d)", -errno, ret); + LOG_ERR("zsock_poll() failed: (%d) (%d)", -errno, ret); delta_t = 0; goto close_end; } - len = recv(fd, buf, alloc_size, 0); + len = zsock_recv(fd, buf, alloc_size, 0); /* Calculate again, how much there's still time left */ delta_t = k_uptime_delta(&start_t); @@ -321,7 +321,7 @@ static uint32_t send_ping_wait_reply(void) if (len <= 0) { if (errno != EAGAIN && errno != EWOULDBLOCK) { - LOG_ERR("recv() failed with errno (%d) and return value (%d)", + LOG_ERR("zsock_recv() failed with errno (%d) and return value (%d)", -errno, len); delta_t = 0; goto close_end; @@ -329,7 +329,7 @@ static uint32_t send_ping_wait_reply(void) } if (len < header_len) { /* Data length error, ignore "silently" */ - LOG_ERR("recv() wrong data (%d)", len); + LOG_ERR("zsock_recv() wrong data (%d)", len); } if ((rep == ICMP_ECHO_REP && buf[IP_PROTOCOL_POS] == IPPROTO_ICMP) || @@ -406,15 +406,15 @@ static uint32_t send_ping_wait_reply(void) (uint32_t)(delta_t)/1000, (uint32_t)(delta_t)%1000); close_end: - (void)close(fd); + (void)zsock_close(fd); free(buf); return (uint32_t)delta_t; } void ping_task(struct k_work *item) { - struct addrinfo *si = ping_argv.src; - struct addrinfo *di = ping_argv.dest; + struct zsock_addrinfo *si = ping_argv.src; + struct zsock_addrinfo *di = ping_argv.dest; uint32_t sum = 0; uint32_t count = 0; uint32_t rtt_min = 0xFFFFFFFF; @@ -452,19 +452,19 @@ void ping_task(struct k_work *item) rtt_min, rtt_max, sum / count); } - freeaddrinfo(si); - freeaddrinfo(di); + zsock_freeaddrinfo(si); + zsock_freeaddrinfo(di); } static int ping_test_handler(const char *target) { int ret; - struct addrinfo *res; + struct zsock_addrinfo *res; - ret = getaddrinfo(target, NULL, NULL, &res); + ret = zsock_getaddrinfo(target, NULL, NULL, &res); if (ret != 0) { - LOG_ERR("getaddrinfo(dest) error: %d", ret); - rsp_send("\"%s\"\r\n", gai_strerror(ret)); + LOG_ERR("zsock_getaddrinfo(dest) error: %d", ret); + rsp_send("\"%s\"\r\n", zsock_gai_strerror(ret)); return -EAGAIN; } @@ -476,16 +476,16 @@ static int ping_test_handler(const char *target) util_get_ip_addr(ping_argv.pdn, ipv4_addr, NULL); if (!*ipv4_addr) { LOG_ERR("Unable to obtain local IPv4 address"); - freeaddrinfo(res); + zsock_freeaddrinfo(res); return -1; } ping_argv.dest = res; res = NULL; - ret = getaddrinfo(ipv4_addr, NULL, NULL, &res); + ret = zsock_getaddrinfo(ipv4_addr, NULL, NULL, &res); if (ret != 0) { - LOG_ERR("getaddrinfo(src) error: %d", ret); - freeaddrinfo(ping_argv.dest); + LOG_ERR("zsock_getaddrinfo(src) error: %d", ret); + zsock_freeaddrinfo(ping_argv.dest); return -ret; } ping_argv.src = res; @@ -496,16 +496,16 @@ static int ping_test_handler(const char *target) util_get_ip_addr(ping_argv.pdn, NULL, ipv6_addr); if (!*ipv6_addr) { LOG_ERR("Unable to obtain local IPv6 address"); - freeaddrinfo(res); + zsock_freeaddrinfo(res); return -1; } ping_argv.dest = res; res = NULL; - ret = getaddrinfo(ipv6_addr, NULL, NULL, &res); + ret = zsock_getaddrinfo(ipv6_addr, NULL, NULL, &res); if (ret != 0) { - LOG_ERR("getaddrinfo(src) error: %d", ret); - freeaddrinfo(ping_argv.dest); + LOG_ERR("zsock_getaddrinfo(src) error: %d", ret); + zsock_freeaddrinfo(ping_argv.dest); return -ret; } ping_argv.src = res; diff --git a/applications/serial_lte_modem/src/slm_at_socket.c b/applications/serial_lte_modem/src/slm_at_socket.c index fb5f9f17fc24..5a0a5c1dad0a 100644 --- a/applications/serial_lte_modem/src/slm_at_socket.c +++ b/applications/serial_lte_modem/src/slm_at_socket.c @@ -62,7 +62,7 @@ static struct slm_socket { uint16_t cid; /* PDP Context ID, 0: primary; 1~10: secondary */ } socks[SLM_MAX_SOCKET_COUNT]; -static struct pollfd fds[SLM_MAX_SOCKET_COUNT]; +static struct zsock_pollfd fds[SLM_MAX_SOCKET_COUNT]; static struct slm_socket sock; /* forward declarations */ @@ -115,7 +115,7 @@ static int bind_to_pdn(uint16_t cid) if (cid > 0) { int cid_int = cid; - ret = setsockopt(sock.fd, SOL_SOCKET, SO_BINDTOPDN, &cid_int, sizeof(int)); + ret = zsock_setsockopt(sock.fd, SOL_SOCKET, SO_BINDTOPDN, &cid_int, sizeof(int)); if (ret < 0) { LOG_ERR("SO_BINDTOPDN error: %d", -errno); } @@ -130,30 +130,30 @@ static int do_socket_open(void) int proto = IPPROTO_TCP; if (sock.type == SOCK_STREAM) { - ret = socket(sock.family, SOCK_STREAM, IPPROTO_TCP); + ret = zsock_socket(sock.family, SOCK_STREAM, IPPROTO_TCP); } else if (sock.type == SOCK_DGRAM) { - ret = socket(sock.family, SOCK_DGRAM, IPPROTO_UDP); + ret = zsock_socket(sock.family, SOCK_DGRAM, IPPROTO_UDP); proto = IPPROTO_UDP; } else if (sock.type == SOCK_RAW) { sock.family = AF_PACKET; sock.role = AT_SOCKET_ROLE_CLIENT; - ret = socket(sock.family, SOCK_RAW, IPPROTO_IP); + ret = zsock_socket(sock.family, SOCK_RAW, IPPROTO_IP); proto = IPPROTO_IP; } else { LOG_ERR("socket type %d not supported", sock.type); return -ENOTSUP; } if (ret < 0) { - LOG_ERR("socket() error: %d", -errno); + LOG_ERR("zsock_socket() error: %d", -errno); return -errno; } sock.fd = ret; struct timeval tmo = {.tv_sec = SOCKET_SEND_TMO_SEC}; - ret = setsockopt(sock.fd, SOL_SOCKET, SO_SNDTIMEO, &tmo, sizeof(tmo)); + ret = zsock_setsockopt(sock.fd, SOL_SOCKET, SO_SNDTIMEO, &tmo, sizeof(tmo)); if (ret) { - LOG_ERR("setsockopt(%d) error: %d", SO_SNDTIMEO, -errno); + LOG_ERR("zsock_setsockopt(%d) error: %d", SO_SNDTIMEO, -errno); ret = -errno; goto error; } @@ -175,7 +175,7 @@ static int do_socket_open(void) return 0; error: - close(sock.fd); + zsock_close(sock.fd); sock.fd = INVALID_SOCKET; return ret; } @@ -190,9 +190,9 @@ static int do_secure_socket_open(int peer_verify) return -ENOTSUP; } - ret = socket(sock.family, sock.type, proto); + ret = zsock_socket(sock.family, sock.type, proto); if (ret < 0) { - LOG_ERR("socket() error: %d", -errno); + LOG_ERR("zsock_socket() error: %d", -errno); return -errno; } sock.fd = ret; @@ -206,16 +206,16 @@ static int do_secure_socket_open(int peer_verify) int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(sock.fd, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); + ret = zsock_setsockopt(sock.fd, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); if (ret) { goto error; } #endif struct timeval tmo = {.tv_sec = SOCKET_SEND_TMO_SEC}; - ret = setsockopt(sock.fd, SOL_SOCKET, SO_SNDTIMEO, &tmo, sizeof(tmo)); + ret = zsock_setsockopt(sock.fd, SOL_SOCKET, SO_SNDTIMEO, &tmo, sizeof(tmo)); if (ret) { - LOG_ERR("setsockopt(%d) error: %d", SO_SNDTIMEO, -errno); + LOG_ERR("zsock_setsockopt(%d) error: %d", SO_SNDTIMEO, -errno); ret = -errno; goto error; } @@ -227,17 +227,18 @@ static int do_secure_socket_open(int peer_verify) } sec_tag_t sec_tag_list[1] = { sock.sec_tag }; - ret = setsockopt(sock.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); + ret = zsock_setsockopt(sock.fd, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { - LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); ret = -errno; goto error; } /* Set up (D)TLS peer verification */ - ret = setsockopt(sock.fd, SOL_TLS, TLS_PEER_VERIFY, &peer_verify, sizeof(peer_verify)); + ret = zsock_setsockopt(sock.fd, SOL_TLS, TLS_PEER_VERIFY, &peer_verify, + sizeof(peer_verify)); if (ret) { - LOG_ERR("setsockopt(TLS_PEER_VERIFY) error: %d", errno); + LOG_ERR("zsock_setsockopt(TLS_PEER_VERIFY) error: %d", errno); ret = -errno; goto error; } @@ -245,9 +246,9 @@ static int do_secure_socket_open(int peer_verify) if (sock.role == AT_SOCKET_ROLE_SERVER) { int tls_role = TLS_DTLS_ROLE_SERVER; - ret = setsockopt(sock.fd, SOL_TLS, TLS_DTLS_ROLE, &tls_role, sizeof(int)); + ret = zsock_setsockopt(sock.fd, SOL_TLS, TLS_DTLS_ROLE, &tls_role, sizeof(int)); if (ret) { - LOG_ERR("setsockopt(TLS_DTLS_ROLE) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_DTLS_ROLE) error: %d", -errno); ret = -errno; goto error; } @@ -264,7 +265,7 @@ static int do_secure_socket_open(int peer_verify) return 0; error: - close(sock.fd); + zsock_close(sock.fd); sock.fd = INVALID_SOCKET; return ret; } @@ -278,15 +279,15 @@ static int do_socket_close(void) } if (sock.fd_peer != INVALID_SOCKET) { - ret = close(sock.fd_peer); + ret = zsock_close(sock.fd_peer); if (ret) { - LOG_WRN("peer close() error: %d", -errno); + LOG_WRN("peer zsock_close() error: %d", -errno); } sock.fd_peer = INVALID_SOCKET; } - ret = close(sock.fd); + ret = zsock_close(sock.fd); if (ret) { - LOG_WRN("close() error: %d", -errno); + LOG_WRN("zsock_close() error: %d", -errno); ret = -errno; } @@ -389,9 +390,9 @@ static int sockopt_set(enum at_sockopt at_option, int at_value) len = sizeof(tmo); } - ret = setsockopt(sock.fd, level, option, value, len); + ret = zsock_setsockopt(sock.fd, level, option, value, len); if (ret) { - LOG_ERR("setsockopt(%d,%d) error: %d", level, option, -errno); + LOG_ERR("zsock_setsockopt(%d,%d) error: %d", level, option, -errno); } return ret; @@ -412,20 +413,20 @@ static int sockopt_get(enum at_sockopt at_option) struct timeval tmo; len = sizeof(struct timeval); - ret = getsockopt(sock.fd, level, option, &tmo, &len); + ret = zsock_getsockopt(sock.fd, level, option, &tmo, &len); if (ret == 0) { rsp_send("\r\n#XSOCKETOPT: %ld\r\n", (long)tmo.tv_sec); } } else { /* Default */ - ret = getsockopt(sock.fd, level, option, &value, &len); + ret = zsock_getsockopt(sock.fd, level, option, &value, &len); if (ret == 0) { rsp_send("\r\n#XSOCKETOPT: %d\r\n", value); } } if (ret) { - LOG_ERR("getsockopt(%d,%d) error: %d", level, option, -errno); + LOG_ERR("zsock_getsockopt(%d,%d) error: %d", level, option, -errno); } return ret; @@ -487,9 +488,9 @@ static int sec_sockopt_set(enum at_sec_sockopt at_option, void *value, socklen_t return -EINVAL; } - ret = setsockopt(sock.fd, level, option, value, len); + ret = zsock_setsockopt(sock.fd, level, option, value, len); if (ret) { - LOG_ERR("setsockopt(%d,%d) error: %d", level, option, -errno); + LOG_ERR("zsock_setsockopt(%d,%d) error: %d", level, option, -errno); } return ret; @@ -508,7 +509,7 @@ static int sec_sockopt_get(enum at_sec_sockopt at_option) /* Options with special handling. */ if (level == SOL_TLS && option == TLS_CIPHERSUITE_USED) { - ret = getsockopt(sock.fd, level, option, &value, &len); + ret = zsock_getsockopt(sock.fd, level, option, &value, &len); if (ret == 0) { rsp_send("\r\n#XSSOCKETOPT: 0x%x\r\n", value); } @@ -516,20 +517,20 @@ static int sec_sockopt_get(enum at_sec_sockopt at_option) char hostname[SLM_MAX_URL] = {0}; len = sizeof(hostname); - ret = getsockopt(sock.fd, level, option, &hostname, &len); + ret = zsock_getsockopt(sock.fd, level, option, &hostname, &len); if (ret == 0) { rsp_send("\r\n#XSSOCKETOPT: %s\r\n", hostname); } } else { /* Default */ - ret = getsockopt(sock.fd, level, option, &value, &len); + ret = zsock_getsockopt(sock.fd, level, option, &value, &len); if (ret == 0) { rsp_send("\r\n#XSSOCKETOPT: %d\r\n", value); } } if (ret) { - LOG_ERR("getsockopt(%d,%d) error: %d", level, option, -errno); + LOG_ERR("zsock_getsockopt(%d,%d) error: %d", level, option, -errno); } return ret; @@ -553,14 +554,14 @@ int slm_bind_to_local_addr(int socket, int family, uint16_t port) .sin_port = htons(port) }; - if (inet_pton(AF_INET, ipv4_addr, &local.sin_addr) != 1) { + if (zsock_inet_pton(AF_INET, ipv4_addr, &local.sin_addr) != 1) { LOG_ERR("Parse local IPv4 address failed: %d", -errno); return -EINVAL; } - ret = bind(socket, (struct sockaddr *)&local, sizeof(struct sockaddr_in)); + ret = zsock_bind(socket, (struct sockaddr *)&local, sizeof(struct sockaddr_in)); if (ret) { - LOG_ERR("bind() sock %d failed: %d", socket, -errno); + LOG_ERR("zsock_bind() sock %d failed: %d", socket, -errno); return -errno; } LOG_DBG("bind sock %d to %s", socket, ipv4_addr); @@ -578,13 +579,13 @@ int slm_bind_to_local_addr(int socket, int family, uint16_t port) .sin6_port = htons(port) }; - if (inet_pton(AF_INET6, ipv6_addr, &local.sin6_addr) != 1) { + if (zsock_inet_pton(AF_INET6, ipv6_addr, &local.sin6_addr) != 1) { LOG_ERR("Parse local IPv6 address failed: %d", -errno); return -EINVAL; } - ret = bind(socket, (struct sockaddr *)&local, sizeof(struct sockaddr_in6)); + ret = zsock_bind(socket, (struct sockaddr *)&local, sizeof(struct sockaddr_in6)); if (ret) { - LOG_ERR("bind() sock %d failed: %d", socket, -errno); + LOG_ERR("zsock_bind() sock %d failed: %d", socket, -errno); return -errno; } LOG_DBG("bind sock %d to %s", socket, ipv6_addr); @@ -608,12 +609,12 @@ static int do_connect(const char *url, uint16_t port) return -EAGAIN; } if (sa.sa_family == AF_INET) { - ret = connect(sock.fd, &sa, sizeof(struct sockaddr_in)); + ret = zsock_connect(sock.fd, &sa, sizeof(struct sockaddr_in)); } else { - ret = connect(sock.fd, &sa, sizeof(struct sockaddr_in6)); + ret = zsock_connect(sock.fd, &sa, sizeof(struct sockaddr_in6)); } if (ret) { - LOG_ERR("connect() error: %d", -errno); + LOG_ERR("zsock_connect() error: %d", -errno); return -errno; } @@ -627,9 +628,9 @@ static int do_listen(void) int ret; /* hardcode backlog to be 1 for now */ - ret = listen(sock.fd, 1); + ret = zsock_listen(sock.fd, 1); if (ret < 0) { - LOG_ERR("listen() error: %d", -errno); + LOG_ERR("zsock_listen() error: %d", -errno); return -errno; } @@ -641,7 +642,7 @@ static int do_accept(int timeout) int ret; char peer_addr[INET6_ADDRSTRLEN] = {0}; - ret = socket_poll(sock.fd, POLLIN, timeout); + ret = socket_poll(sock.fd, ZSOCK_POLLIN, timeout); if (ret) { return ret; } @@ -650,26 +651,26 @@ static int do_accept(int timeout) struct sockaddr_in client; socklen_t len = sizeof(struct sockaddr_in); - ret = accept(sock.fd, (struct sockaddr *)&client, &len); + ret = zsock_accept(sock.fd, (struct sockaddr *)&client, &len); if (ret == -1) { - LOG_ERR("accept() error: %d", -errno); + LOG_ERR("zsock_accept() error: %d", -errno); sock.fd_peer = INVALID_SOCKET; return -errno; } sock.fd_peer = ret; - (void)inet_ntop(AF_INET, &client.sin_addr, peer_addr, sizeof(peer_addr)); + (void)zsock_inet_ntop(AF_INET, &client.sin_addr, peer_addr, sizeof(peer_addr)); } else if (sock.family == AF_INET6) { struct sockaddr_in6 client; socklen_t len = sizeof(struct sockaddr_in6); - ret = accept(sock.fd, (struct sockaddr *)&client, &len); + ret = zsock_accept(sock.fd, (struct sockaddr *)&client, &len); if (ret == -1) { - LOG_ERR("accept() error: %d", -errno); + LOG_ERR("zsock_accept() error: %d", -errno); sock.fd_peer = INVALID_SOCKET; return -errno; } sock.fd_peer = ret; - (void)inet_ntop(AF_INET6, &client.sin6_addr, peer_addr, sizeof(peer_addr)); + (void)zsock_inet_ntop(AF_INET6, &client.sin6_addr, peer_addr, sizeof(peer_addr)); } else { return -EINVAL; } @@ -696,9 +697,9 @@ static int do_send(const uint8_t *data, int datalen) uint32_t offset = 0; while (offset < datalen) { - ret = send(sockfd, data + offset, datalen - offset, 0); + ret = zsock_send(sockfd, data + offset, datalen - offset, 0); if (ret < 0) { - LOG_ERR("send() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send() failed: %d, sent: %d", -errno, offset); ret = -errno; break; } @@ -732,9 +733,9 @@ static int do_send_datamode(const uint8_t *data, int datalen) uint32_t offset = 0; while (offset < datalen) { - ret = send(sockfd, data + offset, datalen - offset, 0); + ret = zsock_send(sockfd, data + offset, datalen - offset, 0); if (ret < 0) { - LOG_ERR("send() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send() failed: %d, sent: %d", -errno, offset); break; } offset += ret; @@ -759,14 +760,14 @@ static int do_recv(int timeout, int flags) } struct timeval tmo = {.tv_sec = timeout}; - ret = setsockopt(sock.fd, SOL_SOCKET, SO_RCVTIMEO, &tmo, sizeof(tmo)); + ret = zsock_setsockopt(sock.fd, SOL_SOCKET, SO_RCVTIMEO, &tmo, sizeof(tmo)); if (ret) { - LOG_ERR("setsockopt(%d) error: %d", SO_RCVTIMEO, -errno); + LOG_ERR("zsock_setsockopt(%d) error: %d", SO_RCVTIMEO, -errno); return -errno; } - ret = recv(sockfd, (void *)slm_data_buf, sizeof(slm_data_buf), flags); + ret = zsock_recv(sockfd, (void *)slm_data_buf, sizeof(slm_data_buf), flags); if (ret < 0) { - LOG_WRN("recv() error: %d", -errno); + LOG_WRN("zsock_recv() error: %d", -errno); return -errno; } /** @@ -777,7 +778,7 @@ static int do_recv(int timeout, int flags) * In both cases, treat as normal shutdown by remote */ if (ret == 0) { - LOG_WRN("recv() return 0"); + LOG_WRN("zsock_recv() return 0"); } else { rsp_send("\r\n#XRECV: %d\r\n", ret); data_send(slm_data_buf, ret); @@ -803,14 +804,14 @@ static int do_sendto(const char *url, uint16_t port, const uint8_t *data, int da while (offset < datalen) { if (sa.sa_family == AF_INET) { - ret = sendto(sock.fd, data + offset, datalen - offset, 0, + ret = zsock_sendto(sock.fd, data + offset, datalen - offset, 0, &sa, sizeof(struct sockaddr_in)); } else { - ret = sendto(sock.fd, data + offset, datalen - offset, 0, + ret = zsock_sendto(sock.fd, data + offset, datalen - offset, 0, &sa, sizeof(struct sockaddr_in6)); } if (ret <= 0) { - LOG_ERR("sendto() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_sendto() failed: %d, sent: %d", -errno, offset); ret = -errno; break; } @@ -843,14 +844,14 @@ static int do_sendto_datamode(const uint8_t *data, int datalen) while (offset < datalen) { if (sa.sa_family == AF_INET) { - ret = sendto(sock.fd, data + offset, datalen - offset, 0, + ret = zsock_sendto(sock.fd, data + offset, datalen - offset, 0, &sa, sizeof(struct sockaddr_in)); } else { - ret = sendto(sock.fd, data + offset, datalen - offset, 0, + ret = zsock_sendto(sock.fd, data + offset, datalen - offset, 0, &sa, sizeof(struct sockaddr_in6)); } if (ret <= 0) { - LOG_ERR("sendto() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_sendto() failed: %d, sent: %d", -errno, offset); break; } offset += ret; @@ -866,15 +867,15 @@ static int do_recvfrom(int timeout, int flags) socklen_t addrlen = sizeof(struct sockaddr); struct timeval tmo = {.tv_sec = timeout}; - ret = setsockopt(sock.fd, SOL_SOCKET, SO_RCVTIMEO, &tmo, sizeof(tmo)); + ret = zsock_setsockopt(sock.fd, SOL_SOCKET, SO_RCVTIMEO, &tmo, sizeof(tmo)); if (ret) { - LOG_ERR("setsockopt(%d) error: %d", SO_RCVTIMEO, -errno); + LOG_ERR("zsock_setsockopt(%d) error: %d", SO_RCVTIMEO, -errno); return -errno; } - ret = recvfrom( + ret = zsock_recvfrom( sock.fd, (void *)slm_data_buf, sizeof(slm_data_buf), flags, &remote, &addrlen); if (ret < 0) { - LOG_ERR("recvfrom() error: %d", -errno); + LOG_ERR("zsock_recvfrom() error: %d", -errno); return -errno; } /** @@ -883,7 +884,7 @@ static int do_recvfrom(int timeout, int flags) * value is 0. Treat as normal case */ if (ret == 0) { - LOG_WRN("recvfrom() return 0"); + LOG_WRN("zsock_recvfrom() return 0"); } else { char peer_addr[INET6_ADDRSTRLEN] = {0}; uint16_t peer_port = 0; @@ -898,7 +899,7 @@ static int do_recvfrom(int timeout, int flags) static int do_poll(int timeout) { - int ret = poll(fds, SLM_MAX_SOCKET_COUNT, timeout); + int ret = zsock_poll(fds, SLM_MAX_SOCKET_COUNT, timeout); if (ret < 0) { rsp_send("\r\n#XPOLL: %d\r\n", ret); @@ -921,7 +922,7 @@ static int do_poll(int timeout) static int socket_poll(int sock_fd, int event, int timeout) { int ret; - struct pollfd fd = { + struct zsock_pollfd fd = { .fd = sock_fd, .events = event }; @@ -930,16 +931,16 @@ static int socket_poll(int sock_fd, int event, int timeout) return 0; } - ret = poll(&fd, 1, MSEC_PER_SEC * timeout); + ret = zsock_poll(&fd, 1, MSEC_PER_SEC * timeout); if (ret < 0) { - LOG_WRN("poll() error: %d", -errno); + LOG_WRN("zsock_poll() error: %d", -errno); return -errno; } else if (ret == 0) { - LOG_WRN("poll() timeout"); + LOG_WRN("zsock_poll() timeout"); return -EAGAIN; } - LOG_DBG("poll() events 0x%08x", fd.revents); + LOG_DBG("zsock_poll() events 0x%08x", fd.revents); if ((fd.revents & event) != event) { return -EAGAIN; } @@ -1537,8 +1538,8 @@ static int handle_at_getaddrinfo(enum at_parser_cmd_type cmd_type, struct at_par char hostname[NI_MAXHOST]; char host[SLM_MAX_URL]; int size = SLM_MAX_URL; - struct addrinfo *result; - struct addrinfo *res; + struct zsock_addrinfo *result; + struct zsock_addrinfo *res; char rsp_buf[256]; switch (cmd_type) { @@ -1549,7 +1550,7 @@ static int handle_at_getaddrinfo(enum at_parser_cmd_type cmd_type, struct at_par } if (param_count == 3) { /* DNS query with designated address family */ - struct addrinfo hints = { + struct zsock_addrinfo hints = { .ai_family = AF_UNSPEC }; err = at_parser_num_get(parser, 2, &hints.ai_family); @@ -1559,14 +1560,14 @@ static int handle_at_getaddrinfo(enum at_parser_cmd_type cmd_type, struct at_par if (hints.ai_family < 0 || hints.ai_family > AF_INET6) { return -EINVAL; } - err = getaddrinfo(host, NULL, &hints, &result); + err = zsock_getaddrinfo(host, NULL, &hints, &result); } else if (param_count == 2) { - err = getaddrinfo(host, NULL, NULL, &result); + err = zsock_getaddrinfo(host, NULL, NULL, &result); } else { return -EINVAL; } if (err) { - rsp_send("\r\n#XGETADDRINFO: \"%s\"\r\n", gai_strerror(err)); + rsp_send("\r\n#XGETADDRINFO: \"%s\"\r\n", zsock_gai_strerror(err)); return err; } else if (result == NULL) { rsp_send("\r\n#XGETADDRINFO: \"not found\"\r\n"); @@ -1579,11 +1580,13 @@ static int handle_at_getaddrinfo(enum at_parser_cmd_type cmd_type, struct at_par if (res->ai_family == AF_INET) { struct sockaddr_in *host = (struct sockaddr_in *)result->ai_addr; - inet_ntop(AF_INET, &host->sin_addr, hostname, sizeof(hostname)); + zsock_inet_ntop(AF_INET, &host->sin_addr, hostname, + sizeof(hostname)); } else if (res->ai_family == AF_INET6) { struct sockaddr_in6 *host = (struct sockaddr_in6 *)result->ai_addr; - inet_ntop(AF_INET6, &host->sin6_addr, hostname, sizeof(hostname)); + zsock_inet_ntop(AF_INET6, &host->sin6_addr, hostname, + sizeof(hostname)); } else { continue; } @@ -1595,7 +1598,7 @@ static int handle_at_getaddrinfo(enum at_parser_cmd_type cmd_type, struct at_par } strcat(rsp_buf, "\"\r\n"); rsp_send("%s", rsp_buf); - freeaddrinfo(result); + zsock_freeaddrinfo(result); break; default: @@ -1623,7 +1626,7 @@ static int handle_at_poll(enum at_parser_cmd_type cmd_type, struct at_parser *pa for (int i = 0; i < SLM_MAX_SOCKET_COUNT; i++) { fds[i].fd = socks[i].fd; if (fds[i].fd != INVALID_SOCKET) { - fds[i].events = POLLIN; + fds[i].events = ZSOCK_POLLIN; } } } else { @@ -1639,7 +1642,7 @@ static int handle_at_poll(enum at_parser_cmd_type cmd_type, struct at_parser *pa return -EINVAL; } fds[i].fd = handle; - fds[i].events = POLLIN; + fds[i].events = ZSOCK_POLLIN; } } } @@ -1673,10 +1676,10 @@ int slm_at_socket_uninit(void) (void)do_socket_close(); for (int i = 0; i < SLM_MAX_SOCKET_COUNT; i++) { if (socks[i].fd_peer != INVALID_SOCKET) { - close(socks[i].fd_peer); + zsock_close(socks[i].fd_peer); } if (socks[i].fd != INVALID_SOCKET) { - close(socks[i].fd); + zsock_close(socks[i].fd); } } diff --git a/applications/serial_lte_modem/src/slm_at_tcp_proxy.c b/applications/serial_lte_modem/src/slm_at_tcp_proxy.c index 04eb493d3693..183e0526c880 100644 --- a/applications/serial_lte_modem/src/slm_at_tcp_proxy.c +++ b/applications/serial_lte_modem/src/slm_at_tcp_proxy.c @@ -72,12 +72,12 @@ static int do_tcp_server_start(uint16_t port) /* Open socket */ if (proxy.sec_tag == INVALID_SEC_TAG) { - ret = socket(proxy.family, SOCK_STREAM, IPPROTO_TCP); + ret = zsock_socket(proxy.family, SOCK_STREAM, IPPROTO_TCP); } else { - ret = socket(proxy.family, SOCK_STREAM, IPPROTO_TLS_1_2); + ret = zsock_socket(proxy.family, SOCK_STREAM, IPPROTO_TLS_1_2); } if (ret < 0) { - LOG_ERR("socket() failed: %d", -errno); + LOG_ERR("zsock_socket() failed: %d", -errno); ret = -errno; goto exit_svr; } @@ -96,7 +96,7 @@ static int do_tcp_server_start(uint16_t port) int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); if (ret) { ret = errno; @@ -105,18 +105,18 @@ static int do_tcp_server_start(uint16_t port) #endif sec_tag_t sec_tag_list[1] = { proxy.sec_tag }; - ret = setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { - LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); ret = -errno; goto exit_svr; } } - ret = setsockopt(proxy.sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); + ret = zsock_setsockopt(proxy.sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); if (ret < 0) { - LOG_ERR("setsockopt(SO_REUSEADDR): %d", -errno); + LOG_ERR("zsock_setsockopt(SO_REUSEADDR): %d", -errno); ret = -errno; goto exit_svr; } @@ -128,9 +128,9 @@ static int do_tcp_server_start(uint16_t port) } /* Enable listen */ - ret = listen(proxy.sock, 1); + ret = zsock_listen(proxy.sock, 1); if (ret < 0) { - LOG_ERR("listen() failed: %d", -errno); + LOG_ERR("zsock_listen() failed: %d", -errno); ret = -EINVAL; goto exit_svr; } @@ -147,7 +147,7 @@ static int do_tcp_server_start(uint16_t port) exit_svr: if (proxy.sock != INVALID_SOCKET) { - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; } rsp_send("\r\n#XTCPSVR: %d,\"not started\"\r\n", ret); @@ -177,16 +177,16 @@ static int do_tcp_proxy_close(void) /* Attempt to make the thread exit by closing the sockets. */ if (proxy.sock != INVALID_SOCKET) { - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; } if (proxy.sock_peer != INVALID_SOCKET) { - close(proxy.sock_peer); + zsock_close(proxy.sock_peer); proxy.sock_peer = INVALID_SOCKET; } } k_msgq_purge(&proxy_event_queue); - close(proxy.efd); + zsock_close(proxy.efd); proxy.efd = INVALID_SOCKET; return ret; @@ -199,12 +199,12 @@ static int do_tcp_client_connect(const char *url, uint16_t port) /* Open socket */ if (proxy.sec_tag == INVALID_SEC_TAG) { - ret = socket(proxy.family, SOCK_STREAM, IPPROTO_TCP); + ret = zsock_socket(proxy.family, SOCK_STREAM, IPPROTO_TCP); } else { - ret = socket(proxy.family, SOCK_STREAM, IPPROTO_TLS_1_2); + ret = zsock_socket(proxy.family, SOCK_STREAM, IPPROTO_TLS_1_2); } if (ret < 0) { - LOG_ERR("socket() failed: %d", -errno); + LOG_ERR("zsock_socket() failed: %d", -errno); return ret; } proxy.sock = ret; @@ -219,7 +219,8 @@ static int do_tcp_client_connect(const char *url, uint16_t port) int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, + sizeof(tls_native)); if (ret) { ret = errno; goto exit_cli; @@ -227,27 +228,27 @@ static int do_tcp_client_connect(const char *url, uint16_t port) #endif sec_tag_t sec_tag_list[1] = { proxy.sec_tag }; - ret = setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { - LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); ret = -errno; goto exit_cli; } - ret = setsockopt(proxy.sock, SOL_TLS, TLS_PEER_VERIFY, &proxy.peer_verify, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_PEER_VERIFY, &proxy.peer_verify, sizeof(proxy.peer_verify)); if (ret) { - LOG_ERR("setsockopt(TLS_PEER_VERIFY) error: %d", errno); + LOG_ERR("zsock_setsockopt(TLS_PEER_VERIFY) error: %d", errno); ret = -errno; goto exit_cli; } if (proxy.hostname_verify) { - ret = setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, url, strlen(url)); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, url, strlen(url)); } else { - ret = setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, NULL, 0); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, NULL, 0); } if (ret) { - LOG_ERR("setsockopt(TLS_HOSTNAME) error: %d", errno); + LOG_ERR("zsock_setsockopt(TLS_HOSTNAME) error: %d", errno); ret = -errno; goto exit_cli; } @@ -259,12 +260,12 @@ static int do_tcp_client_connect(const char *url, uint16_t port) goto exit_cli; } if (sa.sa_family == AF_INET) { - ret = connect(proxy.sock, &sa, sizeof(struct sockaddr_in)); + ret = zsock_connect(proxy.sock, &sa, sizeof(struct sockaddr_in)); } else { - ret = connect(proxy.sock, &sa, sizeof(struct sockaddr_in6)); + ret = zsock_connect(proxy.sock, &sa, sizeof(struct sockaddr_in6)); } if (ret) { - LOG_ERR("connect() failed: %d", -errno); + LOG_ERR("zsock_connect() failed: %d", -errno); ret = -errno; goto exit_cli; } @@ -281,7 +282,7 @@ static int do_tcp_client_connect(const char *url, uint16_t port) return 0; exit_cli: - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; rsp_send("\r\n#XTCPCLI: %d,\"not connected\"\r\n", ret); @@ -299,9 +300,9 @@ static int do_tcp_send(const uint8_t *data, int datalen) } while (offset < datalen) { - ret = send(sock, data + offset, datalen - offset, 0); + ret = zsock_send(sock, data + offset, datalen - offset, 0); if (ret < 0) { - LOG_ERR("send() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send() failed: %d, sent: %d", -errno, offset); ret = -errno; break; } else { @@ -328,9 +329,9 @@ static int do_tcp_send_datamode(const uint8_t *data, int datalen) } while (offset < datalen) { - ret = send(sock, data + offset, datalen - offset, 0); + ret = zsock_send(sock, data + offset, datalen - offset, 0); if (ret < 0) { - LOG_ERR("send() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send() failed: %d, sent: %d", -errno, offset); break; } else { offset += ret; @@ -366,8 +367,8 @@ static int tcp_datamode_callback(uint8_t op, const uint8_t *data, int len, uint8 static void tcpsvr_terminate_connection(int cause) { if (proxy.sock_peer != INVALID_SOCKET) { - if (close(proxy.sock_peer) < 0) { - LOG_WRN("sock %d close() error: %d", proxy.sock_peer, -errno); + if (zsock_close(proxy.sock_peer) < 0) { + LOG_WRN("sock %d zsock_close() error: %d", proxy.sock_peer, -errno); } proxy.sock_peer = INVALID_SOCKET; @@ -390,7 +391,7 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) }; int ret; - struct pollfd fds[FD_COUNT]; + struct zsock_pollfd fds[FD_COUNT]; ARG_UNUSED(p1); ARG_UNUSED(p2); @@ -398,18 +399,18 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) fds[SOCK_LISTEN].fd = proxy.sock; - fds[SOCK_LISTEN].events = POLLIN; + fds[SOCK_LISTEN].events = ZSOCK_POLLIN; /** The field fd contains a file descriptor for an open file. If this field is negative, * then the corresponding events field is ignored and the revents field returns zero. */ fds[SOCK_PEER].fd = INVALID_SOCKET; - fds[SOCK_PEER].events = POLLIN; + fds[SOCK_PEER].events = ZSOCK_POLLIN; fds[EVENT_FD].fd = proxy.efd; - fds[EVENT_FD].events = POLLIN; + fds[EVENT_FD].events = ZSOCK_POLLIN; while (true) { - ret = poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_TCP_POLL_TIME); + ret = zsock_poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_TCP_POLL_TIME); if (ret < 0) { /* IO error */ - LOG_WRN("poll() error: %d", -errno); + LOG_WRN("zsock_poll() error: %d", -errno); ret = -EIO; break; } @@ -421,22 +422,22 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) LOG_DBG("efd events 0x%08x", fds[EVENT_FD].revents); /* Listening socket events must be handled first*/ if (fds[SOCK_LISTEN].revents) { - if ((fds[SOCK_LISTEN].revents & POLLERR) != 0) { - LOG_WRN("SOCK_LISTEN (%d): POLLERR", fds[SOCK_LISTEN].fd); + if ((fds[SOCK_LISTEN].revents & ZSOCK_POLLERR) != 0) { + LOG_WRN("SOCK_LISTEN (%d): ZSOCK_POLLERR", fds[SOCK_LISTEN].fd); ret = -EIO; break; } - if ((fds[SOCK_LISTEN].revents & POLLHUP) != 0) { - LOG_WRN("SOCK_LISTEN (%d): POLLHUP", fds[SOCK_LISTEN].fd); + if ((fds[SOCK_LISTEN].revents & ZSOCK_POLLHUP) != 0) { + LOG_WRN("SOCK_LISTEN (%d): ZSOCK_POLLHUP", fds[SOCK_LISTEN].fd); ret = -ECONNRESET; break; } - if ((fds[SOCK_LISTEN].revents & POLLNVAL) != 0) { - LOG_WRN("SOCK_LISTEN (%d): POLLNVAL", fds[SOCK_LISTEN].fd); + if ((fds[SOCK_LISTEN].revents & ZSOCK_POLLNVAL) != 0) { + LOG_WRN("SOCK_LISTEN (%d): ZSOCK_POLLNVAL", fds[SOCK_LISTEN].fd); ret = -ENETDOWN; break; } - if ((fds[SOCK_LISTEN].revents & POLLIN) == 0) { + if ((fds[SOCK_LISTEN].revents & ZSOCK_POLLIN) == 0) { /* Ignore and check whether there are client events */ goto client_events; } @@ -449,28 +450,28 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) struct sockaddr_in client; len = sizeof(struct sockaddr_in); - ret = accept(proxy.sock, (struct sockaddr *)&client, &len); + ret = zsock_accept(proxy.sock, (struct sockaddr *)&client, &len); if (ret == -1) { - LOG_WRN("accept(ipv4) error: %d", -errno); + LOG_WRN("zsock_accept(ipv4) error: %d", -errno); goto client_events; } - (void)inet_ntop(AF_INET, &client.sin_addr, peer_addr, + (void)zsock_inet_ntop(AF_INET, &client.sin_addr, peer_addr, sizeof(peer_addr)); } else { struct sockaddr_in6 client; len = sizeof(struct sockaddr_in6); - ret = accept(proxy.sock, (struct sockaddr *)&client, &len); + ret = zsock_accept(proxy.sock, (struct sockaddr *)&client, &len); if (ret == -1) { - LOG_WRN("accept(ipv6) error: %d", -errno); + LOG_WRN("zsock_accept(ipv6) error: %d", -errno); goto client_events; } - (void)inet_ntop(AF_INET6, &client.sin6_addr, peer_addr, + (void)zsock_inet_ntop(AF_INET6, &client.sin6_addr, peer_addr, sizeof(peer_addr)); } if (fds[SOCK_PEER].fd >= 0) { LOG_WRN("Full. Close connection."); - close(ret); + zsock_close(ret); goto client_events; } proxy.sock_peer = ret; @@ -481,12 +482,12 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) client_events: /* Incoming socket events */ if (fds[SOCK_PEER].revents) { - /* Process POLLIN first to get the data, even if there are errors. */ - if ((fds[SOCK_PEER].revents & POLLIN) == POLLIN) { - ret = recv(fds[SOCK_PEER].fd, (void *)slm_data_buf, - sizeof(slm_data_buf), MSG_DONTWAIT); + /* Process ZSOCK_POLLIN first to get the data, even if there are errors. */ + if ((fds[SOCK_PEER].revents & ZSOCK_POLLIN) == ZSOCK_POLLIN) { + ret = zsock_recv(fds[SOCK_PEER].fd, (void *)slm_data_buf, + sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT); if (ret < 0 && errno != EAGAIN) { - LOG_ERR("recv() error: %d", -errno); + LOG_ERR("zsock_recv() error: %d", -errno); tcpsvr_terminate_connection(-errno); fds[SOCK_PEER].fd = INVALID_SOCKET; } @@ -497,24 +498,24 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) data_send(slm_data_buf, ret); } } - if ((fds[SOCK_PEER].revents & POLLERR) != 0) { - LOG_WRN("SOCK_PEER (%d): POLLERR", fds[SOCK_PEER].fd); + if ((fds[SOCK_PEER].revents & ZSOCK_POLLERR) != 0) { + LOG_WRN("SOCK_PEER (%d): ZSOCK_POLLERR", fds[SOCK_PEER].fd); tcpsvr_terminate_connection(-EIO); fds[SOCK_PEER].fd = INVALID_SOCKET; } - if ((fds[SOCK_PEER].revents & POLLHUP) != 0) { - LOG_DBG("SOCK_PEER (%d): POLLHUP", fds[SOCK_PEER].fd); + if ((fds[SOCK_PEER].revents & ZSOCK_POLLHUP) != 0) { + LOG_DBG("SOCK_PEER (%d): ZSOCK_POLLHUP", fds[SOCK_PEER].fd); tcpsvr_terminate_connection(0); fds[SOCK_PEER].fd = INVALID_SOCKET; } - if ((fds[SOCK_PEER].revents & POLLNVAL) != 0) { - LOG_WRN("SOCK_PEER (%d): POLLNVAL", fds[SOCK_PEER].fd); + if ((fds[SOCK_PEER].revents & ZSOCK_POLLNVAL) != 0) { + LOG_WRN("SOCK_PEER (%d): ZSOCK_POLLNVAL", fds[SOCK_PEER].fd); tcpsvr_terminate_connection(-EBADF); fds[SOCK_PEER].fd = INVALID_SOCKET; } } /* Events from AT-commands. */ - if ((fds[EVENT_FD].revents & POLLIN) != 0) { + if ((fds[EVENT_FD].revents & ZSOCK_POLLIN) != 0) { eventfd_t value; ret = eventfd_read(fds[EVENT_FD].fd, &value); @@ -538,14 +539,14 @@ static void tcpsvr_thread_func(void *p1, void *p2, void *p3) break; } } - if (fds[EVENT_FD].revents & (POLLERR | POLLHUP | POLLNVAL)) { + if (fds[EVENT_FD].revents & (ZSOCK_POLLERR | ZSOCK_POLLHUP | ZSOCK_POLLNVAL)) { LOG_ERR("efd: unexpected event: %d", fds[EVENT_FD].revents); break; } } tcpsvr_terminate_connection(ret); - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; if (in_datamode()) { @@ -566,20 +567,20 @@ static void tcpcli_thread_func(void *p1, void *p2, void *p3) }; int ret; - struct pollfd fds[FD_COUNT]; + struct zsock_pollfd fds[FD_COUNT]; ARG_UNUSED(p1); ARG_UNUSED(p2); ARG_UNUSED(p3); fds[SOCK].fd = proxy.sock; - fds[SOCK].events = POLLIN; + fds[SOCK].events = ZSOCK_POLLIN; fds[EVENT_FD].fd = proxy.efd; - fds[EVENT_FD].events = POLLIN; + fds[EVENT_FD].events = ZSOCK_POLLIN; while (true) { - ret = poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_TCP_POLL_TIME); + ret = zsock_poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_TCP_POLL_TIME); if (ret < 0) { - LOG_WRN("poll() error: %d", ret); + LOG_WRN("zsock_poll() error: %d", ret); ret = -EIO; break; } @@ -589,11 +590,11 @@ static void tcpcli_thread_func(void *p1, void *p2, void *p3) } LOG_DBG("sock events 0x%08x", fds[SOCK].revents); LOG_DBG("efd events 0x%08x", fds[EVENT_FD].revents); - if ((fds[SOCK].revents & POLLIN) != 0) { - ret = recv(fds[SOCK].fd, (void *)slm_data_buf, sizeof(slm_data_buf), - MSG_DONTWAIT); + if ((fds[SOCK].revents & ZSOCK_POLLIN) != 0) { + ret = zsock_recv(fds[SOCK].fd, (void *)slm_data_buf, sizeof(slm_data_buf), + ZSOCK_MSG_DONTWAIT); if (ret < 0 && errno != EAGAIN) { - LOG_WRN("recv() error: %d", -errno); + LOG_WRN("zsock_recv() error: %d", -errno); } else if (ret > 0) { if (!in_datamode()) { rsp_send("\r\n#XTCPDATA: %d\r\n", ret); @@ -601,24 +602,24 @@ static void tcpcli_thread_func(void *p1, void *p2, void *p3) data_send(slm_data_buf, ret); } } - if ((fds[SOCK].revents & POLLERR) != 0) { - LOG_WRN("SOCK (%d): POLLERR", fds[SOCK].fd); + if ((fds[SOCK].revents & ZSOCK_POLLERR) != 0) { + LOG_WRN("SOCK (%d): ZSOCK_POLLERR", fds[SOCK].fd); ret = -EIO; break; } - if ((fds[SOCK].revents & POLLNVAL) != 0) { - LOG_WRN("SOCK (%d): POLLNVAL", fds[SOCK].fd); + if ((fds[SOCK].revents & ZSOCK_POLLNVAL) != 0) { + LOG_WRN("SOCK (%d): ZSOCK_POLLNVAL", fds[SOCK].fd); ret = -ENETDOWN; break; } - if ((fds[SOCK].revents & POLLHUP) != 0) { + if ((fds[SOCK].revents & ZSOCK_POLLHUP) != 0) { /* Lose LTE connection / remote end close */ - LOG_WRN("SOCK (%d): POLLHUP", fds[SOCK].fd); + LOG_WRN("SOCK (%d): ZSOCK_POLLHUP", fds[SOCK].fd); ret = -ECONNRESET; break; } /* Events from AT-commands. */ - if ((fds[EVENT_FD].revents & POLLIN) != 0) { + if ((fds[EVENT_FD].revents & ZSOCK_POLLIN) != 0) { eventfd_t value; /* AT-command event can only close the client. */ @@ -627,13 +628,13 @@ static void tcpcli_thread_func(void *p1, void *p2, void *p3) ret = 0; break; } - if (fds[EVENT_FD].revents & (POLLERR | POLLHUP | POLLNVAL)) { + if (fds[EVENT_FD].revents & (ZSOCK_POLLERR | ZSOCK_POLLHUP | ZSOCK_POLLNVAL)) { LOG_ERR("efd: unexpected event: %d", fds[EVENT_FD].revents); break; } } - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; if (in_datamode()) { diff --git a/applications/serial_lte_modem/src/slm_at_udp_proxy.c b/applications/serial_lte_modem/src/slm_at_udp_proxy.c index 5383267ddb0c..0d33e9fa350c 100644 --- a/applications/serial_lte_modem/src/slm_at_udp_proxy.c +++ b/applications/serial_lte_modem/src/slm_at_udp_proxy.c @@ -69,12 +69,12 @@ static int do_udp_server_start(uint16_t port) /* Open socket */ if (proxy.sec_tag == INVALID_SEC_TAG) { - ret = socket(proxy.family, SOCK_DGRAM, IPPROTO_UDP); + ret = zsock_socket(proxy.family, SOCK_DGRAM, IPPROTO_UDP); } else { - ret = socket(proxy.family, SOCK_DGRAM, IPPROTO_DTLS_1_2); + ret = zsock_socket(proxy.family, SOCK_DGRAM, IPPROTO_DTLS_1_2); } if (ret < 0) { - LOG_ERR("socket() failed: %d", -errno); + LOG_ERR("zsock_socket() failed: %d", -errno); ret = -errno; goto exit_svr; } @@ -94,27 +94,27 @@ static int do_udp_server_start(uint16_t port) const int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); if (ret) { - LOG_ERR("setsockopt(TLS_NATIVE) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_NATIVE) error: %d", -errno); ret = -errno; goto exit_svr; } sec_tag_t sec_tag_list[1] = { proxy.sec_tag }; - ret = setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { - LOG_ERR("setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_SEC_TAG_LIST) error: %d", -errno); ret = -errno; goto exit_svr; } int tls_role = TLS_DTLS_ROLE_SERVER; - ret = setsockopt(proxy.sock, SOL_TLS, TLS_DTLS_ROLE, &tls_role, sizeof(int)); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_DTLS_ROLE, &tls_role, sizeof(int)); if (ret) { - LOG_ERR("setsockopt(TLS_DTLS_ROLE) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_DTLS_ROLE) error: %d", -errno); ret = -errno; goto exit_svr; } @@ -122,9 +122,9 @@ static int do_udp_server_start(uint16_t port) } int reuseaddr = 1; - ret = setsockopt(proxy.sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); + ret = zsock_setsockopt(proxy.sock, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(int)); if (ret < 0) { - LOG_ERR("setsockopt(SO_REUSEADDR) error: %d", -errno); + LOG_ERR("zsock_setsockopt(SO_REUSEADDR) error: %d", -errno); ret = -errno; goto exit_svr; } @@ -149,7 +149,7 @@ static int do_udp_server_start(uint16_t port) exit_svr: if (proxy.sock != INVALID_SOCKET) { - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; } rsp_send("\r\n#UDPSVR: %d,\"not started\"\r\n", ret); @@ -174,11 +174,11 @@ static int do_udp_proxy_close(void) /* Attempt to make the thread exit by closing the socket. */ if (proxy.sock != INVALID_SOCKET) { - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; } } - close(proxy.efd); + zsock_close(proxy.efd); proxy.efd = INVALID_SOCKET; return ret; @@ -192,9 +192,9 @@ static int do_udp_client_connect(const char *url, uint16_t port) const bool using_dtls = (proxy.sec_tag != INVALID_SEC_TAG); /* Open socket */ - ret = socket(proxy.family, SOCK_DGRAM, using_dtls ? IPPROTO_DTLS_1_2 : IPPROTO_UDP); + ret = zsock_socket(proxy.family, SOCK_DGRAM, using_dtls ? IPPROTO_DTLS_1_2 : IPPROTO_UDP); if (ret < 0) { - LOG_ERR("socket() failed: %d", -errno); + LOG_ERR("zsock_socket() failed: %d", -errno); return -errno; } proxy.sock = ret; @@ -209,16 +209,17 @@ static int do_udp_client_connect(const char *url, uint16_t port) int tls_native = 1; /* Must be the first socket option to set. */ - ret = setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, sizeof(tls_native)); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_NATIVE, &tls_native, + sizeof(tls_native)); if (ret) { - LOG_ERR("setsockopt(TLS_NATIVE) error: %d", -errno); + LOG_ERR("zsock_setsockopt(TLS_NATIVE) error: %d", -errno); ret = errno; goto cli_exit; } #endif sec_tag_t sec_tag_list[1] = { proxy.sec_tag }; - ret = setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_SEC_TAG_LIST, sec_tag_list, sizeof(sec_tag_t)); if (ret) { LOG_ERR("set tag list failed: %d", -errno); @@ -231,7 +232,8 @@ static int do_udp_client_connect(const char *url, uint16_t port) * irresponsive for too long when the connection to a server fails. */ timeout = (struct timeval){ .tv_sec = 10 }; - ret = setsockopt(proxy.sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, sizeof(timeout)); + ret = zsock_setsockopt(proxy.sock, SOL_SOCKET, SO_SNDTIMEO, &timeout, + sizeof(timeout)); if (ret) { ret = -errno; LOG_ERR("Setting timeout failed: %d", ret); @@ -239,27 +241,27 @@ static int do_udp_client_connect(const char *url, uint16_t port) } if (using_cid) { - if (setsockopt(proxy.sock, SOL_TLS, TLS_DTLS_CID, + if (zsock_setsockopt(proxy.sock, SOL_TLS, TLS_DTLS_CID, &proxy.dtls_cid, sizeof(proxy.dtls_cid))) { ret = -errno; LOG_WRN("Setting DTLS CID (%d) failed: %d", proxy.dtls_cid, ret); goto cli_exit; } } - ret = setsockopt(proxy.sock, SOL_TLS, TLS_PEER_VERIFY, &proxy.peer_verify, + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_PEER_VERIFY, &proxy.peer_verify, sizeof(proxy.peer_verify)); if (ret) { - LOG_ERR("setsockopt(TLS_PEER_VERIFY) error: %d", errno); + LOG_ERR("zsock_setsockopt(TLS_PEER_VERIFY) error: %d", errno); ret = -errno; goto cli_exit; } if (proxy.hostname_verify) { - ret = setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, url, strlen(url)); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, url, strlen(url)); } else { - ret = setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, NULL, 0); + ret = zsock_setsockopt(proxy.sock, SOL_TLS, TLS_HOSTNAME, NULL, 0); } if (ret) { - LOG_ERR("setsockopt(TLS_HOSTNAME) error: %d", errno); + LOG_ERR("zsock_setsockopt(TLS_HOSTNAME) error: %d", errno); ret = -errno; goto cli_exit; } @@ -275,9 +277,9 @@ static int do_udp_client_connect(const char *url, uint16_t port) const size_t size = (sa.sa_family == AF_INET) ? sizeof(struct sockaddr_in) : sizeof(struct sockaddr_in6); - ret = connect(proxy.sock, &sa, size); + ret = zsock_connect(proxy.sock, &sa, size); if (ret < 0) { - LOG_ERR("connect() failed: %d", -errno); + LOG_ERR("zsock_connect() failed: %d", -errno); ret = -errno; goto cli_exit; } @@ -295,7 +297,7 @@ static int do_udp_client_connect(const char *url, uint16_t port) return 0; cli_exit: - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; rsp_send("\r\n#XUDPCLI: %d,\"not connected\"\r\n", ret); @@ -310,13 +312,13 @@ static int do_udp_send(const uint8_t *data, int datalen) while (offset < datalen) { if (proxy.role == UDP_ROLE_SERVER) { /* send to remembered remote */ - ret = sendto(proxy.sock, data + offset, datalen - offset, 0, + ret = zsock_sendto(proxy.sock, data + offset, datalen - offset, 0, (struct sockaddr *)&proxy.remote, sizeof(proxy.remote)); } else { - ret = send(proxy.sock, data + offset, datalen - offset, 0); + ret = zsock_send(proxy.sock, data + offset, datalen - offset, 0); } if (ret < 0) { - LOG_ERR("send()/sendto() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send()/zsock_sendto() failed: %d, sent: %d", -errno, offset); ret = -errno; break; } else { @@ -340,13 +342,13 @@ static int do_udp_send_datamode(const uint8_t *data, int datalen) while (offset < datalen) { if (proxy.role == UDP_ROLE_SERVER) { /* send to remembered remote */ - ret = sendto(proxy.sock, data + offset, datalen - offset, 0, + ret = zsock_sendto(proxy.sock, data + offset, datalen - offset, 0, (struct sockaddr *)&proxy.remote, sizeof(proxy.remote)); } else { - ret = send(proxy.sock, data + offset, datalen - offset, 0); + ret = zsock_send(proxy.sock, data + offset, datalen - offset, 0); } if (ret < 0) { - LOG_ERR("send()/sendto() failed: %d, sent: %d", -errno, offset); + LOG_ERR("zsock_send()/zsock_sendto() failed: %d, sent: %d", -errno, offset); break; } else { offset += ret; @@ -365,7 +367,7 @@ static void udp_thread_func(void *p1, void *p2, void *p3) }; int ret; - struct pollfd fds[FD_COUNT]; + struct zsock_pollfd fds[FD_COUNT]; char peer_addr[INET6_ADDRSTRLEN]; uint16_t peer_port; @@ -374,14 +376,14 @@ static void udp_thread_func(void *p1, void *p2, void *p3) ARG_UNUSED(p3); fds[SOCK].fd = proxy.sock; - fds[SOCK].events = POLLIN; + fds[SOCK].events = ZSOCK_POLLIN; fds[EVENT_FD].fd = proxy.efd; - fds[EVENT_FD].events = POLLIN; + fds[EVENT_FD].events = ZSOCK_POLLIN; do { - ret = poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_UDP_POLL_TIME); + ret = zsock_poll(fds, ARRAY_SIZE(fds), MSEC_PER_SEC * CONFIG_SLM_UDP_POLL_TIME); if (ret < 0) { /* IO error */ - LOG_WRN("poll() error: %d", ret); + LOG_WRN("zsock_poll() error: %d", ret); continue; } if (ret == 0) { /* timeout */ @@ -389,21 +391,21 @@ static void udp_thread_func(void *p1, void *p2, void *p3) } LOG_DBG("sock events 0x%08x", fds[SOCK].revents); LOG_DBG("efd events 0x%08x", fds[EVENT_FD].revents); - if ((fds[SOCK].revents & POLLIN) != 0) { + if ((fds[SOCK].revents & ZSOCK_POLLIN) != 0) { if (proxy.role == UDP_ROLE_SERVER) { /* Store the remote to send responses with the #XUDPSEND command. */ unsigned int size = sizeof(proxy.remote); memset(&proxy.remote, 0, sizeof(proxy.remote)); - ret = recvfrom(proxy.sock, (void *)slm_data_buf, - sizeof(slm_data_buf), MSG_DONTWAIT, + ret = zsock_recvfrom(proxy.sock, (void *)slm_data_buf, + sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT, (struct sockaddr *)&proxy.remote, &size); } else { - ret = recv(proxy.sock, (void *)slm_data_buf, sizeof(slm_data_buf), - MSG_DONTWAIT); + ret = zsock_recv(proxy.sock, (void *)slm_data_buf, + sizeof(slm_data_buf), ZSOCK_MSG_DONTWAIT); } if (ret < 0 && errno != EAGAIN) { - LOG_WRN("recv() error: %d", -errno); + LOG_WRN("zsock_recv() error: %d", -errno); } else if (ret > 0) { if (!in_datamode()) { util_get_peer_addr((struct sockaddr *)&proxy.remote, @@ -414,13 +416,13 @@ static void udp_thread_func(void *p1, void *p2, void *p3) data_send(slm_data_buf, ret); } } - if ((fds[SOCK].revents & POLLERR) != 0) { + if ((fds[SOCK].revents & ZSOCK_POLLERR) != 0) { int value; socklen_t len = sizeof(int); - ret = getsockopt(proxy.sock, SOL_SOCKET, SO_ERROR, &value, &len); + ret = zsock_getsockopt(proxy.sock, SOL_SOCKET, SO_ERROR, &value, &len); if (ret) { - LOG_ERR("%d : getsockopt(SO_ERROR) error: %d", fds[SOCK].fd, + LOG_ERR("%d : zsock_getsockopt(SO_ERROR) error: %d", fds[SOCK].fd, -errno); ret = -EIO; break; @@ -432,17 +434,17 @@ static void udp_thread_func(void *p1, void *p2, void *p3) LOG_WRN("DTLS client timed out: \"%s\",%d\r\n", peer_addr, peer_port); } else { - LOG_WRN("%d : POLLERR", fds[SOCK].fd); + LOG_WRN("%d : ZSOCK_POLLERR", fds[SOCK].fd); ret = -EIO; break; } } - if ((fds[SOCK].revents & POLLNVAL) != 0) { - LOG_WRN("%d : POLLNVAL", fds[SOCK].fd); + if ((fds[SOCK].revents & ZSOCK_POLLNVAL) != 0) { + LOG_WRN("%d : ZSOCK_POLLNVAL", fds[SOCK].fd); ret = -ENETDOWN; break; } - if ((fds[SOCK].revents & POLLHUP) != 0) { + if ((fds[SOCK].revents & ZSOCK_POLLHUP) != 0) { if (proxy.role == UDP_ROLE_SERVER && proxy.sec_tag != INVALID_SEC_TAG) { util_get_peer_addr((struct sockaddr *)&proxy.remote, peer_addr, &peer_port); @@ -450,25 +452,25 @@ static void udp_thread_func(void *p1, void *p2, void *p3) peer_port); } else { /* Lose LTE connection / remote end close (with DTLS) */ - LOG_WRN("%d : POLLHUP", fds[SOCK].fd); + LOG_WRN("%d : ZSOCK_POLLHUP", fds[SOCK].fd); ret = -ECONNRESET; break; } } /* Events from AT-commands. */ - if ((fds[EVENT_FD].revents & POLLIN) != 0) { + if ((fds[EVENT_FD].revents & ZSOCK_POLLIN) != 0) { LOG_DBG("Close proxy"); ret = 0; break; } - if (fds[EVENT_FD].revents & (POLLERR | POLLHUP | POLLNVAL)) { + if (fds[EVENT_FD].revents & (ZSOCK_POLLERR | ZSOCK_POLLHUP | ZSOCK_POLLNVAL)) { LOG_ERR("efd: unexpected event: %d", fds[EVENT_FD].revents); break; } } while (true); - close(proxy.sock); + zsock_close(proxy.sock); proxy.sock = INVALID_SOCKET; if (in_datamode()) { diff --git a/applications/serial_lte_modem/src/slm_ppp.c b/applications/serial_lte_modem/src/slm_ppp.c index 0b93df11f12a..2a6ee1ae312f 100644 --- a/applications/serial_lte_modem/src/slm_ppp.c +++ b/applications/serial_lte_modem/src/slm_ppp.c @@ -99,7 +99,7 @@ static bool open_ppp_sockets(void) { int ret; - ppp_fds[ZEPHYR_FD_IDX] = socket(AF_PACKET, SOCK_RAW | SOCK_NATIVE, + ppp_fds[ZEPHYR_FD_IDX] = zsock_socket(AF_PACKET, SOCK_RAW | SOCK_NATIVE, htons(IPPROTO_RAW)); if (ppp_fds[ZEPHYR_FD_IDX] < 0) { LOG_ERR("Zephyr socket creation failed (%d).", errno); @@ -110,14 +110,14 @@ static bool open_ppp_sockets(void) .sll_family = AF_PACKET, .sll_ifindex = net_if_get_by_iface(ppp_iface) }; - ret = bind(ppp_fds[ZEPHYR_FD_IDX], + ret = zsock_bind(ppp_fds[ZEPHYR_FD_IDX], (const struct sockaddr *)&ppp_zephyr_dst_addr, sizeof(ppp_zephyr_dst_addr)); if (ret < 0) { LOG_ERR("Failed to bind Zephyr socket (%d).", errno); return false; } - ppp_fds[MODEM_FD_IDX] = socket(AF_PACKET, SOCK_RAW, 0); + ppp_fds[MODEM_FD_IDX] = zsock_socket(AF_PACKET, SOCK_RAW, 0); if (ppp_fds[MODEM_FD_IDX] < 0) { LOG_ERR("Modem socket creation failed (%d).", errno); return false; @@ -132,7 +132,7 @@ static void close_ppp_sockets(void) if (ppp_fds[i] < 0) { continue; } - if (close(ppp_fds[i])) { + if (zsock_close(ppp_fds[i])) { LOG_WRN("Failed to close %s socket (%d).", ppp_socket_names[i], errno); } @@ -150,7 +150,7 @@ static bool configure_ppp_link_ip_addresses(struct ppp_context *ctx) util_get_ip_addr(PDP_CID, addr4, addr6); if (*addr4) { - if (inet_pton(AF_INET, addr4, &ctx->ipcp.my_options.address) != 1) { + if (zsock_inet_pton(AF_INET, addr4, &ctx->ipcp.my_options.address) != 1) { return false; } } else if (!*addr6) { @@ -161,7 +161,7 @@ static bool configure_ppp_link_ip_addresses(struct ppp_context *ctx) if (*addr6) { struct in6_addr in6; - if (inet_pton(AF_INET6, addr6, &in6) != 1) { + if (zsock_inet_pton(AF_INET6, addr6, &in6) != 1) { return false; } /* The interface identifier is the last 64 bits of the IPv6 address. */ @@ -577,15 +577,15 @@ static int handle_at_ppp(enum at_parser_cmd_type cmd_type, struct at_parser *par static void ppp_data_passing_thread(void*, void*, void*) { const size_t mtu = net_if_get_mtu(ppp_iface); - struct pollfd fds[PPP_FDS_COUNT]; + struct zsock_pollfd fds[PPP_FDS_COUNT]; for (size_t i = 0; i != ARRAY_SIZE(fds); ++i) { fds[i].fd = ppp_fds[i]; - fds[i].events = POLLIN; + fds[i].events = ZSOCK_POLLIN; } while (true) { - const int poll_ret = poll(fds, ARRAY_SIZE(fds), -1); + const int poll_ret = zsock_poll(fds, ARRAY_SIZE(fds), -1); if (poll_ret <= 0) { LOG_ERR("Sockets polling failed (%d, %d).", poll_ret, errno); @@ -599,18 +599,19 @@ static void ppp_data_passing_thread(void*, void*, void*) if (!revents) { continue; } - if (!(revents & POLLIN)) { - /* POLLERR/POLLNVAL happen when the sockets are closed + if (!(revents & ZSOCK_POLLIN)) { + /* ZSOCK_POLLERR/ZSOCK_POLLNVAL happen when the sockets are closed * or when the connection goes down. */ - if ((revents ^ POLLERR) && (revents ^ POLLNVAL)) { + if ((revents ^ ZSOCK_POLLERR) && (revents ^ ZSOCK_POLLNVAL)) { LOG_WRN("Unexpected event 0x%x on %s socket.", revents, ppp_socket_names[src]); } ppp_stop(); return; } - const ssize_t len = recv(fds[src].fd, ppp_data_buf, mtu, MSG_DONTWAIT); + const ssize_t len = + zsock_recv(fds[src].fd, ppp_data_buf, mtu, ZSOCK_MSG_DONTWAIT); if (len <= 0) { if (len != -1 || (errno != EAGAIN && errno != EWOULDBLOCK)) { @@ -624,7 +625,8 @@ static void ppp_data_passing_thread(void*, void*, void*) void *dst_addr = (dst == MODEM_FD_IDX) ? NULL : &ppp_zephyr_dst_addr; socklen_t addrlen = (dst == MODEM_FD_IDX) ? 0 : sizeof(ppp_zephyr_dst_addr); - send_ret = sendto(fds[dst].fd, ppp_data_buf, len, 0, dst_addr, addrlen); + send_ret = + zsock_sendto(fds[dst].fd, ppp_data_buf, len, 0, dst_addr, addrlen); if (send_ret == -1) { LOG_ERR("Failed to send %zd bytes to %s socket (%d).", len, ppp_socket_names[dst], errno); diff --git a/applications/serial_lte_modem/src/slm_util.c b/applications/serial_lte_modem/src/slm_util.c index ae9bfe2de0ec..3315a6866435 100644 --- a/applications/serial_lte_modem/src/slm_util.c +++ b/applications/serial_lte_modem/src/slm_util.c @@ -314,9 +314,9 @@ void util_get_ip_addr(int cid, char addr4[INET_ADDRSTRLEN], char addr6[INET6_ADD if (ret <= 0) { return; } - if (addr4 != NULL && inet_pton(AF_INET, addr1, tmp) == 1) { + if (addr4 != NULL && zsock_inet_pton(AF_INET, addr1, tmp) == 1) { strcpy(addr4, addr1); - } else if (addr6 != NULL && inet_pton(AF_INET6, addr1, tmp) == 1) { + } else if (addr6 != NULL && zsock_inet_pton(AF_INET6, addr1, tmp) == 1) { strcpy(addr6, addr1); return; } @@ -324,7 +324,7 @@ void util_get_ip_addr(int cid, char addr4[INET_ADDRSTRLEN], char addr6[INET6_ADD if (addr6 == NULL) { return; } - if (ret > 1 && inet_pton(AF_INET6, addr2, tmp) == 1) { + if (ret > 1 && zsock_inet_pton(AF_INET6, addr2, tmp) == 1) { strcpy(addr6, addr2); } } @@ -353,8 +353,8 @@ int util_resolve_host(int cid, const char *host, uint16_t port, int family, stru { int err; char service[PORT_MAX_SIZE + PDN_ID_MAX_SIZE + 2]; - struct addrinfo *ai = NULL; - struct addrinfo hints = { + struct zsock_addrinfo *ai = NULL; + struct zsock_addrinfo hints = { .ai_flags = AI_NUMERICSERV | AI_PDNSERV, .ai_family = family }; @@ -365,10 +365,10 @@ int util_resolve_host(int cid, const char *host, uint16_t port, int family, stru /* "service" shall be formatted as follows: "port:pdn_id" */ snprintf(service, sizeof(service), "%hu:%d", port, cid); - err = getaddrinfo(host, service, &hints, &ai); + err = zsock_getaddrinfo(host, service, &hints, &ai); if (!err) { *sa = *(ai->ai_addr); - freeaddrinfo(ai); + zsock_freeaddrinfo(ai); if (sa->sa_family != AF_INET && sa->sa_family != AF_INET6) { err = DNS_EAI_ADDRFAMILY; @@ -382,9 +382,9 @@ int util_resolve_host(int cid, const char *host, uint16_t port, int family, stru errstr = strerror(errno); err = errno; } else { - errstr = gai_strerror(err); + errstr = zsock_gai_strerror(err); } - LOG_ERR("getaddrinfo() error (%d): %s", err, errstr); + LOG_ERR("zsock_getaddrinfo() error (%d): %s", err, errstr); } return err; } @@ -394,17 +394,17 @@ int util_get_peer_addr(struct sockaddr *peer, char addr[static INET6_ADDRSTRLEN] const char *ret = NULL; if (peer->sa_family == AF_INET) { - ret = inet_ntop(AF_INET, &((struct sockaddr_in *)peer)->sin_addr, + ret = zsock_inet_ntop(AF_INET, &((struct sockaddr_in *)peer)->sin_addr, addr, INET6_ADDRSTRLEN); *port = ntohs(((struct sockaddr_in *)peer)->sin_port); } else { - ret = inet_ntop(AF_INET6, &((struct sockaddr_in6 *)peer)->sin6_addr, + ret = zsock_inet_ntop(AF_INET6, &((struct sockaddr_in6 *)peer)->sin6_addr, addr, INET6_ADDRSTRLEN); *port = ntohs(((struct sockaddr_in6 *)peer)->sin6_port); } if (ret == NULL) { - LOG_ERR("inet_ntop error (%d)", -errno); + LOG_ERR("zsock_inet_ntop error (%d)", -errno); return -errno; } diff --git a/applications/serial_lte_modem/src/slm_util.h b/applications/serial_lte_modem/src/slm_util.h index a0ade7142053..b2cdadf16eb4 100644 --- a/applications/serial_lte_modem/src/slm_util.h +++ b/applications/serial_lte_modem/src/slm_util.h @@ -173,7 +173,7 @@ int util_str_to_int(const char *str, int base, int *output); /** * @brief Resolve remote host by host name or IP address * - * This function wraps up getaddrinfo() to return first resolved address. + * This function wraps up zsock_getaddrinfo() to return first resolved address. * * @param[in] cid PDP Context ID as defined in "+CGDCONT" command (0~10). * @param[in] host Name or IP address of remote host. diff --git a/samples/cellular/modem_shell/overlay-ppp.conf b/samples/cellular/modem_shell/overlay-ppp.conf index a93e6a051755..a292d7adb9e1 100644 --- a/samples/cellular/modem_shell/overlay-ppp.conf +++ b/samples/cellular/modem_shell/overlay-ppp.conf @@ -59,8 +59,6 @@ CONFIG_UART_LINE_CTRL=y CONFIG_UART_0_INTERRUPT_DRIVEN=n CONFIG_UART_0_ASYNC=y -CONFIG_UART_0_NRF_HW_ASYNC=y -CONFIG_UART_0_NRF_HW_ASYNC_TIMER=1 #CONFIG_UART_0_NRF_ASYNC_LOW_POWER=y CONFIG_NET_PPP_UART_BUF_LEN=2048 From aeaccb348e3971a7e4c9f3e9b32a448788991c10 Mon Sep 17 00:00:00 2001 From: Sean Madigan Date: Thu, 30 Jan 2025 16:43:05 +0000 Subject: [PATCH 089/109] subsys: bluetooth: rpc: Remove deprecated bt_le_set_auto_conn Function has been deprecated in upstream zephyr, so remove from here. Signed-off-by: Sean Madigan --- .../bluetooth/rpc/client/bt_rpc_conn_client.c | 26 -------------- subsys/bluetooth/rpc/common/bt_rpc_common.h | 1 - subsys/bluetooth/rpc/host/bt_rpc_conn_host.c | 35 ------------------- 3 files changed, 62 deletions(-) diff --git a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c index c442b7a6ac11..ae5487e8c021 100644 --- a/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c +++ b/subsys/bluetooth/rpc/client/bt_rpc_conn_client.c @@ -610,32 +610,6 @@ int bt_conn_create_auto_stop(void) } #endif /* defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ -#if !defined(CONFIG_BT_FILTER_ACCEPT_LIST) -int bt_le_set_auto_conn(const bt_addr_le_t *addr, - const struct bt_le_conn_param *param) -{ - struct nrf_rpc_cbor_ctx ctx; - int result; - size_t buffer_size_max = 3; - - buffer_size_max += addr ? sizeof(bt_addr_le_t) : 0; - buffer_size_max += (param == NULL) ? 1 : 12; - - NRF_RPC_CBOR_ALLOC(&bt_rpc_grp, ctx, buffer_size_max); - - nrf_rpc_encode_buffer(&ctx, addr, sizeof(bt_addr_le_t)); - if (param == NULL) { - nrf_rpc_encode_null(&ctx); - } else { - bt_le_conn_param_enc(&ctx, param); - } - - nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_LE_SET_AUTO_CONN_RPC_CMD, - &ctx, nrf_rpc_rsp_decode_i32, &result); - - return result; -} -#endif /* !defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ #endif /* defined(CONFIG_BT_CENTRAL) */ #if defined(CONFIG_BT_SMP) diff --git a/subsys/bluetooth/rpc/common/bt_rpc_common.h b/subsys/bluetooth/rpc/common/bt_rpc_common.h index 1420740b7b09..aeaef1e51a6a 100644 --- a/subsys/bluetooth/rpc/common/bt_rpc_common.h +++ b/subsys/bluetooth/rpc/common/bt_rpc_common.h @@ -92,7 +92,6 @@ enum bt_rpc_cmd_from_cli_to_host { BT_CONN_LE_CREATE_RPC_CMD, BT_CONN_LE_CREATE_AUTO_RPC_CMD, BT_CONN_CREATE_AUTO_STOP_RPC_CMD, - BT_LE_SET_AUTO_CONN_RPC_CMD, BT_CONN_SET_SECURITY_RPC_CMD, BT_CONN_GET_SECURITY_RPC_CMD, BT_CONN_ENC_KEY_SIZE_RPC_CMD, diff --git a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c index dd0c1cf84b5c..54d69776c468 100644 --- a/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c +++ b/subsys/bluetooth/rpc/host/bt_rpc_conn_host.c @@ -630,41 +630,6 @@ static void bt_conn_create_auto_stop_rpc_handler(const struct nrf_rpc_group *gro NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_conn_create_auto_stop, BT_CONN_CREATE_AUTO_STOP_RPC_CMD, bt_conn_create_auto_stop_rpc_handler, NULL); #endif /* defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ - -#if !defined(CONFIG_BT_FILTER_ACCEPT_LIST) -static void bt_le_set_auto_conn_rpc_handler(const struct nrf_rpc_group *group, - struct nrf_rpc_cbor_ctx *ctx, void *handler_data) -{ - bt_addr_le_t addr_data; - const bt_addr_le_t *addr; - struct bt_le_conn_param param_data; - struct bt_le_conn_param *param; - int result; - - addr = nrf_rpc_decode_buffer(ctx, &addr_data, sizeof(bt_addr_le_t)); - if (nrf_rpc_decode_is_null(ctx)) { - param = NULL; - } else { - param = ¶m_data; - bt_le_conn_param_dec(ctx, param); - } - - if (!nrf_rpc_decoding_done_and_check(group, ctx)) { - goto decoding_error; - } - - result = bt_le_set_auto_conn(addr, param); - - nrf_rpc_rsp_send_int(group, result); - - return; -decoding_error: - report_decoding_error(BT_LE_SET_AUTO_CONN_RPC_CMD, handler_data); -} - -NRF_RPC_CBOR_CMD_DECODER(bt_rpc_grp, bt_le_set_auto_conn, BT_LE_SET_AUTO_CONN_RPC_CMD, - bt_le_set_auto_conn_rpc_handler, NULL); -#endif /* !defined(CONFIG_BT_FILTER_ACCEPT_LIST) */ #endif /* defined(CONFIG_BT_CENTRAL) */ #if defined(CONFIG_BT_SMP) From bf479f5fc0ad015d0c30c946583810937e198c38 Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Fri, 31 Jan 2025 16:23:15 +0530 Subject: [PATCH 090/109] net: lib: hostap_crypto: Enable MBEDTLS_MD5_C config Let HOSTAP_CRYPTO_ALT_LEGACY_PSA select MBEDTLS_MD5_C so that md5 related calls are available when crypto_alt is used. Signed-off-by: Ravi Dondaputi --- subsys/net/lib/hostap_crypto/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/subsys/net/lib/hostap_crypto/Kconfig b/subsys/net/lib/hostap_crypto/Kconfig index f0fa6ed66de5..c4eaeda9af19 100644 --- a/subsys/net/lib/hostap_crypto/Kconfig +++ b/subsys/net/lib/hostap_crypto/Kconfig @@ -58,6 +58,7 @@ config HOSTAP_CRYPTO_ALT_LEGACY_PSA select MBEDTLS_CIPHER_PADDING_PKCS7 select MBEDTLS_PK_WRITE_C select MBEDTLS_KEY_EXCHANGE_ALL_ENABLED + select MBEDTLS_MD5_C select MBEDTLS_ENTROPY_C config HOSTAP_CRYPTO_ALT_PSA From 080c89dbe3c2be30b3a44c352d0ef9374691930b Mon Sep 17 00:00:00 2001 From: Ravi Dondaputi Date: Thu, 30 Jan 2025 13:16:02 +0530 Subject: [PATCH 091/109] samples: wifi: shell: Correct the options for scan_only build In scan_only build we need to override the sysbuild config option as well. By default it gets set to SB_CONFIG_WIFI_NRF70_SYSTEM_MODE which enables supplicant. Overriding this with SB_CONFIG_WIFI_NRF70_SCAN_ONLY fixes this. Signed-off-by: Ravi Dondaputi --- samples/wifi/shell/sample.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/wifi/shell/sample.yaml b/samples/wifi/shell/sample.yaml index 776a32c1b985..2e624be926d0 100644 --- a/samples/wifi/shell/sample.yaml +++ b/samples/wifi/shell/sample.yaml @@ -196,7 +196,7 @@ tests: build_only: true extra_args: - EXTRA_CONF_FILE=overlay-scan-only.conf - - CONFIG_WIFI_NM_WPA_SUPPLICANT=n + - SB_CONFIG_WIFI_NRF70_SCAN_ONLY=y platform_allow: - thingy91x/nrf9151/ns tags: From 3b311e765c300d95b5a891bf464c638a1e7b1d0d Mon Sep 17 00:00:00 2001 From: Tomi Fontanilles Date: Fri, 31 Jan 2025 15:06:36 +0200 Subject: [PATCH 092/109] secure_storage: make the build fail in case of unsupported configuration The ZMS implementation of the ITS store module is not supported when partition manager is used because the DT chosen `secure_storage_its_partition` cannot be used. This would require using a different, partition manager-specific configuration. As partition manager will be replaced this combination is just not supported. Signed-off-by: Tomi Fontanilles --- subsys/CMakeLists.txt | 1 + subsys/secure_storage/CMakeLists.txt | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 subsys/secure_storage/CMakeLists.txt diff --git a/subsys/CMakeLists.txt b/subsys/CMakeLists.txt index be969e651565..8a1e1028bbfb 100644 --- a/subsys/CMakeLists.txt +++ b/subsys/CMakeLists.txt @@ -13,6 +13,7 @@ add_subdirectory_ifdef(CONFIG_SECURE_BOOT_STORAGE bootloader/bl_storage) add_subdirectory_ifdef(CONFIG_NRF_SECURITY nrf_security) add_subdirectory_ifdef(CONFIG_TRUSTED_STORAGE trusted_storage) +add_subdirectory_ifdef(CONFIG_SECURE_STORAGE secure_storage) add_subdirectory(net) add_subdirectory_ifdef(CONFIG_ESB esb) diff --git a/subsys/secure_storage/CMakeLists.txt b/subsys/secure_storage/CMakeLists.txt new file mode 100644 index 000000000000..dc8c75552566 --- /dev/null +++ b/subsys/secure_storage/CMakeLists.txt @@ -0,0 +1,10 @@ +# Copyright (c) 2025 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause + +if(CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS AND CONFIG_PARTITION_MANAGER_ENABLED) + message(FATAL_ERROR " + CONFIG_SECURE_STORAGE_ITS_STORE_IMPLEMENTATION_ZMS is + not supported when partition manager is enabled. + ") +endif() From a852064d97bef991ec02c1f34480ea400fdce7f6 Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 3 Feb 2025 10:36:32 +0100 Subject: [PATCH 093/109] doc: nrf: wifi: remove incorrect doxygen group We cannot render/link Doxygen groups that belong to another project like Zephyr, see https://github.com/nrfconnect/sdk-nrf/pull/19341 for progress on that. Signed-off-by: Gerard Marull-Paretas --- doc/nrf/libraries/networking/wifi_credentials.rst | 2 -- 1 file changed, 2 deletions(-) diff --git a/doc/nrf/libraries/networking/wifi_credentials.rst b/doc/nrf/libraries/networking/wifi_credentials.rst index 1fc4205cccf9..fedd413d1d59 100644 --- a/doc/nrf/libraries/networking/wifi_credentials.rst +++ b/doc/nrf/libraries/networking/wifi_credentials.rst @@ -66,5 +66,3 @@ API documentation | Header file: :file:`include/zephyr/net/wifi_credentials.h` | Source files: :file:`subsys/net/lib/wifi_credentials` - -.. doxygengroup:: wifi_credentials From c8bbced5b747b934ab1a084586f0f19a34c1cb7a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarzyna=20Gi=C4=85d=C5=82a?= Date: Mon, 3 Feb 2025 10:53:53 +0100 Subject: [PATCH 094/109] quarantine_zephyr: Add zephyr tests to overflow issues MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add Zephyr tests due to overflow issues. Refers: NCSDK-31589 NCSDK-31590 NCSDK-31591 Signed-off-by: Katarzyna Giądła --- scripts/quarantine_zephyr.yaml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index a5eaf920660f..f4184a1f9c0b 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -216,6 +216,28 @@ - nrf5340dk/nrf5340/cpuapp/ns comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31574" +- scenarios: + - drivers.eeprom.emul.build + platforms: + - nrf54h20dk@0.9.0/nrf54h20/cpuppr + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31589" + +- scenarios: + - llext.writable + - llext.writable_relocatable + - llext.writable_slid_linking + - llext.writable_relocatable_slid_linking + platforms: + - nrf9160dk@0.14.0/nrf9160 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31590" + +- scenarios: + - drivers.stepper.shell + - drivers.stepper.shell_async + platforms: + - nrf54h20dk@0.9.0/nrf54h20/cpuppr + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31591" + # --------------------------------- Won't fix section ----------------------------------- - scenarios: @@ -430,6 +452,7 @@ - sample.shell.shell_module - sample.shell.shell_module.getopt - sample.shell.shell_module.login + - secure_storage.psa.its.secure_storage.custom.store platforms: - nrf54l15dk/nrf54l15/cpuflpr comment: "region RAM/FLASH overflowed" From 1cc7b87f9eb4caf5e4e2e4adf91e4bb1acacba14 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Mon, 3 Feb 2025 15:47:05 +0100 Subject: [PATCH 095/109] applications: connectivity_bridge: reduce ble logging BLE logging size requirements have increased a lot. We need to reduce logging to fit the application. Signed-off-by: Maximilian Deubel --- .../boards/thingy91x_nrf5340_cpuapp.conf | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf b/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf index d0a53d3492c1..d4f506949a6d 100644 --- a/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf +++ b/applications/connectivity_bridge/boards/thingy91x_nrf5340_cpuapp.conf @@ -45,3 +45,18 @@ CONFIG_CMSIS_DAP_DEVICE_VENDOR="Nordic Semiconductor ASA" CONFIG_CMSIS_DAP_DEVICE_NAME="nrf91" CONFIG_BRIDGE_CMSIS_DAP_NORDIC_COMMANDS=y + +# Reduce BLE logging to save flash space +CONFIG_BT_NUS_LOG_LEVEL_ERR=y +CONFIG_BT_LOG_LEVEL_ERR=y +CONFIG_BT_HCI_DRIVER_LOG_LEVEL_ERR=y +CONFIG_BT_RPA_LOG_LEVEL_ERR=y +CONFIG_BT_CRYPTO_LOG_LEVEL_ERR=y +CONFIG_BT_ATT_LOG_LEVEL_ERR=y +CONFIG_BT_GATT_LOG_LEVEL_ERR=y +CONFIG_BT_L2CAP_LOG_LEVEL_ERR=y +CONFIG_BT_HCI_CORE_LOG_LEVEL_ERR=y +CONFIG_BT_CONN_LOG_LEVEL_ERR=y +CONFIG_BT_KEYS_LOG_LEVEL_ERR=y +CONFIG_BT_SMP_LOG_LEVEL_ERR=y +CONFIG_BT_SERVICE_LOG_LEVEL_ERR=y From effc0ce98ff55448c09be5f1dec88eea474e02f6 Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Fri, 31 Jan 2025 12:54:30 +0100 Subject: [PATCH 096/109] applications: nrf_desktop: Reduce nRF54H20DK debug cfg memory footprint Switched from speed to size optimization for nRF54H20 DK target in debug configurations to reduce memory footprint. Jira: NCSDK-31374 Signed-off-by: Mateusz Kapala --- .../configuration/nrf54h20dk_nrf54h20_cpuapp/prj.conf | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/prj.conf b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/prj.conf index 1e99f5896e1a..4e3a16830357 100644 --- a/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54h20dk_nrf54h20_cpuapp/prj.conf @@ -78,7 +78,8 @@ CONFIG_IDLE_STACK_SIZE=512 CONFIG_HW_STACK_PROTECTION=y CONFIG_RESET_ON_FATAL_ERROR=n -CONFIG_SPEED_OPTIMIZATIONS=y +# Optimize for size to reduce memory footprint. +CONFIG_SIZE_OPTIMIZATIONS=y CONFIG_REBOOT=y From 269c09044248e35e6d9475cab63405c323341ac9 Mon Sep 17 00:00:00 2001 From: Mateusz Kapala Date: Fri, 31 Jan 2025 14:57:18 +0100 Subject: [PATCH 097/109] applications: nrf_desktop: Reduce nRF54L05 memory footprint Switched from speed to size optimizations for nRF54L15 DK (nRF54L05 emulated SoC) and enabled LTO in debug and release configurations to reduce memory footprint. Jira: NCSDK-31374 Signed-off-by: Mateusz Kapala --- .../configuration/nrf54l15dk_nrf54l05_cpuapp/prj.conf | 7 ++++++- .../nrf54l15dk_nrf54l05_cpuapp/prj_release.conf | 7 ++++++- .../nrf54l15dk_nrf54l05_cpuapp/prj_release_fast_pair.conf | 4 ++++ .../nrf54l15dk_nrf54l05_cpuapp/prj_release_keyboard.conf | 7 ++++++- 4 files changed, 22 insertions(+), 3 deletions(-) diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj.conf index bdc675fc80cf..b82df83d3e91 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj.conf @@ -70,7 +70,12 @@ CONFIG_GPIO=y CONFIG_REBOOT=y -CONFIG_SPEED_OPTIMIZATIONS=y +# Optimize for size to reduce memory footprint. +CONFIG_SIZE_OPTIMIZATIONS=y + +# Activate LTO +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_PWM=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release.conf index 3708b59a7906..115b9f55724b 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release.conf @@ -72,7 +72,12 @@ CONFIG_USE_SEGGER_RTT=n CONFIG_REBOOT=y -CONFIG_SPEED_OPTIMIZATIONS=y +# Optimize for size to reduce memory footprint. +CONFIG_SIZE_OPTIMIZATIONS=y + +# Activate LTO +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_PWM=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_fast_pair.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_fast_pair.conf index 95b34aa65d81..107d91e4b088 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_fast_pair.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_fast_pair.conf @@ -94,6 +94,10 @@ CONFIG_REBOOT=y # Optimize for size to reduce memory footprint. CONFIG_SIZE_OPTIMIZATIONS=y +# Activate LTO +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y + CONFIG_PWM=y CONFIG_LED=y diff --git a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_keyboard.conf b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_keyboard.conf index 58ff36ab55dc..3fbaf87111e7 100644 --- a/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_keyboard.conf +++ b/applications/nrf_desktop/configuration/nrf54l15dk_nrf54l05_cpuapp/prj_release_keyboard.conf @@ -79,7 +79,12 @@ CONFIG_USE_SEGGER_RTT=n CONFIG_REBOOT=y -CONFIG_SPEED_OPTIMIZATIONS=y +# Optimize for size to reduce memory footprint. +CONFIG_SIZE_OPTIMIZATIONS=y + +# Activate LTO +CONFIG_LTO=y +CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_PWM=y From b7871204060f7cbaf58018b33b6deb2870045b49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eivind=20J=C3=B8lsgard?= Date: Mon, 3 Feb 2025 14:08:45 +0100 Subject: [PATCH 098/109] tests: net: lib: downloader: Remove reference of z_impl_sys_rand_get() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Remove reference of z_impl_sys_rand_get(). Signed-off-by: Eivind Jølsgard --- tests/subsys/net/lib/downloader/src/main.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/tests/subsys/net/lib/downloader/src/main.c b/tests/subsys/net/lib/downloader/src/main.c index 5ec61b8310f7..1b7bd28e1a51 100644 --- a/tests/subsys/net/lib/downloader/src/main.c +++ b/tests/subsys/net/lib/downloader/src/main.c @@ -226,7 +226,6 @@ FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_sendto, int, const void *, size_t, int, const struct sockaddr *, socklen_t); FAKE_VALUE_FUNC(ssize_t, z_impl_zsock_recvfrom, int, void *, size_t, int, struct sockaddr *, socklen_t *); -FAKE_VOID_FUNC(z_impl_sys_rand_get, void *, size_t); FAKE_VALUE_FUNC(int, coap_get_option_int, const struct coap_packet *, uint16_t); FAKE_VALUE_FUNC(int, coap_block_transfer_init, struct coap_block_context *, enum coap_block_size, @@ -2409,7 +2408,6 @@ void setUp(void) RESET_FAKE(z_impl_net_addr_ntop); RESET_FAKE(z_impl_zsock_sendto); RESET_FAKE(z_impl_zsock_recvfrom); - RESET_FAKE(z_impl_sys_rand_get); RESET_FAKE(coap_get_option_int); RESET_FAKE(coap_block_transfer_init); From 9e5ecae08a576855e0a0df06b54485acbb075693 Mon Sep 17 00:00:00 2001 From: Tommi Rantanen Date: Tue, 4 Feb 2025 10:47:49 +0200 Subject: [PATCH 099/109] samples: cellular: modem_shell: bt: Update to use new HCI driver Updates required by changes in zephyr upstream for the BT HCI driver. Signed-off-by: Tommi Rantanen --- samples/cellular/modem_shell/bt.overlay | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/samples/cellular/modem_shell/bt.overlay b/samples/cellular/modem_shell/bt.overlay index 7b48802efbde..81096e02d40a 100644 --- a/samples/cellular/modem_shell/bt.overlay +++ b/samples/cellular/modem_shell/bt.overlay @@ -8,7 +8,8 @@ / { chosen { - zephyr,bt-uart=&lpuart; + zephyr,bt-uart = &lpuart; + zephyr,bt-hci = &bt_hci_uart; }; }; @@ -30,6 +31,10 @@ status = "okay"; req-pin = <21>; /* <&interface_to_nrf52840 3 0>; */ rdy-pin = <19>; /* <&interface_to_nrf52840 2 0>; */ + bt_hci_uart: bt_hci_uart { + compatible = "zephyr,bt-hci-uart"; + status = "okay"; + }; }; }; &uart1 { From 20b027199a3f69b281b90215cb644c2c20bf2175 Mon Sep 17 00:00:00 2001 From: Knut Eldhuset Date: Tue, 4 Feb 2025 09:13:22 +0100 Subject: [PATCH 100/109] pm: Fix to use abs time with policy event funcs Update pm policy event usage after API was changed from using relative time in cycles to absolute time in ticks. Signed-off-by: Knut Eldhuset --- subsys/mpsl/pm/mpsl_pm_utils.c | 39 ++------------------- tests/subsys/mpsl/pm/CMakeLists.txt | 6 ---- tests/subsys/mpsl/pm/kernel_minimal_mock.h | 25 -------------- tests/subsys/mpsl/pm/pm_test.c | 40 ---------------------- tests/subsys/mpsl/pm/prj.conf | 1 + 5 files changed, 3 insertions(+), 108 deletions(-) delete mode 100644 tests/subsys/mpsl/pm/kernel_minimal_mock.h diff --git a/subsys/mpsl/pm/mpsl_pm_utils.c b/subsys/mpsl/pm/mpsl_pm_utils.c index 0252c4207c41..b6f39ec8d165 100644 --- a/subsys/mpsl/pm/mpsl_pm_utils.c +++ b/subsys/mpsl/pm/mpsl_pm_utils.c @@ -10,7 +10,6 @@ #include #include -#include #include LOG_MODULE_REGISTER(mpsl_pm_utils, CONFIG_MPSL_LOG_LEVEL); @@ -23,9 +22,6 @@ LOG_MODULE_REGISTER(mpsl_pm_utils, CONFIG_MPSL_LOG_LEVEL); #define TIME_TO_REGISTER_EVENT_IN_ZEPHYR_US 1000 #define PM_MAX_LATENCY_HCI_COMMANDS_US 499999 -static void m_work_handler(struct k_work *work); -static K_WORK_DELAYABLE_DEFINE(pm_work, m_work_handler); - static uint8_t m_pm_prev_flag_value; static bool m_pm_event_is_registered; static uint32_t m_prev_lat_value_us; @@ -66,38 +62,13 @@ void m_register_event(void) } case MPSL_PM_EVENT_STATE_BEFORE_EVENT: { - /* Note: Considering an overflow could only happen if the system runs many years, - * it needen't be considered here. - */ - int64_t current_time_us = k_uptime_get() * 1000; - uint64_t relative_time_us = params.event_time_abs_us - current_time_us; - uint64_t max_cycles_until_event = k_us_to_cyc_floor64(relative_time_us); - - if (max_cycles_until_event > UINT32_MAX) { - /* The event is too far in the future and would - * exceed the 32-bit cycle limit. - */ - uint64_t event_delay_us = params.event_time_abs_us - current_time_us - - TIME_TO_REGISTER_EVENT_IN_ZEPHYR_US; -#ifdef CONFIG_TIMEOUT_64BIT - mpsl_work_schedule(&pm_work, K_USEC(event_delay_us)); -#else - if (event_delay_us > UINT32_MAX) { - mpsl_work_schedule(&pm_work, K_USEC(UINT32_MAX)); - } else { - mpsl_work_schedule(&pm_work, K_USEC((uint32_t)event_delay_us)); - } -#endif - return; - } - /* Event scheduled */ if (m_pm_event_is_registered) { pm_policy_event_update(&m_evt, - k_us_to_cyc_floor32(params.event_time_abs_us)); + k_us_to_ticks_floor64(params.event_time_abs_us)); } else { pm_policy_event_register(&m_evt, - k_us_to_cyc_floor32(params.event_time_abs_us)); + k_us_to_ticks_floor64(params.event_time_abs_us)); m_pm_event_is_registered = true; } break; @@ -136,12 +107,6 @@ void mpsl_pm_utils_work_handler(void) m_register_latency(); } -static void m_work_handler(struct k_work *work) -{ - ARG_UNUSED(work); - mpsl_pm_utils_work_handler(); -} - void mpsl_pm_utils_init(void) { mpsl_pm_params_t params = {0}; diff --git a/tests/subsys/mpsl/pm/CMakeLists.txt b/tests/subsys/mpsl/pm/CMakeLists.txt index 3820538a402b..1903f9f8c715 100644 --- a/tests/subsys/mpsl/pm/CMakeLists.txt +++ b/tests/subsys/mpsl/pm/CMakeLists.txt @@ -13,11 +13,9 @@ project(pm_test) test_runner_generate(pm_test.c) # Create mocks for pm module. -cmock_handle(${CMAKE_CURRENT_SOURCE_DIR}/kernel_minimal_mock.h) cmock_handle(${ZEPHYR_BASE}/include/zephyr/pm/policy.h) cmock_handle(${ZEPHYR_NRFXLIB_MODULE_DIR}/mpsl/include/mpsl_pm.h) cmock_handle(${ZEPHYR_NRFXLIB_MODULE_DIR}/mpsl/include/mpsl_pm_config.h) -cmock_handle(${ZEPHYR_NRF_MODULE_DIR}/include/mpsl/mpsl_work.h) # Add Unit Under Test source files target_sources(app PRIVATE ${ZEPHYR_NRF_MODULE_DIR}/subsys/mpsl/pm/mpsl_pm_utils.c) @@ -28,10 +26,6 @@ target_sources(app PRIVATE pm_test.c) # Include paths target_include_directories(app PRIVATE src) -# Preinclude file to the UUT to redefine mpsl_work_schedule(). -set_property(SOURCE ${ZEPHYR_NRF_MODULE_DIR}/subsys/mpsl/pm/mpsl_pm_utils.c - PROPERTY COMPILE_FLAGS "-include mocks/kernel_minimal_mock.h -include mocks/mpsl_work.h") - # Options that cannot be passed through Kconfig fragments. target_compile_options(app PRIVATE -DCONFIG_PM=y diff --git a/tests/subsys/mpsl/pm/kernel_minimal_mock.h b/tests/subsys/mpsl/pm/kernel_minimal_mock.h deleted file mode 100644 index 9377de21d5ae..000000000000 --- a/tests/subsys/mpsl/pm/kernel_minimal_mock.h +++ /dev/null @@ -1,25 +0,0 @@ -/* - * Copyright (c) 2024 Nordic Semiconductor ASA - * - * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause - */ -#ifndef ZEPHYR_INCLUDE_KERNEL_H_ -#define ZEPHYR_INCLUDE_KERNEL_H_ -/* CMock chokes on zephyr/kernel.h, so we define the minimum required to build - * mpsl_pm and tests, then let CMock generate mocks from this file instead. - */ -#include -struct k_work { -}; -typedef struct k_timeout { - uint64_t value; -} k_timeout_t; -struct k_work_delayable { - void *handler; -}; -#define Z_WORK_DELAYABLE_INITIALIZER(work_handler) {work_handler} -#define K_WORK_DELAYABLE_DEFINE(work, work_handler) \ - struct k_work_delayable work = Z_WORK_DELAYABLE_INITIALIZER(work_handler) -k_timeout_t K_USEC(uint64_t d); -int64_t k_uptime_get(void); -#endif diff --git a/tests/subsys/mpsl/pm/pm_test.c b/tests/subsys/mpsl/pm/pm_test.c index 2aec0285ba1a..fda2c50846c5 100644 --- a/tests/subsys/mpsl/pm/pm_test.c +++ b/tests/subsys/mpsl/pm/pm_test.c @@ -13,18 +13,11 @@ #include "cmock_policy.h" #include "cmock_mpsl_pm.h" #include "cmock_mpsl_pm_config.h" -#include "cmock_mpsl_work.h" -#include "cmock_kernel_minimal_mock.h" #include #define PM_MAX_LATENCY_HCI_COMMANDS_US 499999 -#define TIME_TO_REGISTER_EVENT_IN_ZEPHYR_US 1000 - -/* Mock implementation for mpsl_work_q*/ -struct k_work_q mpsl_work_q; - /* The unity_main is not declared in any header file. It is only defined in the generated test * runner because of ncs' unity configuration. It is therefore declared here to avoid a compiler * warning. @@ -36,7 +29,6 @@ typedef enum { EVENT_FUNC_REGISTER, EVENT_FUNC_UPDATE, EVENT_FUNC_UNREGISTER, - EVENT_FUNC_DELAY_SCHEDULING, } event_func_t; typedef enum { @@ -87,26 +79,16 @@ void run_test(test_vector_event_t *p_test_vectors, int num_test_vctr) switch (v.event_func) { case EVENT_FUNC_REGISTER: - __cmock_k_uptime_get_ExpectAndReturn(v.curr_time_ms); __cmock_pm_policy_event_register_Expect(0, v.event_time_us); __cmock_pm_policy_event_register_IgnoreArg_evt(); break; case EVENT_FUNC_UPDATE: - __cmock_k_uptime_get_ExpectAndReturn(v.curr_time_ms); __cmock_pm_policy_event_update_Expect(0, v.event_time_us); __cmock_pm_policy_event_update_IgnoreArg_evt(); break; case EVENT_FUNC_UNREGISTER: __cmock_pm_policy_event_unregister_ExpectAnyArgs(); break; - case EVENT_FUNC_DELAY_SCHEDULING: - __cmock_k_uptime_get_ExpectAndReturn(v.curr_time_ms); - __cmock_K_USEC_ExpectAndReturn( - v.event_time_us, (k_timeout_t){v.event_time_us + 100}); - __cmock_mpsl_work_schedule_Expect( - 0, (k_timeout_t){v.event_time_us + 100}); - __cmock_mpsl_work_schedule_IgnoreArg_dwork(); - break; case EVENT_FUNC_NONE: break; } @@ -226,28 +208,6 @@ void test_register_update_and_deregister_event(void) run_test(&test_vectors[0], ARRAY_SIZE(test_vectors)); } -void test_event_delayed_work(void) -{ - uint64_t event_time_us = (uint64_t)UINT32_MAX + 50000; - /* Make sure time until event will be more than UINT32_MAX cycles away. */ - TEST_ASSERT_GREATER_THAN_INT64(UINT32_MAX, k_us_to_cyc_floor64(event_time_us)); - - test_vector_event_t test_vectors[] = { - /* Event time after 32 bit cycles have wrapped, so schedule retry. */ - {true, {event_time_us, MPSL_PM_EVENT_STATE_BEFORE_EVENT, 1}, - EVENT_FUNC_DELAY_SCHEDULING, event_time_us - 1000, 0}, - /* Time has progressed until cycles will no longer wrap, - * so register latency normally. - */ - {true, {event_time_us, MPSL_PM_EVENT_STATE_BEFORE_EVENT, 2}, - EVENT_FUNC_REGISTER, event_time_us, 100}, - /* Deregister event. */ - {true, {0, MPSL_PM_EVENT_STATE_NO_EVENTS_LEFT, 3}, - EVENT_FUNC_UNREGISTER, 0, 0}, - }; - run_test(&test_vectors[0], ARRAY_SIZE(test_vectors)); -} - int main(void) { (void)unity_main(); diff --git a/tests/subsys/mpsl/pm/prj.conf b/tests/subsys/mpsl/pm/prj.conf index c4750ff9ae70..a9e2ef112386 100644 --- a/tests/subsys/mpsl/pm/prj.conf +++ b/tests/subsys/mpsl/pm/prj.conf @@ -5,3 +5,4 @@ # CONFIG_UNITY=y +CONFIG_SYS_CLOCK_TICKS_PER_SEC=1000000 From b0162f5477128827b31468257343766a15be3f8a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andrzej=20G=C5=82=C4=85bek?= Date: Tue, 4 Feb 2025 11:23:51 +0100 Subject: [PATCH 101/109] quarantine_zephyr: Add drivers.wifi.build.spi on native_sim/native MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This test is not really useful in NCS context (checking if the nRF Wi-Fi driver can be built successfully is done by other tests and samples), and it requires the hal_atmel module to be pulled in (because the WINC1500 driver requires two header files that are located in that module). And the module weights ~87 MB, so it's not reasonable to pull it in just for this one test. Signed-off-by: Andrzej Głąbek --- scripts/quarantine_zephyr.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index f4184a1f9c0b..6b382dd47b5e 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -500,3 +500,9 @@ - scenarios: - sample.net.prometheus comment: "not compatible with NCS (Frank Audun Kvamtro)" + +- scenarios: + - drivers.wifi.build.spi + platforms: + - native_sim/native + comment: "requires pulling in hal_atmel but is actually not very useful" From 6e0f9531cf3ac2144c054632038cbfd6e86d2551 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Tue, 4 Feb 2025 10:35:06 +0000 Subject: [PATCH 102/109] pcd: Fix usage of stream writer Fixes an issue with stream writer by providing the size of the partition Signed-off-by: Jamie McCrae --- subsys/pcd/src/pcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/pcd/src/pcd.c b/subsys/pcd/src/pcd.c index d25015de060d..166190eac514 100644 --- a/subsys/pcd/src/pcd.c +++ b/subsys/pcd/src/pcd.c @@ -100,7 +100,7 @@ int pcd_fw_copy(const struct device *fdev) } rc = stream_flash_init(&stream, fdev, buf, sizeof(buf), - cmd->offset, 0, NULL); + cmd->offset, PM_APP_SIZE, NULL); if (rc != 0) { LOG_ERR("stream_flash_init failed: %d", rc); return rc; From 7e8177005797ebb1596c18be36391808ad5b41d8 Mon Sep 17 00:00:00 2001 From: Maximilian Deubel Date: Tue, 4 Feb 2025 13:57:01 +0100 Subject: [PATCH 103/109] lib: nrf_cloud: change posix names to zsock Change posix names to zsock in nrf_cloud lib. Signed-off-by: Maximilian Deubel --- .../coap/src/nrf_cloud_coap_transport.c | 14 +++++------ subsys/net/lib/nrf_cloud/coap/src/nrfc_dtls.c | 24 +++++++++---------- subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c | 2 +- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/subsys/net/lib/nrf_cloud/coap/src/nrf_cloud_coap_transport.c b/subsys/net/lib/nrf_cloud/coap/src/nrf_cloud_coap_transport.c index 74912150df7b..f7725627415f 100644 --- a/subsys/net/lib/nrf_cloud/coap/src/nrf_cloud_coap_transport.c +++ b/subsys/net/lib/nrf_cloud/coap/src/nrf_cloud_coap_transport.c @@ -655,7 +655,7 @@ static int nrf_cloud_coap_connect_host_cb(struct sockaddr *const addr) size_t addr_size; LOG_DBG("Creating socket type IPPROTO_DTLS_1_2"); - sock = socket(addr->sa_family, SOCK_DGRAM, IPPROTO_DTLS_1_2); + sock = zsock_socket(addr->sa_family, SOCK_DGRAM, IPPROTO_DTLS_1_2); if (sock < 0) { LOG_DBG("Failed to create CoAP socket, errno: %d", errno); @@ -677,7 +677,7 @@ static int nrf_cloud_coap_connect_host_cb(struct sockaddr *const addr) addr_size = sizeof(struct sockaddr_in); } - err = connect(sock, addr, addr_size); + err = zsock_connect(sock, addr, addr_size); if (err) { LOG_DBG("Connect failed, errno: %d", errno); err = -ECONNREFUSED; @@ -687,7 +687,7 @@ static int nrf_cloud_coap_connect_host_cb(struct sockaddr *const addr) out: if (err) { if (sock >= 0) { - close(sock); + zsock_close(sock); } return err; } @@ -711,7 +711,7 @@ int nrf_cloud_coap_transport_connect(struct nrf_cloud_coap_client *const client) /* Could not resume. Try with a full handshake. */ tmp = client->sock; client->sock = client->cc.fd = -1; - close(tmp); + zsock_close(tmp); } client->authenticated = false; @@ -719,7 +719,7 @@ int nrf_cloud_coap_transport_connect(struct nrf_cloud_coap_client *const client) const char *const host_name = CONFIG_NRF_CLOUD_COAP_SERVER_HOSTNAME; uint16_t port = htons(CONFIG_NRF_CLOUD_COAP_SERVER_PORT); - struct addrinfo hints = { + struct zsock_addrinfo hints = { .ai_socktype = SOCK_DGRAM }; sock = nrf_cloud_connect_host(host_name, port, &hints, &nrf_cloud_coap_connect_host_cb); @@ -758,7 +758,7 @@ int nrf_cloud_coap_transport_disconnect(struct nrf_cloud_coap_client *const clie client->paused = false; tmp = client->sock; client->sock = client->cc.fd = -1; - err = close(tmp); + err = zsock_close(tmp); k_mutex_unlock(&client->mutex); return err; @@ -873,7 +873,7 @@ int nrf_cloud_coap_transport_pause(struct nrf_cloud_coap_client *const client) client->paused = false; tmp = client->sock; client->sock = client->cc.fd = -1; - close(tmp); + zsock_close(tmp); LOG_DBG("Closed socket and marked as unauthenticated."); } } else { diff --git a/subsys/net/lib/nrf_cloud/coap/src/nrfc_dtls.c b/subsys/net/lib/nrf_cloud/coap/src/nrfc_dtls.c index f2aff1b623ca..073a65dee083 100644 --- a/subsys/net/lib/nrf_cloud/coap/src/nrfc_dtls.c +++ b/subsys/net/lib/nrf_cloud/coap/src/nrfc_dtls.c @@ -48,7 +48,7 @@ static int get_device_ip_address(uint8_t *d4_addr) LOG_ERR("Could not get IP addr: %d", err); return err; } - err = inet_pton(AF_INET, buf, d4_addr); + err = zsock_inet_pton(AF_INET, buf, d4_addr); if (err == 1) { return 0; } @@ -81,7 +81,7 @@ int nrfc_dtls_setup(int sock) LOG_DBG("Setting socket options:"); LOG_DBG(" hostname: %s", CONFIG_NRF_CLOUD_COAP_SERVER_HOSTNAME); - err = setsockopt(sock, SOL_TLS, TLS_HOSTNAME, CONFIG_NRF_CLOUD_COAP_SERVER_HOSTNAME, + err = zsock_setsockopt(sock, SOL_TLS, TLS_HOSTNAME, CONFIG_NRF_CLOUD_COAP_SERVER_HOSTNAME, sizeof(CONFIG_NRF_CLOUD_COAP_SERVER_HOSTNAME)); if (err) { LOG_ERR("Error setting hostname: %d", -errno); @@ -91,7 +91,7 @@ int nrfc_dtls_setup(int sock) sectag = nrf_cloud_sec_tag_get(); LOG_DBG(" sectag: %d", sectag); - err = setsockopt(sock, SOL_TLS, TLS_SEC_TAG_LIST, §ag, sizeof(sectag)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_SEC_TAG_LIST, §ag, sizeof(sectag)); if (err) { LOG_ERR("Error setting sectag list: %d", -errno); return -errno; @@ -100,7 +100,7 @@ int nrfc_dtls_setup(int sock) int cid_option = TLS_DTLS_CID_SUPPORTED; LOG_DBG(" Enable connection id"); - err = setsockopt(sock, SOL_TLS, TLS_DTLS_CID, &cid_option, sizeof(cid_option)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_DTLS_CID, &cid_option, sizeof(cid_option)); if (!err) { cid_supported = true; } else if ((err != EOPNOTSUPP) && (err != EINVAL)) { @@ -114,7 +114,7 @@ int nrfc_dtls_setup(int sock) int timeout = TLS_DTLS_HANDSHAKE_TIMEO_123S; LOG_DBG(" Set handshake timeout %d", timeout); - err = setsockopt(sock, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEO, + err = zsock_setsockopt(sock, SOL_TLS, TLS_DTLS_HANDSHAKE_TIMEO, &timeout, sizeof(timeout)); if (!err) { } else if ((err != EOPNOTSUPP) || (err != EINVAL)) { @@ -124,7 +124,7 @@ int nrfc_dtls_setup(int sock) int verify = TLS_PEER_VERIFY_REQUIRED; LOG_DBG(" Peer verify: %d", verify); - err = setsockopt(sock, SOL_TLS, TLS_PEER_VERIFY, &verify, sizeof(verify)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_PEER_VERIFY, &verify, sizeof(verify)); if (err) { LOG_ERR("Failed to setup peer verification, errno %d", -errno); return -errno; @@ -133,7 +133,7 @@ int nrfc_dtls_setup(int sock) int session_cache = TLS_SESSION_CACHE_ENABLED; LOG_DBG(" TLS session cache: %d", session_cache); - err = setsockopt(sock, SOL_TLS, TLS_SESSION_CACHE, &session_cache, sizeof(session_cache)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_SESSION_CACHE, &session_cache, sizeof(session_cache)); if (err) { LOG_ERR("Failed to enable session cache, errno: %d", -errno); err = -errno; @@ -141,7 +141,7 @@ int nrfc_dtls_setup(int sock) keepopen_supported = false; if (IS_ENABLED(CONFIG_NRF_CLOUD_COAP_KEEPOPEN)) { - err = setsockopt(sock, SOL_SOCKET, SO_KEEPOPEN, &(int){1}, sizeof(int)); + err = zsock_setsockopt(sock, SOL_SOCKET, SO_KEEPOPEN, &(int){1}, sizeof(int)); if (err) { /* Either not supported or unusable due to unknown error. */ err = 0; @@ -158,7 +158,7 @@ int nrfc_dtls_session_save(int sock) int err; LOG_DBG("Save DTLS CID session"); - err = setsockopt(sock, SOL_TLS, TLS_DTLS_CONN_SAVE, &(int){0}, sizeof(int)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_DTLS_CONN_SAVE, &(int){0}, sizeof(int)); if (err) { LOG_DBG("Failed to save DTLS CID session, errno %d", -errno); err = -errno; @@ -171,7 +171,7 @@ int nrfc_dtls_session_load(int sock) int err; LOG_DBG("Load DTLS CID session"); - err = setsockopt(sock, SOL_TLS, TLS_DTLS_CONN_LOAD, &(int){1}, sizeof(int)); + err = zsock_setsockopt(sock, SOL_TLS, TLS_DTLS_CONN_LOAD, &(int){1}, sizeof(int)); if (err) { LOG_DBG("Failed to load DTLS CID session, errno %d", -errno); err = -errno; @@ -192,7 +192,7 @@ bool nrfc_dtls_cid_is_active(int sock) #if defined(CONFIG_NRF_CLOUD_COAP_LOG_LEVEL_DBG) - err = getsockopt(sock, SOL_TLS, TLS_DTLS_HANDSHAKE_STATUS, &status, &len); + err = zsock_getsockopt(sock, SOL_TLS, TLS_DTLS_HANDSHAKE_STATUS, &status, &len); if (!err) { if (len > 0) { if (status == TLS_DTLS_HANDSHAKE_STATUS_FULL) { @@ -212,7 +212,7 @@ bool nrfc_dtls_cid_is_active(int sock) #endif /* CONFIG_NRF_CLOUD_COAP_LOG_LEVEL_DBG */ len = sizeof(status); - err = getsockopt(sock, SOL_TLS, TLS_DTLS_CID_STATUS, &status, &len); + err = zsock_getsockopt(sock, SOL_TLS, TLS_DTLS_CID_STATUS, &status, &len); if (!err) { if (len > 0) { switch (status) { diff --git a/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c b/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c index e2ff840908ad..78c2b4687534 100644 --- a/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c +++ b/subsys/net/lib/nrf_cloud/src/nrf_cloud_dns.c @@ -95,7 +95,7 @@ int nrf_cloud_connect_host(const char *hostname, uint16_t port, LOG_DBG("Trying static IPv4 address: %s, port: %d", CONFIG_NRF_CLOUD_STATIC_IPV4_ADDR, port); - inet_pton(AF_INET, CONFIG_NRF_CLOUD_STATIC_IPV4_ADDR, &(static_addr.sin_addr)); + zsock_inet_pton(AF_INET, CONFIG_NRF_CLOUD_STATIC_IPV4_ADDR, &(static_addr.sin_addr)); static_addr.sin_family = AF_INET; static_addr.sin_port = static_port; From 152c07ad1968402d669e293fce99293d90d0fd60 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarzyna=20Gi=C4=85d=C5=82a?= Date: Wed, 5 Feb 2025 12:01:17 +0100 Subject: [PATCH 104/109] quarantine_zephyr: Add zephyr tests and samples to quaratine MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Some sdk-zephyr tests and samples reports issues due to RAM overflow issues. Refers: NCSDK-31667 NCSDK-31671 Signed-off-by: Katarzyna Giądła --- scripts/quarantine_zephyr.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/scripts/quarantine_zephyr.yaml b/scripts/quarantine_zephyr.yaml index 6b382dd47b5e..5c4ebecdca7b 100644 --- a/scripts/quarantine_zephyr.yaml +++ b/scripts/quarantine_zephyr.yaml @@ -238,6 +238,19 @@ - nrf54h20dk@0.9.0/nrf54h20/cpuppr comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31591" +- scenarios: + - portability.posix.common.dynamic_stack + platforms: + - qemu_cortex_m3/ti_lm3s6965 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31667" + +- scenarios: + - sample.bluetooth.central.multilink + - sample.bluetooth.peripheral_identity + platforms: + - qemu_cortex_m3/ti_lm3s6965 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31671" + # --------------------------------- Won't fix section ----------------------------------- - scenarios: From 0a72ca01cc5203a5c6ec181a6cd080edf5795306 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katarzyna=20Gi=C4=85d=C5=82a?= Date: Wed, 5 Feb 2025 12:10:42 +0100 Subject: [PATCH 105/109] quarantine: Add quarantine for applications.nrf_desktop.z* MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Applications `applications.nrf_desktop.zrelease` and `applications.nrf_desktop.zdebug` report RAM overflow. Therefore, applications on listed platforms are moved to quaratine. Refers: NCSDK-31675 Signed-off-by: Katarzyna Giądła --- scripts/quarantine.yaml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/scripts/quarantine.yaml b/scripts/quarantine.yaml index 5a7d14d4cc97..d97796183a55 100644 --- a/scripts/quarantine.yaml +++ b/scripts/quarantine.yaml @@ -47,3 +47,18 @@ platforms: - nrf52dk/nrf52832 comment: "To be fixed after upmerge. Footprint should be reduced. NCSDK-31428" + +- scenarios: + - applications.nrf_desktop.zrelease + platforms: + - nrf52833dk/nrf52820 + - nrf52820dongle/nrf52820 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31675" + +- scenarios: + - applications.nrf_desktop.zdebug + platforms: + - nrf52833dk/nrf52820 + - nrf52820dongle/nrf52820 + - nrf52810dmouse/nrf52810 + comment: "https://nordicsemi.atlassian.net/browse/NCSDK-31675" From 45f876b9e940e57e33429c4010fd148ada10efbb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Mon, 3 Feb 2025 10:57:56 +0100 Subject: [PATCH 106/109] manifest: crypto: Add support for static key slots MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This updates sdk-oberon-psa-crypto to a version that support static key slots (see previous commit for configurations. -This updates trusted-firmware-m to a version that supports static key slots (see previous commit for configurations). -This updates Mbed TLS to a version that supports static key slots (see previous commit for configurations). Ref: NCSDK-30210 Signed-off-by: Frank Audun Kvamtrø --- west.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/west.yml b/west.yml index 405488b227c9..986eaf58980d 100644 --- a/west.yml +++ b/west.yml @@ -140,11 +140,11 @@ manifest: - name: mbedtls path: modules/crypto/mbedtls repo-path: sdk-mbedtls - revision: v3.6.2-ncs2 + revision: pull/39/head - name: oberon-psa-crypto path: modules/crypto/oberon-psa-crypto repo-path: sdk-oberon-psa-crypto - revision: d66c20787f82b9469439fb7c1436463c02ca3b10 + revision: pull/20/head - name: nrfxlib repo-path: sdk-nrfxlib path: nrfxlib @@ -152,7 +152,7 @@ manifest: - name: trusted-firmware-m repo-path: sdk-trusted-firmware-m path: modules/tee/tf-m/trusted-firmware-m - revision: 3f08f2595d976624e42478bb377cb24798b00a5d + revision: pull/184/head - name: psa-arch-tests repo-path: sdk-psa-arch-tests path: modules/tee/tf-m/psa-arch-tests From a98455fb08d542261d2634f692b9ff24fde9f1ef Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 5 Feb 2025 08:39:35 +0100 Subject: [PATCH 107/109] crypto: Ensure PSA crypto is called on CryptoCell enabled devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This added SYS_INIT will ensure that psa_crypto_init is called in kernel *after* Hw_CC3XX is executed to ensure that mutexes are ready to be used. Signed-off-by: Frank Audun Kvamtrø --- drivers/hw_cc3xx/hw_cc3xx.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/drivers/hw_cc3xx/hw_cc3xx.c b/drivers/hw_cc3xx/hw_cc3xx.c index b4218477e459..d005bfd07094 100644 --- a/drivers/hw_cc3xx/hw_cc3xx.c +++ b/drivers/hw_cc3xx/hw_cc3xx.c @@ -59,4 +59,26 @@ SYS_INIT(hw_cc3xx_init_internal, PRE_KERNEL_1, SYS_INIT(hw_cc3xx_init, POST_KERNEL, CONFIG_KERNEL_INIT_PRIORITY_DEFAULT); + +#if defined(CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT) + +#include "psa/crypto.h" + +/* Ensuring psa_crypto_init is run on CryptoCell enabled HW */ +static int _psa_crypto_init(void) +{ + psa_status_t err = psa_crypto_init(); + if(err != PSA_SUCCESS) { + return -EIO; + } + + return 0; +} + +/* Ensure PSA crypto is initalized after nrf_cc3xx mutex initialization */ +SYS_INIT(_psa_crypto_init, POST_KERNEL, + CONFIG_KERNEL_INIT_PRIORITY_DEVICE); + +#endif /* CONFIG_MBEDTLS_PSA_CRYPTO_CLIENT */ + #endif /* CONFIG_HW_CC3XX */ From 38fcef59fbe6e0d99ce9ada6cce293c3d200275d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 5 Feb 2025 13:07:42 +0100 Subject: [PATCH 108/109] crypto: Fix dependency loop for ENTROPY_GENERATOR for L15 devices MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -Changing default y for nrf_security to use DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED instead of depending on ENTROPY_PSA_CRYPTO_RNG. Doing this avoids a dependency loop on ENTROPY_GENERATOR Signed-off-by: Frank Audun Kvamtrø --- subsys/nrf_security/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/nrf_security/Kconfig b/subsys/nrf_security/Kconfig index dd034e1d88aa..38fdf4164602 100644 --- a/subsys/nrf_security/Kconfig +++ b/subsys/nrf_security/Kconfig @@ -35,7 +35,7 @@ config NRF_SECURITY depends on SOC_FAMILY_NORDIC_NRF default y if BUILD_WITH_TFM # entropy is provided by PSA and NRF_SECURITY on NRF54LX - default y if ENTROPY_PSA_CRYPTO_RNG && SOC_SERIES_NRF54LX + default y if DT_HAS_ZEPHYR_PSA_CRYPTO_RNG_ENABLED && SOC_SERIES_NRF54LX select DISABLE_MBEDTLS_BUILTIN if MBEDTLS # NCS does not use TF-M's BL2 bootloader, but uses it's own fork # of MCUBoot instead (CONFIG_BOOTLOADER_MCUBOOT). From 913672dbab8034dfb9d4c06f03308ce364688281 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Frank=20Audun=20Kvamtr=C3=B8?= Date: Wed, 5 Feb 2025 13:10:04 +0100 Subject: [PATCH 109/109] manifest: Remove draft commit for ENTROPY_GENERATOR MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -This commit is only used to enact testing. The dependency for PR #2464 to the previous commit is inherent, but we would like to have a commit that is pickable in the upmerge Signed-off-by: Frank Audun Kvamtrø --- west.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/west.yml b/west.yml index 986eaf58980d..43ba70b75234 100644 --- a/west.yml +++ b/west.yml @@ -69,7 +69,7 @@ manifest: # https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/modules.html - name: zephyr repo-path: sdk-zephyr - revision: pull/2411/head + revision: pull/2464/head import: # In addition to the zephyr repository itself, NCS also # imports the contents of zephyr/west.yml at the above