From 625246f2416ae03bd558f8f918400868eca24bd7 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Fri, 25 Oct 2024 09:34:24 -0400 Subject: [PATCH 01/53] twister: --device-testing always implies --filter runnable --device-testing implies runnable tests, this was the case before the rework and was missed in one spot, so instead do that directly in the argument parser. Fixes #80428 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/environment.py | 2 +- scripts/pylib/twister/twisterlib/testplan.py | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/environment.py b/scripts/pylib/twister/twisterlib/environment.py index e0773878ddf..0ab3022729d 100644 --- a/scripts/pylib/twister/twisterlib/environment.py +++ b/scripts/pylib/twister/twisterlib/environment.py @@ -382,7 +382,7 @@ def add_parse_arguments(parser = None): parser.add_argument( "--filter", choices=['buildable', 'runnable'], - default='buildable', + default='runnable' if "--device-testing" in sys.argv else 'buildable', help="""Filter tests to be built and executed. By default everything is built and if a test is runnable (emulation or a connected device), it is run. This option allows for example to only build tests that can diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 8731522c21e..7f098d8e1fc 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -644,9 +644,6 @@ def load_from_file(self, file, filter_platform=[]): if ts.get("run_id"): instance.run_id = ts.get("run_id") - if self.options.device_testing: - self.options.filter = 'runnable' - instance.run = instance.check_runnable( self.options, self.hwm From e90559f0da70b0ea00dd8822cc9928fb189f2236 Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Wed, 23 Oct 2024 21:28:35 -0400 Subject: [PATCH 02/53] twister: fix platform filter when loading plan from file if alias or shorthand name is provided on the command line, we need convert this to complete target name for the filters to work. Fixes #80332 Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/testplan.py | 14 ++++++++++++-- scripts/tests/twister/test_testplan.py | 2 +- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 7f098d8e1fc..25aa5c218ea 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -230,11 +230,21 @@ def load(self): # Get list of connected hardware and filter tests to only be run on connected hardware. # If the platform does not exist in the hardware map or was not specified by --platform, # just skip it. - connected_list = self.options.platform + + connected_list = [] + excluded_list = [] + for _cp in self.options.platform: + if _cp in self.platform_names: + connected_list.append(self.get_platform(_cp).name) + if self.options.exclude_platform: - for excluded in self.options.exclude_platform: + for _p in self.options.exclude_platform: + if _p in self.platform_names: + excluded_list.append(self.get_platform(_p).name) + for excluded in excluded_list: if excluded in connected_list: connected_list.remove(excluded) + self.load_from_file(last_run, filter_platform=connected_list) self.selected_platforms = set(p.platform.name for p in self.instances.values()) else: diff --git a/scripts/tests/twister/test_testplan.py b/scripts/tests/twister/test_testplan.py index 7241633626f..de1c9595a21 100644 --- a/scripts/tests/twister/test_testplan.py +++ b/scripts/tests/twister/test_testplan.py @@ -594,7 +594,7 @@ def test_testplan_discover( (None, None, 'load_tests.json', None, '0/4', TwisterRuntimeError, set(['lt-p1', 'lt-p3', 'lt-p4', 'lt-p2']), []), ('suffix', None, None, True, '2/4', - None, set(['ts-p4', 'ts-p2', 'ts-p3']), [2, 4]), + None, set(['ts-p4', 'ts-p2', 'ts-p1', 'ts-p3']), [2, 4]), ] @pytest.mark.parametrize( From 7066c40afc00e2cf34d8648c0079817e235e4d0a Mon Sep 17 00:00:00 2001 From: Anas Nashif Date: Thu, 24 Oct 2024 11:10:36 -0400 Subject: [PATCH 03/53] twister: also convert platform names from the hardwaremap Convert platform names from the hardware map to full target names. Signed-off-by: Anas Nashif --- scripts/pylib/twister/twisterlib/twister_main.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/scripts/pylib/twister/twisterlib/twister_main.py b/scripts/pylib/twister/twisterlib/twister_main.py index f5ee03b808a..310cdc7bfdd 100644 --- a/scripts/pylib/twister/twisterlib/twister_main.py +++ b/scripts/pylib/twister/twisterlib/twister_main.py @@ -181,6 +181,15 @@ def main(options: argparse.Namespace, default_options: argparse.Namespace): tplan.create_build_dir_links() runner = TwisterRunner(tplan.instances, tplan.testsuites, env) + # FIXME: This is a workaround for the fact that the hardware map can be usng + # the short name of the platform, while the testplan is using the full name. + # + # convert platform names coming from the hardware map to the full target + # name. + # this is needed to match the platform names in the testplan. + for d in hwm.duts: + if d.platform in tplan.platform_names: + d.platform = tplan.get_platform(d.platform).name runner.duts = hwm.duts runner.run() From 200de7c00a0a1beb905ec8565a24fce1d498e13b Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 1 Aug 2024 14:25:51 +0200 Subject: [PATCH 04/53] Bluetooth: Host: Fix `bt_l2cap_chan_ops.recv` `-EINPROGRESS` Fix discrepancy in reference management between calls to `bt_l2cap_chan_ops.recv` when the application returns `-EINPROGRESS`. There are two call sites, `l2cap_chan_le_recv_sdu` and `l2cap_chan_le_recv`, that were inconsistent. `l2cap_chan_le_recv_sdu` moves the reference, and this patch updates `l2cap_chan_le_recv` to do the same. This behavior is also now documented. This bug has existed since the introduction of this feature in 3151d265726fb528d31d8e1ee8b35004e901cfc4. Signed-off-by: Aleksander Wasaznik --- include/zephyr/bluetooth/l2cap.h | 5 +++++ subsys/bluetooth/host/l2cap.c | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/include/zephyr/bluetooth/l2cap.h b/include/zephyr/bluetooth/l2cap.h index 0117da5ebb9..cdd162f9889 100644 --- a/include/zephyr/bluetooth/l2cap.h +++ b/include/zephyr/bluetooth/l2cap.h @@ -349,6 +349,11 @@ struct bt_l2cap_chan_ops { * @kconfig{CONFIG_BT_L2CAP_SEG_RECV} is enabled and seg_recv is * supplied. * + * If the application returns @c -EINPROGRESS, the application takes + * ownership of the reference in @p buf. (I.e. This pointer value can + * simply be given to @ref bt_l2cap_chan_recv_complete without any + * calls @ref net_buf_ref or @ref net_buf_unref.) + * * @return 0 in case of success or negative value in case of error. * @return -EINPROGRESS in case where user has to confirm once the data * has been processed by calling diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 3b5cfe82864..8012706bc45 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include @@ -2566,6 +2567,7 @@ static void l2cap_chan_le_recv_seg_direct(struct bt_l2cap_le_chan *chan, struct static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan, struct net_buf *buf) { + struct net_buf *owned_ref; uint16_t sdu_len; int err; @@ -2639,7 +2641,13 @@ static void l2cap_chan_le_recv(struct bt_l2cap_le_chan *chan, return; } - err = chan->chan.ops->recv(&chan->chan, buf); + owned_ref = net_buf_ref(buf); + err = chan->chan.ops->recv(&chan->chan, owned_ref); + if (err != -EINPROGRESS) { + net_buf_unref(owned_ref); + owned_ref = NULL; + } + if (err < 0) { if (err != -EINPROGRESS) { LOG_ERR("err %d", err); From 70ad45d4d915e21583fc1efecd916303c40f5a2a Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:14:02 +0200 Subject: [PATCH 05/53] Bluetooth: Host: Upgrade log severity for L2CAP user error For ease of development, we should log the event as an error. Signed-off-by: Aleksander Wasaznik --- subsys/bluetooth/host/l2cap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/subsys/bluetooth/host/l2cap.c b/subsys/bluetooth/host/l2cap.c index 8012706bc45..d280db5363c 100644 --- a/subsys/bluetooth/host/l2cap.c +++ b/subsys/bluetooth/host/l2cap.c @@ -3147,7 +3147,7 @@ static int bt_l2cap_dyn_chan_send(struct bt_l2cap_le_chan *le_chan, struct net_b /* Call `net_buf_reserve(buf, BT_L2CAP_SDU_CHAN_SEND_RESERVE)` * when allocating buffers intended for bt_l2cap_chan_send(). */ - LOG_DBG("Not enough headroom in buf %p", buf); + LOG_ERR("Not enough headroom in buf %p", buf); return -EINVAL; } @@ -3195,7 +3195,7 @@ int bt_l2cap_chan_send(struct bt_l2cap_chan *chan, struct net_buf *buf) LOG_DBG("chan %p buf %p len %zu", chan, buf, buf->len); if (buf->ref != 1) { - LOG_DBG("Expecting 1 ref, got %d", buf->ref); + LOG_WRN("Expecting 1 ref, got %d", buf->ref); return -EINVAL; } From 5f89a6b8f1051ca30655c8a049935a497bb245d6 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:17:39 +0200 Subject: [PATCH 06/53] Bluetooth: Host: Add BT_TESTING trace event for ACL pool destroy This is needed for a test to catch a double-free. Signed-off-by: Aleksander Wasaznik --- include/zephyr/bluetooth/testing.h | 27 +++++++++++++++++++++++++++ subsys/bluetooth/host/hci_core.c | 12 ++++++++++++ 2 files changed, 39 insertions(+) create mode 100644 include/zephyr/bluetooth/testing.h diff --git a/include/zephyr/bluetooth/testing.h b/include/zephyr/bluetooth/testing.h new file mode 100644 index 00000000000..3ac48c7b36e --- /dev/null +++ b/include/zephyr/bluetooth/testing.h @@ -0,0 +1,27 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +/** @brief Internal testing interfaces for Bluetooth + * @file + * @internal + * + * The interfaces in this file are internal and not stable. + */ + +#ifndef ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ +#define ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ + +#include + +/** @brief Hook for `acl_in_pool.destroy` + * + * Weak-function interface. The user can simply define this + * function, and it will automatically become the event + * listener. + * + * @kconfig_dep{CONFIG_BT_TESTING} + */ +void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf); + +#endif /* ZEPHYR_INCLUDE_BLUETOOTH_TESTING_H_ */ diff --git a/subsys/bluetooth/host/hci_core.c b/subsys/bluetooth/host/hci_core.c index 6a19f79c31b..4606c8c9b1f 100644 --- a/subsys/bluetooth/host/hci_core.c +++ b/subsys/bluetooth/host/hci_core.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -28,6 +29,7 @@ #include #include #include +#include #if DT_HAS_CHOSEN(zephyr_bt_hci) #include #else @@ -263,6 +265,12 @@ void bt_send_one_host_num_completed_packets(uint16_t handle) BT_ASSERT_MSG(err == 0, "Unable to send Host NCP (err %d)", err); } +#if defined(CONFIG_BT_TESTING) +__weak void bt_testing_trace_event_acl_pool_destroy(struct net_buf *buf) +{ +} +#endif + #if defined(CONFIG_BT_HCI_ACL_FLOW_CONTROL) void bt_hci_host_num_completed_packets(struct net_buf *buf) { @@ -270,6 +278,10 @@ void bt_hci_host_num_completed_packets(struct net_buf *buf) struct bt_conn *conn; uint8_t index = acl(buf)->index; + if (IS_ENABLED(CONFIG_BT_TESTING)) { + bt_testing_trace_event_acl_pool_destroy(buf); + } + net_buf_destroy(buf); if (acl(buf)->host_ncp_sent) { From abeca2470247db7da9c1aa3bd83b6e55d94c9407 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 22 Aug 2024 10:19:08 +0200 Subject: [PATCH 07/53] Bluetooth: testlib: Add `BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_` This is shorthand for random static addresses. It's similar to `bt_addr_le_from_str`, but is a macro that results in an object literal, making it more versatile and less verbose. This macro only gives access to the first 255 random static addresses, but this ought to be enough addresses for testing. Signed-off-by: Aleksander Wasaznik --- .../common/testlib/include/testlib/addr.h | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/bluetooth/common/testlib/include/testlib/addr.h diff --git a/tests/bluetooth/common/testlib/include/testlib/addr.h b/tests/bluetooth/common/testlib/include/testlib/addr.h new file mode 100644 index 00000000000..2f9e49488b7 --- /dev/null +++ b/tests/bluetooth/common/testlib/include/testlib/addr.h @@ -0,0 +1,20 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ +#define ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ + +#include + +#include +#include + +/** Bluetooth LE static random address */ +#define BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(last) \ + ((bt_addr_le_t){ \ + .type = BT_ADDR_LE_RANDOM, \ + .a = {{last, 0x00, 0x00, 0x00, 0x00, 0xc0}}, \ + }) + +#endif /* ZEPHYR_TESTS_BLUETOOTH_COMMON_TESTLIB_INCLUDE_TESTLIB_ADDR_H_ */ From 47325f8df5649cfdfff9d19504e79b5635e35a08 Mon Sep 17 00:00:00 2001 From: Aleksander Wasaznik Date: Thu, 1 Aug 2024 14:25:51 +0200 Subject: [PATCH 08/53] Bluetooth: Host: Test L2CAP -EINPROGRESS feature The test implementation is based on a copy of the HFC multilink test. The test verifies that the stack respects the reference counting of SDU buffers when the L2CAP -EINPROGRESS feature is used. Signed-off-by: Aleksander Wasaznik --- tests/bsim/bluetooth/host/l2cap/compile.sh | 1 + .../host/l2cap/einprogress/CMakeLists.txt | 24 ++++ .../host/l2cap/einprogress/compile.sh | 13 ++ .../bluetooth/host/l2cap/einprogress/prj.conf | 25 ++++ .../host/l2cap/einprogress/src/data.h | 11 ++ .../host/l2cap/einprogress/src/dut.c | 124 ++++++++++++++++++ .../host/l2cap/einprogress/src/main.c | 47 +++++++ .../host/l2cap/einprogress/src/tester.c | 72 ++++++++++ .../l2cap/einprogress/test_scripts/run.sh | 26 ++++ 9 files changed, 343 insertions(+) create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt create mode 100755 tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c create mode 100644 tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c create mode 100755 tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh diff --git a/tests/bsim/bluetooth/host/l2cap/compile.sh b/tests/bsim/bluetooth/host/l2cap/compile.sh index 71d41a7f2e7..ddb7f5d14bc 100755 --- a/tests/bsim/bluetooth/host/l2cap/compile.sh +++ b/tests/bsim/bluetooth/host/l2cap/compile.sh @@ -19,6 +19,7 @@ app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_nofrag.conf compile app=tests/bsim/bluetooth/host/l2cap/stress conf_file=prj_syswq.conf compile run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/split/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/reassembly/compile.sh +run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh run_in_background ${ZEPHYR_BASE}/tests/bsim/bluetooth/host/l2cap/ecred/compile.sh app=tests/bsim/bluetooth/host/l2cap/credits compile app=tests/bsim/bluetooth/host/l2cap/credits conf_file=prj_ecred.conf compile diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt b/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt new file mode 100644 index 00000000000..b6d0135f936 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/CMakeLists.txt @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 + +cmake_minimum_required(VERSION 3.20.0) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) + +project(test_l2cap_einprogress) + +add_subdirectory(${ZEPHYR_BASE}/tests/bluetooth/common/testlib testlib) +target_link_libraries(app PRIVATE testlib) + +add_subdirectory(${ZEPHYR_BASE}/tests/bsim/babblekit babblekit) +target_link_libraries(app PRIVATE babblekit) + +zephyr_include_directories( + ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ + ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ +) + +target_sources(app PRIVATE + src/main.c + src/dut.c + src/tester.c +) diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh b/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh new file mode 100755 index 00000000000..e717a4b2bbe --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/compile.sh @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 +set -eu +: "${ZEPHYR_BASE:?ZEPHYR_BASE must be defined}" + +INCR_BUILD=1 + +source ${ZEPHYR_BASE}/tests/bsim/compile.source + +app="$(guess_test_relpath)" compile + +wait_for_background_jobs diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf b/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf new file mode 100644 index 00000000000..e2540cd6f6a --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/prj.conf @@ -0,0 +1,25 @@ +CONFIG_LOG=y +CONFIG_ASSERT=y +CONFIG_THREAD_NAME=y +CONFIG_LOG_THREAD_ID_PREFIX=y +CONFIG_ARCH_POSIX_TRAP_ON_FATAL=y +CONFIG_BT_TESTING=y + +CONFIG_BT_HCI_ACL_FLOW_CONTROL=y + +CONFIG_BT=y +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y + +# Dependency of testlib/adv and testlib/scan. +CONFIG_BT_EXT_ADV=y + +# Dynamic channel depends on SMP +CONFIG_BT_SMP=y +CONFIG_BT_L2CAP_DYNAMIC_CHANNEL=y + +# Disable auto-initiated procedures so they don't +# mess with the test's execution. +CONFIG_BT_AUTO_PHY_UPDATE=n +CONFIG_BT_AUTO_DATA_LEN_UPDATE=n +CONFIG_BT_GAP_AUTO_UPDATE_CONN_PARAMS=n diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h b/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h new file mode 100644 index 00000000000..4920d909d08 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/data.h @@ -0,0 +1,11 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#ifndef ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ +#define ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ + +#define TEST_DATA_L2CAP_PSM 0x0080 +#define TEST_DATA_DUT_ADDR BT_TESTLIB_ADDR_LE_RANDOM_C0_00_00_00_00_(0x01) + +#endif /* ZEPHYR_TESTS_BSIM_BLUETOOTH_HOST_L2CAP_EINPROGRESS_SRC_DATA_H_ */ diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c new file mode 100644 index 00000000000..2c026befd20 --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/dut.c @@ -0,0 +1,124 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "data.h" + +LOG_MODULE_REGISTER(dut, LOG_LEVEL_INF); + +/** Here we keep track of the reference count in the test + * application. This allows us to notice if the stack has freed + * references that were ours. + */ +static atomic_t acl_pool_refs_held[CONFIG_BT_BUF_ACL_RX_COUNT]; + +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_TESTING)); +BUILD_ASSERT(IS_ENABLED(CONFIG_BT_HCI_ACL_FLOW_CONTROL)); +void bt_testing_trace_event_acl_pool_destroy(struct net_buf *destroyed_buf) +{ + int buf_id = net_buf_id(destroyed_buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < ARRAY_SIZE(acl_pool_refs_held)); + TEST_ASSERT(acl_pool_refs_held[buf_id] == 0, + "ACL buf was destroyed while tester still held a reference"); +} + +static void acl_pool_refs_held_add(struct net_buf *buf) +{ + int buf_id = net_buf_id(buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < CONFIG_BT_BUF_ACL_RX_COUNT); + atomic_inc(&acl_pool_refs_held[buf_id]); +} + +static void acl_pool_refs_held_remove(struct net_buf *buf) +{ + int buf_id = net_buf_id(buf); + + __ASSERT_NO_MSG(0 <= buf_id && buf_id < ARRAY_SIZE(acl_pool_refs_held)); + atomic_val_t old = atomic_dec(&acl_pool_refs_held[buf_id]); + + __ASSERT(old != 0, "Tester error: releasing a reference that was not held"); +} + +struct k_fifo ack_todo; + +static int dut_chan_recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + /* Move buf. Ownership is ours if we return -EINPROGRESS. */ + acl_pool_refs_held_add(buf); + k_fifo_put(&ack_todo, buf); + + return -EINPROGRESS; +} + +static const struct bt_l2cap_chan_ops ops = { + .recv = dut_chan_recv_cb, +}; + +static struct bt_l2cap_le_chan le_chan = { + .chan.ops = &ops, +}; + +static int dut_server_accept_cb(struct bt_conn *conn, struct bt_l2cap_server *server, + struct bt_l2cap_chan **chan) +{ + *chan = &le_chan.chan; + return 0; +} + +static struct bt_l2cap_server test_l2cap_server = { + .accept = dut_server_accept_cb, + .psm = TEST_DATA_L2CAP_PSM, +}; + +void entrypoint_dut(void) +{ + struct net_buf *ack_buf; + struct bt_conn *conn = NULL; + int err; + + TEST_START("dut"); + + k_fifo_init(&ack_todo); + + err = bt_id_create(&TEST_DATA_DUT_ADDR, NULL); + __ASSERT_NO_MSG(!err); + + err = bt_enable(NULL); + __ASSERT_NO_MSG(!err); + + err = bt_l2cap_server_register(&test_l2cap_server); + __ASSERT_NO_MSG(!err); + + err = bt_testlib_adv_conn(&conn, BT_ID_DEFAULT, NULL); + __ASSERT_NO_MSG(!err); + + ack_buf = k_fifo_get(&ack_todo, K_FOREVER); + __ASSERT_NO_MSG(ack_buf); + + acl_pool_refs_held_remove(ack_buf); + err = bt_l2cap_chan_recv_complete(&le_chan.chan, ack_buf); + TEST_ASSERT(!err); + + TEST_PASS_AND_EXIT("dut"); +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c new file mode 100644 index 00000000000..d6611e8f8dd --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/main.c @@ -0,0 +1,47 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#include "bstests.h" +#include "babblekit/testcase.h" + +extern void entrypoint_dut(void); +extern void entrypoint_tester(void); +extern enum bst_result_t bst_result; + +static void test_end_cb(void) +{ + if (bst_result != Passed) { + TEST_PRINT("Test has not passed."); + } +} + +static const struct bst_test_instance entrypoints[] = { + { + .test_id = "l2cap/einprogress/dut", + .test_delete_f = test_end_cb, + .test_main_f = entrypoint_dut, + }, + { + .test_id = "l2cap/einprogress/tester", + .test_delete_f = test_end_cb, + .test_main_f = entrypoint_tester, + }, + BSTEST_END_MARKER, +}; + +static struct bst_test_list *install(struct bst_test_list *tests) +{ + return bst_add_tests(tests, entrypoints); +}; + +bst_test_install_t test_installers[] = {install, NULL}; + +int main(void) +{ + bst_main(); + + return 0; +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c b/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c new file mode 100644 index 00000000000..2e2d000aa9c --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/src/tester.c @@ -0,0 +1,72 @@ +/* Copyright (c) 2024 Nordic Semiconductor ASA + * SPDX-License-Identifier: Apache-2.0 + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include "data.h" + +LOG_MODULE_REGISTER(tester, LOG_LEVEL_INF); + +static int tester_chan_recv_cb(struct bt_l2cap_chan *chan, struct net_buf *buf) +{ + __ASSERT(false, "Unexpected recv in tester"); + return 0; +}; + +static struct bt_l2cap_le_chan le_chan = { + .chan.ops = + &(const struct bt_l2cap_chan_ops){ + .recv = tester_chan_recv_cb, + }, +}; + +NET_BUF_POOL_DEFINE(test_pool, 1, BT_L2CAP_SDU_BUF_SIZE(0), CONFIG_BT_CONN_TX_USER_DATA_SIZE, NULL); + +void entrypoint_tester(void) +{ + struct net_buf *sdu; + struct bt_conn *conn = NULL; + int err; + + TEST_START("tester"); + + err = bt_enable(NULL); + __ASSERT_NO_MSG(!err); + + err = bt_testlib_connect(&TEST_DATA_DUT_ADDR, &conn); + __ASSERT_NO_MSG(!err); + + err = bt_l2cap_chan_connect(conn, &le_chan.chan, TEST_DATA_L2CAP_PSM); + __ASSERT_NO_MSG(!err); + + /* Wait for async L2CAP connect */ + while (!atomic_test_bit(le_chan.chan.status, BT_L2CAP_STATUS_OUT)) { + k_sleep(K_MSEC(100)); + } + + sdu = net_buf_alloc(&test_pool, K_NO_WAIT); + __ASSERT_NO_MSG(sdu); + net_buf_reserve(sdu, BT_L2CAP_SDU_CHAN_SEND_RESERVE); + + err = bt_l2cap_chan_send(&le_chan.chan, sdu); + __ASSERT(!err, "err: %d", err); + + TEST_PASS("tester"); +} diff --git a/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh b/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh new file mode 100755 index 00000000000..b86db52d9df --- /dev/null +++ b/tests/bsim/bluetooth/host/l2cap/einprogress/test_scripts/run.sh @@ -0,0 +1,26 @@ +#!/usr/bin/env bash +# Copyright (c) 2024 Nordic Semiconductor +# SPDX-License-Identifier: Apache-2.0 + +set -eu + +source ${ZEPHYR_BASE}/tests/bsim/sh_common.source + +test_name="$(guess_test_long_name)" +simulation_id=${test_name} +verbosity_level=2 +EXECUTE_TIMEOUT=120 +SIM_LEN_US=$((2 * 1000 * 1000)) + +test_exe="${BSIM_OUT_PATH}/bin/bs_${BOARD_TS}_${test_name}_prj_conf" + +cd ${BSIM_OUT_PATH}/bin + +Execute "${test_exe}" -v=${verbosity_level} -s=${simulation_id} -d=0 \ + -testid=l2cap/einprogress/dut +Execute "${test_exe}" -v=${verbosity_level} -s=${simulation_id} -d=1 \ + -testid=l2cap/einprogress/tester + +Execute ./bs_2G4_phy_v1 -v=${verbosity_level} -s=${simulation_id} -D=2 -sim_length=${SIM_LEN_US} $@ + +wait_for_background_jobs From e2f5ac01c7965e973dc40fb2a6e6e3fd80a37d1b Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 14 May 2024 11:58:10 +0200 Subject: [PATCH 09/53] cmake: cleanup hwm_v2.cmake module code Cleanup the Kconfig generating code in hwm_v2.cmake by moving common logic inside the kconfig_gen() helper function. This prepares the code for board extension feature. Signed-off-by: Torsten Rasmussen --- cmake/modules/hwm_v2.cmake | 36 +++++++++++------------------------- 1 file changed, 11 insertions(+), 25 deletions(-) diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index 45238f212b3..b514a33c5b0 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -24,9 +24,11 @@ if(NOT HWMv2) endif() # Internal helper function for creation of Kconfig files. -function(kconfig_gen bin_dir file dirs) - file(MAKE_DIRECTORY "${bin_dir}") - set(kconfig_file ${bin_dir}/${file}) +function(kconfig_gen bin_dir file dirs comment) + set(kconfig_header "# Load ${comment} descriptions.\n") + set(kconfig_file ${KCONFIG_BINARY_DIR}/${bin_dir}/${file}) + file(WRITE ${kconfig_file} "${kconfig_header}") + foreach(dir ${dirs}) cmake_path(CONVERT "${dir}" TO_CMAKE_PATH_LIST dir) file(APPEND ${kconfig_file} "osource \"${dir}/${file}\"\n") @@ -92,28 +94,12 @@ while(TRUE) endwhile() list(REMOVE_DUPLICATES kconfig_soc_source_dir) -# Support multiple ARCH_ROOT and SOC_ROOT -set(arch_kconfig_file Kconfig) -set(soc_defconfig_file Kconfig.defconfig) -set(soc_zephyr_file Kconfig) -set(soc_kconfig_file Kconfig.soc) -set(soc_sysbuild_file Kconfig.sysbuild) -set(arch_kconfig_header "# Load arch Kconfig descriptions.\n") -set(defconfig_header "# Load Zephyr SoC Kconfig defconfig.\n") -set(soc_zephyr_header "# Load Zephyr SoC Kconfig descriptions.\n") -set(soc_kconfig_header "# Load SoC Kconfig descriptions.\n") -set(soc_sysbuild_header "# Load SoC sysbuild Kconfig descriptions.\n") -file(WRITE ${KCONFIG_BINARY_DIR}/arch/${arch_kconfig_file} "${arch_kconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_defconfig_file} "${defconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_zephyr_file} "${soc_zephyr_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_kconfig_file} "${soc_kconfig_header}") -file(WRITE ${KCONFIG_BINARY_DIR}/soc/${soc_sysbuild_file} "${soc_sysbuild_header}") - -kconfig_gen("${KCONFIG_BINARY_DIR}/arch" "${arch_kconfig_file}" "${kconfig_arch_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_defconfig_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_zephyr_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_kconfig_file}" "${kconfig_soc_source_dir}") -kconfig_gen("${KCONFIG_BINARY_DIR}/soc" "${soc_sysbuild_file}" "${kconfig_soc_source_dir}") +# Support multiple ARCH_ROOT, SOC_ROOT and BOARD_ROOT +kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") +kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") +kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") +kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") +kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") # Clear variables created by cmake_parse_arguments unset(SOC_V2_NAME) From 536d34fa7ae84870d595a0453897d800107ae0c5 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 8 May 2024 13:10:48 +0200 Subject: [PATCH 10/53] cmake: scripts: support board extension Fixes: #69548 Support extending an existing board with new board variants. This commit introduces the following changes to allow a board to be extended out-of-tree. The board yaml schema is extended to support an extend field which will be used to identify the board to be extended. A board 'plank' can be extended like this: > board: > extend: plank > variants: > - name: ext > qualifier: soc1 For the rest of the build system this means that there is no longer a single board directory. The existing CMake variable BOARD_DIR is kept and reference the directory which defines the board. A new CMake variable BOARD_DIRECTORIES provides a list of all directories which defines board targets for the board. This means the directory which defines the board as well as all directories that extends the board. Signed-off-by: Torsten Rasmussen --- Kconfig.zephyr | 4 +- boards/Kconfig | 2 +- boards/Kconfig.v1 | 6 +- boards/Kconfig.v2 | 2 +- cmake/modules/boards.cmake | 34 ++--- cmake/modules/dts.cmake | 40 +++--- cmake/modules/hwm_v2.cmake | 14 ++- cmake/modules/kconfig.cmake | 7 +- cmake/modules/kernel.cmake | 4 +- doc/_extensions/zephyr/kconfig/__init__.py | 12 +- doc/_scripts/gen_boards_catalog.py | 4 +- scripts/ci/check_compliance.py | 12 +- scripts/ci/test_plan.py | 4 +- scripts/kconfig/lint.py | 2 +- scripts/list_boards.py | 125 +++++++++++++++---- scripts/pylib/twister/twisterlib/testplan.py | 2 +- scripts/schemas/board-schema.yml | 22 +++- scripts/west_commands/boards.py | 4 +- share/sysbuild/Kconfig | 2 +- 19 files changed, 200 insertions(+), 102 deletions(-) diff --git a/Kconfig.zephyr b/Kconfig.zephyr index 425d79f4e74..f97819896d9 100644 --- a/Kconfig.zephyr +++ b/Kconfig.zephyr @@ -17,13 +17,13 @@ osource "${APPLICATION_SOURCE_DIR}/VERSION" # Shield defaults should have precedence over board defaults, which should have # precedence over SoC defaults, so include them in that order. # -# $ARCH and $BOARD_DIR will be glob patterns when building documentation. +# $ARCH and $KCONFIG_BOARD_DIR will be glob patterns when building documentation. # This loads custom shields defconfigs (from BOARD_ROOT) osource "$(KCONFIG_BINARY_DIR)/Kconfig.shield.defconfig" # This loads Zephyr base shield defconfigs source "boards/shields/*/Kconfig.defconfig" -osource "$(BOARD_DIR)/Kconfig.defconfig" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.defconfig" # This loads Zephyr specific SoC root defconfigs source "$(KCONFIG_BINARY_DIR)/soc/Kconfig.defconfig" diff --git a/boards/Kconfig b/boards/Kconfig index 6eb9ca5916d..8f186b32caf 100644 --- a/boards/Kconfig +++ b/boards/Kconfig @@ -129,7 +129,7 @@ config QEMU_EXTRA_FLAGS GDBstub over serial with `-serial tcp:127.0.0.1:5678,server` # There might not be any board options, hence the optional source -osource "$(BOARD_DIR)/Kconfig" +osource "$(KCONFIG_BOARD_DIR)/Kconfig" endmenu config BOARD_HAS_TIMING_FUNCTIONS diff --git a/boards/Kconfig.v1 b/boards/Kconfig.v1 index 670e2f2376e..c98bd27d2db 100644 --- a/boards/Kconfig.v1 +++ b/boards/Kconfig.v1 @@ -2,9 +2,13 @@ # SPDX-License-Identifier: Apache-2.0 +# In HWMv1 the KCONFIG_BOARD_DIR points directly to the BOARD_DIR. +# Set the BOARD_DIR variable for backwards compatibility to legacy hardware model. +BOARD_DIR := $(KCONFIG_BOARD_DIR) + choice prompt "Board Selection" -source "$(BOARD_DIR)/Kconfig.board" +source "$(KCONFIG_BOARD_DIR)/Kconfig.board" endchoice diff --git a/boards/Kconfig.v2 b/boards/Kconfig.v2 index 47bb3ae2240..6fce9ccb99d 100644 --- a/boards/Kconfig.v2 +++ b/boards/Kconfig.v2 @@ -25,4 +25,4 @@ config BOARD_QUALIFIERS For example, if building for ``nrf5340dk/nrf5340/cpuapp`` then this will contain the value ``nrf5340/cpuapp``. -osource "$(BOARD_DIR)/Kconfig.$(BOARD)" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.$(BOARD)" diff --git a/cmake/modules/boards.cmake b/cmake/modules/boards.cmake index a1b05b07b57..2b78845482a 100644 --- a/cmake/modules/boards.cmake +++ b/cmake/modules/boards.cmake @@ -185,9 +185,7 @@ set(format_str "{NAME}\;{DIR}\;{HWM}\;") set(format_str "${format_str}{REVISION_FORMAT}\;{REVISION_DEFAULT}\;{REVISION_EXACT}\;") set(format_str "${format_str}{REVISIONS}\;{SOCS}\;{QUALIFIERS}") -if(BOARD_DIR) - set(board_dir_arg "--board-dir=${BOARD_DIR}") -endif() +list(TRANSFORM BOARD_DIRECTORIES PREPEND "--board-dir=" OUTPUT_VARIABLE board_dir_arg) execute_process(${list_boards_commands} --board=${BOARD} ${board_dir_arg} --cmakeformat=${format_str} OUTPUT_VARIABLE ret_board @@ -200,29 +198,15 @@ endif() if(NOT "${ret_board}" STREQUAL "") string(STRIP "${ret_board}" ret_board) - string(FIND "${ret_board}" "\n" idx REVERSE) - if(idx GREATER -1) - while(TRUE) - math(EXPR start "${idx} + 1") - string(SUBSTRING "${ret_board}" ${start} -1 line) - string(SUBSTRING "${ret_board}" 0 ${idx} ret_board) - - cmake_parse_arguments(LIST_BOARD "" "DIR" "" ${line}) - set(board_dirs "${board_dirs}\n${LIST_BOARD_DIR}") - - if(idx EQUAL -1) - break() - endif() - string(FIND "${ret_board}" "\n" idx REVERSE) - endwhile() - message(FATAL_ERROR "Multiple boards named '${BOARD}' found in:${board_dirs}") - endif() - - set(single_val "NAME;DIR;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") - set(multi_val "REVISIONS;SOCS;QUALIFIERS") + set(single_val "NAME;HWM;REVISION_FORMAT;REVISION_DEFAULT;REVISION_EXACT") + set(multi_val "DIR;REVISIONS;SOCS;QUALIFIERS") cmake_parse_arguments(LIST_BOARD "" "${single_val}" "${multi_val}" ${ret_board}) - set(BOARD_DIR ${LIST_BOARD_DIR} CACHE PATH "Board directory for board (${BOARD})" FORCE) - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${BOARD_DIR}/board.yml) + list(GET LIST_BOARD_DIR 0 BOARD_DIR) + set(BOARD_DIR ${BOARD_DIR} CACHE PATH "Main board directory for board (${BOARD})" FORCE) + set(BOARD_DIRECTORIES ${LIST_BOARD_DIR} CACHE INTERNAL "List of board directories for board (${BOARD})" FORCE) + foreach(dir ${BOARD_DIRECTORIES}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/board.yml) + endforeach() # Create two CMake variables identifying the hw model. # CMake variable: HWM=[v1,v2] diff --git a/cmake/modules/dts.cmake b/cmake/modules/dts.cmake index 16b497d5737..a2c56577cfa 100644 --- a/cmake/modules/dts.cmake +++ b/cmake/modules/dts.cmake @@ -76,9 +76,9 @@ find_package(Dtc 1.4.6) # # Optional variables: # - BOARD: board name to use when looking for DTS_SOURCE -# - BOARD_DIR: board directory to use when looking for DTS_SOURCE +# - BOARD_DIRECTORIES: list of board directories to use when looking for DTS_SOURCE # - BOARD_REVISION_STRING: used when looking for a board revision's -# devicetree overlay file in BOARD_DIR +# devicetree overlay file in one of the BOARD_DIRECTORIES # - CMAKE_DTS_PREPROCESSOR: the path to the preprocessor to use # for devicetree files # - DTC_OVERLAY_FILE: list of devicetree overlay files which will be @@ -94,7 +94,7 @@ find_package(Dtc 1.4.6) # C preprocessor when generating the devicetree from DTS_SOURCE # - DTS_SOURCE: the devicetree source file to use may be pre-set # with this variable; otherwise, it defaults to -# ${BOARD_DIR}/${BOARD}.dts +# ${BOARD_DIRECTORIES}/.dts # # Variables set by this module and not mentioned above are for internal # use only, and may be removed, renamed, or re-purposed without prior notice. @@ -137,28 +137,30 @@ if(NOT DEFINED DTS_SOURCE) zephyr_build_string(board_string SHORT shortened_board_string BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} ) - if(EXISTS ${BOARD_DIR}/${shortened_board_string}.dts AND NOT BOARD_${BOARD}_SINGLE_SOC) - message(FATAL_ERROR "Board ${ZFILE_BOARD} defines multiple SoCs.\nShortened file name " - "(${shortened_board_string}.dts) not allowed, use '_.dts' naming" - ) - elseif(EXISTS ${BOARD_DIR}/${board_string}.dts AND EXISTS ${BOARD_DIR}/${shortened_board_string}.dts) - message(FATAL_ERROR "Conflicting file names discovered. Cannot use both " - "${board_string}.dts and ${shortened_board_string}.dts. " - "Please choose one naming style, ${board_string}.dts is recommended." - ) - elseif(EXISTS ${BOARD_DIR}/${board_string}.dts) - set(DTS_SOURCE ${BOARD_DIR}/${board_string}.dts) - elseif(EXISTS ${BOARD_DIR}/${shortened_board_string}.dts) - set(DTS_SOURCE ${BOARD_DIR}/${shortened_board_string}.dts) - endif() + foreach(dir ${BOARD_DIRECTORIES}) + if(EXISTS ${dir}/${shortened_board_string}.dts AND NOT BOARD_${BOARD}_SINGLE_SOC) + message(FATAL_ERROR "Board ${ZFILE_BOARD} defines multiple SoCs.\nShortened file name " + "(${shortened_board_string}.dts) not allowed, use '_.dts' naming" + ) + elseif(EXISTS ${dir}/${board_string}.dts AND EXISTS ${dir}/${shortened_board_string}.dts) + message(FATAL_ERROR "Conflicting file names discovered. Cannot use both " + "${board_string}.dts and ${shortened_board_string}.dts. " + "Please choose one naming style, ${board_string}.dts is recommended." + ) + elseif(EXISTS ${dir}/${board_string}.dts) + set(DTS_SOURCE ${dir}/${board_string}.dts) + elseif(EXISTS ${dir}/${shortened_board_string}.dts) + set(DTS_SOURCE ${dir}/${shortened_board_string}.dts) + endif() + endforeach() endif() if(EXISTS ${DTS_SOURCE}) # We found a devicetree. Append all relevant dts overlays we can find... - zephyr_file(CONF_FILES ${BOARD_DIR} DTS DTS_SOURCE) + zephyr_file(CONF_FILES ${BOARD_DIRECTORIES} DTS DTS_SOURCE) zephyr_file( - CONF_FILES ${BOARD_DIR} + CONF_FILES ${BOARD_DIRECTORIES} DTS no_rev_suffix_dts_board_overlays BOARD ${BOARD} BOARD_QUALIFIERS ${BOARD_QUALIFIERS} diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index b514a33c5b0..c4feb03736e 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -95,11 +95,15 @@ endwhile() list(REMOVE_DUPLICATES kconfig_soc_source_dir) # Support multiple ARCH_ROOT, SOC_ROOT and BOARD_ROOT -kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") -kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") -kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") -kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") -kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") +kconfig_gen("arch" "Kconfig" "${kconfig_arch_source_dir}" "Zephyr Arch Kconfig") +kconfig_gen("soc" "Kconfig.defconfig" "${kconfig_soc_source_dir}" "Zephyr SoC defconfig") +kconfig_gen("soc" "Kconfig" "${kconfig_soc_source_dir}" "Zephyr SoC Kconfig") +kconfig_gen("soc" "Kconfig.soc" "${kconfig_soc_source_dir}" "SoC Kconfig") +kconfig_gen("soc" "Kconfig.sysbuild" "${kconfig_soc_source_dir}" "Sysbuild SoC Kconfig") +kconfig_gen("boards" "Kconfig.defconfig" "${BOARD_DIRECTORIES}" "Zephyr board defconfig") +kconfig_gen("boards" "Kconfig.${BOARD}" "${BOARD_DIRECTORIES}" "board Kconfig") +kconfig_gen("boards" "Kconfig" "${BOARD_DIRECTORIES}" "Zephyr board Kconfig") +kconfig_gen("boards" "Kconfig.sysbuild" "${BOARD_DIRECTORIES}" "Sysbuild board Kconfig") # Clear variables created by cmake_parse_arguments unset(SOC_V2_NAME) diff --git a/cmake/modules/kconfig.cmake b/cmake/modules/kconfig.cmake index 0273d39bf85..02bebbe0851 100644 --- a/cmake/modules/kconfig.cmake +++ b/cmake/modules/kconfig.cmake @@ -21,9 +21,12 @@ file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/kconfig/include/config) set_ifndef(KCONFIG_NAMESPACE "CONFIG") set_ifndef(KCONFIG_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/Kconfig) +set(KCONFIG_BOARD_DIR ${KCONFIG_BINARY_DIR}/boards) file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) if(HWMv1) + # HWMv1 only supoorts a single board dir which points directly to the board dir. + set(KCONFIG_BOARD_DIR ${BOARD_DIR}) # Support multiple SOC_ROOT file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}/soc) set(kconfig_soc_root ${SOC_ROOT}) @@ -73,7 +76,7 @@ else() endif() if(NOT DEFINED BOARD_DEFCONFIG) - zephyr_file(CONF_FILES ${BOARD_DIR} DEFCONFIG BOARD_DEFCONFIG) + zephyr_file(CONF_FILES ${BOARD_DIRECTORIES} DEFCONFIG BOARD_DEFCONFIG) endif() if(DEFINED BOARD_REVISION) @@ -157,7 +160,7 @@ set(COMMON_KCONFIG_ENV_SETTINGS APP_VERSION_TWEAK_STRING=${APP_VERSION_TWEAK_STRING} CONFIG_=${KCONFIG_NAMESPACE}_ KCONFIG_CONFIG=${DOTCONFIG} - BOARD_DIR=${BOARD_DIR} + KCONFIG_BOARD_DIR=${KCONFIG_BOARD_DIR} BOARD=${BOARD} BOARD_REVISION=${BOARD_REVISION} BOARD_QUALIFIERS=${BOARD_QUALIFIERS} diff --git a/cmake/modules/kernel.cmake b/cmake/modules/kernel.cmake index 1946e2357ba..6a1a48b172d 100644 --- a/cmake/modules/kernel.cmake +++ b/cmake/modules/kernel.cmake @@ -173,7 +173,9 @@ if(CONFIG_LLEXT AND CONFIG_LLEXT_TYPE_ELF_SHAREDLIB) set_property(GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS TRUE) endif() -include(${BOARD_DIR}/board.cmake OPTIONAL) +foreach(dir ${BOARD_DIRECTORIES}) + include(${dir}/board.cmake OPTIONAL) +endforeach() # If we are using a suitable ethernet driver inside qemu, then these options # must be set, otherwise a zephyr instance cannot receive any network packets. diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index 6052db638fa..abbdcc1b9be 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -91,7 +91,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: root_args = argparse.Namespace(**{'soc_roots': [Path(ZEPHYR_BASE)]}) v2_systems = list_hardware.find_v2_systems(root_args) - soc_folders = {soc.folder for soc in v2_systems.get_socs()} + soc_folders = {soc.folder[0] for soc in v2_systems.get_socs()} with open(Path(td) / "soc" / "Kconfig.defconfig", "w") as f: f.write('') @@ -114,8 +114,9 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: (Path(td) / 'boards').mkdir(exist_ok=True) root_args = argparse.Namespace(**{'board_roots': [Path(ZEPHYR_BASE)], - 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None}) - v2_boards = list_boards.find_v2_boards(root_args) + 'soc_roots': [Path(ZEPHYR_BASE)], 'board': None, + 'board_dir': []}) + v2_boards = list_boards.find_v2_boards(root_args).values() with open(Path(td) / "boards" / "Kconfig.boards", "w") as f: for board in v2_boards: @@ -126,7 +127,8 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper() f.write('config ' + board_str + '\n') f.write('\t bool\n') - f.write('source "' + (board.dir / ('Kconfig.' + board.name)).as_posix() + '"\n\n') + f.write('source "' + + (board.directories[0] / ('Kconfig.' + board.name)).as_posix() + '"\n\n') # base environment os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) @@ -140,7 +142,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: os.environ["HWM_SCHEME"] = "v2" os.environ["BOARD"] = "boards" - os.environ["BOARD_DIR"] = str(Path(td) / "boards") + os.environ["KCONFIG_BOARD_DIR"] = str(Path(td) / "boards") # insert external Kconfigs to the environment module_paths = dict() diff --git a/doc/_scripts/gen_boards_catalog.py b/doc/_scripts/gen_boards_catalog.py index 859f37c9ece..52be751e81f 100644 --- a/doc/_scripts/gen_boards_catalog.py +++ b/doc/_scripts/gen_boards_catalog.py @@ -70,7 +70,7 @@ def get_catalog(): arch_roots=module_settings["arch_root"], board_roots=module_settings["board_root"], soc_roots=module_settings["soc_root"], - board_dir=ZEPHYR_BASE / "boards", + board_dir=[], board=None, ) @@ -78,7 +78,7 @@ def get_catalog(): systems = list_hardware.find_v2_systems(args_find_boards) board_catalog = {} - for board in boards: + for board in boards.values(): # We could use board.vendor but it is often incorrect. Instead, deduce vendor from # containing folder. There are a few exceptions, like the "native" and "others" folders # which we know are not actual vendors so treat them as such. diff --git a/scripts/ci/check_compliance.py b/scripts/ci/check_compliance.py index f586b53d147..63e7fb948b7 100755 --- a/scripts/ci/check_compliance.py +++ b/scripts/ci/check_compliance.py @@ -511,8 +511,9 @@ def get_v2_model(self, kconfig_dir, settings_file): soc_roots = self.get_module_setting_root('soc', settings_file) soc_roots.insert(0, Path(ZEPHYR_BASE)) root_args = argparse.Namespace(**{'board_roots': board_roots, - 'soc_roots': soc_roots, 'board': None}) - v2_boards = list_boards.find_v2_boards(root_args) + 'soc_roots': soc_roots, 'board': None, + 'board_dir': []}) + v2_boards = list_boards.find_v2_boards(root_args).values() with open(kconfig_defconfig_file, 'w') as fp: for board in v2_boards: @@ -546,7 +547,7 @@ def get_v2_model(self, kconfig_dir, settings_file): root_args = argparse.Namespace(**{'soc_roots': soc_roots}) v2_systems = list_hardware.find_v2_systems(root_args) - soc_folders = {soc.folder for soc in v2_systems.get_socs()} + soc_folders = {soc.folder[0] for soc in v2_systems.get_socs()} with open(kconfig_defconfig_file, 'w') as fp: for folder in soc_folders: fp.write('osource "' + (Path(folder) / 'Kconfig.defconfig').as_posix() + '"\n') @@ -616,7 +617,7 @@ def parse_kconfig(self, filename="Kconfig", hwm=None): os.makedirs(os.path.join(kconfiglib_dir, 'soc'), exist_ok=True) os.makedirs(os.path.join(kconfiglib_dir, 'arch'), exist_ok=True) - os.environ["BOARD_DIR"] = kconfiglib_boards_dir + os.environ["KCONFIG_BOARD_DIR"] = kconfiglib_boards_dir self.get_v2_model(kconfiglib_dir, os.path.join(kconfiglib_dir, "settings_file.txt")) # Tells Kconfiglib to generate warnings for all references to undefined @@ -920,6 +921,9 @@ def check_no_undef_outside_kconfig(self, kconf): # Zephyr toolchain variant and therefore not # visible to compliance. "BOARD_", # Used as regex in scripts/utils/board_v1_to_v2.py + "BOARD_MPS2_AN521_CPUTEST", # Used for board and SoC extension feature tests + "BOARD_NATIVE_SIM_NATIVE_64_TWO", # Used for board and SoC extension feature tests + "BOARD_NATIVE_SIM_NATIVE_ONE", # Used for board and SoC extension feature tests "BOOT_DIRECT_XIP", # Used in sysbuild for MCUboot configuration "BOOT_DIRECT_XIP_REVERT", # Used in sysbuild for MCUboot configuration "BOOT_FIRMWARE_LOADER", # Used in sysbuild for MCUboot configuration diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 326068ab715..4bb428ee5b1 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -239,12 +239,12 @@ def find_boards(self): # Look for boards in monitored repositories lb_args = argparse.Namespace(**{'arch_roots': roots, 'board_roots': roots, 'board': None, 'soc_roots':roots, 'board_dir': None}) - known_boards = list_boards.find_v2_boards(lb_args) + known_boards = list_boards.find_v2_boards(lb_args).values() for changed in changed_boards: for board in known_boards: c = (zephyr_base / changed).resolve() - if c.is_relative_to(board.dir.resolve()): + if c.is_relative_to(board.directories[0].resolve()): for file in glob.glob(os.path.join(board.dir, f"{board.name}*.yaml")): with open(file, 'r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) diff --git a/scripts/kconfig/lint.py b/scripts/kconfig/lint.py index 30064c34546..5a123ded42f 100755 --- a/scripts/kconfig/lint.py +++ b/scripts/kconfig/lint.py @@ -209,7 +209,7 @@ def init_kconfig(): ZEPHYR_BASE=TOP_DIR, SOC_DIR="soc", ARCH_DIR="arch", - BOARD_DIR="boards/*/*", + KCONFIG_BOARD_DIR="boards/*/*", ARCH="*") kconf = kconfiglib.Kconfig(suppress_traceback=True) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index bf716584885..634c67df821 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -4,13 +4,13 @@ # SPDX-License-Identifier: Apache-2.0 import argparse -from collections import defaultdict +from collections import defaultdict, Counter from dataclasses import dataclass, field import itertools from pathlib import Path import pykwalify.core import sys -from typing import List +from typing import List, Union import yaml import list_hardware from list_hardware import unique_paths @@ -91,7 +91,8 @@ def from_soc(soc, variants): @dataclass(frozen=True) class Board: name: str - dir: Path + # HWMv1 only supports a single Path, and requires Board dataclass to be hashable. + directories: Union[Path, List[Path]] hwm: str full_name: str = None arch: str = None @@ -103,6 +104,41 @@ class Board: socs: List[Soc] = field(default_factory=list, compare=False) variants: List[str] = field(default_factory=list, compare=False) + def from_qualifier(self, qualifiers): + qualifiers_list = qualifiers.split('/') + + node = Soc(None) + n = len(qualifiers_list) + if n > 0: + soc_qualifier = qualifiers_list.pop(0) + for s in self.socs: + if s.name == soc_qualifier: + node = s + break + + if n > 1: + if node.cpuclusters: + cpu_qualifier = qualifiers_list.pop(0) + for c in node.cpuclusters: + if c.name == cpu_qualifier: + node = c + break + else: + node = Variant(None) + + for q in qualifiers_list: + for v in node.variants: + if v.name == q: + node = v + break + else: + node = Variant(None) + + if node in (Soc(None), Variant(None)): + sys.exit(f'ERROR: qualifiers {qualifiers} not found when extending board {self.name}') + + return node + def board_key(board): return board.name @@ -165,11 +201,10 @@ def find_arch2board_set_in(root, arches, board_dir): for arch in arches: if not (boards / arch).is_dir(): continue - for maybe_board in (boards / arch).iterdir(): if not maybe_board.is_dir(): continue - if board_dir is not None and board_dir != maybe_board: + if board_dir and maybe_board not in board_dir: continue for maybe_defconfig in maybe_board.iterdir(): file_name = maybe_defconfig.name @@ -181,7 +216,8 @@ def find_arch2board_set_in(root, arches, board_dir): def load_v2_boards(board_name, board_yml, systems): - boards = [] + boards = {} + board_extensions = [] if board_yml.is_file(): with board_yml.open('r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) @@ -199,6 +235,18 @@ def load_v2_boards(board_name, board_yml, systems): board_array = b.get('boards', [b.get('board', None)]) for board in board_array: + mutual_exclusive = {'name', 'extend'} + if len(mutual_exclusive - board.keys()) < 1: + sys.exit(f'ERROR: Malformed "board" section in file: {board_yml.as_posix()}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + + # This is a extending an existing board, place in array to allow later processing. + if 'extend' in board: + board.update({'dir': board_yml.parent}) + board_extensions.append(board) + continue + + # Create board if board_name is not None: if board['name'] != board_name: # Not the board we're looking for, ignore. @@ -220,9 +268,9 @@ def load_v2_boards(board_name, board_yml, systems): socs = [Soc.from_soc(systems.get_soc(s['name']), s.get('variants', [])) for s in board.get('socs', {})] - board = Board( + boards[board['name']] = Board( name=board['name'], - dir=board_yml.parent, + directories=[board_yml.parent], vendor=board.get('vendor'), full_name=board.get('full_name'), revision_format=board.get('revision', {}).get('format'), @@ -234,8 +282,28 @@ def load_v2_boards(board_name, board_yml, systems): variants=[Variant.from_dict(v) for v in board.get('variants', [])], hwm='v2', ) - boards.append(board) - return boards + board_qualifiers = board_v2_qualifiers(boards[board['name']]) + duplicates = [q for q, n in Counter(board_qualifiers).items() if n > 1] + if duplicates: + sys.exit(f'ERROR: Duplicated board qualifiers detected {duplicates} for board: ' + f'{board["name"]}.\nPlease check content of: {board_yml.as_posix()}\n') + return boards, board_extensions + + +def extend_v2_boards(boards, board_extensions): + for e in board_extensions: + board = boards.get(e['extend']) + if board is None: + continue + board.directories.append(e['dir']) + + for v in e.get('variants', []): + node = board.from_qualifier(v['qualifier']) + if str(v['qualifier'] + '/' + v['name']) in board_v2_qualifiers(board): + board_yml = e['dir'] / BOARD_YML + sys.exit(f'ERROR: Variant: {v["name"]}, defined multiple times for board: ' + f'{board.name}.\nLast defined in {board_yml}') + node.variants.append(Variant.from_dict(v)) # Note that this does not share the args.board functionality of find_v2_boards @@ -253,14 +321,25 @@ def find_v2_boards(args): root_args = argparse.Namespace(**{'soc_roots': args.soc_roots}) systems = list_hardware.find_v2_systems(root_args) - boards = [] + boards = {} + board_extensions = [] board_files = [] - for root in unique_paths(args.board_roots): - board_files.extend((root / 'boards').rglob(BOARD_YML)) + if args.board_dir: + board_files = [d / BOARD_YML for d in args.board_dir] + else: + for root in unique_paths(args.board_roots): + board_files.extend((root / 'boards').rglob(BOARD_YML)) for board_yml in board_files: - b = load_v2_boards(args.board, board_yml, systems) - boards.extend(b) + b, e = load_v2_boards(args.board, board_yml, systems) + conflict_boards = set(boards.keys()).intersection(b.keys()) + if conflict_boards: + sys.exit(f'ERROR: Board(s): {conflict_boards}, defined multiple times.\n' + f'Last defined in {board_yml}') + boards.update(b) + board_extensions.extend(e) + + extend_v2_boards(boards, board_extensions) return boards @@ -285,7 +364,7 @@ def add_args(parser): help='add a soc root, may be given more than once') parser.add_argument("--board", dest='board', default=None, help='lookup the specific board, fail if not found') - parser.add_argument("--board-dir", default=None, type=Path, + parser.add_argument("--board-dir", default=[], type=Path, action='append', help='Only look for boards at the specific location') @@ -327,20 +406,16 @@ def board_v2_qualifiers_csv(board): def dump_v2_boards(args): - if args.board_dir: - root_args = argparse.Namespace(**{'soc_roots': args.soc_roots}) - systems = list_hardware.find_v2_systems(root_args) - boards = load_v2_boards(args.board, args.board_dir / BOARD_YML, systems) - else: - boards = find_v2_boards(args) + boards = find_v2_boards(args) - for b in boards: + for b in boards.values(): qualifiers_list = board_v2_qualifiers(b) if args.cmakeformat is not None: notfound = lambda x: x or 'NOTFOUND' info = args.cmakeformat.format( NAME='NAME;' + b.name, - DIR='DIR;' + str(b.dir.as_posix()), + DIR='DIR;' + ';'.join( + [str(x.as_posix()) for x in b.directories]), VENDOR='VENDOR;' + notfound(b.vendor), HWM='HWM;' + b.hwm, REVISION_DEFAULT='REVISION_DEFAULT;' + notfound(b.revision_default), @@ -365,7 +440,7 @@ def dump_boards(args): if args.cmakeformat is not None: info = args.cmakeformat.format( NAME='NAME;' + board.name, - DIR='DIR;' + str(board.dir.as_posix()), + DIR='DIR;' + str(board.directories.as_posix()), HWM='HWM;' + board.hwm, VENDOR='VENDOR;NOTFOUND', REVISION_DEFAULT='REVISION_DEFAULT;NOTFOUND', diff --git a/scripts/pylib/twister/twisterlib/testplan.py b/scripts/pylib/twister/twisterlib/testplan.py index 25aa5c218ea..377a0dab2bb 100755 --- a/scripts/pylib/twister/twisterlib/testplan.py +++ b/scripts/pylib/twister/twisterlib/testplan.py @@ -442,7 +442,7 @@ def init_and_add_platforms(data, board, target, qualifier, aliases): logger.debug(f"Adding platform {platform.name} with aliases {platform.aliases}") self.platforms.append(platform) - for board in known_boards: + for board in known_boards.values(): new_config_found = False # don't load the same board data twice if not bdirs.get(board.dir): diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 7a2afbd566d..656a62a37ef 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -23,17 +23,33 @@ schema;variant-schema: required: false include: variant-schema +schema;extend-variant-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: true + type: str + qualifier: + required: true + type: str + schema;board-schema: type: map mapping: name: - required: true + required: false # Note: either name or extend is required, but that is handled in python type: str desc: Name of the board full_name: required: false type: str desc: Full name of the board. Typically set to the commercial name of the board. + extend: + required: false # Note: either name or extend is required, but that is handled in python + type: str vendor: required: false type: str @@ -63,7 +79,7 @@ schema;board-schema: required: true type: str socs: - required: true + required: false # Required for name:, but not for extend. type: seq sequence: - type: map @@ -73,6 +89,8 @@ schema;board-schema: type: str variants: include: variant-schema + variants: + include: extend-variant-schema type: map mapping: diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 9777d377f53..9cb6182a7a7 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -97,14 +97,14 @@ def do_run(self, args, _): log.inf(args.format.format(name=board.name, arch=board.arch, dir=board.dir, hwm=board.hwm, qualifiers='')) - for board in list_boards.find_v2_boards(args): + for board in list_boards.find_v2_boards(args).values(): if name_re is not None and not name_re.search(board.name): continue log.inf( args.format.format( name=board.name, full_name=board.full_name, - dir=board.dir, + dir=board.directories[0], hwm=board.hwm, vendor=board.vendor, qualifiers=list_boards.board_v2_qualifiers_csv(board), diff --git a/share/sysbuild/Kconfig b/share/sysbuild/Kconfig index 556462af310..69f2d4cd396 100644 --- a/share/sysbuild/Kconfig +++ b/share/sysbuild/Kconfig @@ -6,7 +6,7 @@ rsource "Kconfig.$(HWM_SCHEME)" comment "Sysbuild image configuration" -osource "$(BOARD_DIR)/Kconfig.sysbuild" +osource "$(KCONFIG_BOARD_DIR)/Kconfig.sysbuild" osource "$(KCONFIG_BINARY_DIR)/soc/Kconfig.sysbuild" menu "Modules" From 98b186c1103a818b6fb4de0380f4c018a92c439f Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 15 May 2024 22:46:33 +0200 Subject: [PATCH 11/53] cmake: scripts: support SoC extension Fixes: #72374 Support extending an existing SoC with new CPU clusters. This commit introduces the following changes to allow an SoC to be extended out-of-tree. The SoC yaml schema is extended to support an extend field which will be used to identify the SoC to be extended with extra CPU clusters. A SoC 'a_soc' can be extended like this: > socs: > extend: a_soc > cpuclusters: > - name: extra_core Signed-off-by: Torsten Rasmussen --- cmake/modules/hwm_v2.cmake | 18 ++++++---- cmake/modules/soc_v2.cmake | 7 +++- scripts/list_hardware.py | 66 +++++++++++++++++++++++++--------- scripts/schemas/soc-schema.yml | 19 ++++++++-- 4 files changed, 84 insertions(+), 26 deletions(-) diff --git a/cmake/modules/hwm_v2.cmake b/cmake/modules/hwm_v2.cmake index c4feb03736e..a440c95c832 100644 --- a/cmake/modules/hwm_v2.cmake +++ b/cmake/modules/hwm_v2.cmake @@ -73,19 +73,23 @@ while(TRUE) string(TOUPPER "${ARCH_V2_NAME}" ARCH_V2_NAME_UPPER) set(ARCH_V2_${ARCH_V2_NAME_UPPER}_DIR ${ARCH_V2_DIR}) elseif(HWM_TYPE MATCHES "^soc|^series|^family") - cmake_parse_arguments(SOC_V2 "" "NAME;DIR;HWM" "" ${line}) + cmake_parse_arguments(SOC_V2 "" "NAME;HWM" "DIR" ${line}) list(APPEND kconfig_soc_source_dir "${SOC_V2_DIR}") + string(TOUPPER "${SOC_V2_NAME}" SOC_V2_NAME_UPPER) + string(TOUPPER "${HWM_TYPE}" HWM_TYPE_UPPER) if(HWM_TYPE STREQUAL "soc") - set(setting_name SOC_${SOC_V2_NAME}_DIR) + # We support both SOC_foo_DIR and SOC_FOO_DIR. + set(SOC_${SOC_V2_NAME}_DIRECTORIES ${SOC_V2_DIR}) + set(SOC_${SOC_V2_NAME_UPPER}_DIRECTORIES ${SOC_V2_DIR}) + list(GET SOC_V2_DIR 0 SOC_${SOC_V2_NAME}_DIR) + list(GET SOC_V2_DIR 0 SOC_${SOC_V2_NAME_UPPER}_DIR) else() - set(setting_name SOC_${HWM_TYPE}_${SOC_V2_NAME}_DIR) + # We support both SOC_series_foo_DIR and SOC_SERIES_FOO_DIR (and family / FAMILY). + set(SOC_${HWM_TYPE}_${SOC_V2_NAME}_DIR ${SOC_V2_DIR}) + set(SOC_${HWM_TYPE_UPPER}_${SOC_V2_NAME_UPPER}_DIR ${SOC_V2_DIR}) endif() - # We support both SOC_foo_DIR and SOC_FOO_DIR. - set(${setting_name} ${SOC_V2_DIR}) - string(TOUPPER ${setting_name} setting_name) - set(${setting_name} ${SOC_V2_DIR}) endif() if(idx EQUAL -1) diff --git a/cmake/modules/soc_v2.cmake b/cmake/modules/soc_v2.cmake index 606ed690f77..f98d33e0011 100644 --- a/cmake/modules/soc_v2.cmake +++ b/cmake/modules/soc_v2.cmake @@ -28,5 +28,10 @@ if(HWMv2) set(SOC_FAMILY ${CONFIG_SOC_FAMILY}) set(SOC_V2_DIR ${SOC_${SOC_NAME}_DIR}) set(SOC_FULL_DIR ${SOC_V2_DIR} CACHE PATH "Path to the SoC directory." FORCE) - set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${SOC_V2_DIR}/soc.yml) + set(SOC_DIRECTORIES ${SOC_${SOC_NAME}_DIRECTORIES} CACHE INTERNAL + "List of SoC directories for SoC (${SOC_NAME})" FORCE + ) + foreach(dir ${SOC_DIRECTORIES}) + set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${dir}/soc.yml) + endforeach() endif() diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index cce6fbe9831..57c8b22586f 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -35,6 +35,7 @@ def __init__(self, folder='', soc_yaml=None): self._socs = [] self._series = [] self._families = [] + self._extended_socs = [] if soc_yaml is None: return @@ -47,12 +48,12 @@ def __init__(self, folder='', soc_yaml=None): sys.exit(f'ERROR: Malformed yaml {soc_yaml.as_posix()}', e) for f in data.get('family', []): - family = Family(f['name'], folder, [], []) + family = Family(f['name'], [folder], [], []) for s in f.get('series', []): - series = Series(s['name'], folder, f['name'], []) + series = Series(s['name'], [folder], f['name'], []) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, s['name'], f['name'])) + [folder], s['name'], f['name'])) for soc in s.get('socs', [])] series.socs.extend(socs) self._series.append(series) @@ -61,26 +62,36 @@ def __init__(self, folder='', soc_yaml=None): family.socs.extend(socs) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, None, f['name'])) + [folder], None, f['name'])) for soc in f.get('socs', [])] self._socs.extend(socs) self._families.append(family) for s in data.get('series', []): - series = Series(s['name'], folder, '', []) + series = Series(s['name'], [folder], '', []) socs = [(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], - folder, s['name'], '')) + [folder], s['name'], '')) for soc in s.get('socs', [])] series.socs.extend(socs) self._series.append(series) self._socs.extend(socs) - socs = [(Soc(soc['name'], - [c['name'] for c in soc.get('cpuclusters', [])], - folder, '', '')) - for soc in data.get('socs', [])] - self._socs.extend(socs) + for soc in data.get('socs', []): + mutual_exclusive = {'name', 'extend'} + if len(mutual_exclusive - soc.keys()) < 1: + sys.exit(f'ERROR: Malformed content in SoC file: {soc_yaml}\n' + f'{mutual_exclusive} are mutual exclusive at this level.') + if soc.get('name') is not None: + self._socs.append(Soc(soc['name'], [c['name'] for c in soc.get('cpuclusters', [])], + [folder], '', '')) + elif soc.get('extend') is not None: + self._extended_socs.append(Soc(soc['extend'], + [c['name'] for c in soc.get('cpuclusters', [])], + [folder], '', '')) + else: + sys.exit(f'ERROR: Malformed "socs" section in SoC file: {soc_yaml}\n' + f'Cannot find one of required keys {mutual_exclusive}.') # Ensure that any runner configuration matches socs and cpuclusters declared in the same # soc.yml file @@ -97,7 +108,7 @@ def __init__(self, folder='', soc_yaml=None): if components and components[-1] == 'ns': components.pop() - for soc in self._socs: + for soc in self._socs + self._extended_socs: if re.match(fr'^{soc_name}$', soc.name) is not None: if soc.cpuclusters and components: check_string = '/'.join(components) @@ -133,8 +144,23 @@ def from_yaml(socs_yaml): def extend(self, systems): self._families.extend(systems.get_families()) self._series.extend(systems.get_series()) + + for es in self._extended_socs[:]: + for s in systems.get_socs(): + if s.name == es.name: + s.extend(es) + self._extended_socs.remove(es) + break self._socs.extend(systems.get_socs()) + for es in systems.get_extended_socs(): + for s in self._socs: + if s.name == es.name: + s.extend(es) + break + else: + self._extended_socs.append(es) + def get_families(self): return self._families @@ -144,6 +170,9 @@ def get_series(self): def get_socs(self): return self._socs + def get_extended_socs(self): + return self._extended_socs + def get_soc(self, name): try: return next(s for s in self._socs if s.name == name) @@ -156,15 +185,20 @@ def get_soc(self, name): class Soc: name: str cpuclusters: List[str] - folder: str + folder: List[str] series: str = '' family: str = '' + def extend(self, soc): + if self.name == soc.name: + self.cpuclusters.extend(soc.cpuclusters) + self.folder.extend(soc.folder) + @dataclass class Series: name: str - folder: str + folder: List[str] family: str socs: List[Soc] @@ -172,7 +206,7 @@ class Series: @dataclass class Family: name: str - folder: str + folder: List[str] series: List[Series] socs: List[Soc] @@ -289,7 +323,7 @@ def dump_v2_system(args, type, system): info = args.cmakeformat.format( TYPE='TYPE;' + type, NAME='NAME;' + system.name, - DIR='DIR;' + Path(system.folder).as_posix(), + DIR='DIR;' + ';'.join([Path(x).as_posix() for x in system.folder]), HWM='HWM;' + 'v2' ) else: diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index c13b4a4f7e0..1d8537e8ad2 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -24,7 +24,22 @@ schema;soc-schema: - type: map mapping: name: - required: true + required: true # Note: either name or extend is required, but that is handled in python + type: str + cpuclusters: + include: cpucluster-schema + +schema;soc-extend-schema: + required: false + type: seq + sequence: + - type: map + mapping: + name: + required: false # Note: either name or extend is required, but that is handled in python + type: str + extend: + required: false # Note: either name or extend is required, but that is handled in python type: str cpuclusters: include: cpucluster-schema @@ -60,7 +75,7 @@ mapping: series: include: series-schema socs: - include: soc-schema + include: soc-extend-schema vendor: required: false type: str From f3151571ba969f2beeae5f16a19e73c747619836 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Wed, 15 May 2024 13:42:04 +0200 Subject: [PATCH 12/53] tests: add twister tests for CMake board and SoC extension This commit adds new tests for verifying the functionality of the board and SoC extension feature. It does so by defining: - A new CPU cluster on an existing SoC - Two new board variants on top of an existing board The new board variants are defined on top of the existing `native_sim` board, so that the following native_sim board targets are available for the test. Existing board targets: - native_sim/native - native_sim/native/64 Extended board targets: - native_sim/native/one - native_sim/native/64/two The new CPU cluster is defined for the existing `an521` SoC. Existing CPU Clusters on an521: - cpu0 - cpu1 New CPU Cluster: - cputest For SoC tests the mps2 board is used. This means that for testing, the following board targets using the an521 SoC are: - mps2/an521/cpu0 - mps2/an521/cpu1 - mps2/an521/cputest Signed-off-by: Torsten Rasmussen --- tests/cmake/hwm/board_extend/CMakeLists.txt | 14 ++ tests/cmake/hwm/board_extend/Kconfig | 15 ++ .../hwm/board_extend/boards/native_sim.conf | 1 + .../boards/native_sim_native_64_two.conf | 1 + .../boards/native_sim_native_one.conf | 1 + .../oot_root/boards/arm/mps2/Kconfig.mps2 | 5 + .../oot_root/boards/arm/mps2/board.cmake | 14 ++ .../oot_root/boards/arm/mps2/board.yml | 2 + .../boards/arm/mps2/mps2_an521-common.dtsi | 191 +++++++++++++++ .../boards/arm/mps2/mps2_an521_cputest.dts | 130 +++++++++++ .../arm/mps2/mps2_an521_cputest_defconfig | 21 ++ .../boards/native/native_sim_extend/Kconfig | 30 +++ .../native_sim_extend/Kconfig.defconfig | 16 ++ .../boards/native/native_sim_extend/board.yml | 7 + .../native_sim_native_64_two.dts | 14 ++ .../native_sim_native_64_two.yaml | 25 ++ .../native_sim_native_64_two_defconfig | 7 + .../native_sim_native_one.dts | 218 ++++++++++++++++++ .../native_sim_native_one.yaml | 25 ++ .../native_sim_native_one_defconfig | 7 + .../board_extend/oot_root/soc/arm/Kconfig.soc | 6 + .../hwm/board_extend/oot_root/soc/arm/soc.yml | 4 + tests/cmake/hwm/board_extend/prj.conf | 1 + tests/cmake/hwm/board_extend/src/main.c | 85 +++++++ tests/cmake/hwm/board_extend/testcase.yaml | 33 +++ 25 files changed, 873 insertions(+) create mode 100644 tests/cmake/hwm/board_extend/CMakeLists.txt create mode 100644 tests/cmake/hwm/board_extend/Kconfig create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim.conf create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf create mode 100644 tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml create mode 100644 tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig create mode 100644 tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc create mode 100644 tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml create mode 100644 tests/cmake/hwm/board_extend/prj.conf create mode 100644 tests/cmake/hwm/board_extend/src/main.c create mode 100644 tests/cmake/hwm/board_extend/testcase.yaml diff --git a/tests/cmake/hwm/board_extend/CMakeLists.txt b/tests/cmake/hwm/board_extend/CMakeLists.txt new file mode 100644 index 00000000000..20bd94d6af0 --- /dev/null +++ b/tests/cmake/hwm/board_extend/CMakeLists.txt @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024 Nordic Semiconductor ASA + +cmake_minimum_required(VERSION 3.20.0) + +set(BOARD_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root) +set(SOC_ROOT ${CMAKE_CURRENT_LIST_DIR}/oot_root) + +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) +project(native_sim_extend) + +FILE(GLOB app_sources src/*.c) +target_sources(app PRIVATE ${app_sources}) diff --git a/tests/cmake/hwm/board_extend/Kconfig b/tests/cmake/hwm/board_extend/Kconfig new file mode 100644 index 00000000000..6bbf5b73227 --- /dev/null +++ b/tests/cmake/hwm/board_extend/Kconfig @@ -0,0 +1,15 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# +# SPDX-License-Identifier: Apache-2.0 + +config BASE_BOARD_SETTING + bool "Base board test string" + help + This kconfig is set when the base board config fragment is supposed to + be sourced, that is when oot variant defines + 'extends:' + ' board: native_sim' + ' qualifier: posix' + ' inherit: 1' + +source "Kconfig.zephyr" diff --git a/tests/cmake/hwm/board_extend/boards/native_sim.conf b/tests/cmake/hwm/board_extend/boards/native_sim.conf new file mode 100644 index 00000000000..71a2b211d0a --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim.conf @@ -0,0 +1 @@ +CONFIG_BASE_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf b/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf new file mode 100644 index 00000000000..b2dfe184407 --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim_native_64_two.conf @@ -0,0 +1 @@ +CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf b/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf new file mode 100644 index 00000000000..b2dfe184407 --- /dev/null +++ b/tests/cmake/hwm/board_extend/boards/native_sim_native_one.conf @@ -0,0 +1 @@ +CONFIG_EXTENDED_VARIANT_BOARD_SETTING=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 new file mode 100644 index 00000000000..448c9cc1308 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/Kconfig.mps2 @@ -0,0 +1,5 @@ +# Copyright (c) 2017 Linaro Limited +# SPDX-License-Identifier: Apache-2.0 + +config BOARD_MPS2 + select SOC_MPS2_AN521_CPUTEST if BOARD_MPS2_AN521_CPUTEST diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake new file mode 100644 index 00000000000..27c74975756 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.cmake @@ -0,0 +1,14 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2024, Nordic Semiconductor ASA + +if(CONFIG_BOARD_MPS2_AN521_CPUTEST) + set(QEMU_CPU_TYPE_${ARCH} cortex-m33) + set(QEMU_FLAGS_${ARCH} + -cpu ${QEMU_CPU_TYPE_${ARCH}} + -machine mps2-an521 + -nographic + -m 16 + -vga none + ) +endif() diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml new file mode 100644 index 00000000000..05982ac1bb8 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/board.yml @@ -0,0 +1,2 @@ +board: + extend: mps2 diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi new file mode 100644 index 00000000000..5b1959ff5fe --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521-common.dtsi @@ -0,0 +1,191 @@ +/* + * Copyright (c) 2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +sysclk: system-clock { + compatible = "fixed-clock"; + clock-frequency = <25000000>; + #clock-cells = <0>; +}; + +timer0: timer@0 { + compatible = "arm,cmsdk-timer"; + reg = <0x0 0x1000>; + interrupts = <3 3>; +}; + +timer1: timer@1000 { + compatible = "arm,cmsdk-timer"; + reg = <0x1000 0x1000>; + interrupts = <4 3>; +}; + +dtimer0: dtimer@2000 { + compatible = "arm,cmsdk-dtimer"; + reg = <0x2000 0x1000>; + interrupts = <5 3>; +}; + +mhu0: mhu@3000 { + compatible = "arm,mhu"; + reg = <0x3000 0x1000>; + interrupts = <6 3>; +}; + +mhu1: mhu@4000 { + compatible = "arm,mhu"; + reg = <0x4000 0x1000>; + interrupts = <7 3>; +}; + +gpio0: gpio@100000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x100000 0x1000>; + interrupts = <68 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio1: gpio@101000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x101000 0x1000>; + interrupts = <69 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio2: gpio@102000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x102000 0x1000>; + interrupts = <70 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +gpio3: gpio@103000 { + compatible = "arm,cmsdk-gpio"; + reg = <0x103000 0x1000>; + interrupts = <71 3>; + gpio-controller; + #gpio-cells = <2>; +}; + +wdog0: wdog@81000 { + compatible = "arm,cmsdk-watchdog"; + reg = <0x81000 0x1000>; + clocks = <&sysclk>; +}; + +uart0: uart@200000 { + compatible = "arm,cmsdk-uart"; + reg = <0x200000 0x1000>; + interrupts = <33 3 32 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart1: uart@201000 { + compatible = "arm,cmsdk-uart"; + reg = <0x201000 0x1000>; + interrupts = <35 3 34 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart2: uart@202000 { + compatible = "arm,cmsdk-uart"; + reg = <0x202000 0x1000>; + interrupts = <37 3 36 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart3: uart@203000 { + compatible = "arm,cmsdk-uart"; + reg = <0x203000 0x1000>; + interrupts = <39 3 38 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +uart4: uart@204000 { + compatible = "arm,cmsdk-uart"; + reg = <0x204000 0x1000>; + interrupts = <41 3 40 3>; + interrupt-names = "tx", "rx"; + clocks = <&sysclk>; + current-speed = <115200>; +}; + +i2c_touch: i2c@207000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x207000 0x1000>; +}; + +i2c_audio_conf: i2c@208000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x208000 0x1000>; +}; + +i2c_shield0: i2c@20c000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x20c000 0x1000>; +}; + +i2c_shield1: i2c@20d000 { + compatible = "arm,versatile-i2c"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x20d000 0x1000>; +}; + +gpio_led0: mps2_fpgaio@302000 { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x302000 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <2>; +}; + +gpio_button: mps2_fpgaio@302008 { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x302008 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <2>; +}; + +gpio_misc: mps2_fpgaio@30204c { + compatible = "arm,mps2-fpgaio-gpio"; + + reg = <0x30204c 0x4>; + gpio-controller; + #gpio-cells = <1>; + ngpios = <10>; +}; + +eth0: eth@2000000 { + /* Linux has "smsc,lan9115" */ + compatible = "smsc,lan9220"; + /* Actual reg range is ~0x200 */ + reg = <0x2000000 0x100000>; + interrupts = <48 3>; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts new file mode 100644 index 00000000000..2bb956645ca --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest.dts @@ -0,0 +1,130 @@ +/* + * Copyright (c) 2018-2019 Linaro Limited + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include +#include +#include + +/ { + compatible = "arm,mps2"; + #address-cells = <1>; + #size-cells = <1>; + + aliases { + led0 = &led_0; + led1 = &led_1; + sw0 = &user_button_0; + sw1 = &user_button_1; + uart-1 = &uart1; + watchdog0 = &wdog0; + }; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + + /* + * These SRAM and flash settings give the entire available + * code and data memories to this secure firmware image. + * This may conflict with mps2_an521_remote firmware. Use + * caution when using both targets simultaneously. + */ + zephyr,sram = &ssram2_3; + zephyr,flash = &ssram1; + }; + + leds { + compatible = "gpio-leds"; + led_0: led_0 { + gpios = <&gpio_led0 0>; + label = "USERLED0"; + }; + led_1: led_1 { + gpios = <&gpio_led0 1>; + label = "USERLED1"; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + user_button_0: button_0 { + label = "USERPB0"; + gpios = <&gpio_button 0>; + zephyr,code = ; + }; + user_button_1: button_1 { + label = "USERPB1"; + gpios = <&gpio_button 1>; + zephyr,code = ; + }; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + compatible = "arm,cortex-m33"; + reg = <0>; + #address-cells = <1>; + #size-cells = <1>; + + mpu: mpu@e000ed90 { + compatible = "arm,armv8m-mpu"; + reg = <0xe000ed90 0x40>; + }; + }; + }; + + /* + * The memory regions defined below are according to AN521: + * https://documentation-service.arm.com/static/5fa12fe9b1a7c5445f29017f + * + * Please see tables mentioned in individual comments below for details. + */ + + ssram1: memory@10000000 { + /* Table 3-2, row 6. */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x10000000 DT_SIZE_M(4)>; + zephyr,memory-region = "SSRAM1"; + }; + + ssram2_3: memory@38000000 { + /* Table 3-4, rows 16 and 17. */ + compatible = "zephyr,memory-region", "mmio-sram"; + reg = <0x38000000 DT_SIZE_M(4)>; + zephyr,memory-region = "SSRAM2_3"; + }; + + psram: memory@80000000 { + /* Table 3-6, row 1. */ + device_type = "memory"; + reg = <0x80000000 DT_SIZE_M(16)>; + }; + + soc { + peripheral@50000000 { + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x50000000 0x10000000>; + + #include "mps2_an521-common.dtsi" + }; + }; +}; + +&nvic { + arm,num-irq-priority-bits = <3>; +}; + +&uart1 { + status = "okay"; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig new file mode 100644 index 00000000000..08949950a9e --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/arm/mps2/mps2_an521_cputest_defconfig @@ -0,0 +1,21 @@ +# +# Copyright (c) 2018-2019 Linaro Limited +# +# SPDX-License-Identifier: Apache-2.0 +# + +#CONFIG_RUNTIME_NMI=y +#CONFIG_ARM_TRUSTZONE_M=y +#CONFIG_ARM_MPU=y +CONFIG_QEMU_ICOUNT_SHIFT=6 +# +## GPIOs +CONFIG_GPIO=y + +# Serial +CONFIG_CONSOLE=y +CONFIG_UART_CONSOLE=y +CONFIG_SERIAL=y + +# Build a non-secure firmware image +#CONFIG_TRUSTED_EXECUTION_NONSECURE=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig new file mode 100644 index 00000000000..e724497c3b5 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig @@ -0,0 +1,30 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config EXTENDED_VARIANT_BOARD_SETTING + bool "Extended variant board test string" + depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is set when the extended variant board config fragment + is supposed to be sourced, that is when oot variant defines 'extends:' + +config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS + bool + depends on BOARD_NATIVE_SIM_NATIVE_ONE + help + This kconfig is promptless and is expected to be set through the + Kconfig.defconfig for the extended board. + +config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS + bool + depends on BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is promptless and is expected to be set through the + Kconfig.defconfig for the extended board. + +config EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG + bool "Extended variant board test string defconfig" + depends on BOARD_NATIVE_SIM_NATIVE_ONE || BOARD_NATIVE_SIM_NATIVE_64_TWO + help + This kconfig is set when the extended variant board defconfig fragment + is supposed to be sourced, that is when oot variant defines 'extends:' diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig new file mode 100644 index 00000000000..343daa1246a --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/Kconfig.defconfig @@ -0,0 +1,16 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if BOARD_NATIVE_SIM_NATIVE_ONE + +config EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS + default y + +endif # BOARD_NATIVE_SIM_NATIVE_ONE + +if BOARD_NATIVE_SIM_NATIVE_64_TWO + +config EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS + default y + +endif # BOARD_NATIVE_SIM_NATIVE_64_TWO diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml new file mode 100644 index 00000000000..8df9cf3c433 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/board.yml @@ -0,0 +1,7 @@ +board: + extend: native_sim + variants: + - name: one + qualifier: native + - name: two + qualifier: native/64 diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts new file mode 100644 index 00000000000..b3fc17d81fb --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.dts @@ -0,0 +1,14 @@ +/* + * Copyright (c) 2023 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "native_sim_native_one.dts" + +/ { + /delete-node/ added-by-native-one; + + added-by-native-two{ + }; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml new file mode 100644 index 00000000000..190d4906cc8 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two.yaml @@ -0,0 +1,25 @@ +identifier: native_sim_native_64_two +name: Native Simulation port - 32-bit +type: native +simulation: native +arch: posix +ram: 65536 +flash: 65536 +toolchain: + - host + - llvm +supported: + - can + - counter + - dma + - eeprom + - netif:eth + - usb_device + - adc + - i2c + - spi + - gpio + - rtc +testing: + default: true +vendor: zephyr diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig new file mode 100644 index 00000000000..d0de015b0df --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_64_two_defconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000 + +CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts new file mode 100644 index 00000000000..652c7605f60 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.dts @@ -0,0 +1,218 @@ +/* + * Copyright (c) 2019 Jan Van Winkel (jan.van_winkel@dxplore.eu) + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include +#include +#include +#include + +/ { + model = "Native Sim Board"; + compatible = "zephyr,posix"; + + chosen { + zephyr,console = &uart0; + zephyr,shell-uart = &uart0; + zephyr,uart-mcumgr = &uart0; + zephyr,flash = &flash0; + zephyr,entropy = &rng; + zephyr,flash-controller = &flashcontroller0; + zephyr,display = &sdl_dc; + zephyr,canbus = &can_loopback0; + zephyr,code-partition = &slot0_partition; + }; + + aliases { + eeprom-0 = &eeprom0; + i2c-0 = &i2c0; + spi-0 = &spi0; + led0 = &led0; + rtc = &rtc; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 0 GPIO_ACTIVE_HIGH>; + label = "Green LED"; + }; + }; + + lvgl_pointer { + compatible = "zephyr,lvgl-pointer-input"; + input = <&input_sdl_touch>; + }; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu0: cpu@0 { + compatible = "zephyr,native-posix-cpu"; + reg = <0>; + }; + }; + + flashcontroller0: flash-controller@0 { + compatible = "zephyr,sim-flash"; + reg = <0x00000000 DT_SIZE_K(2048)>; + + #address-cells = <1>; + #size-cells = <1>; + erase-value = <0xff>; + + flash0: flash@0 { + status = "okay"; + compatible = "soc-nv-flash"; + erase-block-size = <4096>; + write-block-size = <1>; + reg = <0x00000000 DT_SIZE_K(2048)>; + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000C000>; + }; + slot0_partition: partition@c000 { + label = "image-0"; + reg = <0x0000C000 0x00069000>; + }; + slot1_partition: partition@75000 { + label = "image-1"; + reg = <0x00075000 0x00069000>; + }; + scratch_partition: partition@de000 { + label = "image-scratch"; + reg = <0x000de000 0x0001e000>; + }; + storage_partition: partition@fc000 { + label = "storage"; + reg = <0x000fc000 0x00004000>; + }; + }; + }; + }; + + eeprom0: eeprom { + status = "okay"; + compatible = "zephyr,sim-eeprom"; + size = ; + }; + + i2c0: i2c@100 { + status = "okay"; + compatible = "zephyr,i2c-emul-controller"; + clock-frequency = ; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x100 4>; + }; + + spi0: spi@200 { + status = "okay"; + compatible = "zephyr,spi-emul-controller"; + clock-frequency = <50000000>; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x200 4>; + }; + + espi0: espi@300 { + status = "okay"; + compatible = "zephyr,espi-emul-controller"; + reg = <0x300 4>; + #address-cells = <1>; + #size-cells = <0>; + }; + + uart0: uart { + status = "okay"; + compatible = "zephyr,native-posix-uart"; + /* Dummy current-speed entry to comply with serial + * DTS binding + */ + current-speed = <0>; + }; + + uart1: uart_1 { + status = "okay"; + compatible = "zephyr,native-posix-uart"; + /* Dummy current-speed entry to comply with serial + * DTS binding + */ + current-speed = <0>; + }; + + rng: rng { + status = "okay"; + compatible = "zephyr,native-posix-rng"; + }; + + counter0: counter { + status = "okay"; + compatible = "zephyr,native-posix-counter"; + }; + + gpio0: gpio@800 { + status = "okay"; + compatible = "zephyr,gpio-emul"; + reg = <0x800 0x4>; + rising-edge; + falling-edge; + high-level; + low-level; + gpio-controller; + #gpio-cells = <2>; + }; + + zephyr_udc0: udc0 { + compatible = "zephyr,native-posix-udc"; + }; + + sdl_dc: sdl_dc { + compatible = "zephyr,sdl-dc"; + height = <240>; + width = <320>; + }; + + input_sdl_touch: input-sdl-touch { + compatible = "zephyr,input-sdl-touch"; + }; + + can_loopback0: can_loopback0 { + status = "okay"; + compatible = "zephyr,can-loopback"; + }; + + can0: can { + status = "disabled"; + compatible = "zephyr,native-linux-can"; + /* adjust zcan0 to desired host interface or create an alternative + * name, e.g.: sudo ip link property add dev vcan0 altname zcan0 + */ + host-interface = "zcan0"; + }; + + rtc: rtc { + status = "okay"; + compatible = "zephyr,rtc-emul"; + alarms-count = <2>; + }; + + dma: dma { + compatible = "zephyr,dma-emul"; + #dma-cells = <1>; + stack-size = <4096>; + }; + + added-by-native-one { + }; +}; diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml new file mode 100644 index 00000000000..ea2c2d856ae --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one.yaml @@ -0,0 +1,25 @@ +identifier: native_sim_native_one +name: Native Simulation port - 32-bit +type: native +simulation: native +arch: posix +ram: 65536 +flash: 65536 +toolchain: + - host + - llvm +supported: + - can + - counter + - dma + - eeprom + - netif:eth + - usb_device + - adc + - i2c + - spi + - gpio + - rtc +testing: + default: true +vendor: zephyr diff --git a/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig new file mode 100644 index 00000000000..d0de015b0df --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/boards/native/native_sim_extend/native_sim_native_one_defconfig @@ -0,0 +1,7 @@ +# Copyright (c) 2024 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_CONSOLE=y +CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC=1000000 + +CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG=y diff --git a/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc b/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc new file mode 100644 index 00000000000..a699e8413a1 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/soc/arm/Kconfig.soc @@ -0,0 +1,6 @@ +# Copyright (c) 2024, Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +config SOC_MPS2_AN521_CPUTEST + bool + select SOC_MPS2_AN521 diff --git a/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml b/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml new file mode 100644 index 00000000000..04b69c75ae4 --- /dev/null +++ b/tests/cmake/hwm/board_extend/oot_root/soc/arm/soc.yml @@ -0,0 +1,4 @@ +socs: + - extend: an521 + cpuclusters: + - name: cputest diff --git a/tests/cmake/hwm/board_extend/prj.conf b/tests/cmake/hwm/board_extend/prj.conf new file mode 100644 index 00000000000..9467c292689 --- /dev/null +++ b/tests/cmake/hwm/board_extend/prj.conf @@ -0,0 +1 @@ +CONFIG_ZTEST=y diff --git a/tests/cmake/hwm/board_extend/src/main.c b/tests/cmake/hwm/board_extend/src/main.c new file mode 100644 index 00000000000..9795bd8dcb8 --- /dev/null +++ b/tests/cmake/hwm/board_extend/src/main.c @@ -0,0 +1,85 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING +#define EXTENDED_BOARD_A 1 +#else +#define EXTENDED_BOARD_A 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_ONE_SETTING_PROMPTLESS +#define EXTENDED_BOARD_ONE_B 1 +#else +#define EXTENDED_BOARD_ONE_B 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_TWO_SETTING_PROMPTLESS +#define EXTENDED_BOARD_TWO_C 1 +#else +#define EXTENDED_BOARD_TWO_C 0 +#endif + +#ifdef CONFIG_EXTENDED_VARIANT_BOARD_SETTING_DEFCONFIG +#define EXTENDED_BOARD_D 1 +#else +#define EXTENDED_BOARD_D 0 +#endif + +#ifdef CONFIG_BASE_BOARD_SETTING +#define BASE_BOARD_CONFIG 1 +#else +#define BASE_BOARD_CONFIG 0 +#endif + +#ifdef CONFIG_SOC_MPS2_AN521_CPUTEST +#define EXTENDED_SOC 1 +#else +#define EXTENDED_SOC 0 +#endif + +ZTEST_SUITE(soc_board_extend, NULL, NULL, NULL, NULL, NULL); + +#if CONFIG_BOARD_NATIVE_SIM +ZTEST(soc_board_extend, test_native_sim_extend) +{ +#if CONFIG_BOARD_NATIVE_SIM_NATIVE_ONE + zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set"); + zassert_true(EXTENDED_BOARD_ONE_B, "Expected extended board to be set"); + zassert_false(EXTENDED_BOARD_TWO_C, "Did not expect extended board two to be set"); + zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set"); + zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set"); + zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_one))); + zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_two))); + zassert_false(DT_NODE_EXISTS(DT_PATH(adc))); +#elif CONFIG_BOARD_NATIVE_SIM_NATIVE_64_TWO + zassert_true(EXTENDED_BOARD_A, "Expected extended board to be set"); + zassert_false(EXTENDED_BOARD_ONE_B, "Did not expect extended board one to be set"); + zassert_true(EXTENDED_BOARD_TWO_C, "Expected extended board to be set"); + zassert_true(EXTENDED_BOARD_D, "Expected extended board to be set"); + zassert_false(BASE_BOARD_CONFIG, "Did not expect base board to be set"); + zassert_false(DT_NODE_EXISTS(DT_PATH(added_by_native_one))); + zassert_true(DT_NODE_EXISTS(DT_PATH(added_by_native_two))); + zassert_false(DT_NODE_EXISTS(DT_PATH(adc))); +#else + zassert_true(false, "Did not expect to build for a base native_sim board"); +#endif +#elif CONFIG_BOARD_MPS2 +ZTEST(soc_board_extend, test_an521_soc_extend) +{ +#if CONFIG_BOARD_MPS2_AN521_CPUTEST + zassert_true(EXTENDED_SOC, "Expected extended SoC to be set"); +#elif CONFIG_BOARD_MPS2 + zassert_true(false, "Did not expect to build for a base mps2 board"); +#endif + +#else +ZTEST(soc_board_extend, test_failure) +{ + zassert_true(false, "Did not expect to build for a regular board"); +#endif +} diff --git a/tests/cmake/hwm/board_extend/testcase.yaml b/tests/cmake/hwm/board_extend/testcase.yaml new file mode 100644 index 00000000000..aae39ce6b2c --- /dev/null +++ b/tests/cmake/hwm/board_extend/testcase.yaml @@ -0,0 +1,33 @@ +common: + tags: + - cmake +tests: + cmake.board.extend_one: + extra_args: + # Twister can only lookup known board roots. + # Thus platform above is set to native_sim, while at this location + # we overrule with the native_sim/native/one board. + # Test will fail if we accidentially build for the base native_sim board. + - CACHED_BOARD=native_sim/native/one + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + cmake.board.extend_two: + extra_args: + - CACHED_BOARD=native_sim/native/64/two + platform_allow: + - native_sim + - native_sim/native/64 + integration_platforms: + - native_sim + - native_sim/native/64 + cmake.soc.extend_cputest: + extra_args: + - CACHED_BOARD=mps2/an521/cputest + platform_allow: + - mps2/an521/cpu0 + integration_platforms: + - mps2/an521/cpu0 From a04dfc4ece61b8e72886bfd30c6669e85cc5deaf Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 1 Jul 2024 08:19:25 +0100 Subject: [PATCH 13/53] scripts: west_commands: run: Add priority to run once config Adds an optional priority parameter to the flash runner run once configuration which allows for deciding upon which file should ultimately be used Signed-off-by: Jamie McCrae --- scripts/schemas/board-schema.yml | 5 ++ scripts/schemas/soc-schema.yml | 5 ++ scripts/west_commands/run_common.py | 105 +++++++++++++++++----------- 3 files changed, 75 insertions(+), 40 deletions(-) diff --git a/scripts/schemas/board-schema.yml b/scripts/schemas/board-schema.yml index 656a62a37ef..4c86c9d000c 100644 --- a/scripts/schemas/board-schema.yml +++ b/scripts/schemas/board-schema.yml @@ -103,6 +103,11 @@ mapping: runners: type: map mapping: + priority: + type: int + desc: | + Priority of this flash run once configuration. The highest value data will be used + instead of any with lower priorities. If omitted, will default to 10. run_once: type: map desc: | diff --git a/scripts/schemas/soc-schema.yml b/scripts/schemas/soc-schema.yml index 1d8537e8ad2..060afea3254 100644 --- a/scripts/schemas/soc-schema.yml +++ b/scripts/schemas/soc-schema.yml @@ -88,6 +88,11 @@ mapping: runners: type: map mapping: + priority: + type: int + desc: | + Priority of this flash run once configuration. The highest value data will be used + instead of any with lower priorities. If omitted, will default to 0. run_once: type: map desc: | diff --git a/scripts/west_commands/run_common.py b/scripts/west_commands/run_common.py index 82ec7a09b9b..adfd2922fb9 100644 --- a/scripts/west_commands/run_common.py +++ b/scripts/west_commands/run_common.py @@ -42,6 +42,10 @@ # Don't change this, or output from argparse won't match up. INDENT = ' ' * 2 +IGNORED_RUN_ONCE_PRIORITY = -1 +SOC_FILE_RUN_ONCE_DEFAULT_PRIORITY = 0 +BOARD_FILE_RUN_ONCE_DEFAULT_PRIORITY = 10 + if log.VERBOSE >= log.VERBOSE_NORMAL: # Using level 1 allows sub-DEBUG levels of verbosity. The # west.log module decides whether or not to actually print the @@ -96,6 +100,13 @@ class ImagesFlashed: flashed: int = 0 total: int = 0 +@dataclass +class SocBoardFilesProcessing: + filename: str + board: bool = False + priority: int = IGNORED_RUN_ONCE_PRIORITY + yaml: object = None + def command_verb(command): return "flash" if command.name == "flash" else "debug" @@ -178,6 +189,10 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None): # images for a given board. board_image_count = defaultdict(ImagesFlashed) + highest_priority = IGNORED_RUN_ONCE_PRIORITY + highest_entry = None + check_files = [] + if user_args.context: dump_context(command, user_args, user_runner_args) return @@ -223,48 +238,58 @@ def do_run_common(command, user_args, user_runner_args, domain_file=None): # Load board flash runner configuration (if it exists) and store # single-use commands in a dictionary so that they get executed # once per unique board name. - if cache['BOARD_DIR'] not in processed_boards and 'SOC_FULL_DIR' in cache: - soc_yaml_file = Path(cache['SOC_FULL_DIR']) / 'soc.yml' - board_yaml_file = Path(cache['BOARD_DIR']) / 'board.yml' - group_type = 'boards' - - # Search for flash runner configuration, board takes priority over SoC - try: - with open(board_yaml_file, 'r') as f: - data_yaml = yaml.safe_load(f.read()) - - except FileNotFoundError: - continue - - if 'runners' not in data_yaml: - # Check SoC file - group_type = 'qualifiers' - try: - with open(soc_yaml_file, 'r') as f: - data_yaml = yaml.safe_load(f.read()) - - except FileNotFoundError: + for directory in cache.get_list('SOC_DIRECTORIES'): + if directory not in processed_boards: + check_files.append(SocBoardFilesProcessing(Path(directory) / 'soc.yml')) + processed_boards.add(directory) + + for directory in cache.get_list('BOARD_DIRECTORIES'): + if directory not in processed_boards: + check_files.append(SocBoardFilesProcessing(Path(directory) / 'board.yml', True)) + processed_boards.add(directory) + + for check in check_files: + try: + with open(check.filename, 'r') as f: + check.yaml = yaml.safe_load(f.read()) + + if 'runners' not in check.yaml: + continue + elif check.board is False and 'run_once' not in check.yaml['runners']: continue - processed_boards.add(cache['BOARD_DIR']) - - if 'runners' not in data_yaml or 'run_once' not in data_yaml['runners']: - continue - - for cmd in data_yaml['runners']['run_once']: - for data in data_yaml['runners']['run_once'][cmd]: - for group in data['groups']: - run_first = bool(data['run'] == 'first') - if group_type == 'qualifiers': - targets = [] - for target in group[group_type]: - # For SoC-based qualifiers, prepend to the beginning of the - # match to allow for matching any board name - targets.append('([^/]+)/' + target) - else: - targets = group[group_type] - - used_cmds.append(UsedFlashCommand(cmd, targets, data['runners'], run_first)) + if 'priority' in check.yaml['runners']: + check.priority = check.yaml['runners']['priority'] + else: + check.priority = BOARD_FILE_RUN_ONCE_DEFAULT_PRIORITY if check.board is True else SOC_FILE_RUN_ONCE_DEFAULT_PRIORITY + + if check.priority == highest_priority: + log.die("Duplicate flash run once configuration found with equal priorities") + + elif check.priority > highest_priority: + highest_priority = check.priority + highest_entry = check + + except FileNotFoundError: + continue + + if highest_entry is not None: + group_type = 'boards' if highest_entry.board is True else 'qualifiers' + + for cmd in highest_entry.yaml['runners']['run_once']: + for data in highest_entry.yaml['runners']['run_once'][cmd]: + for group in data['groups']: + run_first = bool(data['run'] == 'first') + if group_type == 'qualifiers': + targets = [] + for target in group[group_type]: + # For SoC-based qualifiers, prepend to the beginning of the + # match to allow for matching any board name + targets.append('([^/]+)/' + target) + else: + targets = group[group_type] + + used_cmds.append(UsedFlashCommand(cmd, targets, data['runners'], run_first)) # Reduce entries to only those having matching board names (either exact or with regex) and # remove any entries with empty board lists From 33e70b32dc047165d0cc1ed13c7a7f11f65e42e1 Mon Sep 17 00:00:00 2001 From: Jamie McCrae Date: Mon, 8 Jul 2024 13:25:12 +0100 Subject: [PATCH 14/53] scripts: list_hardware: Do not check qualifiers for run once config Removes validating the qualifiers for flash run once configuration as files may be present that contain information for qualifiers that are not present in a single repository but are spaced out in other repositories, or might be optional Signed-off-by: Jamie McCrae --- scripts/list_hardware.py | 18 +++--------------- 1 file changed, 3 insertions(+), 15 deletions(-) diff --git a/scripts/list_hardware.py b/scripts/list_hardware.py index 57c8b22586f..0a446ad7fff 100755 --- a/scripts/list_hardware.py +++ b/scripts/list_hardware.py @@ -100,25 +100,13 @@ def __init__(self, folder='', soc_yaml=None): for item_data in data['runners']['run_once'][grp]: for group in item_data['groups']: for qualifiers in group['qualifiers']: - soc_name, *components = qualifiers.split('/') + soc_name = qualifiers.split('/')[0] found_match = False - # Allow 'ns' as final qualifier until "virtual" CPUs are ported to soc.yml - # https://github.com/zephyrproject-rtos/zephyr/issues/70721 - if components and components[-1] == 'ns': - components.pop() - for soc in self._socs + self._extended_socs: if re.match(fr'^{soc_name}$', soc.name) is not None: - if soc.cpuclusters and components: - check_string = '/'.join(components) - for cpucluster in soc.cpuclusters: - if re.match(fr'^{check_string}$', cpucluster) is not None: - found_match = True - break - elif not soc.cpuclusters and not components: - found_match = True - break + found_match = True + break if found_match is False: sys.exit(f'ERROR: SoC qualifier match unresolved: {qualifiers}') From a1f3f882fdcded4ef80d25aafd5c7ce9c1fc58d1 Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 18 Jul 2024 15:08:35 +0200 Subject: [PATCH 15/53] scripts: list_boards: Reintroduce Board.dir as @property In the `Board` class, the `dir` member was renamed to `directories`, both to indicate that it is now a list (in HWMv2 with board extensions) and to reflect the addition of the `BOARD_DIRECTORIES` CMake variable. Considering that the build system also keeps the `BOARD_DIR` variable, and for the sake of backwards compatibility and brevity, it should be useful to retain `Board.dir` in Python as well, symmetrically. Signed-off-by: Grzegorz Swiderski --- scripts/list_boards.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 634c67df821..44247b450ff 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -104,6 +104,13 @@ class Board: socs: List[Soc] = field(default_factory=list, compare=False) variants: List[str] = field(default_factory=list, compare=False) + @property + def dir(self): + # Get the main board directory. + if isinstance(self.directories, Path): + return self.directories + return self.directories[0] + def from_qualifier(self, qualifiers): qualifiers_list = qualifiers.split('/') From 276c1fc4a09a80499c07808abe2a2fcb9b3c832c Mon Sep 17 00:00:00 2001 From: Grzegorz Swiderski Date: Thu, 18 Jul 2024 15:08:35 +0200 Subject: [PATCH 16/53] scripts: Undo Board.{dir -> directories[0]} renames `Board.dir` can be used in place of `Board.directories[0]` for brevity. Signed-off-by: Grzegorz Swiderski --- doc/_extensions/zephyr/kconfig/__init__.py | 3 +-- scripts/ci/test_plan.py | 2 +- scripts/list_boards.py | 2 +- scripts/west_commands/boards.py | 2 +- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/doc/_extensions/zephyr/kconfig/__init__.py b/doc/_extensions/zephyr/kconfig/__init__.py index abbdcc1b9be..905376d8168 100644 --- a/doc/_extensions/zephyr/kconfig/__init__.py +++ b/doc/_extensions/zephyr/kconfig/__init__.py @@ -127,8 +127,7 @@ def kconfig_load(app: Sphinx) -> Tuple[kconfiglib.Kconfig, Dict[str, str]]: board_str = 'BOARD_' + re.sub(r"[^a-zA-Z0-9_]", "_", qualifier).upper() f.write('config ' + board_str + '\n') f.write('\t bool\n') - f.write('source "' + - (board.directories[0] / ('Kconfig.' + board.name)).as_posix() + '"\n\n') + f.write('source "' + (board.dir / ('Kconfig.' + board.name)).as_posix() + '"\n\n') # base environment os.environ["ZEPHYR_BASE"] = str(ZEPHYR_BASE) diff --git a/scripts/ci/test_plan.py b/scripts/ci/test_plan.py index 4bb428ee5b1..dfc87368198 100755 --- a/scripts/ci/test_plan.py +++ b/scripts/ci/test_plan.py @@ -244,7 +244,7 @@ def find_boards(self): for changed in changed_boards: for board in known_boards: c = (zephyr_base / changed).resolve() - if c.is_relative_to(board.directories[0].resolve()): + if c.is_relative_to(board.dir.resolve()): for file in glob.glob(os.path.join(board.dir, f"{board.name}*.yaml")): with open(file, 'r', encoding='utf-8') as f: b = yaml.load(f.read(), Loader=SafeLoader) diff --git a/scripts/list_boards.py b/scripts/list_boards.py index 44247b450ff..443e18a1980 100755 --- a/scripts/list_boards.py +++ b/scripts/list_boards.py @@ -447,7 +447,7 @@ def dump_boards(args): if args.cmakeformat is not None: info = args.cmakeformat.format( NAME='NAME;' + board.name, - DIR='DIR;' + str(board.directories.as_posix()), + DIR='DIR;' + str(board.dir.as_posix()), HWM='HWM;' + board.hwm, VENDOR='VENDOR;NOTFOUND', REVISION_DEFAULT='REVISION_DEFAULT;NOTFOUND', diff --git a/scripts/west_commands/boards.py b/scripts/west_commands/boards.py index 9cb6182a7a7..6c4ee168466 100644 --- a/scripts/west_commands/boards.py +++ b/scripts/west_commands/boards.py @@ -104,7 +104,7 @@ def do_run(self, args, _): args.format.format( name=board.name, full_name=board.full_name, - dir=board.directories[0], + dir=board.dir, hwm=board.hwm, vendor=board.vendor, qualifiers=list_boards.board_v2_qualifiers_csv(board), From c4fcf56e76c7521ae5dccc8782a65368c9421e43 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Tue, 28 May 2024 15:31:42 +0200 Subject: [PATCH 17/53] doc: extend board porting guide with new board extend feature Extend the board porting guide with documentation on the new board extend feature. Signed-off-by: Torsten Rasmussen --- doc/hardware/porting/board_porting.rst | 58 ++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/doc/hardware/porting/board_porting.rst b/doc/hardware/porting/board_porting.rst index 48c7c2e497e..5b0e52ade38 100644 --- a/doc/hardware/porting/board_porting.rst +++ b/doc/hardware/porting/board_porting.rst @@ -910,9 +910,67 @@ There are some extra things you'll need to do: #. Prepare a pull request adding your board which follows the :ref:`contribute_guidelines`. +.. _extend-board: + Board extensions **************** +The board hardware model in Zephyr allows you to extend an existing board with +new board variants. Such board extensions can be done in your custom repository +and thus outside of the Zephyr repository. + +Extending an existing board with an extra variant allows you to adjust an +existing board and thereby during build to select building for the existing, +unmodified board, or the new variant. + +To extend an existing board, first create a :file:`board.yml` in your extended +board. Make sure to use the directory structure described in +:ref:`create-your-board-directory`. + +The skeleton of the board YAML file for extending a board is: + +.. code-block:: yaml + + board: + extend: + variants: + - name: + qualifier: + +When extending a board, your board directory should look like: + +.. code-block:: none + + boards//plank + ├── board.yml + ├── plank__defconfig + └── plank_.dts + +Replace ``plank`` with the real name of the board you extend. + +In some cases you might want to also adjust additional settings, like the +:file:`Kconfig.defconfig` or :file:`Kconfig.{board}`. +Therefore it is also possible to provide the following in addition when +extending a board. + +.. code-block:: none + + boards//plank + ├── board.cmake + ├── Kconfig + ├── Kconfig.plank + ├── Kconfig.defconfig + └── plank_.yaml + +Board extensions (Old hardware model) +************************************* + +.. note:: + + This extension mechanism is intended for boards in old hardware description + format. For boards described in new hardware model format, use the extension + feature described in :ref:`extend-board`. + Boards already supported by Zephyr can be extended by downstream users, such as ``example-application`` or vendor SDKs. In some situations, certain hardware description or :ref:`choices ` can not be added in the From 4670181986c1de3c5c621ff0f532d0178f0eef15 Mon Sep 17 00:00:00 2001 From: Patryk Biel Date: Tue, 1 Oct 2024 20:33:38 +0200 Subject: [PATCH 18/53] boards: seeed: Add support for XIAO ESP32S3 Sense The Seeed Studio XIAO ESP32S3 Sense board is a board based on the XIAO ESP32S3 board with a soldered B2B connector that allows to connect an extension board with a camera sensor, microphone and the sdcard slot. Signed-off-by: Patryk Biel --- boards/seeed/xiao_esp32s3/Kconfig | 2 +- .../seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 | 2 +- boards/seeed/xiao_esp32s3/board.yml | 3 + .../doc/img/xiao-esp32s3-sense.png | Bin 0 -> 41388 bytes boards/seeed/xiao_esp32s3/doc/index.rst | 101 +++++++++++--- .../xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi | 32 +++++ .../xiao_esp32s3/xiao_esp32s3_procpu.dts | 123 +--------------- .../xiao_esp32s3_procpu_common.dtsi | 131 ++++++++++++++++++ .../xiao_esp32s3_procpu_sense.dts | 71 ++++++++++ .../xiao_esp32s3_procpu_sense.yaml | 22 +++ .../xiao_esp32s3_procpu_sense_defconfig | 7 + 11 files changed, 351 insertions(+), 143 deletions(-) create mode 100644 boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml create mode 100644 boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig diff --git a/boards/seeed/xiao_esp32s3/Kconfig b/boards/seeed/xiao_esp32s3/Kconfig index 9261164bb3f..361a4f5fc84 100644 --- a/boards/seeed/xiao_esp32s3/Kconfig +++ b/boards/seeed/xiao_esp32s3/Kconfig @@ -3,5 +3,5 @@ config HEAP_MEM_POOL_ADD_SIZE_BOARD int - default 4096 if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU + default 4096 if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU || BOARD_XIAO_ESP32S3_ESP32S3_PROCPU_SENSE default 256 if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 b/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 index cbe07014750..212d510c344 100644 --- a/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 +++ b/boards/seeed/xiao_esp32s3/Kconfig.xiao_esp32s3 @@ -5,5 +5,5 @@ config BOARD_XIAO_ESP32S3 select SOC_ESP32S3_WROOM_N8R8 - select SOC_ESP32S3_PROCPU if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU + select SOC_ESP32S3_PROCPU if BOARD_XIAO_ESP32S3_ESP32S3_PROCPU || BOARD_XIAO_ESP32S3_ESP32S3_PROCPU_SENSE select SOC_ESP32S3_APPCPU if BOARD_XIAO_ESP32S3_ESP32S3_APPCPU diff --git a/boards/seeed/xiao_esp32s3/board.yml b/boards/seeed/xiao_esp32s3/board.yml index c3eb3a0204d..1d3c200f657 100644 --- a/boards/seeed/xiao_esp32s3/board.yml +++ b/boards/seeed/xiao_esp32s3/board.yml @@ -4,3 +4,6 @@ board: vendor: seeed socs: - name: esp32s3 + variants: + - name: 'sense' + cpucluster: 'procpu' diff --git a/boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png b/boards/seeed/xiao_esp32s3/doc/img/xiao-esp32s3-sense.png new file mode 100644 index 0000000000000000000000000000000000000000..90e0824a13e037fbeabc4ed795b076623b2a6232 GIT binary patch literal 41388 zcmdQ~<6kDu+r2Zl?(Dj2vt65Q*Jj(cZM)63ZELe@vu*qLeg2H+&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<&4C zeuDCj`ApNTM2g=zh{j<28$s`+zh`2NYctuc6Dj*B@uRoMj*yaX&0k?(#do|nThfY{ zmc$D`x)mdL4z76?Fs+XBwoThjRU{!x;+r8m=hClZ(j7|*@B2Q!I+&&}XB+wu8WK3+ zeup`mu6)R3-;Cu{Uypr4|0S~@z+S&LnRin;Uo!o_)er#A|9gZjilI>We>Q#VWc|kx XaISa~_7ALq^Dv%j8bTV>oudB-GxAn= literal 0 HcmV?d00001 diff --git a/boards/seeed/xiao_esp32s3/doc/index.rst b/boards/seeed/xiao_esp32s3/doc/index.rst index 0da45987f35..6ce906d3bde 100644 --- a/boards/seeed/xiao_esp32s3/doc/index.rst +++ b/boards/seeed/xiao_esp32s3/doc/index.rst @@ -1,13 +1,28 @@ -.. zephyr:board:: xiao_esp32s3 +.. _xiao_esp32s3: + +XIAO ESP32S3/XIAO ESP32S3 Sense +############################### Overview ******** -Seeed Studio XIAO ESP32S3 is an IoT mini development board based on the +Seeed Studio XIAO ESP32S3 and XIAO ESP32S3 Sense are IoT mini development boards based on the Espressif ESP32-S3 WiFi/Bluetooth dual-mode chip. For more details see the `Seeed Studio XIAO ESP32S3`_ wiki page. +.. figure:: img/xiao_esp32s3.jpg + :align: center + :alt: XIAO ESP32S3 + + XIAO ESP32S3 + +.. figure:: img/xiao-esp32s3-sense.png + :align: center + :alt: XIAO ESP32S3 Sense + + XIAO ESP32S3 Sense + Hardware ******** @@ -21,6 +36,8 @@ and Bluetooth® Low Energy (Bluetooth LE). It consists of high-performance dual- (Xtensa® 32-bit LX7), a low power coprocessor, a Wi-Fi baseband, a Bluetooth LE baseband, RF module, and numerous peripherals. +Additionally, Sense variant integrates a OV2640 camera sensor, microphone and sdcard slot. + Supported Features ================== @@ -57,6 +74,8 @@ Current Zephyr's XIAO ESP32S3 board supports the following features: +------------+------------+-------------------------------------+ | GDMA | on-chip | dma | +------------+------------+-------------------------------------+ +| LCD_CAM | on-chip | lcd_cam | ++------------+------------+-------------------------------------+ Connections and IOs =================== @@ -67,7 +86,7 @@ The board uses a standard XIAO pinout, the default pin mapping is the following: :align: center :alt: XIAO ESP32S3 Pinout - XIAO ESP32S3 Pinout + XIAO ESP32S3 and XIAO ESP32S3 Sense Pinout Prerequisites ------------- @@ -174,19 +193,41 @@ The only difference is the structure of the build directory. Build and flash applications as usual (see :ref:`build_an_application` and :ref:`application_run` for more details). -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32s3/procpu - :goals: build +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: build + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: build The usual ``flash`` target will work with the ``xiao_esp32s3`` board configuration. Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32s3/procpu - :goals: flash +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: flash + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: flash Open the serial monitor using the following command: @@ -213,17 +254,39 @@ Further documentation can be obtained from the SoC vendor in `JTAG debugging for Here is an example for building the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu - :goals: build flash +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: debug + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: debug You can debug an application in the usual way. Here is an example for the :zephyr:code-sample:`hello_world` application. -.. zephyr-app-commands:: - :zephyr-app: samples/hello_world - :board: xiao_esp32s3/esp32/procpu - :goals: debug +.. tabs:: + + .. group-tab:: XIAO ESP32S3 + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu + :goals: debug + + .. group-tab:: XIAO ESP32S3 Sense + + .. zephyr-app-commands:: + :zephyr-app: samples/hello_world + :board: xiao_esp32s3/esp32/procpu/sense + :goals: debug References ********** diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi b/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi index 27097b6bb26..3159a39611b 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3-pinctrl.dtsi @@ -41,6 +41,38 @@ }; }; + i2c1_default: i2c1_default { + group1 { + pinmux = , + ; + bias-pull-up; + drive-open-drain; + output-high; + }; + }; + + lcd_cam_default: lcd_cam_default { + group1 { + pinmux = ; + output-enable; + }; + group2 { + pinmux = , + , + , + , + , + , + , + , + , + , + ; + input-enable; + bias-disable; + }; + }; + twai_default: twai_default { group1 { pinmux = , diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts index 2c1349b735c..2a68af1ee18 100644 --- a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu.dts @@ -5,130 +5,9 @@ */ /dts-v1/; - -#include -#include "xiao_esp32s3-pinctrl.dtsi" -#include "seeed_xiao_connector.dtsi" +#include "xiao_esp32s3_procpu_common.dtsi" / { model = "Seeed Xiao ESP32S3 PROCPU"; compatible = "seeed,xiao-esp32s3"; - - chosen { - zephyr,sram = &sram0; - zephyr,console = &usb_serial; - zephyr,shell-uart = &usb_serial; - zephyr,flash = &flash0; - zephyr,code-partition = &slot0_partition; - zephyr,bt-hci = &esp32_bt_hci; - }; - - aliases { - i2c-0 = &i2c0; - watchdog0 = &wdt0; - led0 = &led0; - }; - - leds { - compatible = "gpio-leds"; - led0: led_0 { - gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; - label = "BUILTIN LED"; - }; - }; - -}; - -&usb_serial { - status = "okay"; -}; - -&uart0 { - status = "okay"; - current-speed = <115200>; - pinctrl-0 = <&uart0_default>; - pinctrl-names = "default"; -}; - -&i2c0 { - status = "okay"; - clock-frequency = ; - pinctrl-0 = <&i2c0_default>; - pinctrl-names = "default"; -}; - -&trng0 { - status = "okay"; -}; - -&spi2 { - #address-cells = <1>; - #size-cells = <0>; - status = "okay"; - pinctrl-0 = <&spim2_default>; - pinctrl-names = "default"; -}; - -&gpio0 { - status = "okay"; -}; - -&gpio1 { - status = "okay"; -}; - -&wdt0 { - status = "okay"; -}; - -&twai { - pinctrl-0 = <&twai_default>; - pinctrl-names = "default"; -}; - -&timer0 { - status = "okay"; -}; - -&timer1 { - status = "okay"; -}; - -&flash0 { - status = "okay"; - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x0000F000>; - read-only; - }; - - slot0_partition: partition@10000 { - label = "image-0"; - reg = <0x00010000 0x00100000>; - }; - - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x00110000 0x00100000>; - }; - - scratch_partition: partition@210000 { - label = "image-scratch"; - reg = <0x00210000 0x00040000>; - }; - - storage_partition: partition@250000 { - label = "storage"; - reg = <0x00250000 0x00006000>; - }; - }; -}; - -&esp32_bt_hci { - status = "okay"; }; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi new file mode 100644 index 00000000000..8a99ef2c694 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_common.dtsi @@ -0,0 +1,131 @@ +/* + * Copyright (c) 2023 Seeed Studio inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; + +#include +#include "xiao_esp32s3-pinctrl.dtsi" +#include "seeed_xiao_connector.dtsi" + +/ { + chosen { + zephyr,sram = &sram0; + zephyr,console = &usb_serial; + zephyr,shell-uart = &usb_serial; + zephyr,flash = &flash0; + zephyr,code-partition = &slot0_partition; + zephyr,bt-hci = &esp32_bt_hci; + }; + + aliases { + i2c-0 = &i2c0; + watchdog0 = &wdt0; + led0 = &led0; + }; + + leds { + compatible = "gpio-leds"; + led0: led_0 { + gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + label = "BUILTIN LED"; + }; + }; + +}; + +&usb_serial { + status = "okay"; +}; + +&uart0 { + status = "okay"; + current-speed = <115200>; + pinctrl-0 = <&uart0_default>; + pinctrl-names = "default"; +}; + +&i2c0 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c0_default>; + pinctrl-names = "default"; +}; + +&trng0 { + status = "okay"; +}; + +&spi2 { + #address-cells = <1>; + #size-cells = <0>; + status = "okay"; + pinctrl-0 = <&spim2_default>; + pinctrl-names = "default"; +}; + +&gpio0 { + status = "okay"; +}; + +&gpio1 { + status = "okay"; +}; + +&wdt0 { + status = "okay"; +}; + +&twai { + pinctrl-0 = <&twai_default>; + pinctrl-names = "default"; +}; + +&timer0 { + status = "okay"; +}; + +&timer1 { + status = "okay"; +}; + +&flash0 { + status = "okay"; + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x0000F000>; + read-only; + }; + + slot0_partition: partition@10000 { + label = "image-0"; + reg = <0x00010000 0x00100000>; + }; + + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x00110000 0x00100000>; + }; + + scratch_partition: partition@210000 { + label = "image-scratch"; + reg = <0x00210000 0x00040000>; + }; + + storage_partition: partition@250000 { + label = "storage"; + reg = <0x00250000 0x00006000>; + }; + }; +}; + +&esp32_bt_hci { + status = "okay"; +}; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts new file mode 100644 index 00000000000..1fc6f2560d7 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.dts @@ -0,0 +1,71 @@ +/* + * Copyright (c) 2023 Seeed Studio inc. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/dts-v1/; +#include "xiao_esp32s3_procpu_common.dtsi" + +/ { + model = "Seeed Xiao ESP32S3 PROCPU Sense"; + compatible = "seeed,xiao-esp32s3"; + + chosen { + zephyr,camera = &lcd_cam; + }; +}; + +&i2c1 { + status = "okay"; + clock-frequency = ; + pinctrl-0 = <&i2c1_default>; + pinctrl-names = "default"; + + ov2640: ov2640@30 { + compatible = "ovti,ov2640"; + reg = <0x30>; + status = "okay"; + clock-rate-control = <0x80>; + port { + ov2640_ep_out: endpoint { + remote-endpoint-label = "dvp_ep_in"; + }; + }; + }; +}; + +&dma { + status = "okay"; +}; + +&lcd_cam { + status = "okay"; + cam-clk = <10000000>; + pinctrl-0 = <&lcd_cam_default>; + pinctrl-names = "default"; + source = <&ov2640>; + dmas = <&dma 2>; + dma-names = "rx"; + port { + dvp_ep_in: endpoint { + remote-endpoint-label = "ov2640_ep_out"; + }; + }; +}; + +&spi2 { + status = "okay"; + cs-gpios = <&gpio0 21 GPIO_ACTIVE_LOW>; + + sdcard: sdcard@0 { + compatible = "zephyr,sdhc-spi-slot"; + reg = <0>; + status = "okay"; + mmc { + compatible = "zephyr,sdmmc-disk"; + status = "okay"; + }; + spi-max-frequency = <20000000>; + }; +}; diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml new file mode 100644 index 00000000000..91521bcd7d6 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense.yaml @@ -0,0 +1,22 @@ +identifier: xiao_esp32s3/esp32s3/procpu/sense +name: XIAO ESP32S3 Sense PROCPU +type: mcu +arch: xtensa +toolchain: + - zephyr +supported: + - gpio + - uart + - i2c + - spi + - can + - counter + - watchdog + - entropy + - pwm + - dma +testing: + ignore_tags: + - net + - bluetooth +vendor: seeed diff --git a/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig new file mode 100644 index 00000000000..6539bd42e59 --- /dev/null +++ b/boards/seeed/xiao_esp32s3/xiao_esp32s3_procpu_sense_defconfig @@ -0,0 +1,7 @@ +# SPDX-License-Identifier: Apache-2.0 + +CONFIG_MAIN_STACK_SIZE=2048 +CONFIG_CONSOLE=y +CONFIG_SERIAL=y +CONFIG_UART_CONSOLE=y +CONFIG_GPIO=y From 51412b5875a4ab8a78b8b50fd5b335fcf440d1f9 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:13:24 +0200 Subject: [PATCH 19/53] soc: st: stm32wb0: make SMPS mode visible to drivers Make the SMPS_MODE define visible from drivers by moving it to soc.h This define is for example used by the ADC driver to determine if sampling should be synchronized with the SMPS clock. Signed-off-by: Mathieu Choplain --- soc/st/stm32/stm32wb0x/soc.c | 9 +-------- soc/st/stm32/stm32wb0x/soc.h | 11 +++++++++++ 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/soc/st/stm32/stm32wb0x/soc.c b/soc/st/stm32/stm32wb0x/soc.c index 546ae1a6195..49e42f59d81 100644 --- a/soc/st/stm32/stm32wb0x/soc.c +++ b/soc/st/stm32/stm32wb0x/soc.c @@ -41,16 +41,9 @@ uint32_t SystemCoreClock = 16000000U; Z_GENERIC_SECTION("stm32wb0_RAM_VR") __used RAM_VR_TypeDef RAM_VR; -/** Power Controller node */ +/** Power Controller node (shorthand for upcoming macros) */ #define PWRC DT_INST(0, st_stm32wb0_pwr) -/** SMPS modes */ -#define STM32WB0_SMPS_MODE_OFF 0 -#define STM32WB0_SMPS_MODE_PRECHARGE 1 -#define STM32WB0_SMPS_MODE_RUN 2 - -#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, DT_STRING_UNQUOTED(PWRC, smps_mode)) - /* Convert DTS properties to LL macros */ #define SMPS_PRESCALER _CONCAT(LL_RCC_SMPS_DIV_, DT_PROP(PWRC, smps_clock_prescaler)) diff --git a/soc/st/stm32/stm32wb0x/soc.h b/soc/st/stm32/stm32wb0x/soc.h index 57d14e761c3..8361f7258e8 100644 --- a/soc/st/stm32/stm32wb0x/soc.h +++ b/soc/st/stm32/stm32wb0x/soc.h @@ -17,6 +17,17 @@ #include +/** SMPS modes */ +#define STM32WB0_SMPS_MODE_OFF 0 +#define STM32WB0_SMPS_MODE_PRECHARGE 1 +#define STM32WB0_SMPS_MODE_RUN 2 + +/** Active SMPS mode (provided here for usage in drivers) */ +#define SMPS_MODE _CONCAT(STM32WB0_SMPS_MODE_, \ + DT_STRING_UNQUOTED( \ + DT_INST(0, st_stm32wb0_pwr), \ + smps_mode)) + #endif /* !_ASMLANGUAGE */ #endif /* _STM32WB0_SOC_H_ */ From 189d0211280d7ca3622c41d8092a2fbf4e208b2e Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:24:52 +0200 Subject: [PATCH 20/53] dts: bindings: adc: add STM32WB0 ADC Add DT binding for STM32WB0 series ADC. Signed-off-by: Mathieu Choplain --- dts/bindings/adc/st,stm32wb0-adc.yaml | 30 +++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 dts/bindings/adc/st,stm32wb0-adc.yaml diff --git a/dts/bindings/adc/st,stm32wb0-adc.yaml b/dts/bindings/adc/st,stm32wb0-adc.yaml new file mode 100644 index 00000000000..b2b6599c834 --- /dev/null +++ b/dts/bindings/adc/st,stm32wb0-adc.yaml @@ -0,0 +1,30 @@ +# SPDX-License-Identifier: Apache-2.0 + +description: STM32WB0 series Analog-to-Digital Converter + +compatible: "st,stm32wb0-adc" + +include: [adc-controller.yaml, pinctrl-device.yaml] + +properties: + reg: + required: true + + clocks: + required: true + + interrupts: + required: true + + "#io-channel-cells": + const: 1 + + io-booster: + type: boolean + description: | + When set, the I/O Booster block is enabled during ADC usage. Otherwise, the + I/O Booster block is always disabled. This property MUST be set if VBAT voltage + may reach a value below 2.7V to guarantee that the ADC behavior remains correct. + +io-channel-cells: + - input From c86f0ac6f3cfceb8a180714d511214cfc09c87a9 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:22:38 +0200 Subject: [PATCH 21/53] drivers: adc: stm32: add STM32WB0 ADC Add driver for ADC in STM32WB0 series. Signed-off-by: Mathieu Choplain --- drivers/adc/CMakeLists.txt | 1 + drivers/adc/Kconfig.stm32 | 11 +- drivers/adc/adc_stm32wb0.c | 1251 ++++++++++++++++++++++++++++++++++++ 3 files changed, 1262 insertions(+), 1 deletion(-) create mode 100644 drivers/adc/adc_stm32wb0.c diff --git a/drivers/adc/CMakeLists.txt b/drivers/adc/CMakeLists.txt index dce35036f43..0877adc5b3d 100644 --- a/drivers/adc/CMakeLists.txt +++ b/drivers/adc/CMakeLists.txt @@ -19,6 +19,7 @@ zephyr_library_sources_ifdef(CONFIG_ADC_NRFX_SAADC adc_nrfx_saadc.c) zephyr_library_sources_ifdef(CONFIG_ADC_SAM adc_sam.c) zephyr_library_sources_ifdef(CONFIG_ADC_SAM0 adc_sam0.c) zephyr_library_sources_ifdef(CONFIG_ADC_STM32 adc_stm32.c) +zephyr_library_sources_ifdef(CONFIG_ADC_STM32WB0 adc_stm32wb0.c) zephyr_library_sources_ifdef(CONFIG_ADC_XEC adc_mchp_xec.c) zephyr_library_sources_ifdef(CONFIG_ADC_LMP90XXX adc_lmp90xxx.c) zephyr_library_sources_ifdef(CONFIG_ADC_MCP320X adc_mcp320x.c) diff --git a/drivers/adc/Kconfig.stm32 b/drivers/adc/Kconfig.stm32 index 70be46acaef..0f567a635f9 100644 --- a/drivers/adc/Kconfig.stm32 +++ b/drivers/adc/Kconfig.stm32 @@ -5,6 +5,7 @@ # Copyright (c) 2019 Song Qiang # Copyright (c) 2021 Marius Scholtz, RIC Electronics # Copyright (c) 2022 Hein Wessels, Nobleo Technology +# Copyright (c) 2024 STMicroelectronics # SPDX-License-Identifier: Apache-2.0 config ADC_STM32 @@ -15,7 +16,15 @@ config ADC_STM32 help Enable the driver implementation for the stm32xx ADC -if ADC_STM32 +config ADC_STM32WB0 + bool "STM32WB0 ADC driver" + default y + depends on DT_HAS_ST_STM32WB0_ADC_ENABLED + select PINCTRL + help + Enable the driver implementation for the STM32WB0 series ADC + +if ADC_STM32 || ADC_STM32WB0 config ADC_STM32_DMA bool "STM32 MCU ADC DMA Support" diff --git a/drivers/adc/adc_stm32wb0.c b/drivers/adc/adc_stm32wb0.c new file mode 100644 index 00000000000..e36cee7631c --- /dev/null +++ b/drivers/adc/adc_stm32wb0.c @@ -0,0 +1,1251 @@ +/* + * Copyright (c) 2024 STMicroelectronics + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/** + * Terminology used in this file: + * - sampling: a single analog-to-digital conversion performed by the ADC + * - sequence: one or more sampling(s) performed one after the other by the + * ADC after a single programmation. This is the meaning used in the + * STM32WB0 ADC documentation. + * - round: all ADC operations needed to read all channels in the adc_sequence passed + * to adc_read. Zephyr calls this a "sampling", but we use the term "round" to + * prevent confusion with STM32 terminology. A single round may require multiple + * sequences to be performed by the ADC to be completed, due to hardware limitations. + * + * When Zephyr's "sequence" feature is used, the same round is repeated multiple times. + * + * - idle mode: clock & ADC configuration that minimizes power consumption + * - Only the ADC digital domain clock is turned on: + * - ADC is powered off (CTRL.ADC_CTRL_ADC_ON_OFF = 0) + * - ADC analog domain clock is turned off + * - If applicable: + * - ADC LDO is disabled + * - ADC I/O Booster clock is turned off + * - ADC I/O Booster is disabled + * - ADC-SMPS clock synchronization is disabled + */ + +#define DT_DRV_COMPAT st_stm32wb0_adc + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef CONFIG_ADC_STM32_DMA +#include +#include +#include +#include +#endif + +#define ADC_CONTEXT_USES_KERNEL_TIMER +#define ADC_CONTEXT_ENABLE_ON_COMPLETE +#include "adc_context.h" + +#include +LOG_MODULE_REGISTER(adc_stm32wb0, CONFIG_ADC_LOG_LEVEL); + +/** + * Driver private definitions & assertions + */ +#define ADC_INSTANCE 0 +#define ADC_NODE DT_DRV_INST(ADC_INSTANCE) +#define ADC_USE_IO_BOOSTER DT_PROP_OR(ADC_NODE, io_booster, 0) + +#define LL_ADC_EXTERNAL_CHANNEL_NUM 12 /* must be a plain constant for LISTIFY */ +#define LL_ADC_EXTERNAL_CHANNEL_MAX (LL_ADC_CHANNEL_VINP3_VINM3 + 1U) +#define LL_ADC_CHANNEL_MAX (LL_ADC_CHANNEL_TEMPSENSOR + 1U) +#define LL_ADC_VIN_RANGE_INVALID ((uint8_t)0xFFU) + +#define NUM_CALIBRATION_POINTS 4 /* 4 calibration point registers (COMP_[0-3]) */ + +#if !defined(ADC_CONF_SAMPLE_RATE_MSB) +# define NUM_ADC_SAMPLE_RATES 4 /* SAMPLE_RATE on 2 bits */ +#else +# define NUM_ADC_SAMPLE_RATES 32 /* SAMPLE_RATE on 5 bits */ +#endif + +/* The STM32WB0 has a 12-bit ADC, but the resolution can be + * enhanced to 16-bit by oversampling (using the downsampler) + */ +#define ADC_MIN_RESOLUTION 12 +#define ADC_MAX_RESOLUTION 16 + +/* ADC channel type definitions are not provided by LL as + * it uses per-type functions instead. Bring our own. + */ +#define ADC_CHANNEL_TYPE_SINGLE_NEG (0x00U) /* Single-ended, positive */ +#define ADC_CHANNEL_TYPE_SINGLE_POS (0x01U) /* Single-ended, negative */ +#define ADC_CHANNEL_TYPE_DIFF (0x02U) /* Differential */ +#define ADC_CHANNEL_TYPE_INVALID (0xFFU) /* Invalid */ + +/** See RM0505 §6.2.1 "System clock details" */ +BUILD_ASSERT(CONFIG_SYS_CLOCK_HW_CYCLES_PER_SEC >= (8 * 1000 * 1000), + "STM32WB0: system clock frequency must be at least 8MHz to use ADC"); + +/** + * Driver private structures + */ +struct adc_stm32wb0_data { + struct adc_context ctx; + const struct device *const dev; + + /** + * Bitmask of all channels requested as part of this round + * but not sampled yet. + */ + uint32_t unsampled_channels; + + /** + * Pointer in output buffer where the first data sample of the round + * is stored. This is used to reload next_sample_ptr when the user + * callback asks to repeat a round. + */ + uint16_t *round_buf_pointer; + + /** + * Pointer in output buffer where the next data sample from ADC should + * be stored. + */ + uint16_t *next_sample_ptr; + +#if defined(CONFIG_ADC_STM32_DMA) + /** Size of the sequence currently scheduled and executing */ + size_t sequence_length; + struct dma_config dmac_config; + struct dma_block_config dma_block_config; +#endif + + /** Channels configuration */ + struct adc_stm32wb0_channel_config { + /** Vinput range selection */ + uint8_t vinput_range; + } channel_config[LL_ADC_CHANNEL_MAX]; +}; + +struct adc_stm32wb0_config { + ADC_TypeDef *reg; + const struct pinctrl_dev_config *pinctrl_cfg; + /** ADC digital domain clock */ + struct stm32_pclken dig_clk; + /** ADC analog domain clock */ + struct stm32_pclken ana_clk; +#if defined(CONFIG_ADC_STM32_DMA) + const struct device *dmac; + uint32_t dma_channel; +#endif +}; + +/** + * Driver private utility functions + */ + +/** + * In STM32CubeWB0 v1.0.0, the LL_GetPackageType is buggy and returns wrong values. + * This bug is reported in the ST internal bugtracker under reference 185295. + * For now, implement the function ourselves. + */ +static inline uint32_t ll_get_package_type(void) +{ + return sys_read32(PACKAGE_BASE); +} + +static inline struct adc_stm32wb0_data *drv_data_from_adc_ctx(struct adc_context *adc_ctx) +{ + return CONTAINER_OF(adc_ctx, struct adc_stm32wb0_data, ctx); +} + +static inline uint8_t vinput_range_from_adc_ref(uint32_t reference) +{ + switch (reference) { + case ADC_REF_INTERNAL: + case ADC_REF_VDD_1: + return LL_ADC_VIN_RANGE_3V6; + case ADC_REF_VDD_1_2: + return LL_ADC_VIN_RANGE_2V4; + case ADC_REF_VDD_1_3: + return LL_ADC_VIN_RANGE_1V2; + default: + return LL_ADC_VIN_RANGE_INVALID; + } +} + +static inline uint32_t ds_width_from_adc_res(uint32_t resolution) +{ + /* + * 12 -> 0 (LL_ADC_DS_DATA_WIDTH_12_BIT) + * 13 -> 1 (LL_ADC_DS_DATA_WIDTH_13_BIT) + * 14 -> 2 (LL_ADC_DS_DATA_WIDTH_14_BIT) + * 15 -> 3 (LL_ADC_DS_DATA_WIDTH_15_BIT) + * 16 -> 4 (LL_ADC_DS_DATA_WIDTH_16_BIT) + */ + return resolution - 12; +} + +static inline uint8_t get_channel_type(uint32_t channel) +{ + switch (channel) { + case LL_ADC_CHANNEL_VINM0: + case LL_ADC_CHANNEL_VINM1: + case LL_ADC_CHANNEL_VINM2: + case LL_ADC_CHANNEL_VINM3: + case LL_ADC_CHANNEL_VBAT: + return ADC_CHANNEL_TYPE_SINGLE_NEG; + case LL_ADC_CHANNEL_VINP0: + case LL_ADC_CHANNEL_VINP1: + case LL_ADC_CHANNEL_VINP2: + case LL_ADC_CHANNEL_VINP3: + case LL_ADC_CHANNEL_TEMPSENSOR: + return ADC_CHANNEL_TYPE_SINGLE_POS; + case LL_ADC_CHANNEL_VINP0_VINM0: + case LL_ADC_CHANNEL_VINP1_VINM1: + case LL_ADC_CHANNEL_VINP2_VINM2: + case LL_ADC_CHANNEL_VINP3_VINM3: + return ADC_CHANNEL_TYPE_DIFF; + default: + __ASSERT_NO_MSG(0); + return ADC_CHANNEL_TYPE_INVALID; + } +} + +/** + * @brief Checks all fields of the adc_sequence and asserts they are + * valid and all configuration options are supported by the driver. + * + * @param sequence adc_sequence to validate + * @return 0 if the adc_sequence is valid, negative value otherwise + */ +static int validate_adc_sequence(const struct adc_sequence *sequence) +{ + const size_t round_size = sizeof(uint16_t) * POPCOUNT(sequence->channels); + size_t needed_buf_size; + + if (sequence->channels == 0 || + (sequence->channels & ~BIT_MASK(LL_ADC_CHANNEL_MAX)) != 0) { + LOG_ERR("invalid channels selection"); + return -EINVAL; + } + + CHECKIF(!sequence->buffer) { + LOG_ERR("storage buffer pointer is NULL"); + return -EINVAL; + } + + if (!IN_RANGE(sequence->resolution, ADC_MIN_RESOLUTION, ADC_MAX_RESOLUTION)) { + LOG_ERR("invalid resolution %u (must be between %u and %u)", + sequence->resolution, ADC_MIN_RESOLUTION, ADC_MAX_RESOLUTION); + return -EINVAL; + } + + /* N.B.: LL define is in the same log2(x) format as the Zephyr variable */ + if (sequence->oversampling > LL_ADC_DS_RATIO_128) { + LOG_ERR("oversampling unsupported by hardware (max: %lu)", LL_ADC_DS_RATIO_128); + return -ENOTSUP; + } + + if (sequence->options) { + const size_t samplings = (size_t)sequence->options->extra_samplings + 1; + + if (size_mul_overflow(round_size, samplings, &needed_buf_size)) { + return -ENOMEM; + } + } else { + needed_buf_size = round_size; + } + + if (needed_buf_size > sequence->buffer_size) { + return -ENOMEM; + } + + return 0; +} + +/** + * @brief Set which channel is sampled during a given conversion of the sequence. + * + * @param ADCx ADC registers pointer + * @param Conversion Target conversion index (0~15) + * @param Channel Channel to sample during specified conversion + * + * @note This function is a more convenient implementation of LL_ADC_SetSequencerRanks + */ +static inline void ll_adc_set_conversion_channel(ADC_TypeDef *ADCx, + uint32_t Conversion, uint32_t Channel) +{ + /** + * There are two registers to control the sequencer: + * - SEQ_1 holds channel selection for conversions 0~7 + * - SEQ_2 holds channel selection for conversions 8~15 + * + * Notice that all conversions in SEQ_2 have 3rd bit set, + * whereas all conversions in SEQ_1 have 3rd bit clear. + * + * In a SEQ_x register, each channel occupies 4 bits, so the + * field for conversion N is at bit offset (4 * (N % 7)). + */ + const uint32_t reg = (Conversion & 8) ? 1 : 0; + const uint32_t shift = 4 * (Conversion & 7); + + MODIFY_REG((&ADCx->SEQ_1)[reg], ADC_SEQ_1_SEQ0 << shift, Channel << shift); +} + +/** + * @brief Set the calibration point to use for a chosen channel type and Vinput range. + * + * @param ADCx ADC registers pointer + * @param Type Channel type + * @param Range Channel Vinput range + * @param Point Calibration point to use + * + * @note This is a generic version of the LL_ADC_SetCalibPointFor* functions. + */ +static inline void ll_adc_set_calib_point_for_any(ADC_TypeDef *ADCx, uint32_t Type, + uint32_t Range, uint32_t Point) +{ + __ASSERT(Range == LL_ADC_VIN_RANGE_1V2 + || Range == LL_ADC_VIN_RANGE_2V4 + || Range == LL_ADC_VIN_RANGE_3V6, "Range is not valid"); + + __ASSERT(Type == ADC_CHANNEL_TYPE_SINGLE_NEG + || Type == ADC_CHANNEL_TYPE_SINGLE_POS + || Type == ADC_CHANNEL_TYPE_DIFF, "Type is not valid"); + + __ASSERT(Point == LL_ADC_CALIB_POINT_1 + || Point == LL_ADC_CALIB_POINT_2 + || Point == LL_ADC_CALIB_POINT_3 + || Point == LL_ADC_CALIB_POINT_4, "Point is not valid"); + + /* Register organization is as follows: + * + * - Group for 1.2V Vinput range + * - Group for 2.4V Vinput range + * - Group for 3.6V Vinput range + * + * where Group is organized as: + * - Select for Single Negative mode + * - Select for Single Positive mode + * - Select for Differential mode + * + * Each select is 2 bits, and each group is thus 6 bits. + */ + + uint32_t type_shift, group_shift; + + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_NEG: + type_shift = 0 * 2; + break; + case ADC_CHANNEL_TYPE_SINGLE_POS: + type_shift = 1 * 2; + break; + case ADC_CHANNEL_TYPE_DIFF: + type_shift = 2 * 2; + break; + default: + CODE_UNREACHABLE; + } + + switch (Range) { + case LL_ADC_VIN_RANGE_1V2: + group_shift = 0 * 6; + break; + case LL_ADC_VIN_RANGE_2V4: + group_shift = 1 * 6; + break; + case LL_ADC_VIN_RANGE_3V6: + group_shift = 2 * 6; + break; + default: + CODE_UNREACHABLE; + } + + const uint32_t shift = (group_shift + type_shift); + + MODIFY_REG(ADCx->COMP_SEL, (ADC_COMP_SEL_OFFSET_GAIN0 << shift), (Point << shift)); +} + +static void adc_acquire_pm_locks(void) +{ + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES); + if (IS_ENABLED(CONFIG_PM_S2RAM)) { + pm_policy_state_lock_get(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } +} + +static void adc_release_pm_locks(void) +{ + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_IDLE, PM_ALL_SUBSTATES); + if (IS_ENABLED(CONFIG_PM_S2RAM)) { + pm_policy_state_lock_put(PM_STATE_SUSPEND_TO_RAM, PM_ALL_SUBSTATES); + } +} + +/** + * Driver private functions + */ + +static void configure_tempsensor_calib_point(ADC_TypeDef *adc, uint32_t calib_point) +{ + uint16_t gain; +#if defined(CONFIG_SOC_STM32WB09XX) || defined(CONFIG_SOC_STM32WB05XX) + /** RM0505/RM0529 §12.2.1 "Temperature sensor subsystem" */ + gain = 0xFFF; +#else + /** RM0530 §12.2.2 "Temperature sensor subsystem" */ + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_1V2(); +#endif /* CONFIG_SOC_STM32WB09XX | CONFIG_SOC_STM32WB05XX */ + + LL_ADC_ConfigureCalibPoint(adc, calib_point, gain, 0x0); +} + +/** + * @brief Obtain calibration data for specified channel type and Vinput range + * from engineering flash, and write it to specified calibration point + * + * @param ADCx ADC registers pointer + * @param Point Calibration point to configure + * @param Type Target channel type + * @param Range Target channel Vinput range + */ +static void configure_calib_point_from_flash(ADC_TypeDef *ADCx, uint32_t Point, + uint32_t Type, uint32_t Range) +{ + int8_t offset = 0; + uint16_t gain = 0; + + switch (Range) { + case LL_ADC_VIN_RANGE_1V2: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_1V2(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_1V2(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_1V2(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_1V2(); + break; + } + break; + case LL_ADC_VIN_RANGE_2V4: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_2V4(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_2V4(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_2V4(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_2V4(); + break; + } + break; + case LL_ADC_VIN_RANGE_3V6: + switch (Type) { + case ADC_CHANNEL_TYPE_SINGLE_POS: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINPX_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINPX_3V6(); + break; + case ADC_CHANNEL_TYPE_SINGLE_NEG: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINMX_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINMX_3V6(); + break; + case ADC_CHANNEL_TYPE_DIFF: + gain = LL_ADC_GET_CALIB_GAIN_FOR_VINDIFF_3V6(); + offset = LL_ADC_GET_CALIB_OFFSET_FOR_VINDIFF_3V6(); + break; + } + break; + } + + LL_ADC_ConfigureCalibPoint(ADCx, Point, gain, offset); +} + +static void adc_enter_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + int err; + + /* Power down the ADC */ + LL_ADC_Disable(adc); + +#if SMPS_MODE != STM32WB0_SMPS_MODE_OFF + /* Disable SMPS synchronization */ + LL_ADC_SMPSSyncDisable(adc); +#endif /* SMPS_MODE != STM32WB0_SMPS_MODE_OFF */ + +#if ADC_USE_IO_BOOSTER + /* Disable ADC I/O booster */ + LL_RCC_IOBOOST_Disable(); + +# if defined(RCC_CFGR_IOBOOSTCLKEN) + /* Disable ADC I/O Booster clock if present */ + LL_RCC_IOBOOSTCLK_Disable(); +# endif +#endif /* ADC_USE_IO_BOOSTER */ + +#if defined(ADC_CTRL_ADC_LDO_ENA) + /* Disable ADC voltage regulator */ + LL_ADC_DisableInternalRegulator(adc); +#endif /* ADC_CTRL_ADC_LDO_ENA */ + + /* Turn off ADC analog domain clock */ + err = clock_control_off(clk, (clock_control_subsys_t)ana_clk); + if (err < 0) { + LOG_WRN("failed to turn off ADC analog clock (%d)", err); + } + + /* Release power management locks */ + adc_release_pm_locks(); +} + +static int adc_exit_idle_mode(ADC_TypeDef *adc, const struct stm32_pclken *ana_clk) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + int err; + + /* Acquire power management locks */ + adc_acquire_pm_locks(); + + /* Turn on ADC analog domain clock */ + err = clock_control_on(clk, + (clock_control_subsys_t)ana_clk); + if (err < 0) { + LOG_ERR("failed to turn on ADC analog clock: %d", err); + adc_release_pm_locks(); + return err; + } + +#if defined(ADC_CTRL_ADC_LDO_ENA) + /* RM0479 §12.6.3: bit ADC_LDO_ENA must not be set on QFN32 packages. + * Using an equality check with supported package types ensures that + * we never accidentally set the bit on an unsupported MCU. + */ + const uint32_t package_type = ll_get_package_type(); + + if (package_type == LL_UTILS_PACKAGETYPE_QFN48 + || package_type == LL_UTILS_PACKAGETYPE_CSP49) { + LL_ADC_EnableInternalRegulator(adc); + } +#endif /* ADC_CTRL_ADC_LDO_ENA */ + +#if ADC_USE_IO_BOOSTER +# if defined(RCC_CFGR_IOBOOSTCLKEN) + /* Enable ADC I/O Booster clock if needed by hardware */ + LL_RCC_IOBOOSTCLK_Enable(); +# endif + + /* Enable ADC I/O Booster */ + LL_RCC_IOBOOST_Enable(); +#endif /* ADC_USE_IO_BOOSTER*/ + +#if SMPS_MODE != STM32WB0_SMPS_MODE_OFF + /* RM0505 §6.2.2 "Peripherals clock details": + * To avoid SNR degradation of the ADC, + * SMPS and ADC clocks must be synchronous. + */ + LL_ADC_SMPSSyncEnable(adc); +#endif /* SMPS_MODE != STM32WB0_SMPS_MODE_OFF */ + + /* Power up the ADC */ + LL_ADC_Enable(adc); + + return err; +} + +/** + * @brief Schedule as many samplings as possible in a sequence + * then start the ADC conversion. + */ +static void schedule_and_start_adc_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) +{ + uint32_t remaining_unsampled = data->unsampled_channels; + uint32_t allocated_calib_points = 0; + uint32_t sequence_length = 0; + bool temp_sensor_scheduled = false; + + /** + * These tables are used to keep track of which calibration + * point registers are used for what type of acquisition, in + * order to share the same calibration point for different + * channels if they use compatible configurations. + * + * Initialize only the first table with invalid values; since + * both tables are updated at the same time, this is sufficient + * to know when to stop programming calibration points. + */ + uint8_t calib_pt_ch_type[NUM_CALIBRATION_POINTS] = { + ADC_CHANNEL_TYPE_INVALID, ADC_CHANNEL_TYPE_INVALID, + ADC_CHANNEL_TYPE_INVALID, ADC_CHANNEL_TYPE_INVALID + }; + uint8_t calib_pt_vin_range[NUM_CALIBRATION_POINTS]; + + /* Schedule as many channels as possible for sampling */ + for (uint32_t channel = 0; + channel < LL_ADC_CHANNEL_MAX && remaining_unsampled != 0U; + channel++) { + const uint32_t ch_bit = BIT(channel); + + if ((remaining_unsampled & ch_bit) == 0) { + continue; + } + + /* Get channel information */ + const uint8_t ch_type = get_channel_type(channel); + const uint8_t ch_vin_range = data->channel_config[channel].vinput_range; + + /* Attempt to find a compatible calibration point */ + uint32_t calib_pt = 0; + + for (; calib_pt < allocated_calib_points; calib_pt++) { + if (calib_pt_ch_type[calib_pt] == ch_type + && calib_pt_vin_range[calib_pt] == ch_vin_range) { + break; + } + } + + if (calib_pt == allocated_calib_points) { + /* No compatible calibration point found. + * If an unallocated calibration point remains, use it. + * Otherwise, this channel cannot be scheduled; since we must + * perform samplings in order, exit the scheduling loop. + */ + if (allocated_calib_points < NUM_CALIBRATION_POINTS) { + allocated_calib_points++; + } else { + /* Exit scheduling loop */ + break; + } + } + + if (channel == LL_ADC_CHANNEL_TEMPSENSOR) { + if (calib_pt_ch_type[calib_pt] == ADC_CHANNEL_TYPE_INVALID) { + /** + * Temperature sensor is a special channel: it must be sampled + * with special gain/offset instead of the calibration values found + * in engineering flash. For this reason, it must NOT be scheduled + * with any other 1.2V Vinput range, single-ended positive channel. + * + * If this check succeeds, then no such channel is scheduled, and we + * can add the temperature sensor to this sequence. We're sure there + * won't be any conflict because the temperature sensor is the last + * channel. Otherwise, a channel with 1.2V Vinput range has been + * scheduled and we must delay the temperature sensor measurement to + * another sequence. + */ + temp_sensor_scheduled = true; + } else { + /* Exit scheduling loop before scheduling temperature sensor */ + break; + } + } + + /* Ensure calibration point tables are updated. + * This is unneeded if the entry was already filled up, + * but cheaper than checking for duplicate work. + */ + calib_pt_ch_type[calib_pt] = ch_type; + calib_pt_vin_range[calib_pt] = ch_vin_range; + + /* Remove channel from unscheduled list */ + remaining_unsampled &= ~ch_bit; + + /* Add channel to sequence */ + ll_adc_set_conversion_channel(adc, sequence_length, channel); + sequence_length++; + + /* Select the calibration point to use for channel */ + ll_adc_set_calib_point_for_any(adc, ch_type, ch_vin_range, calib_pt); + + /* Configure the channel Vinput range selection. + * This must not be done for internal channels, which + * use a hardwired Vinput range selection instead. + */ + if (channel < LL_ADC_EXTERNAL_CHANNEL_MAX) { + LL_ADC_SetChannelVoltageRange(adc, channel, ch_vin_range); + } +#if !defined(CONFIG_ADC_STM32_DMA) + /* If DMA is not enabled, only schedule one channel at a time. + * Otherwise, the ADC will overflow and everything will break. + */ + __ASSERT_NO_MSG(sequence_length == 1); + break; +#endif + } + + /* Configure all (used) calibration points */ + for (int i = 0; i < NUM_CALIBRATION_POINTS; i++) { + uint8_t type = calib_pt_ch_type[i]; + uint8_t range = calib_pt_vin_range[i]; + + if (type == ADC_CHANNEL_TYPE_INVALID) { + break; + } else if ((type == ADC_CHANNEL_TYPE_SINGLE_POS) + && (range == LL_ADC_VIN_RANGE_1V2) + && temp_sensor_scheduled) { + /* Configure special calibration point for temperature sensor */ + configure_tempsensor_calib_point(adc, i); + } else { + configure_calib_point_from_flash(adc, i, type, range); + } + } + + __ASSERT_NO_MSG(sequence_length > 0); + + /* Now that scheduling is done, we can set the sequence length */ + LL_ADC_SetSequenceLength(adc, sequence_length); + + /* Save unsampled channels (if any) for next sequence */ + data->unsampled_channels = remaining_unsampled; + +#if defined(CONFIG_ADC_STM32_DMA) + const struct adc_stm32wb0_config *config = data->dev->config; + int err; + + /* Save sequence length in driver data for later usage */ + data->sequence_length = sequence_length; + + /* Prepare the DMA controller for ADC->memory transfers */ + data->dma_block_config.source_address = (uint32_t)&adc->DS_DATAOUT; + data->dma_block_config.dest_address = (uint32_t)data->next_sample_ptr; + data->dma_block_config.block_size = data->sequence_length * sizeof(uint16_t); + + err = dma_config(config->dmac, config->dma_channel, &data->dmac_config); + if (err < 0) { + LOG_ERR("%s: FAIL - dma_config returns %d", __func__, err); + adc_context_complete(&data->ctx, err); + return; + } + + err = dma_start(config->dmac, config->dma_channel); + if (err < 0) { + LOG_ERR("%s: FAIL - dma_start returns %d", __func__, err); + adc_context_complete(&data->ctx, err); + return; + } +#endif + + /* Start conversion sequence */ + LL_ADC_StartConversion(adc); +} + +static inline void handle_end_of_sequence(ADC_TypeDef *adc, struct adc_stm32wb0_data *data) +{ + if (data->unsampled_channels != 0) { + /* Some channels requested for this round have + * not been sampled yet. Schedule and start another + * acquisition sequence. + */ + schedule_and_start_adc_sequence(adc, data); + } else { + /* All channels sampled: round is complete. */ + adc_context_on_sampling_done(&data->ctx, data->dev); + } +} + +static int initiate_read_operation(const struct device *dev, + const struct adc_sequence *sequence) +{ + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = (ADC_TypeDef *)config->reg; + int err; + + err = validate_adc_sequence(sequence); + if (err < 0) { + return err; + } + + /* Take ADC out of idle mode before getting to work */ + err = adc_exit_idle_mode(adc, &config->ana_clk); + if (err < 0) { + return err; + } + + /* Initialize output pointers to first byte of user buffer */ + data->next_sample_ptr = data->round_buf_pointer = sequence->buffer; + + /* Configure resolution */ + LL_ADC_SetDSDataOutputWidth(adc, ds_width_from_adc_res(sequence->resolution)); + + /* Configure oversampling */ + LL_ADC_SetDSDataOutputRatio(adc, sequence->oversampling); + + /* Start reading using the ADC */ + adc_context_start_read(&data->ctx, sequence); + + return 0; +} + +#if !defined(CONFIG_ADC_STM32_DMA) +void adc_stm32wb0_isr(const struct device *dev) +{ + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = config->reg; + + /* Down sampler output data available */ + if (LL_ADC_IsActiveFlag_EODS(adc)) { + /* Clear pending interrupt flag */ + LL_ADC_ClearFlag_EODS(adc); + + /* Write ADC data to output buffer and update pointer */ + *data->next_sample_ptr++ = LL_ADC_DSGetOutputData(adc); + } + + /* Down sampler overflow detected - return error */ + if (LL_ADC_IsActiveFlag_OVRDS(adc)) { + LL_ADC_ClearFlag_OVRDS(adc); + + LOG_ERR("ADC overflow\n"); + + adc_context_complete(&data->ctx, -EIO); + return; + } + + if (!LL_ADC_IsActiveFlag_EOS(adc)) { + /* ADC sequence not finished yet */ + return; + } + + /* Clear pending interrupt flag */ + LL_ADC_ClearFlag_EOS(adc); + + /* Execute end-of-sequence logic */ + handle_end_of_sequence(adc, data); +} +#else /* CONFIG_ADC_STM32_DMA */ +static void adc_stm32wb0_dma_callback(const struct device *dma, void *user_data, + uint32_t dma_channel, int dma_status) +{ + struct adc_stm32wb0_data *data = user_data; + const struct device *dev = data->dev; + const struct adc_stm32wb0_config *config = dev->config; + ADC_TypeDef *adc = config->reg; + int err; + + /* N.B.: some of this code is borrowed from existing ADC driver, + * but may be not applicable to STM32WB0 series' ADC. + */ + if (dma_channel == config->dma_channel) { + if (LL_ADC_IsActiveFlag_OVRDS(adc) || (dma_status >= 0)) { + /* Sequence finished - update driver data accordingly */ + data->next_sample_ptr += data->sequence_length; + + /* Stop the DMA controller */ + err = dma_stop(config->dmac, config->dma_channel); + LOG_DBG("%s: dma_stop returns %d", __func__, err); + + LL_ADC_ClearFlag_OVRDS(adc); + + /* Execute the common end-of-sequence logic */ + handle_end_of_sequence(adc, data); + } else { /* dma_status < 0 */ + LOG_ERR("%s: dma error %d", __func__, dma_status); + LL_ADC_StopConversion(adc); + + err = dma_stop(config->dmac, config->dma_channel); + + LOG_DBG("dma_stop returns %d", err); + + adc_context_complete(&data->ctx, dma_status); + } + } else { + LOG_DBG("dma_channel 0x%08X != config->dma_channel 0x%08X", + dma_channel, config->dma_channel); + } +} +#endif /* !CONFIG_ADC_STM32_DMA */ + +/** + * adc_context API implementation + */ +static void adc_context_start_sampling(struct adc_context *ctx) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + const struct adc_stm32wb0_config *config = data->dev->config; + + /* Mark all channels of this round as unsampled */ + data->unsampled_channels = data->ctx.sequence.channels; + + /* Schedule and start first sequence of this round */ + schedule_and_start_adc_sequence(config->reg, data); +} + +static void adc_context_update_buffer_pointer( + struct adc_context *ctx, bool repeat_sampling) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + + if (repeat_sampling) { + /* Roll back output pointer to address of first sample in round */ + data->next_sample_ptr = data->round_buf_pointer; + } else /* a new round is starting: */ { + /* Save address of first sample in round in case we have to repeat it */ + data->round_buf_pointer = data->next_sample_ptr; + } +} + +static void adc_context_on_complete(struct adc_context *ctx, int status) +{ + struct adc_stm32wb0_data *data = drv_data_from_adc_ctx(ctx); + const struct adc_stm32wb0_config *config = data->dev->config; + + ARG_UNUSED(status); + + /** + * All ADC operations are complete. + * Save power by placing ADC in idle mode. + */ + adc_enter_idle_mode(config->reg, &config->ana_clk); + + /* Prevent data corruption if something goes wrong. */ + data->next_sample_ptr = NULL; +} + +/** + * Driver subsystem API implementation + */ +int adc_stm32wb0_channel_setup(const struct device *dev, + const struct adc_channel_cfg *channel_cfg) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + CHECKIF(channel_cfg == NULL) { return -EINVAL; } + const bool is_diff_channel = + (channel_cfg->channel_id == LL_ADC_CHANNEL_VINP0_VINM0 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP1_VINM1 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP2_VINM2 + || channel_cfg->channel_id == LL_ADC_CHANNEL_VINP3_VINM3); + const uint8_t vin_range = vinput_range_from_adc_ref(channel_cfg->reference); + const uint32_t channel_id = channel_cfg->channel_id; + struct adc_stm32wb0_data *data = dev->data; + int res; + + /* Forbid reconfiguration while operation in progress */ + res = k_sem_take(&data->ctx.lock, K_NO_WAIT); + if (res < 0) { + return res; + } + + /* Validate channel configuration parameters */ + if (channel_cfg->gain != ADC_GAIN_1) { + LOG_ERR("gain unsupported by hardware"); + res = -ENOTSUP; + goto unlock_and_return; + } + + if (vin_range == LL_ADC_VIN_RANGE_INVALID) { + LOG_ERR("invalid channel voltage reference"); + res = -EINVAL; + goto unlock_and_return; + } + + if (channel_id >= LL_ADC_CHANNEL_MAX) { + LOG_ERR("invalid channel id %d", channel_cfg->channel_id); + res = -EINVAL; + goto unlock_and_return; + } else if (is_diff_channel != channel_cfg->differential) { + /* channel_cfg->differential flag does not match + * with the selected channel's type + */ + LOG_ERR("differential flag does not match channel type"); + res = -EINVAL; + goto unlock_and_return; + } + + if (channel_cfg->acquisition_time != ADC_ACQ_TIME_DEFAULT) { + LOG_ERR("acquisition time unsupported by hardware"); + res = -ENOTSUP; + goto unlock_and_return; + } + + /* Verify that the correct reference is selected for special channels */ + if (channel_id == LL_ADC_CHANNEL_VBAT && vin_range != LL_ADC_VIN_RANGE_3V6) { + LOG_ERR("invalid reference for Vbat channel"); + res = -EINVAL; + goto unlock_and_return; + } else if (channel_id == LL_ADC_CHANNEL_TEMPSENSOR && vin_range != LL_ADC_VIN_RANGE_1V2) { + LOG_ERR("invalid reference for temperature sensor channel"); + res = -EINVAL; + goto unlock_and_return; + } + + /* Save the channel configuration in driver data. + * Note that the only configuration option available + * is the ADC channel reference (= Vinput range). + */ + data->channel_config[channel_id].vinput_range = vin_range; + +unlock_and_return: + /* Unlock the instance after updating configuration */ + k_sem_give(&data->ctx.lock); + + return res; +} + +int adc_stm32wb0_read(const struct device *dev, + const struct adc_sequence *sequence) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + struct adc_stm32wb0_data *data = dev->data; + int err; + + adc_context_lock(&data->ctx, false, NULL); + + /* When context is locked in synchronous mode, this + * function blocks until the whole operation is complete. + */ + err = initiate_read_operation(dev, sequence); + + if (err >= 0) { + err = adc_context_wait_for_completion(&data->ctx); + } else { + adc_release_pm_locks(); + } + + adc_context_release(&data->ctx, err); + + return err; +} + +#if defined(CONFIG_ADC_ASYNC) +int adc_stm32wb0_read_async(const struct device *dev, + const struct adc_sequence *sequence, struct k_poll_signal *async) +{ + CHECKIF(dev == NULL) { return -ENODEV; } + struct adc_stm32wb0_data *data = dev->data; + int err; + + adc_context_lock(&data->ctx, true, async); + + /* When context is locked in synchronous mode, this + * function blocks until the whole operation is complete. + */ + err = initiate_read_operation(dev, sequence); + if (err < 0) { + adc_release_pm_locks(); + } + + adc_context_release(&data->ctx, err); + + return err; +} +#endif /* CONFIG_ADC_ASYNC */ + +static const struct adc_driver_api api_stm32wb0_driver_api = { + .channel_setup = adc_stm32wb0_channel_setup, + .read = adc_stm32wb0_read, +#if defined(CONFIG_ADC_ASYNC) + .read_async = adc_stm32wb0_read_async, +#endif /* CONFIG_ADC_ASYNC */ + .ref_internal = 3600U /* ADC_REF_INTERNAL is mapped to Vinput 3.6V range */ +}; + +int adc_stm32wb0_init(const struct device *dev) +{ + const struct device *clk = DEVICE_DT_GET(STM32_CLOCK_CONTROL_NODE); + const struct adc_stm32wb0_config *config = dev->config; + struct adc_stm32wb0_data *data = dev->data; + ADC_TypeDef *adc = config->reg; + int err; + + if (!device_is_ready(clk)) { + LOG_ERR("clock control device not ready"); + return -ENODEV; + } + + /* Turn on ADC digital clock (always on) */ + err = clock_control_on(clk, + (clock_control_subsys_t)&config->dig_clk); + if (err < 0) { + LOG_ERR("failed to turn on ADC digital clock (%d)", err); + return err; + } + + /* Configure DT-provided signals when available */ + err = pinctrl_apply_state(config->pinctrl_cfg, PINCTRL_STATE_DEFAULT); + if (err < 0 && err != -ENOENT) { + /* ENOENT indicates no entry - should not be treated as failure */ + LOG_ERR("fail to apply ADC pinctrl state (%d)", err); + return err; + } + +#if defined(ADC_SUPPORT_AUDIO_FEATURES) + /* Configure ADC for analog sampling */ + LL_ADC_SetADCMode(adc, LL_ADC_OP_MODE_ADC); +#endif + +#if defined(PWR_CR2_ENTS) + /* Enable on-die temperature sensor */ + LL_PWR_EnableTempSens(); +#endif + + /* Set ADC sample rate to 1 Msps (maximum speed) */ + LL_ADC_SetSampleRate(adc, LL_ADC_SAMPLE_RATE_16); + + /* Keep new data on overrun, if it ever happens */ + LL_ADC_SetOverrunDS(adc, LL_ADC_NEW_DATA_IS_KEPT); + +#if !defined(CONFIG_ADC_STM32_DMA) + /* Attach ISR and enable ADC interrupt in NVIC */ + IRQ_CONNECT(DT_IRQN(ADC_NODE), DT_IRQ(ADC_NODE, priority), + adc_stm32wb0_isr, DEVICE_DT_GET(ADC_NODE), 0); + irq_enable(DT_IRQN(ADC_NODE)); + + /* Enable ADC interrupt after each sampling. + * NOTE: enabling EOS interrupt is not necessary because + * the EODS interrupt flag is also set to high when the + * EOS flag is being set to high. + */ + LL_ADC_EnableIT_EODS(adc); +#else + /* Check that DMA controller exists and is ready to be used */ + if (!config->dmac) { + LOG_ERR("no DMA assigned to ADC in DMA driver mode!"); + return -ENODEV; + } + + if (!device_is_ready(config->dmac)) { + LOG_ERR("DMA controller '%s' for ADC not ready", config->dmac->name); + return -ENODEV; + } + + /* Finalize DMA configuration structure in driver data */ + data->dmac_config.head_block = &data->dma_block_config; + data->dmac_config.user_data = data; + + /* Enable DMA datapath in ADC */ + LL_ADC_DMAModeDSEnable(adc); +#endif /* !CONFIG_ADC_STM32_DMA */ + + /* Unlock the ADC context to mark ADC as ready to use */ + adc_context_unlock_unconditionally(&data->ctx); + + /* Keep ADC powered down ("idle mode"). + * It will be awakened on-demand when a call to the ADC API + * is performed by the application. + */ + return 0; +} + +/** + * Driver power management implementation + */ +#ifdef CONFIG_PM_DEVICE +static int adc_stm32wb0_pm_action(const struct device *dev, + enum pm_device_action action) +{ + const struct adc_stm32wb0_config *config = dev->config; + ADC_TypeDef *adc = config->reg; + int res; + + switch (action) { + case PM_DEVICE_ACTION_RESUME: + return adc_stm32wb0_init(dev); + case PM_DEVICE_ACTION_SUSPEND: + adc_enter_idle_mode(adc, &config->ana_clk); + + /* Move pins to sleep state */ + res = pinctrl_apply_state(config->pinctrl_cfg, PINCTRL_STATE_SLEEP); + + /** + * -ENOENT is returned if there are no pins defined in DTS for sleep mode. + * This is fine and should not block PM from suspending the device. + * Silently ignore the error by returning 0 instead. + */ + if (res >= 0 || res == -ENOENT) { + return 0; + } else { + return res; + } + default: + return -ENOTSUP; + } +} +#endif /* CONFIG_PM_DEVICE */ + +/** + * Driver device instantiation + */ +PINCTRL_DT_DEFINE(ADC_NODE); + +static const struct adc_stm32wb0_config adc_config = { + .reg = (ADC_TypeDef *)DT_REG_ADDR(ADC_NODE), + .pinctrl_cfg = PINCTRL_DT_DEV_CONFIG_GET(ADC_NODE), + .dig_clk = STM32_CLOCK_INFO(0, ADC_NODE), + .ana_clk = STM32_CLOCK_INFO(1, ADC_NODE), +#if defined(CONFIG_ADC_STM32_DMA) + .dmac = DEVICE_DT_GET(DT_DMAS_CTLR_BY_IDX(ADC_NODE, 0)), + .dma_channel = DT_DMAS_CELL_BY_IDX(ADC_NODE, 0, channel), +#endif +}; + +static struct adc_stm32wb0_data adc_data = { + ADC_CONTEXT_INIT_TIMER(adc_data, ctx), + ADC_CONTEXT_INIT_LOCK(adc_data, ctx), + ADC_CONTEXT_INIT_SYNC(adc_data, ctx), + .dev = DEVICE_DT_GET(ADC_NODE), + .channel_config = { + /* Internal channels selection is hardwired */ + [LL_ADC_CHANNEL_VBAT] = { + .vinput_range = LL_ADC_VIN_RANGE_3V6 + }, + [LL_ADC_CHANNEL_TEMPSENSOR] = { + .vinput_range = LL_ADC_VIN_RANGE_1V2 + } + }, +#if defined(CONFIG_ADC_STM32_DMA) + .dmac_config = { + .dma_slot = DT_INST_DMAS_CELL_BY_IDX(ADC_INSTANCE, 0, slot), + .channel_direction = STM32_DMA_CONFIG_DIRECTION( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .channel_priority = STM32_DMA_CONFIG_PRIORITY( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .source_data_size = STM32_DMA_CONFIG_PERIPHERAL_DATA_SIZE( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .dest_data_size = STM32_DMA_CONFIG_MEMORY_DATA_SIZE( + STM32_DMA_CHANNEL_CONFIG_BY_IDX(ADC_INSTANCE, 0)), + .source_burst_length = 1, /* SINGLE transfer */ + .dest_burst_length = 1, /* SINGLE transfer */ + .block_count = 1, + .dma_callback = adc_stm32wb0_dma_callback, + /* head_block and user_data are initialized at runtime */ + }, + .dma_block_config = { + .source_addr_adj = DMA_ADDR_ADJ_NO_CHANGE, + .source_reload_en = 0, + .dest_addr_adj = DMA_ADDR_ADJ_INCREMENT, + .dest_reload_en = 0, + } +#endif +}; + +PM_DEVICE_DT_DEFINE(ADC_NODE, adc_stm32wb0_pm_action); + +DEVICE_DT_DEFINE(ADC_NODE, &adc_stm32wb0_init, PM_DEVICE_DT_GET(ADC_NODE), + &adc_data, &adc_config, POST_KERNEL, CONFIG_ADC_INIT_PRIORITY, + &api_stm32wb0_driver_api); From 27c2c62c64deab917630f460fc51eec043b58736 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:24:25 +0200 Subject: [PATCH 22/53] dts: arm: st: wb0: add ADC node Add Device Tree node corresponding to STM32WB0 series ADC. Signed-off-by: Mathieu Choplain --- dts/arm/st/wb0/stm32wb0.dtsi | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/dts/arm/st/wb0/stm32wb0.dtsi b/dts/arm/st/wb0/stm32wb0.dtsi index 0532f0ba027..c6a43b37f23 100644 --- a/dts/arm/st/wb0/stm32wb0.dtsi +++ b/dts/arm/st/wb0/stm32wb0.dtsi @@ -218,6 +218,22 @@ status = "disabled"; }; + adc1: adc@41006000 { + compatible = "st,stm32wb0-adc"; + reg = <0x41006000 256>; + /* On STM32WB0, the two ADC clock domains (ANALOG / DIGITAL) + * can be controlled independently. Expose this feature to + * the driver by having two `clocks` property entries: + * - first entry is digital part of ADC block (always-on) + * - second entry is analog part of ADC block (on-demand) + */ + clocks = <&rcc STM32_CLOCK(APB1, 4)>, + <&rcc STM32_CLOCK(APB1, 5)>; + interrupts = <12 0>; + #io-channel-cells = <1>; + status = "disabled"; + }; + dma1: dma@48700000 { compatible = "st,stm32-dma-v2bis"; #dma-cells = <2>; From 5dd9fda746d739f120815f1b4a3e6c2d14d271c0 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 16:45:32 +0200 Subject: [PATCH 23/53] boards: st: wb0: add ADC to supported feature set Add ADC to supported feature set on existing STM32WB0 boards. Signed-off-by: Mathieu Choplain --- boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml | 1 + boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml | 1 + 2 files changed, 2 insertions(+) diff --git a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml index 8070d9ece04..bf602772d9d 100644 --- a/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml +++ b/boards/st/nucleo_wb05kz/nucleo_wb05kz.yaml @@ -9,6 +9,7 @@ toolchain: ram: 24 flash: 192 supported: + - adc - arduino_i2c - arduino_spi - dma diff --git a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml index 922f199851d..a853e0e1d7f 100644 --- a/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml +++ b/boards/st/nucleo_wb09ke/nucleo_wb09ke.yaml @@ -9,6 +9,7 @@ toolchain: ram: 64 flash: 512 supported: + - adc - arduino_i2c - arduino_spi - dma From 59b469725b376a4fc1b67386cb46de5a50bd6676 Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Mon, 21 Oct 2024 15:29:58 +0200 Subject: [PATCH 24/53] tests: adc: adc_api: add overlay for Nucleo-WB09KE Add an overlay to the test so that it can run on STM32WB0 series hardware. Signed-off-by: Mathieu Choplain --- .../adc/adc_api/boards/nucleo_wb09ke.overlay | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay diff --git a/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay b/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay new file mode 100644 index 00000000000..65bb4e308f8 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nucleo_wb09ke.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 STMicroelectronics + */ + +/ { + zephyr,user { + io-channels = <&adc1 4>, <&adc1 12>, <&adc1 13>; + }; +}; + +&adc1 { + status = "okay"; + + pinctrl-0 = <&adc1_vinp0_pb3>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + vinp0: channel@4 { + reg = <4>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_vbat_ch: channel@c { + reg = <12>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_tempsensor_ch: channel@d { + reg = <13>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1_3"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; From 5e7009a12069515bbac9d469821dec5ce59ad3ac Mon Sep 17 00:00:00 2001 From: Mathieu Choplain Date: Wed, 23 Oct 2024 14:28:50 +0200 Subject: [PATCH 25/53] tests: adc: adc_api: add overlay for Nucleo-WB05KZ Add an overlay to the test to allow build for this board (needed for CI). Signed-off-by: Mathieu Choplain --- .../adc/adc_api/boards/nucleo_wb05kz.overlay | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay diff --git a/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay b/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay new file mode 100644 index 00000000000..65bb4e308f8 --- /dev/null +++ b/tests/drivers/adc/adc_api/boards/nucleo_wb05kz.overlay @@ -0,0 +1,44 @@ +/* + * SPDX-License-Identifier: Apache-2.0 + * + * Copyright (c) 2024 STMicroelectronics + */ + +/ { + zephyr,user { + io-channels = <&adc1 4>, <&adc1 12>, <&adc1 13>; + }; +}; + +&adc1 { + status = "okay"; + + pinctrl-0 = <&adc1_vinp0_pb3>; + pinctrl-names = "default"; + #address-cells = <1>; + #size-cells = <0>; + + vinp0: channel@4 { + reg = <4>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_INTERNAL"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_vbat_ch: channel@c { + reg = <12>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; + + adc_tempsensor_ch: channel@d { + reg = <13>; + zephyr,gain = "ADC_GAIN_1"; + zephyr,reference = "ADC_REF_VDD_1_3"; + zephyr,acquisition-time = ; + zephyr,resolution = <12>; + }; +}; From 13f1200e771b94ae1bc81c44f3288480920abef5 Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 24 Oct 2024 17:18:50 +0200 Subject: [PATCH 26/53] soc: st: stm32: stm32wbax: Files renaming Files renaming done to better isolate zephyr related functions from stm32 hal related functions Signed-off-by: Alessandro Manganaro --- soc/st/stm32/stm32wbax/CMakeLists.txt | 4 ++-- .../hci_if/{linklayer_plat.c => linklayer_plat_adapt.c} | 0 .../stm32/stm32wbax/hci_if/{ll_sys_if.c => ll_sys_if_adapt.c} | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename soc/st/stm32/stm32wbax/hci_if/{linklayer_plat.c => linklayer_plat_adapt.c} (100%) rename soc/st/stm32/stm32wbax/hci_if/{ll_sys_if.c => ll_sys_if_adapt.c} (100%) diff --git a/soc/st/stm32/stm32wbax/CMakeLists.txt b/soc/st/stm32/stm32wbax/CMakeLists.txt index 0c970756442..6872ff696f9 100644 --- a/soc/st/stm32/stm32wbax/CMakeLists.txt +++ b/soc/st/stm32/stm32wbax/CMakeLists.txt @@ -12,10 +12,10 @@ zephyr_sources_ifdef(CONFIG_PM if(CONFIG_BT_STM32WBA) zephyr_include_directories(hci_if) - zephyr_sources(hci_if/linklayer_plat.c) + zephyr_sources(hci_if/linklayer_plat_adapt.c) zephyr_sources(hci_if/bleplat.c) zephyr_sources(hci_if/host_stack_if.c) - zephyr_sources(hci_if/ll_sys_if.c) + zephyr_sources(hci_if/ll_sys_if_adapt.c) zephyr_sources(hci_if/stm32_timer.c) endif() diff --git a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat.c b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c similarity index 100% rename from soc/st/stm32/stm32wbax/hci_if/linklayer_plat.c rename to soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c diff --git a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if.c b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c similarity index 100% rename from soc/st/stm32/stm32wbax/hci_if/ll_sys_if.c rename to soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c From 4b4bba4fa4c0cf5e84433f60a0d0c358a910924c Mon Sep 17 00:00:00 2001 From: Alessandro Manganaro Date: Thu, 24 Oct 2024 17:36:28 +0200 Subject: [PATCH 27/53] soc: st: stm32: stm32wbax: STM32WBA Cube 1.4.1 integration Removed unnecessary pure HAL stm32 functions Headers cleanup Signed-off-by: Alessandro Manganaro --- soc/st/stm32/stm32wbax/Kconfig | 1 + .../stm32wbax/hci_if/linklayer_plat_adapt.c | 71 +------------------ .../stm32/stm32wbax/hci_if/ll_sys_if_adapt.c | 10 +-- west.yml | 2 +- 4 files changed, 4 insertions(+), 80 deletions(-) diff --git a/soc/st/stm32/stm32wbax/Kconfig b/soc/st/stm32/stm32wbax/Kconfig index 1b1418e048a..cebc0fd7e22 100644 --- a/soc/st/stm32/stm32wbax/Kconfig +++ b/soc/st/stm32/stm32wbax/Kconfig @@ -14,5 +14,6 @@ config SOC_SERIES_STM32WBAX select CPU_CORTEX_M_HAS_DWT select HAS_STM32CUBE select USE_STM32_HAL_PWR_EX + select USE_STM32_HAL_CORTEX select HAS_PM select SOC_EARLY_INIT_HOOK diff --git a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c index 4f99a3e6848..b482c0b86fc 100644 --- a/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c +++ b/soc/st/stm32/stm32wbax/hci_if/linklayer_plat_adapt.c @@ -4,22 +4,14 @@ * SPDX-License-Identifier: Apache-2.0 */ -#include #include -#include -#include #include #include -#include - -#include - -#include #include "scm.h" #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL -LOG_MODULE_REGISTER(linklayer_plat); +LOG_MODULE_REGISTER(linklayer_plat_adapt); #define RADIO_INTR_PRIO_HIGH_Z (RADIO_INTR_PRIO_HIGH + _IRQ_PRIO_OFFSET) #define RADIO_INTR_PRIO_LOW_Z (RADIO_INTR_PRIO_LOW + _IRQ_PRIO_OFFSET) @@ -36,52 +28,17 @@ extern const struct device *rng_dev; volatile int32_t prio_high_isr_counter; volatile int32_t prio_low_isr_counter; volatile int32_t prio_sys_isr_counter; -volatile int32_t irq_counter; volatile uint32_t local_basepri_value; /* Radio SW low ISR global variable */ volatile uint8_t radio_sw_low_isr_is_running_high_prio; -void LINKLAYER_PLAT_ClockInit(void) -{ - LL_PWR_EnableBkUpAccess(); - - /* Select LSE as Sleep CLK */ - __HAL_RCC_RADIOSLPTIM_CONFIG(RCC_RADIOSTCLKSOURCE_LSE); - - LL_PWR_DisableBkUpAccess(); - - /* Enable AHB5ENR peripheral clock (bus CLK) */ - __HAL_RCC_RADIO_CLK_ENABLE(); -} void LINKLAYER_PLAT_DelayUs(uint32_t delay) { k_busy_wait(delay); } -void LINKLAYER_PLAT_WaitHclkRdy(void) -{ - while (HAL_RCCEx_GetRadioBusClockReadiness() != RCC_RADIO_BUS_CLOCK_READY) { - } -} - -void LINKLAYER_PLAT_AclkCtrl(uint8_t enable) -{ - LOG_DBG("enable: %d", enable); - if (enable) { - /* Enable RADIO baseband clock (active CLK) */ - HAL_RCCEx_EnableRadioBBClock(); - - /* Polling on HSE32 activation */ - while (LL_RCC_HSE_IsReady() == 0) { - } - } else { - /* Disable RADIO baseband clock (active CLK) */ - HAL_RCCEx_DisableRadioBBClock(); - } -} - void LINKLAYER_PLAT_GetRNG(uint8_t *ptr_rnd, uint32_t len) { int ret; @@ -191,22 +148,6 @@ void LINKLAYER_PLAT_TriggerSwLowIT(uint8_t priority) NVIC_SetPendingIRQ((IRQn_Type)RADIO_SW_LOW_INTR_NUM); } -void LINKLAYER_PLAT_EnableIRQ(void) -{ - irq_counter = MAX(0, irq_counter - 1); - - if (irq_counter == 0) { - __enable_irq(); - } -} - -void LINKLAYER_PLAT_DisableIRQ(void) -{ - __disable_irq(); - - irq_counter++; -} - void LINKLAYER_PLAT_Assert(uint8_t condition) { __ASSERT_NO_MSG(condition); @@ -267,16 +208,6 @@ void LINKLAYER_PLAT_DisableSpecificIRQ(uint8_t isr_type) } } -void LINKLAYER_PLAT_EnableRadioIT(void) -{ - irq_enable((IRQn_Type)RADIO_INTR_NUM); -} - -void LINKLAYER_PLAT_DisableRadioIT(void) -{ - irq_disable((IRQn_Type)RADIO_INTR_NUM); -} - void LINKLAYER_PLAT_StartRadioEvt(void) { __HAL_RCC_RADIO_CLK_SLEEP_ENABLE(); diff --git a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c index 8607cbbafd8..df0342ff1f1 100644 --- a/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c +++ b/soc/st/stm32/stm32wbax/hci_if/ll_sys_if_adapt.c @@ -8,12 +8,9 @@ #include #define LOG_LEVEL CONFIG_SOC_LOG_LEVEL -LOG_MODULE_REGISTER(ll_sys_if); +LOG_MODULE_REGISTER(ll_sys_if_adapt); -#include "ll_intf.h" #include "ll_sys.h" -#include "linklayer_plat.h" -#include "app_conf.h" extern struct k_mutex ble_ctlr_stack_mutex; extern struct k_work_q ll_work_q; @@ -40,8 +37,3 @@ void ll_sys_bg_process_init(void) { k_work_init(&ll_sys_work, &ll_sys_bg_process_handler); } - -void ll_sys_config_params(void) -{ - ll_intf_config_ll_ctx_params(USE_RADIO_LOW_ISR, NEXT_EVENT_SCHEDULING_FROM_ISR); -} diff --git a/west.yml b/west.yml index b1287ecabd6..d3a1d5f5314 100644 --- a/west.yml +++ b/west.yml @@ -233,7 +233,7 @@ manifest: groups: - hal - name: hal_stm32 - revision: 6f0e5f70cb540c487e3e3678af2e95d0937f9863 + revision: 019d8255333f96bdd47d26b44049bd3e7af8ef55 path: modules/hal/stm32 groups: - hal From d73fda80a6b36fe49ac8811e91a9ed93ba2771ce Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Sat, 26 Oct 2024 11:51:01 +0200 Subject: [PATCH 28/53] ci: Switch to CI image v0.27.4 This commit updates the CI workflows to use the CI image v0.27.4, which includes nrf-regtool v7.0.0. Signed-off-by: Carles Cufi Signed-off-by: Stephanos Ioannidis --- .github/workflows/bsim-tests.yaml | 2 +- .github/workflows/clang.yaml | 2 +- .github/workflows/codecov.yaml | 2 +- .github/workflows/errno.yml | 2 +- .github/workflows/footprint-tracking.yml | 2 +- .github/workflows/twister.yaml | 4 ++-- .github/workflows/twister_tests_blackbox.yml | 2 +- 7 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/bsim-tests.yaml b/.github/workflows/bsim-tests.yaml index 47c6aa86c27..4739f99e68b 100644 --- a/.github/workflows/bsim-tests.yaml +++ b/.github/workflows/bsim-tests.yaml @@ -37,7 +37,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' env: ZEPHYR_TOOLCHAIN_VARIANT: zephyr diff --git a/.github/workflows/clang.yaml b/.github/workflows/clang.yaml index 8e1d51ca05e..4221babe2e5 100644 --- a/.github/workflows/clang.yaml +++ b/.github/workflows/clang.yaml @@ -12,7 +12,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/codecov.yaml b/.github/workflows/codecov.yaml index 834ec8505e3..56edb6a1e87 100644 --- a/.github/workflows/codecov.yaml +++ b/.github/workflows/codecov.yaml @@ -14,7 +14,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/errno.yml b/.github/workflows/errno.yml index c70368ade30..d3fe1b0dcae 100644 --- a/.github/workflows/errno.yml +++ b/.github/workflows/errno.yml @@ -10,7 +10,7 @@ jobs: check-errno: runs-on: ubuntu-22.04 container: - image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.4 steps: - name: Apply container owner mismatch workaround diff --git a/.github/workflows/footprint-tracking.yml b/.github/workflows/footprint-tracking.yml index 694dc8166be..93eae63e954 100644 --- a/.github/workflows/footprint-tracking.yml +++ b/.github/workflows/footprint-tracking.yml @@ -26,7 +26,7 @@ jobs: group: zephyr-runner-v2-linux-x64-4xlarge if: github.repository_owner == 'zephyrproject-rtos' container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' defaults: run: diff --git a/.github/workflows/twister.yaml b/.github/workflows/twister.yaml index 8f940ce11c6..f12cdeb2efa 100644 --- a/.github/workflows/twister.yaml +++ b/.github/workflows/twister.yaml @@ -25,7 +25,7 @@ jobs: runs-on: group: zephyr-runner-v2-linux-x64-4xlarge container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' outputs: subset: ${{ steps.output-services.outputs.subset }} @@ -130,7 +130,7 @@ jobs: needs: twister-build-prep if: needs.twister-build-prep.outputs.size != 0 container: - image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.3.20241022 + image: ghcr.io/zephyrproject-rtos/ci-repo-cache:v0.27.4.20241026 options: '--entrypoint /bin/bash' strategy: fail-fast: false diff --git a/.github/workflows/twister_tests_blackbox.yml b/.github/workflows/twister_tests_blackbox.yml index 0e36630d092..f2f64e66a89 100644 --- a/.github/workflows/twister_tests_blackbox.yml +++ b/.github/workflows/twister_tests_blackbox.yml @@ -24,7 +24,7 @@ jobs: python-version: ['3.10', '3.11', '3.12', '3.13'] os: [ubuntu-22.04] container: - image: ghcr.io/zephyrproject-rtos/ci:v0.27.3 + image: ghcr.io/zephyrproject-rtos/ci:v0.27.4 steps: - name: Apply Container Owner Mismatch Workaround From 26603cefaf41298c417f2eee834ed40d9ab35d3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C3=A5kon=20Amundsen?= Date: Mon, 7 Oct 2024 15:43:13 +0200 Subject: [PATCH 29/53] dts: update memory map and remove ext-uicr MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Extended UICR will not be used as its configurations will be merged with the UICR registers in NVR. Memory maps changes are needed to align with pre compiled firmware. Signed-off-by: Håkon Amundsen Signed-off-by: Jonathan Nilsen --- .../nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi | 15 +++++++++++++++ .../nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay | 7 +++++++ .../nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay | 7 +++++++ dts/bindings/arm/nordic,nrf-uicr-v2.yaml | 7 ------- dts/common/nordic/nrf54h20.dtsi | 14 ++------------ dts/common/nordic/nrf9280.dtsi | 10 ---------- 8 files changed, 45 insertions(+), 29 deletions(-) create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay create mode 100644 boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi new file mode 100644 index 00000000000..940ac4d2391 --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_0_8_0.dtsi @@ -0,0 +1,15 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +/delete-node/ &suit_storage_partition; + +/ { + reserved-memory { + suit_storage_partition: memory@e1eb000 { + reg = <0xe1eb000 DT_SIZE_K(24)>; + }; + }; +}; diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay new file mode 100644 index 00000000000..dfee18c5b6f --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuapp_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay new file mode 100644 index 00000000000..dfee18c5b6f --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuflpr_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay new file mode 100644 index 00000000000..dfee18c5b6f --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpuppr_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay new file mode 100644 index 00000000000..dfee18c5b6f --- /dev/null +++ b/boards/nordic/nrf54h20dk/nrf54h20dk_nrf54h20_cpurad_0_8_0.overlay @@ -0,0 +1,7 @@ +/* + * Copyright (c) 2024 Nordic Semiconductor ASA + * + * SPDX-License-Identifier: Apache-2.0 + */ + +#include "nrf54h20dk_nrf54h20_0_8_0.dtsi" diff --git a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml index f509fdf4061..9000cce94c5 100644 --- a/dts/bindings/arm/nordic,nrf-uicr-v2.yaml +++ b/dts/bindings/arm/nordic,nrf-uicr-v2.yaml @@ -17,10 +17,3 @@ properties: description: | Domain ID of the domain associated with this UICR instance. Must be unique across all UICR instances in the system. - - ptr-ext-uicr: - type: phandle - required: true - description: | - Handle of a memory region reserved to contain an Extended UICR instance. - The address of that node will be stored in the UICR.PTREXTUICR register. diff --git a/dts/common/nordic/nrf54h20.dtsi b/dts/common/nordic/nrf54h20.dtsi index 5f48cfb6d5b..92a4880cf17 100644 --- a/dts/common/nordic/nrf54h20.dtsi +++ b/dts/common/nordic/nrf54h20.dtsi @@ -145,16 +145,8 @@ #address-cells = <1>; #size-cells = <1>; - suit_storage_partition: memory@e1eb000 { - reg = <0xe1eb000 DT_SIZE_K(24)>; - }; - - cpurad_uicr_ext: memory@e1ff000 { - reg = <0xe1ff000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e1ff800 { - reg = <0xe1ff800 DT_SIZE_K(2)>; + suit_storage_partition: memory@e1ed000 { + reg = <0xe1ed000 DT_SIZE_K(20)>; }; }; @@ -217,14 +209,12 @@ compatible = "nordic,nrf-uicr-v2"; reg = <0xfff8000 DT_SIZE_K(2)>; domain = <2>; - ptr-ext-uicr = <&cpuapp_uicr_ext>; }; cpurad_uicr: uicr@fffa000 { compatible = "nordic,nrf-uicr-v2"; reg = <0xfffa000 DT_SIZE_K(2)>; domain = <3>; - ptr-ext-uicr = <&cpurad_uicr_ext>; }; ficr: ficr@fffe000 { diff --git a/dts/common/nordic/nrf9280.dtsi b/dts/common/nordic/nrf9280.dtsi index e0a34fc22f9..4fd64cd10be 100644 --- a/dts/common/nordic/nrf9280.dtsi +++ b/dts/common/nordic/nrf9280.dtsi @@ -74,14 +74,6 @@ reserved-memory { #address-cells = <1>; #size-cells = <1>; - - cpurad_uicr_ext: memory@e401000 { - reg = <0xe401000 DT_SIZE_K(2)>; - }; - - cpuapp_uicr_ext: memory@e401800 { - reg = <0xe401800 DT_SIZE_K(2)>; - }; }; clocks { @@ -113,14 +105,12 @@ compatible = "nordic,nrf-uicr-v2"; reg = <0xfff8000 DT_SIZE_K(2)>; domain = <2>; - ptr-ext-uicr = <&cpuapp_uicr_ext>; }; cpurad_uicr: uicr@fffa000 { compatible = "nordic,nrf-uicr-v2"; reg = <0xfffa000 DT_SIZE_K(2)>; domain = <3>; - ptr-ext-uicr = <&cpurad_uicr_ext>; }; ficr: ficr@fffe000 { From 906ae3591c3414c7c0ba3eef31629cb94f02f600 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 21:52:56 +0200 Subject: [PATCH 30/53] Bluetooth: Controller: Fix ISO Sync Receiver BIS payload dereferencing Fix incorrect use of BIS indices to dereference the payload array, instead correctly use synchronised stream indices. Signed-off-by: Vinayak Kariappa Chettimada --- .../ll_sw/nordic/lll/lll_sync_iso.c | 48 +++++++++++-------- 1 file changed, 28 insertions(+), 20 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c index 42c57790516..2b17807f217 100644 --- a/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c +++ b/subsys/bluetooth/controller/ll_sw/nordic/lll/lll_sync_iso.c @@ -526,6 +526,7 @@ static void isr_rx(void *param) uint16_t data_chan_id; uint8_t data_chan_use; uint8_t crc_init[3]; + uint8_t stream_curr; uint8_t rssi_ready; uint32_t start_us; uint8_t new_burst; @@ -553,6 +554,9 @@ static void isr_rx(void *param) /* BIS index */ bis_idx = lll->bis_curr - 1U; + /* Current stream */ + stream_curr = lll->stream_curr; + goto isr_rx_done; } @@ -587,6 +591,9 @@ static void isr_rx(void *param) /* BIS index */ bis_idx = lll->bis_curr - 1U; + /* Current stream */ + stream_curr = lll->stream_curr; + /* Check CRC and generate ISO Data PDU */ if (crc_ok) { struct lll_sync_iso_stream *sync_stream; @@ -648,14 +655,14 @@ static void isr_rx(void *param) } /* Get reference to stream context */ - stream_handle = lll->stream_handle[lll->stream_curr]; + stream_handle = lll->stream_handle[stream_curr]; sync_stream = ull_sync_iso_lll_stream_get(stream_handle); /* Store the received PDU if selected stream and not already * received (say in previous event as pre-transmitted PDU. */ if ((lll->bis_curr == sync_stream->bis_index) && pdu->len && - !lll->payload[bis_idx][payload_index]) { + !lll->payload[stream_curr][payload_index]) { uint16_t handle; if (IS_ENABLED(CONFIG_BT_CTLR_BROADCAST_ISO_ENC) && @@ -679,7 +686,7 @@ static void isr_rx(void *param) handle = LL_BIS_SYNC_HANDLE_FROM_IDX(stream_handle); isr_rx_iso_data_valid(lll, handle, node_rx); - lll->payload[bis_idx][payload_index] = node_rx; + lll->payload[stream_curr][payload_index] = node_rx; } } @@ -724,7 +731,7 @@ static void isr_rx(void *param) } /* Check if (bn_curr)th Rx PDU has been received */ - if (!lll->payload[bis_idx][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* Receive the (bn_curr)th Rx PDU of bis_curr */ bis = lll->bis_curr; @@ -767,7 +774,7 @@ static void isr_rx(void *param) /* Check if (irc_curr)th bn = 1 Rx PDU has been * received. */ - if (!lll->payload[bis_idx][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* Receive the (irc_curr)th bn = 1 Rx PDU of * bis_curr. */ @@ -816,14 +823,13 @@ static void isr_rx(void *param) /* Next BIS */ if (lll->bis_curr < lll->num_bis) { - const uint8_t stream_curr = lll->stream_curr + 1U; struct lll_sync_iso_stream *sync_stream; uint16_t stream_handle; /* Next selected stream */ - if (stream_curr < lll->stream_count) { - lll->stream_curr = stream_curr; - stream_handle = lll->stream_handle[lll->stream_curr]; + if ((lll->stream_curr + 1U) < lll->stream_count) { + stream_curr = ++lll->stream_curr; + stream_handle = lll->stream_handle[stream_curr]; sync_stream = ull_sync_iso_lll_stream_get(stream_handle); if (sync_stream->bis_index <= lll->num_bis) { uint32_t payload_offset; @@ -859,7 +865,7 @@ static void isr_rx(void *param) /* Check if (irc_curr)th bn = 1 Rx PDU has been * received. */ - if (!lll->payload[bis_idx_new][payload_index]) { + if (!lll->payload[stream_curr][payload_index]) { /* bn = 1 Rx PDU not received */ skipped = (bis_idx_new - bis_idx) * ((lll->bn * lll->irc) + @@ -1165,14 +1171,16 @@ static void isr_rx_done(void *param) /* Catchup with ISO event latencies */ latency_event = lll->latency_event; do { - lll->stream_curr = 0U; + uint8_t stream_curr; + + stream_curr = 0U; for (bis_idx = 0U; bis_idx < lll->num_bis; bis_idx++) { struct lll_sync_iso_stream *stream; - uint8_t payload_tail; - uint8_t stream_curr; + uint8_t stream_curr_inc; uint16_t stream_handle; + uint8_t payload_tail; - stream_handle = lll->stream_handle[lll->stream_curr]; + stream_handle = lll->stream_handle[stream_curr]; stream = ull_sync_iso_lll_stream_get(stream_handle); /* Skip BIS indices not synchronized. bis_index is 0x01 to 0x1F, * where as bis_idx is 0 indexed. @@ -1184,9 +1192,9 @@ static void isr_rx_done(void *param) payload_tail = lll->payload_tail; bn = lll->bn; while (bn--) { - if (lll->payload[bis_idx][payload_tail]) { - node_rx = lll->payload[bis_idx][payload_tail]; - lll->payload[bis_idx][payload_tail] = NULL; + if (lll->payload[stream_curr][payload_tail]) { + node_rx = lll->payload[stream_curr][payload_tail]; + lll->payload[stream_curr][payload_tail] = NULL; iso_rx_put(node_rx->hdr.link, node_rx); } else { @@ -1221,9 +1229,9 @@ static void isr_rx_done(void *param) payload_tail = payload_index; } - stream_curr = lll->stream_curr + 1U; - if (stream_curr < lll->stream_count) { - lll->stream_curr = stream_curr; + stream_curr_inc = stream_curr + 1U; + if (stream_curr_inc < lll->stream_count) { + stream_curr = stream_curr_inc; } } lll->payload_tail = payload_index; From eb180052bb9ddeab9e65010ac36705e1ee7284ca Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 22:09:44 +0200 Subject: [PATCH 31/53] samples: Bluetooth: iso_broadcast: Restrict max stream sync Restrict possible maximum stream synchronization to implementation defined 2 stream, as structure declarations in the implementation is limited to 2. Signed-off-by: Vinayak Kariappa Chettimada --- samples/bluetooth/iso_receive/src/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/bluetooth/iso_receive/src/main.c b/samples/bluetooth/iso_receive/src/main.c index 989694907b4..b7714e08b21 100644 --- a/samples/bluetooth/iso_receive/src/main.c +++ b/samples/bluetooth/iso_receive/src/main.c @@ -22,7 +22,7 @@ #define PA_RETRY_COUNT 6 -#define BIS_ISO_CHAN_COUNT 2 +#define BIS_ISO_CHAN_COUNT MIN(2U, CONFIG_BT_ISO_MAX_CHAN) static bool per_adv_found; static bool per_adv_lost; From 7048b0fa4b65a9ec3ab1dba5a92f428bf7399c47 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Tue, 10 Sep 2024 22:17:59 +0200 Subject: [PATCH 32/53] samples: Bluetooth: iso_broadcast: Fix buf alloc timeout Fix buf alloc timeout to 20 millisecond as the sent callback can have a latency that is upto twice the ISO interval. Signed-off-by: Vinayak Kariappa Chettimada --- samples/bluetooth/iso_broadcast/src/main.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/samples/bluetooth/iso_broadcast/src/main.c b/samples/bluetooth/iso_broadcast/src/main.c index 85460d10fdd..0086a9786de 100644 --- a/samples/bluetooth/iso_broadcast/src/main.c +++ b/samples/bluetooth/iso_broadcast/src/main.c @@ -8,9 +8,9 @@ #include #include -#define BUF_ALLOC_TIMEOUT (10) /* milliseconds */ +#define BIG_SDU_INTERVAL_US (10000) +#define BUF_ALLOC_TIMEOUT_US (BIG_SDU_INTERVAL_US * 2U) /* milliseconds */ #define BIG_TERMINATE_TIMEOUT_US (60 * USEC_PER_SEC) /* microseconds */ -#define BIG_SDU_INTERVAL_US (10000) #define BIS_ISO_CHAN_COUNT 2 NET_BUF_POOL_FIXED_DEFINE(bis_tx_pool, BIS_ISO_CHAN_COUNT, @@ -163,16 +163,14 @@ int main(void) struct net_buf *buf; int ret; - buf = net_buf_alloc(&bis_tx_pool, - K_MSEC(BUF_ALLOC_TIMEOUT)); + buf = net_buf_alloc(&bis_tx_pool, K_USEC(BUF_ALLOC_TIMEOUT_US)); if (!buf) { printk("Data buffer allocate timeout on channel" " %u\n", chan); return 0; } - ret = k_sem_take(&sem_iso_data, - K_MSEC(BUF_ALLOC_TIMEOUT)); + ret = k_sem_take(&sem_iso_data, K_USEC(BUF_ALLOC_TIMEOUT_US)); if (ret) { printk("k_sem_take for ISO data sent failed\n"); net_buf_unref(buf); From bb4c44153b3bbf7c55b3f3c41d8873626d140f4f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:27:41 +0200 Subject: [PATCH 33/53] samples: Bluetooth: broadcaster_multiple: Refactor for reuse Refactor the sample so that multiple advertising setup can be reused in other sample if required. Bluetooth enable can be in the sample that reuses the advertising setup. Signed-off-by: Vinayak Kariappa Chettimada --- .../broadcaster_multiple/src/broadcaster_multiple.c | 7 ------- samples/bluetooth/broadcaster_multiple/src/main.c | 10 ++++++++++ tests/bsim/bluetooth/host/adv/chain/src/main.c | 8 ++++++++ 3 files changed, 18 insertions(+), 7 deletions(-) diff --git a/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c b/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c index f2e7127b406..63834fa3852 100644 --- a/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c +++ b/samples/bluetooth/broadcaster_multiple/src/broadcaster_multiple.c @@ -77,13 +77,6 @@ int broadcaster_multiple(void) }; int err; - /* Initialize the Bluetooth Subsystem */ - err = bt_enable(NULL); - if (err) { - printk("Bluetooth init failed (err %d)\n", err); - return err; - } - for (int index = 0; index < CONFIG_BT_EXT_ADV_MAX_ADV_SET; index++) { /* Use advertising set instance index as SID */ adv_param.sid = index; diff --git a/samples/bluetooth/broadcaster_multiple/src/main.c b/samples/bluetooth/broadcaster_multiple/src/main.c index f30db217e86..4da680e4d8b 100644 --- a/samples/bluetooth/broadcaster_multiple/src/main.c +++ b/samples/bluetooth/broadcaster_multiple/src/main.c @@ -5,13 +5,23 @@ */ #include +#include int broadcaster_multiple(void); int main(void) { + int err; + printk("Starting Multiple Broadcaster Demo\n"); + /* Initialize the Bluetooth Subsystem */ + err = bt_enable(NULL); + if (err) { + printk("Bluetooth init failed (err %d)\n", err); + return 0; + } + (void)broadcaster_multiple(); printk("Exiting %s thread.\n", __func__); diff --git a/tests/bsim/bluetooth/host/adv/chain/src/main.c b/tests/bsim/bluetooth/host/adv/chain/src/main.c index dd7a400cb62..ad718125318 100644 --- a/tests/bsim/bluetooth/host/adv/chain/src/main.c +++ b/tests/bsim/bluetooth/host/adv/chain/src/main.c @@ -51,6 +51,14 @@ static void test_adv_main(void) extern int broadcaster_multiple(void); int err; + err = bt_enable(NULL); + if (err) { + FAIL("Bluetooth init failed\n"); + + bs_trace_silent_exit(err); + return; + } + err = broadcaster_multiple(); if (err) { FAIL("Adv tests failed\n"); From 742ffd5b169d3fcf938575eba1d55a8d4c7fd368 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:17:35 +0200 Subject: [PATCH 34/53] Bluetooth: Controller: Fix compile error missing lll_df_types include Fix compile error due to missing lll_df_types include. Signed-off-by: Vinayak Kariappa Chettimada --- .../controller/ll_sw/ull_llcp_past.c | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c index a1d3887d115..8b8f88147e0 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp_past.c @@ -12,36 +12,42 @@ #include "hal/ccm.h" #include "hal/debug.h" -#include "util/memq.h" #include "util/util.h" +#include "util/memq.h" +#include "util/dbuf.h" #include "pdu_df.h" #include "lll/pdu_vendor.h" #include "pdu.h" + #include "lll.h" -#include "lll_conn.h" +#include "lll/lll_df_types.h" #include "lll_filter.h" +#include "lll_scan.h" +#include "lll_sync.h" +#include "lll_sync_iso.h" +#include "lll_conn.h" +#include "lll_conn_iso.h" + #include "ull_tx_queue.h" -#include "ull_conn_types.h" -#include "ull_llcp_internal.h" + #include "isoal.h" +#include "ull_scan_types.h" +#include "ull_sync_types.h" #include "ull_iso_types.h" -#include "lll_conn_iso.h" +#include "ull_conn_types.h" #include "ull_conn_iso_types.h" -#include "lll_sync.h" -#include "lll_sync_iso.h" -#include "ull_sync_types.h" -#include "lll_scan.h" -#include "ull_scan_types.h" -#include "ull_llcp.h" -#include "ull_internal.h" -#include "ull_conn_internal.h" -#include "ull_sync_internal.h" #include "ll_settings.h" #include "ll_feat.h" + +#include "ull_llcp.h" #include "ull_llcp_features.h" +#include "ull_internal.h" +#include "ull_sync_internal.h" +#include "ull_conn_internal.h" +#include "ull_llcp_internal.h" #if defined(CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER) /* LLCP Remote Procedure FSM states */ From 9a8b1b1d72dadb37dee2c294ff9b15f48a5d194e Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 10:17:35 +0200 Subject: [PATCH 35/53] Bluetooth: Controller: Fix compile error when BT_CTLR_PRIVACY disabled Fix compile error when BT_CTLR_PRIVACY is disabled. Compile error seen building hci_uart sample for nrf54l15dk. Signed-off-by: Vinayak Kariappa Chettimada --- subsys/bluetooth/controller/ll_sw/ull_llcp.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/subsys/bluetooth/controller/ll_sw/ull_llcp.c b/subsys/bluetooth/controller/ll_sw/ull_llcp.c index 14754090934..0f9877ecc84 100644 --- a/subsys/bluetooth/controller/ll_sw/ull_llcp.c +++ b/subsys/bluetooth/controller/ll_sw/ull_llcp.c @@ -1072,7 +1072,7 @@ uint8_t ull_cp_periodic_sync(struct ll_conn *conn, struct ll_sync_set *sync, interval = sync->interval; addr_type = sync->peer_id_addr_type; - if (sync->peer_addr_resolved) { + if (IS_ENABLED(CONFIG_BT_CTLR_PRIVACY) && sync->peer_addr_resolved) { uint8_t rl_idx; /* peer_id_addr contains the identity address; Get the peers RPA */ From 14d5b8d63d7acd35f6fc4045370cae32c4a44b59 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 09:46:44 +0200 Subject: [PATCH 36/53] samples: Bluetooth: hci_uart_3wire: Align Kconfigs with hci_uart Align Kconfig values used with bt-ll-sw-split Controller as same used in hci_uart sample. Relates to commit 2c6306d09954 ("Bluetooth: Controller: BT_CTLR_ISO_TX_BUFFER_SIZE from BT_ISO_TX_MTU")'. Signed-off-by: Vinayak Kariappa Chettimada --- .../hci_uart_3wire/overlay-all-bt_ll_sw_split.conf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index 35ac7c6525b..548d3a14a2b 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -81,7 +81,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller @@ -94,12 +94,12 @@ CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y -CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 # ISO Transmissions CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=251 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions From 7f4bfdfd63af6097582c497fea1c4dc96302246f Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Fri, 25 Oct 2024 09:59:34 +0200 Subject: [PATCH 37/53] samples: Bluetooth: hci_uart(_3wire)/hci_ipc: Enable PAST feature Enabled Periodic Advertising Sync Transfer feature in the Bluetooth Low Energy HCI Controller samples. Signed-off-by: Vinayak Kariappa Chettimada --- .../bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf | 2 ++ .../bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf | 2 ++ samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf | 2 ++ .../bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf | 2 ++ 4 files changed, 8 insertions(+) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index 0e4a20602b5..c117a556dc1 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -77,6 +77,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -84,6 +85,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index 62a0225b580..f27d32ee080 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -89,6 +89,7 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -97,6 +98,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 3b2a93aba04..5885a1cfb28 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -81,6 +81,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -88,6 +89,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index 548d3a14a2b..df974a21ff4 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -80,6 +80,7 @@ CONFIG_BT_CTLR_DF_CONN_CTE_REQ=y # ISO Broadcaster Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 @@ -87,6 +88,7 @@ CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y +CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 From 23f03dcd84381e14e28c8a4ca1b21933bf14ec97 Mon Sep 17 00:00:00 2001 From: Vinayak Kariappa Chettimada Date: Wed, 24 Jan 2024 13:52:48 +0100 Subject: [PATCH 38/53] samples: Bluetooth: hci_uart hci_ipc configuration update Updates to project configuration extras to build with Zephyr Controller. Configure for 2 broadcast audio sources in 2 groups, 2 unicast audio source in 1 group and, 2 audio sinks for 1 group for both broadcast and unicast usecases. Signed-off-by: Vinayak Kariappa Chettimada --- .../nrf5340_cpunet_bis-bt_ll_sw_split.conf | 26 ++++++++---- .../nrf5340_cpunet_cis-bt_ll_sw_split.conf | 23 +++++++---- .../nrf5340_cpunet_df-bt_ll_sw_split.conf | 9 ++-- .../nrf5340_cpunet_iso-bt_ll_sw_split.conf | 41 ++++++++++++------- ...0_cpunet_iso_broadcast-bt_ll_sw_split.conf | 21 ++++++---- ...340_cpunet_iso_central-bt_ll_sw_split.conf | 20 +++++---- ..._cpunet_iso_peripheral-bt_ll_sw_split.conf | 20 +++++---- ...340_cpunet_iso_receive-bt_ll_sw_split.conf | 15 +++---- .../hci_uart/overlay-all-bt_ll_sw_split.conf | 36 ++++++++++++---- .../overlay-all-bt_ll_sw_split.conf | 36 ++++++++++++---- 10 files changed, 169 insertions(+), 78 deletions(-) diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf index c117a556dc1..a7487118694 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_bis-bt_ll_sw_split.conf @@ -5,13 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y -CONFIG_BT_OBSERVER=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -24,11 +21,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=2 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -37,7 +39,9 @@ CONFIG_BT_ISO_CENTRAL=n CONFIG_BT_ISO_PERIPHERAL=n # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -79,21 +83,25 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf index af142bf7dc6..f7e1f8fc673 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_cis-bt_ll_sw_split.conf @@ -5,12 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -23,12 +21,15 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=3 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=n @@ -37,7 +38,9 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -79,13 +82,17 @@ CONFIG_BT_CTLR_LLCP_LOCAL_PROC_CTX_BUF_NUM=6 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf index 403501a5810..b183a4c9825 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_df-bt_ll_sw_split.conf @@ -5,12 +5,10 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=2 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -23,11 +21,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=2 # Controller CONFIG_BT_LL_SW_SPLIT=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf index f27d32ee080..925eac8e34e 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_CBPRINTF_REDUCED_INTEGRAL=y @@ -13,10 +12,7 @@ CONFIG_ISR_TABLES_LOCAL_DECLARATION=y CONFIG_LTO=y CONFIG_BT=y -CONFIG_BT_PERIPHERAL=y -CONFIG_BT_CENTRAL=y CONFIG_BT_HCI_RAW=y -CONFIG_BT_MAX_CONN=3 # Workaround: Unable to allocate command buffer when using K_NO_WAIT since # Host number of completed commands does not follow normal flow control. @@ -29,11 +25,16 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host features +# Host and Controller common dependencies +CONFIG_BT_BROADCASTER=y +CONFIG_BT_OBSERVER=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=3 # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -42,7 +43,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -71,8 +76,12 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n @@ -91,38 +100,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 -CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_ISO_TX_MTU=310 -CONFIG_BT_ISO_TX_BUF_COUNT=4 -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_ISO_RX_MTU=310 -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf index 05645663bc4..67c5854c9c0 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_broadcast-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -15,26 +14,30 @@ CONFIG_BT_HCI_RAW=y # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=n -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_ISO_BROADCASTER=y -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=n # ISO Broadcast Controller CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 + +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_ADV_RESERVE_MAX=n diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf index 56e80860f32..505b9d352ba 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_central-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -20,21 +19,24 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=n -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=y CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n CONFIG_BT_ISO_BROADCASTER=n CONFIG_BT_ISO_SYNC_RECEIVER=n +CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=n +CONFIG_BT_MAX_CONN=2 CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=n # ISO Streams CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -44,17 +46,21 @@ CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=n +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Controller with minimum ACL event length and unreserved scanning CONFIG_BT_CTLR_ADVANCED_FEATURES=y diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf index b72aaa624f1..05c9a9d3903 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_peripheral-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -20,21 +19,24 @@ CONFIG_BT_BUF_ACL_RX_SIZE=255 CONFIG_BT_BUF_ACL_TX_SIZE=251 CONFIG_BT_BUF_CMD_TX_SIZE=255 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=y -CONFIG_BT_PERIPHERAL=y CONFIG_BT_OBSERVER=n -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=n CONFIG_BT_PER_ADV_SYNC=n CONFIG_BT_ISO_BROADCASTER=n CONFIG_BT_ISO_SYNC_RECEIVER=n +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=y +CONFIG_BT_MAX_CONN=1 CONFIG_BT_ISO_CENTRAL=n CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -44,17 +46,21 @@ CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=n CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=16 -CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 CONFIG_BT_CTLR_ISOAL_SOURCES=2 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=12 +CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ADVANCED_FEATURES=y CONFIG_BT_CTLR_ADV_RESERVE_MAX=n diff --git a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf index cc3b5adecdd..51ca53e83f2 100644 --- a/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_ipc/nrf5340_cpunet_iso_receive-bt_ll_sw_split.conf @@ -5,7 +5,6 @@ CONFIG_ISR_STACK_SIZE=1024 CONFIG_IDLE_STACK_SIZE=256 CONFIG_MAIN_STACK_SIZE=512 CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=512 -CONFIG_IPC_SERVICE_BACKEND_RPMSG_WQ_STACK_SIZE=512 CONFIG_HEAP_MEM_POOL_SIZE=8192 CONFIG_BT=y @@ -15,22 +14,24 @@ CONFIG_BT_HCI_RAW=y # Host number of completed commands does not follow normal flow control. CONFIG_BT_BUF_CMD_TX_COUNT=10 -# Host +# Host and Controller common dependencies CONFIG_BT_BROADCASTER=n -CONFIG_BT_PERIPHERAL=n CONFIG_BT_OBSERVER=y -CONFIG_BT_CENTRAL=n CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_ISO_SYNC_RECEIVER=y -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_CENTRAL=n +CONFIG_BT_PERIPHERAL=n # ISO Receive Controller CONFIG_BT_LL_SW_SPLIT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191 CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_ISO_RX_BUFFERS=16 -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 diff --git a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf index 5885a1cfb28..a4054de0934 100644 --- a/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf @@ -10,8 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 -CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -20,7 +20,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -49,9 +53,16 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n +CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y @@ -83,31 +94,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y diff --git a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf index df974a21ff4..8a0f9d3364a 100644 --- a/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf +++ b/samples/bluetooth/hci_uart_3wire/overlay-all-bt_ll_sw_split.conf @@ -10,8 +10,8 @@ CONFIG_BT_EXT_ADV=y CONFIG_BT_PER_ADV=y CONFIG_BT_PER_ADV_SYNC=y CONFIG_BT_PER_ADV_SYNC_MAX=2 -CONFIG_BT_PERIPHERAL=y CONFIG_BT_CENTRAL=y +CONFIG_BT_PERIPHERAL=y # Broadcast and Connected ISO CONFIG_BT_ISO_BROADCASTER=y @@ -20,7 +20,11 @@ CONFIG_BT_ISO_CENTRAL=y CONFIG_BT_ISO_PERIPHERAL=y # ISO Streams -CONFIG_BT_ISO_MAX_CHAN=2 +CONFIG_BT_ISO_TX_MTU=310 +CONFIG_BT_ISO_RX_MTU=310 +CONFIG_BT_ISO_MAX_CHAN=4 +CONFIG_BT_ISO_TX_BUF_COUNT=1 +CONFIG_BT_ISO_RX_BUF_COUNT=1 # Controller CONFIG_BT_LL_SW_SPLIT=y @@ -48,9 +52,16 @@ CONFIG_BT_CTLR_ADV_DATA_BUF_MAX=6 # Increase the below to receive interleaved advertising chains CONFIG_BT_CTLR_SCAN_AUX_SET=1 +# CONFIG_BT_CTLR_SCAN_AUX_USE_CHAINS=y +# CONFIG_BT_CTLR_SCAN_AUX_CHAIN_COUNT=1 CONFIG_BT_CTLR_ADV_RESERVE_MAX=n +CONFIG_BT_CTLR_ADV_ISO_RESERVE_MAX=y +CONFIG_BT_CTLR_SYNC_ISO_RESERVE_MAX=n CONFIG_BT_CTLR_CENTRAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_RESERVE_MAX=n +CONFIG_BT_CTLR_PERIPHERAL_ISO_RESERVE_MAX=n +CONFIG_BT_CTLR_EVENT_OVERHEAD_RESERVE_MAX=y CONFIG_BT_CTLR_SLOT_RESERVATION_UPDATE=n CONFIG_BT_CTLR_SCAN_UNRESERVED=y CONFIG_BT_TICKER_NEXT_SLOT_GET_MATCH=y @@ -82,31 +93,42 @@ CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_ADV_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_SENDER=y CONFIG_BT_CTLR_ADV_ISO=y -CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 +CONFIG_BT_CTLR_ADV_ISO_SET=2 +CONFIG_BT_CTLR_ADV_ISO_STREAM_COUNT=4 CONFIG_BT_CTLR_ADV_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_ADV_ISO_PDU_LEN_MAX=247 # ISO Receive Controller CONFIG_BT_CTLR_ADV_EXT=y CONFIG_BT_CTLR_SYNC_PERIODIC=y CONFIG_BT_CTLR_SYNC_TRANSFER_RECEIVER=y CONFIG_BT_CTLR_SYNC_ISO=y -CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_SCAN_SYNC_ISO_SET=1 +CONFIG_BT_CTLR_SYNC_ISO_STREAM_COUNT=2 CONFIG_BT_CTLR_SYNC_ISO_STREAM_MAX=2 +CONFIG_BT_CTLR_SYNC_ISO_PDU_LEN_MAX=251 # ISO Connection Oriented CONFIG_BT_CTLR_CENTRAL_ISO=y CONFIG_BT_CTLR_PERIPHERAL_ISO=y +CONFIG_BT_CTLR_CONN_ISO_STREAMS=2 +CONFIG_BT_CTLR_CONN_ISO_GROUPS=1 +CONFIG_BT_CTLR_CONN_ISO_STREAMS_PER_GROUP=2 CONFIG_BT_CTLR_CONN_ISO_SDU_LEN_MAX=247 CONFIG_BT_CTLR_CONN_ISO_PDU_LEN_MAX=251 +CONFIG_BT_CTLR_CONN_ISO_LOW_LATENCY_POLICY=y # ISO Transmissions -CONFIG_BT_CTLR_ISO_TX_BUFFERS=8 +CONFIG_BT_CTLR_ISOAL_SOURCES=4 +CONFIG_BT_CTLR_ISO_TX_BUFFERS=18 CONFIG_BT_CTLR_ISO_TX_BUFFER_SIZE=255 -CONFIG_BT_CTLR_ISOAL_SOURCES=2 # ISO Receptions -CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 CONFIG_BT_CTLR_ISOAL_SINKS=2 +CONFIG_BT_CTLR_ISO_RX_BUFFERS=8 # Tx Power Dynamic Control CONFIG_BT_CTLR_TX_PWR_DYNAMIC_CONTROL=y + +# Ignore HCI ISO data Tx sequence numbers +# CONFIG_BT_CTLR_ISOAL_PSN_IGNORE=y From 45fbc31a3f0065f0c5a54ab3cf8cd2d38afdc8a3 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Tue, 22 Oct 2024 13:34:47 +0200 Subject: [PATCH 39/53] modules: hal_nordic: Require nrf-regtool 7.0.0 Some upcoming changes require this version. Signed-off-by: Carles Cufi --- modules/hal_nordic/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/hal_nordic/CMakeLists.txt b/modules/hal_nordic/CMakeLists.txt index a9384a03633..9be36d4998d 100644 --- a/modules/hal_nordic/CMakeLists.txt +++ b/modules/hal_nordic/CMakeLists.txt @@ -12,7 +12,7 @@ if(CONFIG_NRF_REGTOOL_GENERATE_UICR) list(APPEND nrf_regtool_components GENERATE:UICR) endif() if(DEFINED nrf_regtool_components) - find_package(nrf-regtool 5.6.0 REQUIRED + find_package(nrf-regtool 7.0.0 REQUIRED COMPONENTS ${nrf_regtool_components} PATHS ${CMAKE_CURRENT_LIST_DIR}/nrf-regtool NO_CMAKE_PATH From b5c53d6ac496f72133dd5b872580b2f802cae2ea Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 17:42:15 -0300 Subject: [PATCH 40/53] wifi: esp32: move kconfig to driver area Make sure all kconfig related to Wi-Fi is in its driver area. This commit also removes esp_timer_init() call from Wi-Fi driver. Signed-off-by: Sylvio Alves --- drivers/wifi/esp32/Kconfig.esp32 | 94 ++++++++++++++++++++++++++- drivers/wifi/esp32/src/esp_wifi_drv.c | 2 - soc/espressif/common/Kconfig.wifi | 51 --------------- 3 files changed, 93 insertions(+), 54 deletions(-) delete mode 100644 soc/espressif/common/Kconfig.wifi diff --git a/drivers/wifi/esp32/Kconfig.esp32 b/drivers/wifi/esp32/Kconfig.esp32 index f6b37899a8f..6732bd5ff7e 100644 --- a/drivers/wifi/esp32/Kconfig.esp32 +++ b/drivers/wifi/esp32/Kconfig.esp32 @@ -175,6 +175,39 @@ config ESP32_WIFI_DYNAMIC_TX_BUFFER_NUM than WiFi layer can transmit. In these cases, we may run out of TX buffers. +choice ESP32_WIFI_MGMT_RX_BUFFER + prompt "Type of WiFi RX MGMT buffers" + default ESP32_WIFI_STATIC_RX_MGMT_BUFFER + help + Select type of WiFi RX MGMT buffers: + + If "Static" is selected, WiFi RX MGMT buffers are allocated when WiFi is initialized and released + when WiFi is de-initialized. The size of each static RX MGMT buffer is fixed to about 500 Bytes. + + If "Dynamic" is selected, each WiFi RX MGMT buffer is allocated as needed when a MGMT data frame is + received. The MGMT buffer is freed after the MGMT data frame has been processed by the WiFi driver. + + config ESP32_WIFI_STATIC_RX_MGMT_BUFFER + bool "Static" + config ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER + bool "Dynamic" +endchoice + +config ESP32_WIFI_DYNAMIC_RX_MGMT_BUF + int + default 0 if ESP32_WIFI_STATIC_RX_MGMT_BUFFER + default 1 if ESP32_WIFI_DYNAMIC_RX_MGMT_BUFFER + +config ESP32_WIFI_RX_MGMT_BUF_NUM_DEF + int "Max number of WiFi RX MGMT buffers" + range 1 10 + default 5 + help + Set the number of WiFi RX_MGMT buffers. + + For Management buffers, the number of dynamic and static management buffers is the same. + In order to prevent memory fragmentation, the management buffer type should be set to static first. + config ESP32_WIFI_CSI_ENABLED bool "WiFi CSI(Channel State Information)" default n @@ -234,6 +267,13 @@ config ESP32_WIFI_AMSDU_TX_ENABLED help Select this option to enable AMSDU TX feature +config ESP32_WIFI_MGMT_SBUF_NUM + int "WiFi mgmt short buffer number" + range 6 32 + default 32 + help + Set the number of WiFi management short buffer. + config ESP32_WIFI_IRAM_OPT bool "WiFi IRAM speed optimization" default n if (BT && ESP_SPIRAM && SOC_SERIES_ESP32) @@ -251,10 +291,62 @@ config ESP32_WIFI_RX_IRAM_OPT When this option is disabled, more than 17Kbytes of IRAM memory will be saved but Wi-Fi performance will be reduced. +config ESP32_WIFI_MAX_THREAD_PRIORITY + int "Maximum work queue thread priority" + default 7 + help + Maximum priority of thread used for processing driver work queue items. + +config ESP32_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME + int "Minimum active time" + range 8 60 + default 50 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station enters the active state, + it will work for at least ESP_WIFI_SLP_DEFAULT_MIN_ACTIVE_TIME. If a data packet is received or sent + during this period, the time will be refreshed. If the time is up, but the station still has packets + to receive or send, the time will also be refreshed. unit: milliseconds. + +config ESP32_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME + int "Maximum keep alive time" + range 10 60 + default 10 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. If no packet has been + sent within ESP_WIFI_SLP_DEFAULT_MAX_ACTIVE_TIME, a null data packet will be sent + to maintain the connection with the AP. unit: seconds. + +config ESP32_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME + int "Minimum wait broadcast data time" + range 10 30 + default 15 + help + Only for station in WIFI_PS_MIN_MODEM or WIFI_PS_MAX_MODEM. When the station knows through the beacon + that AP will send broadcast packet, it will wait for ESP_WIFI_SLP_DEFAULT_WAIT_BROADCAST_DATA_TIME + before entering the sleep process. If a broadcast packet is received with more data bits, the time + will refreshed. unit: milliseconds. + +choice ESP_WIFI_HEAP + prompt "Wifi adapter heap in use" + default ESP_WIFI_HEAP_RUNTIME + + config ESP_WIFI_HEAP_RUNTIME + bool "Wifi adapter use ESP runtime heap" + depends on ESP_HEAP_RUNTIME + + config ESP_WIFI_HEAP_SPIRAM + bool "Wifi adapter use SPIRAM heap" + depends on ESP_SPIRAM + + config ESP_WIFI_HEAP_SYSTEM + bool "Wifi adapter use system heap" + +endchoice # ESP_WIFI_HEAP + config ESP32_WIFI_FTM_ENABLE bool "WiFi FTM" default n - depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 + depends on SOC_SERIES_ESP32C2 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 || SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 help Enable feature Fine Timing Measurement for calculating WiFi Round-Trip-Time (RTT). diff --git a/drivers/wifi/esp32/src/esp_wifi_drv.c b/drivers/wifi/esp32/src/esp_wifi_drv.c index fb8dd8577f0..56f8b92e51e 100644 --- a/drivers/wifi/esp32/src/esp_wifi_drv.c +++ b/drivers/wifi/esp32/src/esp_wifi_drv.c @@ -871,7 +871,6 @@ static int esp32_wifi_dev_init(const struct device *dev) adc2_init_code_calibration(); #endif /* CONFIG_SOC_SERIES_ESP32S2 || CONFIG_SOC_SERIES_ESP32C3 */ - esp_timer_init(); wifi_init_config_t config = WIFI_INIT_CONFIG_DEFAULT(); esp_err_t ret = esp_wifi_init(&config); @@ -883,7 +882,6 @@ static int esp32_wifi_dev_init(const struct device *dev) LOG_ERR("Unable to initialize the Wi-Fi: %d", ret); return -EIO; } - if (IS_ENABLED(CONFIG_ESP32_WIFI_STA_AUTO_DHCPV4)) { net_mgmt_init_event_callback(&esp32_dhcp_cb, wifi_event_handler, DHCPV4_MASK); net_mgmt_add_event_callback(&esp32_dhcp_cb); diff --git a/soc/espressif/common/Kconfig.wifi b/soc/espressif/common/Kconfig.wifi deleted file mode 100644 index a52cff48583..00000000000 --- a/soc/espressif/common/Kconfig.wifi +++ /dev/null @@ -1,51 +0,0 @@ -# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 - -if SOC_FAMILY_ESPRESSIF_ESP32 - -menu "ESP32 Wi-Fi config" - -config ESP_WIFI_MAX_THREAD_PRIORITY - int "Maximum work queue thread priority" - default 7 - help - Maximum priority of thread used for processing driver work queue items. - -config ESP32_WIFI_TIMER_TASK_PRIO - int "Wi-Fi timer task priority" - default 2 - range 0 ESP_WIFI_MAX_THREAD_PRIORITY - - -config ESP32_PHY_MAX_WIFI_TX_POWER - int "Max Wi-Fi/BLE TX power (dBm)" - range 10 20 - default 20 - help - Set maximum transmit power for Wi-Fi radio. Actual transmit power for high - data rates may be lower than this setting. - -config ESP32_PHY_MAX_TX_POWER - int - default ESP32_PHY_MAX_WIFI_TX_POWER - -choice ESP_WIFI_HEAP - prompt "Wifi adapter heap in use" - default ESP_WIFI_HEAP_RUNTIME - - config ESP_WIFI_HEAP_RUNTIME - bool "Wifi adapter use ESP runtime heap" - depends on ESP_HEAP_RUNTIME - - config ESP_WIFI_HEAP_SPIRAM - bool "Wifi adapter use SPIRAM heap" - depends on ESP_SPIRAM - - config ESP_WIFI_HEAP_SYSTEM - bool "Wifi adapter use system heap" - -endchoice # ESP_WIFI_HEAP - -endmenu # ESP32 Wi-Fi config - -endif # SOC_FAMILY_ESPRESSIF_ESP32 From a70741bc82d70c80d6fd2d9a93316680ff30b354 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 18:51:09 -0300 Subject: [PATCH 41/53] west.yml: update hal_espressif to latest version - Update GDMA and ADC drivers and remove deprecated entries. - Rebased hal_espressif to latest bump sync. - Added ESP Timer and Radio common config values Signed-off-by: Sylvio Alves --- drivers/adc/adc_esp32.c | 12 ++++++------ drivers/dma/dma_esp32_gdma.c | 4 ---- soc/espressif/common/Kconfig | 27 ++++++++++++++++++++++++++- soc/espressif/common/Kconfig.esptool | 2 +- west.yml | 2 +- 5 files changed, 34 insertions(+), 13 deletions(-) diff --git a/drivers/adc/adc_esp32.c b/drivers/adc/adc_esp32.c index 740719901b3..1740d96b0cc 100644 --- a/drivers/adc/adc_esp32.c +++ b/drivers/adc/adc_esp32.c @@ -41,7 +41,7 @@ LOG_MODULE_REGISTER(adc_esp32, CONFIG_ADC_LOG_LEVEL); * clip the value instead of yet another correction. The IDF implementation * for ESP32-S2 is doing it, so we copy that approach in Zephyr driver */ -#define ADC_CLIP_MVOLT_11DB 2550 +#define ADC_CLIP_MVOLT_12DB 2550 #elif CONFIG_SOC_SERIES_ESP32S3 #define ADC_CALI_SCHEME ESP_ADC_CAL_VAL_EFUSE_TP_FIT #else @@ -95,7 +95,7 @@ static inline int gain_to_atten(enum adc_gain gain, adc_atten_t *atten) *atten = ADC_ATTEN_DB_6; break; case ADC_GAIN_1_4: - *atten = ADC_ATTEN_DB_11; + *atten = ADC_ATTEN_DB_12; break; default: return -ENOTSUP; @@ -117,7 +117,7 @@ static void atten_to_gain(adc_atten_t atten, uint32_t *val_mv) case ADC_ATTEN_DB_6: *val_mv = *val_mv >> 1; /* 1/ADC_GAIN_1_2 */ break; - case ADC_ATTEN_DB_11: + case ADC_ATTEN_DB_12: *val_mv = *val_mv / 4; /* 1/ADC_GAIN_1_4 */ break; case ADC_ATTEN_DB_0: /* 1/ADC_GAIN_1 */ @@ -458,9 +458,9 @@ static int adc_esp32_read(const struct device *dev, const struct adc_sequence *s cal = cal_mv = esp_adc_cal_raw_to_voltage(reading, &data->chars[channel_id]); #if CONFIG_SOC_SERIES_ESP32 - if (data->attenuation[channel_id] == ADC_ATTEN_DB_11) { - if (cal > ADC_CLIP_MVOLT_11DB) { - cal = ADC_CLIP_MVOLT_11DB; + if (data->attenuation[channel_id] == ADC_ATTEN_DB_12) { + if (cal > ADC_CLIP_MVOLT_12DB) { + cal = ADC_CLIP_MVOLT_12DB; } } #endif /* CONFIG_SOC_SERIES_ESP32 */ diff --git a/drivers/dma/dma_esp32_gdma.c b/drivers/dma/dma_esp32_gdma.c index cc57f419efd..7fb5da72b43 100644 --- a/drivers/dma/dma_esp32_gdma.c +++ b/drivers/dma/dma_esp32_gdma.c @@ -33,11 +33,7 @@ LOG_MODULE_REGISTER(dma_esp32_gdma, CONFIG_DMA_LOG_LEVEL); #define ISR_HANDLER intr_handler_t #endif -#if defined(CONFIG_SOC_SERIES_ESP32C6) -#define DMA_MAX_CHANNEL SOC_GDMA_PAIRS_PER_GROUP_MAX -#else #define DMA_MAX_CHANNEL SOC_GDMA_PAIRS_PER_GROUP -#endif #define ESP_DMA_M2M_ON 0 #define ESP_DMA_M2M_OFF 1 diff --git a/soc/espressif/common/Kconfig b/soc/espressif/common/Kconfig index 05ba9901f6e..ccb37c6fff7 100644 --- a/soc/espressif/common/Kconfig +++ b/soc/espressif/common/Kconfig @@ -32,7 +32,32 @@ config ESP_HEAP_RUNTIME ending by a last memory location that can be safely accesed (depending on a boot mode). This is a memory pool used in runtime to create a new heap memory. +config ESP32_TIMER_TASK_STACK_SIZE + int "Stack size of the high resolution ESP Timer" + default 4096 + help + Set the stack size for the internal high resolution ESP Timer + used in Wi-Fi and BLE peripherals. + +config ESP32_TIMER_TASK_PRIO + int "Task priority of the high resolution ESP Timer" + default 3 + help + Set the task priority for the internal high resolution ESP Timer + used in Wi-Fi and BLE peripherals. + +if (BT_ESP32 || WIFI_ESP32) + +config ESP32_PHY_MAX_TX_POWER + int "Max Wi-Fi/BLE TX power (dBm)" + range 10 20 + default 20 + help + Set maximum transmit power for Wi-Fi radio. Actual transmit power for high + data rates may be lower than this setting. + +endif + rsource "Kconfig.spiram" rsource "Kconfig.esptool" rsource "Kconfig.flash" -rsource "Kconfig.wifi" diff --git a/soc/espressif/common/Kconfig.esptool b/soc/espressif/common/Kconfig.esptool index 5235a207f84..b4844371971 100644 --- a/soc/espressif/common/Kconfig.esptool +++ b/soc/espressif/common/Kconfig.esptool @@ -114,7 +114,7 @@ endchoice # ESPTOOLPY_FLASHFREQ config ESPTOOLPY_FLASHFREQ_80M_DEFAULT bool - default y if SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 || SOC_SERIES_ESP32C3 + default y if SOC_SERIES_ESP32S2 || SOC_SERIES_ESP32S3 || SOC_SERIES_ESP32C3 || SOC_SERIES_ESP32C6 help This is an invisible item, used to define the targets that defaults to use 80MHz Flash SPI speed. diff --git a/west.yml b/west.yml index d3a1d5f5314..5d50af43600 100644 --- a/west.yml +++ b/west.yml @@ -157,7 +157,7 @@ manifest: groups: - hal - name: hal_espressif - revision: 09676fc39bde2c38d6cd40912875cf78ee76126e + revision: 0f1874284f5dee0d49cb23f44f756e7be404e7b7 path: modules/hal/espressif west-commands: west/west-commands.yml groups: From 685c6e42b89c476940aff2962108f5e6ff0b3562 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Sun, 29 Sep 2024 18:53:16 -0300 Subject: [PATCH 42/53] driver: ble: add custom espressif kconfig Adds ESP32 custom configurations for BLE driver. Signed-off-by: Sylvio Alves --- drivers/bluetooth/hci/Kconfig.esp32 | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/drivers/bluetooth/hci/Kconfig.esp32 b/drivers/bluetooth/hci/Kconfig.esp32 index cea379b046b..ad7a53d5de3 100644 --- a/drivers/bluetooth/hci/Kconfig.esp32 +++ b/drivers/bluetooth/hci/Kconfig.esp32 @@ -1,5 +1,4 @@ -# Copyright (c) 2024 Espressif Systems (Shanghai) Co., Ltd. -# SPDX-License-Identifier: Apache-2.0 +# Copyright 2024 Espressif Systems (Shanghai) PTE LTD if BT_ESP32 @@ -16,4 +15,12 @@ choice ESP_BT_HEAP endchoice # ESP_BT_HEAP -endif +config ESP32_BT_CONTROLLER_STACK_SIZE + int "Bluetooth controller stack size" + default 4096 + +config ESP32_BT_CONTROLLER_TASK_PRIO + int "Bluetooth controller task priority level" + default 2 + +endif # BT_ESP32 From 876a893018b64fe0cae1883e9e25528122b73efb Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:34:48 -0300 Subject: [PATCH 43/53] soc: esp32: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32/default.ld | 26 ++++++++++++++------------ soc/espressif/esp32/mcuboot.ld | 4 ---- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/soc/espressif/esp32/default.ld b/soc/espressif/esp32/default.ld index 593c895d61e..86a25901d03 100644 --- a/soc/espressif/esp32/default.ld +++ b/soc/espressif/esp32/default.ld @@ -285,16 +285,16 @@ SECTIONS *libc.a:*(.literal .text .literal.* .text.*) *libphy.a:( .phyiram .phyiram.*) *libgcov.a:(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_psram_impl_quad.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_psram_impl_octal.*(.literal .literal.* .text .text.*) /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.literal .literal.* .text .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_esp32.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_hal_esp32.*(.literal .text .literal.* .text.*) *libzephyr.a:ledc_hal_iram.*(.literal .literal.* .text .text.*) *libzephyr.a:i2c_hal_iram.*(.literal .literal.* .text .text.*) *libzephyr.a:wdt_hal_iram.*(.literal .literal.* .text .text.*) @@ -325,7 +325,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -366,6 +366,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.literal .literal.* .text .text.*) @@ -376,8 +377,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) /* [mapping:esp_wifi] */ *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) @@ -520,20 +521,20 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.*) *libzephyr.a:loader.*(.rodata .rodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.*) *libzephyr.a:esp_memory_utils.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) /* [mapping:esp_psram] */ *libzephyr.a:mmu_psram_flash.*(.rodata .rodata.*) - *libzephyr.a:esp_psram_impl_octal.*(.rodata .rodata.*) *libzephyr.a:esp_psram_impl_quad.*(.rodata .rodata.*) /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hal_iram.*(.rodata .rodata.*) *libzephyr.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.*) - *libzephyr.a:cache_hal.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) + *libzephyr.a:cache_esp32.*(.rodata .rodata.*) + *libzephyr.a:cache_hal_esp32.*(.rodata .rodata.*) *libzephyr.a:ledc_hal_iram.*(.rodata .rodata.*) *libzephyr.a:i2c_hal_iram.*(.rodata .rodata.*) *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.*) @@ -564,7 +565,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.rodata .rodata.*) @@ -609,6 +610,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.*) *libzephyr.a:esp_rom_wdt.*(.rodata .rodata.*) + *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.*) KEEP(*(.jcr)) *(.dram1 .dram1.*) @@ -855,8 +857,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #ifndef CONFIG_ESP32_WIFI_IRAM_OPT - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif #ifndef CONFIG_ESP32_WIFI_RX_IRAM_OPT diff --git a/soc/espressif/esp32/mcuboot.ld b/soc/espressif/esp32/mcuboot.ld index 8fb1c25decc..b880e2c7b34 100644 --- a/soc/espressif/esp32/mcuboot.ld +++ b/soc/espressif/esp32/mcuboot.ld @@ -54,7 +54,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_esp32.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -65,9 +64,6 @@ SECTIONS *libkernel.a:device.*(.literal .text .literal.* .text.*) *libkernel.a:timeout.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 412921b59438ee48625b5dd951d20825ac73a425 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:36:00 -0300 Subject: [PATCH 44/53] soc: esp32c2: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c2/default.ld | 10 ++++------ soc/espressif/esp32c2/mcuboot.ld | 4 ---- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/soc/espressif/esp32c2/default.ld b/soc/espressif/esp32c2/default.ld index 1b6ec0e6377..1805d45a472 100644 --- a/soc/espressif/esp32c2/default.ld +++ b/soc/espressif/esp32c2/default.ld @@ -178,7 +178,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c2_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -276,8 +275,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -421,7 +420,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -616,8 +614,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c2/mcuboot.ld b/soc/espressif/esp32c2/mcuboot.ld index 9bbbad889a5..54aff6076c4 100644 --- a/soc/espressif/esp32c2/mcuboot.ld +++ b/soc/espressif/esp32c2/mcuboot.ld @@ -50,7 +50,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -59,9 +58,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From be9574e48266552090881f206bdf58d05532d4ea Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:36:25 -0300 Subject: [PATCH 45/53] soc: esp32c3: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c3/default.ld | 17 ++++++----------- soc/espressif/esp32c3/mcuboot.ld | 4 ---- 2 files changed, 6 insertions(+), 15 deletions(-) diff --git a/soc/espressif/esp32c3/default.ld b/soc/espressif/esp32c3/default.ld index 042e2068366..50f41b6cd99 100644 --- a/soc/espressif/esp32c3/default.ld +++ b/soc/espressif/esp32c3/default.ld @@ -238,7 +238,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c3_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -293,7 +292,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -336,8 +335,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -381,8 +380,6 @@ SECTIONS *libzephyr.a:bootloader_console.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_image_format.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops_esp32c3.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encrypt.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_partitions.*(.literal .text .literal.* .text.*) @@ -481,7 +478,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -521,7 +517,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_mm] */ @@ -580,7 +576,6 @@ SECTIONS *libzephyr.a:esp_clk.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_mmap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:flash_ops_esp32c3.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_gpio_reserve.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal.*(.rodata .rodata.* .srodata .srodata.*) @@ -682,8 +677,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c3/mcuboot.ld b/soc/espressif/esp32c3/mcuboot.ld index 44f075893e5..cbc727faf0b 100644 --- a/soc/espressif/esp32c3/mcuboot.ld +++ b/soc/espressif/esp32c3/mcuboot.ld @@ -50,7 +50,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -59,9 +58,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From a1a6e8a1a37a6d08a3214b2701f216177a46981d Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:37:12 -0300 Subject: [PATCH 46/53] soc: esp32c6: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32c6/Kconfig | 12 ---- soc/espressif/esp32c6/default.ld | 111 ++++++++++++++++++++++--------- soc/espressif/esp32c6/mcuboot.ld | 4 -- 3 files changed, 81 insertions(+), 46 deletions(-) diff --git a/soc/espressif/esp32c6/Kconfig b/soc/espressif/esp32c6/Kconfig index 7c5c00e4777..88963c36cd8 100644 --- a/soc/espressif/esp32c6/Kconfig +++ b/soc/espressif/esp32c6/Kconfig @@ -18,18 +18,6 @@ config SOC_SERIES_ESP32C6 if SOC_SERIES_ESP32C6 -config ESP32_PHY_MAX_WIFI_TX_POWER - int "Max WiFi TX power (dBm)" - range 10 20 - default 20 - help - Set maximum transmit power for WiFi radio. Actual transmit power for high - data rates may be lower than this setting. - -config ESP32_PHY_MAX_TX_POWER - int - default ESP32_PHY_MAX_WIFI_TX_POWER - config MAC_BB_PD bool "Power down MAC and baseband of Wi-Fi and Bluetooth when PHY is disabled" depends on SOC_SERIES_ESP32C6 && TICKLESS_KERNEL diff --git a/soc/espressif/esp32c6/default.ld b/soc/espressif/esp32c6/default.ld index 514c7ef058b..9cd69db8e3a 100644 --- a/soc/espressif/esp32c6/default.ld +++ b/soc/espressif/esp32c6/default.ld @@ -68,9 +68,9 @@ MEMORY mmap0_0_seg (R): org = CACHED_ORG, len = CACHED_SIZE lp_ram_seg(RW): org = LPSRAM_IRAM_START, - len = 0x4000 - RESERVE_RTC_MEM + len = 0x2000 - RESERVE_RTC_MEM - lp_reserved_seg(RW) : org = LPSRAM_IRAM_START + 0x4000 - RESERVE_RTC_MEM, + lp_reserved_seg(RW) : org = LPSRAM_IRAM_START + 0x2000 - RESERVE_RTC_MEM, len = RESERVE_RTC_MEM #ifdef CONFIG_GEN_ISR_TABLES @@ -145,35 +145,65 @@ SECTIONS .rtc.text : { . = ALIGN(4); + _rtc_fast_start = ABSOLUTE(.); + _rtc_text_start = ABSOLUTE(.); + *(.rtc.entry.text) *(.rtc.literal .rtc.text) *rtc_wake_stub*.o(.literal .text .literal.* .text.*) + . = ALIGN(4); + + _rtc_text_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) - /* This section is required to skip rtc.text area because the text and - * data segments reflect the same address space on different buses. + /* This section located in RTC FAST Memory area. + * It holds data marked with RTC_FAST_ATTR attribute. + * See the file "esp_attr.h" for more information. */ - .rtc.dummy (NOLOAD): + .rtc.force_fast : { - . = SIZEOF(.rtc.text); - } GROUP_LINK_IN(rtc_iram_seg) + . = ALIGN(4); + _rtc_force_fast_start = ABSOLUTE(.); + + *(.rtc.force_fast .rtc.force_fast.*) + . = ALIGN(4) ; + _rtc_force_fast_end = ABSOLUTE(.); + } GROUP_DATA_LINK_IN(rtc_data_seg, ROMABLE_REGION) + /* RTC data section holds data marked with + * RTC_DATA_ATTR, RTC_RODATA_ATTR attributes. + */ .rtc.data : { _rtc_data_start = ABSOLUTE(.); *(.rtc.data) *(.rtc.rodata) - *rtc_wake_stub*.o(.data .rodata .data.* .rodata.* .bss .bss.*) _rtc_data_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) .rtc.bss (NOLOAD) : { _rtc_bss_start = ABSOLUTE(.); - *rtc_wake_stub*.o(.bss .bss.*) - *rtc_wake_stub*.o(COMMON) + + *(.rtc.data) + *(.rtc.rodata) + _rtc_bss_end = ABSOLUTE(.); } GROUP_LINK_IN(rtc_iram_seg) + /* This section holds data that should not be initialized at power up + * and will be retained during deep sleep. + * User data marked with RTC_NOINIT_ATTR will be placed + * into this section. See the file "esp_attr.h" for more information. + */ + .rtc_noinit (NOLOAD): + { + . = ALIGN(4); + _rtc_noinit_start = ABSOLUTE(.); + *(.rtc_noinit .rtc_noinit.*) + . = ALIGN(4) ; + _rtc_noinit_end = ABSOLUTE(.); + } GROUP_LINK_IN(rtc_slow_seg) + /* This section located in RTC SLOW Memory area. * It holds data marked with RTC_SLOW_ATTR attribute. * See the file "esp_attr.h" for more information. @@ -183,12 +213,33 @@ SECTIONS . = ALIGN(4); _rtc_force_slow_start = ABSOLUTE(.); *(.rtc.force_slow .rtc.force_slow.*) - . = ALIGN(4) ; + . = ALIGN(4); _rtc_force_slow_end = ABSOLUTE(.); - } > rtc_slow_seg + } GROUP_DATA_LINK_IN(rtc_slow_seg, ROMABLE_REGION) + + /** + * This section holds RTC data that should have fixed addresses. + * The data are not initialized at power-up and are retained during deep sleep. + */ + .rtc_reserved (NOLOAD): + { + . = ALIGN(4); + _rtc_reserved_start = ABSOLUTE(.); + /* New data can only be added here to ensure existing data are not moved. + Because data have adhered to the end of the segment and code is relied on it. + >> put new data here << */ + + *(.rtc_timer_data_in_rtc_mem .rtc_timer_data_in_rtc_mem.*) + KEEP(*(.bootloader_data_rtc_mem .bootloader_data_rtc_mem.*)) + _rtc_reserved_end = ABSOLUTE(.); + } GROUP_LINK_IN(rtc_reserved_seg) - /* Get size of rtc slow data */ + /* Get size of rtc slow data based on rtc_data_location alias */ _rtc_slow_length = (_rtc_force_slow_end - _rtc_data_start); + _rtc_fast_length = (_rtc_force_fast_end - _rtc_fast_start); + + ASSERT((_rtc_slow_length <= LENGTH(rtc_slow_seg)), "RTC_SLOW segment data does not fit.") + ASSERT((_rtc_fast_length <= LENGTH(rtc_data_seg)), "RTC_FAST segment data does not fit.") /* --- END OF RTC --- */ @@ -229,7 +280,6 @@ SECTIONS *libkernel.a:(.literal .text .literal.* .text.*) *libgcc.a:lib2funcs.*(.literal .text .literal.* .text.*) *libdrivers__flash.a:flash_esp32.*(.literal .text .literal.* .text.*) - *libzephyr.a:spi_flash_rom_patch.*(.literal .text .literal.* .text.*) *libzephyr.a:log_noos.*(.literal .text .literal.* .text.*) *libdrivers__timer.a:esp32c6_sys_timer.*(.literal .text .literal.* .text.*) *libzephyr.a:log_core.*(.literal .text .literal.* .text.*) @@ -259,6 +309,8 @@ SECTIONS *libzephyr.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:systimer_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:spi_flash_hal_gpspi.*(.literal .literal.* .text .text.*) + *libzephyr.a:modem_clock_hal.*(.literal .literal.* .text .text.*) + *libzephyr.a:modem_clock.*(.literal .literal.* .text .text.*) /* [mapping:soc] */ *libzephyr.a:lldesc.*(.literal .literal.* .text .text.*) @@ -284,7 +336,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:reset_reason.*(.literal .literal.* .text .text.*) @@ -303,6 +355,7 @@ SECTIONS *(.literal.rtc_vddsdio_set_config .text.rtc_vddsdio_set_config) *libzephyr.a:esp_memory_utils.*(.literal .literal.* .text .text.*) *libzephyr.a:pmu_init.*(.literal .literal.* .text .text.*) + *libzephyr.a:pmu_param.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk_init.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_time.*(.literal .literal.* .text .text.*) @@ -316,17 +369,14 @@ SECTIONS *(.literal.GPIO_HOLD_MASK .text.GPIO_HOLD_MASK) /* [mapping:esp_rom] */ - *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_crc.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_sys.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_uart.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) - *libzephyr.a:esp_rom_regi2c_esp32c6.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_hp_regi2c_esp32c6.*(.literal .literal.* .text .text.*) *libzephyr.a:efuse_hal.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ @@ -338,9 +388,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) /* [mapping:esp_wifi] */ *(.literal.wifi_clock_enable_wrapper .text.wifi_clock_enable_wrapper) @@ -383,7 +432,6 @@ SECTIONS *libzephyr.a:esp_image_format.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_ops.*(.literal .text .literal.* .text.*) - *libzephyr.a:flash_ops_esp32c6.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encrypt.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_encryption_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_partitions.*(.literal .text .literal.* .text.*) @@ -402,6 +450,8 @@ SECTIONS *libzephyr.a:secure_boot_secure_features.*(.literal .text .literal.* .text.*) *libzephyr.a:secure_boot_signatures_bootloader.*(.literal .text .literal.* .text.*) + *libzephyr.a:regi2c_ctrl.*(.literal .text .literal.* .text.*) + *libzephyr.a:cpu_region_protect.*(.literal .text .literal.* .text.*) /* TODO: optimise */ @@ -474,7 +524,6 @@ SECTIONS *libzephyr.a:log_output.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__flash.a:flash_esp32.*(.rodata .rodata.* .srodata .srodata.*) *libdrivers__serial.a:uart_esp32.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_rom_patch.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:periph_ctrl.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:loader.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:cache_utils.*(.rodata .rodata.* .srodata .srodata.*) @@ -489,6 +538,8 @@ SECTIONS *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:systimer_hal.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal_gpspi.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:modem_clock_hal.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:modem_clock.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:soc] */ *libzephyr.a:lldesc.*(.rodata .rodata.* .srodata .srodata.*) @@ -514,7 +565,7 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_mm] */ @@ -538,6 +589,7 @@ SECTIONS *libzephyr.a:mspi_timing_tuning.*(.rodata .rodata.* .srodata .srodata.*) *(.rodata.sar_periph_ctrl_power_enable) *libzephyr.a:pmu_init.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:pmu_param.*(.rodata .rodata.* .srodata .srodata.*) /* [mapping:esp_system] */ *libzephyr.a:reset_reason.*(.rodata .rodata.*) @@ -551,7 +603,7 @@ SECTIONS *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:esp_rom_regi2c_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) + *libzephyr.a:esp_rom_hp_regi2c_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:efuse_hal.*(.rodata .rodata.* .srodata .srodata.*) . = ALIGN(4); @@ -585,7 +637,6 @@ SECTIONS *libzephyr.a:esp_clk.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_mmap.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:flash_ops.*(.rodata .rodata.* .srodata .srodata.*) - *libzephyr.a:flash_ops_esp32c6.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:esp_gpio_reserve.*(.rodata .rodata.* .srodata .srodata.*) *libzephyr.a:spi_flash_hal.*(.rodata .rodata.* .srodata .srodata.*) @@ -686,8 +737,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) #endif /* CONFIG_ESP32_WIFI_IRAM_OPT */ #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32c6/mcuboot.ld b/soc/espressif/esp32c6/mcuboot.ld index a96d80471ac..8c76315ffe3 100644 --- a/soc/espressif/esp32c6/mcuboot.ld +++ b/soc/espressif/esp32c6/mcuboot.ld @@ -48,7 +48,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -57,9 +56,6 @@ SECTIONS *libkernel.a:kheap.*(.literal .text .literal.* .text.*) *libkernel.a:mempool.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 279f4b8aecdbaf50964b206d5d7b20f04a5276ed Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:37:55 -0300 Subject: [PATCH 47/53] soc: esp32s2: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s2/default.ld | 12 ++++++++---- soc/espressif/esp32s2/mcuboot.ld | 3 --- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/soc/espressif/esp32s2/default.ld b/soc/espressif/esp32s2/default.ld index f79ea789a08..f3dfcac5015 100644 --- a/soc/espressif/esp32s2/default.ld +++ b/soc/espressif/esp32s2/default.ld @@ -362,6 +362,7 @@ SECTIONS /* [mapping:hal] */ *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) *libzephyr.a:ledc_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:i2c_hal_iram.*(.literal .text .literal.* .text.*) *libzephyr.a:wdt_hal_iram.*(.literal .text .literal.* .text.*) @@ -395,6 +396,7 @@ SECTIONS *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -438,8 +440,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -603,6 +605,7 @@ SECTIONS *libzephyr.a:spi_flash_hal_iram.*(.rodata .rodata.*) *libzephyr.a:spi_flash_encrypt_hal_iram.*(.rodata .rodata.*) *libzephyr.a:cache_hal.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) *libzephyr.a:ledc_hal_iram.*(.rodata .rodata.*) *libzephyr.a:i2c_hal_iram.*(.rodata .rodata.*) *libzephyr.a:wdt_hal_iram.*(.rodata .rodata.*) @@ -634,6 +637,7 @@ SECTIONS *libzephyr.a:spi_flash_wrap.*(.rodata .rodata.*) *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.* .sdata2 .sdata2.* .srodata .srodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.*) /* [mapping:esp_mm] */ @@ -833,8 +837,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif diff --git a/soc/espressif/esp32s2/mcuboot.ld b/soc/espressif/esp32s2/mcuboot.ld index 23a15b858b5..bf14afeb6a3 100644 --- a/soc/espressif/esp32s2/mcuboot.ld +++ b/soc/espressif/esp32s2/mcuboot.ld @@ -54,7 +54,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) *libzephyr.a:heap.*(.literal .text .literal.* .text.*) @@ -68,8 +67,6 @@ SECTIONS *libzephyr.a:rtc_clk.*(.literal .literal.* .text .text.*) *libzephyr.a:rtc_clk_init.*(.literal .literal.* .text .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) *(.literal.esp_intr_disable .literal.esp_intr_disable.* .text.esp_intr_disable .text.esp_intr_disable.*) *(.literal.default_intr_handler .text.default_intr_handler .iram1.*.default_intr_handler) *(.literal.esp_log_timestamp .text.esp_log_timestamp) From 05b462a907331217a3e04c3f51be50dc15a2e20b Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Fri, 25 Oct 2024 09:11:43 -0300 Subject: [PATCH 48/53] soc: esp32s2: add cache mode disabled option Update data cache mode to work when data cache is set to 0KB. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s2/soc_cache.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/soc/espressif/esp32s2/soc_cache.c b/soc/espressif/esp32s2/soc_cache.c index 658d0a5988a..8c4e45669bf 100644 --- a/soc/espressif/esp32s2/soc_cache.c +++ b/soc/espressif/esp32s2/soc_cache.c @@ -24,7 +24,9 @@ /* * Data Cache definitions */ -#if defined(CONFIG_ESP32S2_DATA_CACHE_8KB) +#if defined(CONFIG_ESP32S2_DATA_CACHE_0KB) +#define ESP32S2_DCACHE_SIZE CACHE_SIZE_0KB +#elif defined(CONFIG_ESP32S2_DATA_CACHE_8KB) #define ESP32S2_DCACHE_SIZE CACHE_SIZE_8KB #else #define ESP32S2_DCACHE_SIZE CACHE_SIZE_16KB @@ -66,7 +68,10 @@ void IRAM_ATTR esp_config_data_cache_mode(void) cache_line_size_t cache_line_size; #if CONFIG_ESP32S2_INSTRUCTION_CACHE_8KB -#if CONFIG_ESP32S2_DATA_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_0KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID, + CACHE_MEMORY_INVALID); +#elif CONFIG_ESP32S2_DATA_CACHE_8KB esp_rom_Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID, CACHE_MEMORY_INVALID); #else @@ -74,7 +79,10 @@ void IRAM_ATTR esp_config_data_cache_mode(void) CACHE_MEMORY_DCACHE_HIGH, CACHE_MEMORY_INVALID); #endif #else -#if CONFIG_ESP32S2_DATA_CACHE_8KB +#if CONFIG_ESP32S2_DATA_CACHE_0KB + Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_INVALID, + CACHE_MEMORY_INVALID); +#elif CONFIG_ESP32S2_DATA_CACHE_8KB esp_rom_Cache_Allocate_SRAM(CACHE_MEMORY_ICACHE_LOW, CACHE_MEMORY_ICACHE_HIGH, CACHE_MEMORY_DCACHE_LOW, CACHE_MEMORY_INVALID); #else From 02fc5e3f6622f2eab0f40736ea480cbeac517bc2 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:40:07 -0300 Subject: [PATCH 49/53] soc: esp32s3: update linker files Add new wifi sections into iram area. Add new functions to iram area. Remove unused entries. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s3/default.ld | 18 ++++++++++++------ soc/espressif/esp32s3/mcuboot.ld | 4 ---- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/soc/espressif/esp32s3/default.ld b/soc/espressif/esp32s3/default.ld index 487b084b03d..17d865cf526 100644 --- a/soc/espressif/esp32s3/default.ld +++ b/soc/espressif/esp32s3/default.ld @@ -160,7 +160,7 @@ SECTIONS . = ALIGN(4); _rtc_fast_start = ABSOLUTE(.); _rtc_text_start = ABSOLUTE(.); - *(.rtc.literal .rtc.text) + *(.rtc.entry.literal .rtc.text) *(.rtc.entry.text) _rtc_text_end = ABSOLUTE(.); } GROUP_DATA_LINK_IN(rtc_iram_seg, ROMABLE_REGION) @@ -350,7 +350,8 @@ SECTIONS *libzephyr.a:flash_brownout_hook.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_wrap.*(.literal .literal.* .text .text.*) *libzephyr.a:spi_flash_hpm_enable.*(.literal .literal.* .text .text.*) - *libzephyr.a:spi_flash_oct_flash_init*(.literal .literal.* .text .text.*) + *libzephyr.a:spi_flash_oct_flash_init.*(.literal .literal.* .text .text.*) + *libzephyr.a:flash_ops.*(.literal .literal.* .text .text.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.literal .literal.* .text .text.*) @@ -381,9 +382,11 @@ SECTIONS /* [mapping:esp_rom] */ *libzephyr.a:esp_rom_cache_esp32s2_esp32s3.*(.literal .literal.* .text .text.*) + *libzephyr.a:cache_utils.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_systimer.*(.literal .literal.* .text .text.*) *libzephyr.a:esp_rom_wdt.*(.literal .literal.* .text .text.*) + *libzephyr.a:esp_rom_efuse.*(.literal .literal.* .text .text.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.literal .literal.* .text .text.*) @@ -393,8 +396,8 @@ SECTIONS *libzephyr.a:bootloader_random*.*(.literal.bootloader_random_enable .text.bootloader_random_enable) #if defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:(.wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) *libcoexist.a:(.wifi_slp_iram .wifi_slp_iram.*) /* [mapping:esp_wifi] */ @@ -589,6 +592,7 @@ SECTIONS *libzephyr.a:spi_flash_hpm_enable.*(.rodata .rodata.*) *libzephyr.a:spi_flash_oct_flash_init.*(.rodata .rodata.*) *libzephyr.a:flash_qio_mode.*(.rodata .rodata.*) + *libzephyr.a:flash_ops.*(.rodata .rodata.*) /* [mapping:esp_mm] */ *libzephyr.a:esp_cache.*(.rodata .rodata.*) @@ -616,9 +620,11 @@ SECTIONS /* [mapping:esp_rom] */ *libzephyr.a:esp_rom_cache_esp32s2_esp32s3.*(.rodata .rodata.*) + *libzephyr.a:cache_utils.*(.rodata .rodata.*) *libzephyr.a:esp_rom_spiflash.*(.rodata .rodata.*) *libzephyr.a:esp_rom_systimer.*(.rodata .rodata.*) *libzephyr.a:esp_rom_wdt.*(.rodata .rodata.*) + *libzephyr.a:esp_rom_efuse.*(.rodata .rodata.*) /* [mapping:esp_system] */ *libzephyr.a:esp_err.*(.rodata .rodata.*) @@ -761,8 +767,8 @@ SECTIONS __rom_region_start = ABSOLUTE(.); #if !defined(CONFIG_ESP32_WIFI_IRAM_OPT) - *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.*) - *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.*) + *libnet80211.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiextrairam .wifiextrairam.*) + *libpp.a:( .wifi0iram .wifi0iram.* .wifislpiram .wifislpiram.* .wifiorslpiram .wifiorslpiram.* .wifiextrairam .wifiextrairam.*) #endif #if !defined(CONFIG_ESP32_WIFI_RX_IRAM_OPT) diff --git a/soc/espressif/esp32s3/mcuboot.ld b/soc/espressif/esp32s3/mcuboot.ld index 46a3c0c3168..f0fb717d5d9 100644 --- a/soc/espressif/esp32s3/mcuboot.ld +++ b/soc/espressif/esp32s3/mcuboot.ld @@ -57,7 +57,6 @@ SECTIONS *libzephyr.a:cbprintf_nano.*(.literal .text .literal.* .text.*) *libzephyr.a:cpu.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) - *libzephyr.a:cache_hal.*(.literal .text .literal.* .text.*) *libzephyr.a:flash_map.*(.literal .text .literal.* .text.*) *libzephyr.a:esp_rom_spiflash.*(.literal .text .literal.* .text.*) @@ -68,9 +67,6 @@ SECTIONS *libkernel.a:device.*(.literal .text .literal.* .text.*) *libkernel.a:timeout.*(.literal .text .literal.* .text.*) - *(.literal.bootloader_mmap .text.bootloader_mmap) - *(.literal.bootloader_munmap .text.bootloader_munmap) - *libzephyr.a:esp_loader.*(.literal .text .literal.* .text.*) *libzephyr.a:mmu_hal.*(.literal .text .literal.* .text.*) From 5678512fe830422c1d909f73cad9db3e8a0d0d19 Mon Sep 17 00:00:00 2001 From: Sylvio Alves Date: Thu, 24 Oct 2024 19:40:22 -0300 Subject: [PATCH 50/53] soc: esp32s3: move cache mode call Removed unused function declaration. Added missing include. Move Cache_Susped_DCache() call to proper function configuration call. Signed-off-by: Sylvio Alves --- soc/espressif/esp32s3/soc.c | 1 + soc/espressif/esp32s3/soc.h | 4 ---- soc/espressif/esp32s3/soc_cache.c | 3 +-- 3 files changed, 2 insertions(+), 6 deletions(-) diff --git a/soc/espressif/esp32s3/soc.c b/soc/espressif/esp32s3/soc.c index 538a811aa6f..a1349b61db0 100644 --- a/soc/espressif/esp32s3/soc.c +++ b/soc/espressif/esp32s3/soc.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #if CONFIG_ESP_SPIRAM diff --git a/soc/espressif/esp32s3/soc.h b/soc/espressif/esp32s3/soc.h index 2cb247ca489..1d6d2204cf4 100644 --- a/soc/espressif/esp32s3/soc.h +++ b/soc/espressif/esp32s3/soc.h @@ -73,8 +73,4 @@ extern int esp_rom_Cache_Ibus_MMU_Set(uint32_t ext_ram, uint32_t vaddr, uint32_t extern uint8_t esp_rom_i2c_readReg(uint8_t block, uint8_t host_id, uint8_t reg_add); extern void esp_rom_i2c_writeReg(uint8_t block, uint8_t host_id, uint8_t reg_add, uint8_t data); -/* cache initialization functions */ -void esp_config_instruction_cache_mode(void); -void esp_config_data_cache_mode(void); - #endif /* __SOC_H__ */ diff --git a/soc/espressif/esp32s3/soc_cache.c b/soc/espressif/esp32s3/soc_cache.c index 65330b2f939..a80d0ca8d87 100644 --- a/soc/espressif/esp32s3/soc_cache.c +++ b/soc/espressif/esp32s3/soc_cache.c @@ -26,12 +26,11 @@ void IRAM_ATTR esp_config_instruction_cache_mode(void) rom_config_instruction_cache_mode(CONFIG_ESP32S3_INSTRUCTION_CACHE_SIZE, CONFIG_ESP32S3_ICACHE_ASSOCIATED_WAYS, CONFIG_ESP32S3_INSTRUCTION_CACHE_LINE_SIZE); - - Cache_Suspend_DCache(); } void IRAM_ATTR esp_config_data_cache_mode(void) { + Cache_Suspend_DCache(); rom_config_data_cache_mode(CONFIG_ESP32S3_DATA_CACHE_SIZE, CONFIG_ESP32S3_DCACHE_ASSOCIATED_WAYS, CONFIG_ESP32S3_DATA_CACHE_LINE_SIZE); From 9f93dede369c365c68b5618844e3d31e35327bc2 Mon Sep 17 00:00:00 2001 From: Dan Kalowsky Date: Sun, 27 Oct 2024 15:05:35 -0700 Subject: [PATCH 51/53] VERSION: bump for 4.0.0 rc1 Update the VERSION file to reflect the tagging for 4.0.0rc1 release. Signed-off-by: Dan Kalowsky --- VERSION | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/VERSION b/VERSION index 83bbbb1d942..1659ec4dbe2 100644 --- a/VERSION +++ b/VERSION @@ -1,5 +1,5 @@ -VERSION_MAJOR = 3 -VERSION_MINOR = 7 -PATCHLEVEL = 99 +VERSION_MAJOR = 4 +VERSION_MINOR = 0 +PATCHLEVEL = 0 VERSION_TWEAK = 0 -EXTRAVERSION = +EXTRAVERSION = rc1 From c133b64f41726aed20f6627ee087caa7d024f8b8 Mon Sep 17 00:00:00 2001 From: Carles Cufi Date: Mon, 28 Oct 2024 16:17:36 +0100 Subject: [PATCH 52/53] gh: manifest: Point to a PR Work in progress. Signed-off-by: Carles Cufi --- .github/workflows/manifest.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/manifest.yml b/.github/workflows/manifest.yml index 76b80f66504..8da3e1d6109 100644 --- a/.github/workflows/manifest.yml +++ b/.github/workflows/manifest.yml @@ -26,7 +26,7 @@ jobs: west init -l . || true - name: Manifest - uses: zephyrproject-rtos/action-manifest@v1.3.1 + uses: zephyrproject-rtos/action-manifest@pull/14/head with: github-token: ${{ secrets.ZB_GITHUB_TOKEN }} manifest-path: 'west.yml' From 1461cb2db8bd544238e06c690040047e63bd54b5 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Mon, 28 Oct 2024 12:17:09 +0100 Subject: [PATCH 53/53] manifest: Update bsim to version v2.4 Main changes since v2.3: * Support for immediate RSSI measurements during abort reevaluations * Several minor improvements in the base components, including tolerating better under-setup docker images, improved C++ compatibility, a new sanity check for problematic user provided sim_ids, and other minor improvements. Note: Like before, bsim remains fully backwards compatible Signed-off-by: Alberto Escolar Piedras --- west.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/west.yml b/west.yml index 5d50af43600..f5a8923c458 100644 --- a/west.yml +++ b/west.yml @@ -34,7 +34,7 @@ manifest: path: modules/lib/acpica - name: bsim repo-path: babblesim-manifest - revision: 9ee22c707970f6621adba0375841c0a609e24628 + revision: 1f242f4ed7fc141fdfcfeca8d21c6d9e801179d7 path: tools/bsim groups: - babblesim @@ -42,21 +42,21 @@ manifest: remote: babblesim repo-path: base path: tools/bsim/components - revision: a3dff9a57f334fb25daa9625841cd64cbfe56681 + revision: 0cc70e78a88c1de9d8ec045a703b38134861e7e7 groups: - babblesim - name: babblesim_ext_2G4_libPhyComv1 remote: babblesim repo-path: ext_2G4_libPhyComv1 path: tools/bsim/components/ext_2G4_libPhyComv1 - revision: aa4951317cc7d84f24152ea38ac9ac21e6d78a76 + revision: 15ae0f87fa049e04cbec48a866f3bc37d903f950 groups: - babblesim - name: babblesim_ext_2G4_phy_v1 remote: babblesim repo-path: ext_2G4_phy_v1 path: tools/bsim/components/ext_2G4_phy_v1 - revision: 04eeb3c3794444122fbeeb3715f4233b0b50cfbb + revision: 62e797b2c518e5bb6123a198382ed2b64b8c068e groups: - babblesim - name: babblesim_ext_2G4_channel_NtNcable