Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support to Bluetooth RPC Host for nRF54H20 #15634

Merged
merged 4 commits into from
Jun 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,7 @@ Kconfig* @tejlmand
/snippets/tfm-enable-share-uart/ @nrfconnect/ncs-cia
/snippets/nrf70-debug/ @krish2718 @sachinthegreen
/snippets/nrf70-fw-patch-ext-flash/ @krish2718 @sachinthegreen
/snippets/nordic-bt-rpc/ @ppryga-nordic
/subsys/audio_module/ @nrfconnect/ncs-audio
/subsys/bluetooth/ @alwa-nordic @jori-nordic @carlescufi @KAGA164
/subsys/bluetooth/mesh/ @ludvigsj
Expand Down
3 changes: 0 additions & 3 deletions samples/bluetooth/peripheral_uart/Kconfig.sysbuild
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,3 @@ source "${ZEPHYR_BASE}/share/sysbuild/Kconfig"

config NRF_DEFAULT_IPC_RADIO
default y
dchat-nordic marked this conversation as resolved.
Show resolved Hide resolved

config NETCORE_IPC_RADIO_BT_HCI_IPC
default y
8 changes: 5 additions & 3 deletions samples/bluetooth/peripheral_uart/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@ tests:
sample.bluetooth.peripheral_uart_ble_rpc:
sysbuild: true
build_only: true
extra_configs:
- CONFIG_BT_RPC_STACK=y
extra_args:
- SNIPPET=nordic-bt-rpc
- FILE_SUFFIX=bt_rpc
integration_platforms:
- nrf5340dk/nrf5340/cpuapp
platform_allow: nrf5340dk/nrf5340/cpuapp
- nrf54h20dk/nrf54h20/cpuapp
platform_allow: nrf5340dk/nrf5340/cpuapp nrf54h20dk/nrf54h20/cpuapp
tags: bluetooth ci_build sysbuild
sample.bluetooth.peripheral_uart.security_disabled:
sysbuild: true
Expand Down
7 changes: 7 additions & 0 deletions samples/bluetooth/peripheral_uart/sysbuild.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

SB_CONFIG_NETCORE_IPC_RADIO_BT_HCI_IPC=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG=n
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_BT_DEVICE_NAME="Nordic_UART_Service"

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_LOG=n
7 changes: 7 additions & 0 deletions samples/bluetooth/peripheral_uart/sysbuild_bt_rpc.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

SB_CONFIG_NETCORE_IPC_RADIO_BT_RPC=y
11 changes: 11 additions & 0 deletions snippets/nordic-bt-rpc/README.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.. _nordic-rpc-host:

Nordic RPC Host snippet (nordic-rpc-host)
#########################################

Overview
********

This snippet allows users to build Bluetooth applications with Bluetooth stack running on Radio
core. The communication between an application and Bluetooth stack is handled over the Bluetooth
RPC subsystem.
7 changes: 7 additions & 0 deletions snippets/nordic-bt-rpc/boards/nrf5340dk_nrf5340_cpuapp.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_BT_RPC_STACK=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/
/delete-node/ &cpuppr_code_partition;

&cpuapp_rx_partitions {
cpuapp_slot0_partition: partition@a6000 {
reg = <0xa6000 DT_SIZE_K(488)>;
};

cpuppr_code_partition: partition@120000 {
reg = <0x120000 DT_SIZE_K(64)>;
};
};

/delete-node/ &storage_partition;

&cpuapp_rw_partitions {
storage_partition: partition@130000 {
reg = <0x130000 DT_SIZE_K(24)>;
};
};

&mram1x {
cpurad_rw_partitions: cpurad-rw-partitions {
compatible = "nordic,owned-partitions", "fixed-partitions";
perm-read;
perm-write;
perm-secure;
#address-cells = <1>;
#size-cells = <1>;

cpurad_storage_partition: partition@136000 {
reg = <0x136000 DT_SIZE_K(24)>;
};
};
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_BT_RPC_STACK=y
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Included because partitions must be moved on both cores App and Rad cores to avoid memory
* regions overlapping.
*/
#include "nrf54h20dk_nrf54h20-mem-map-move.dtsi"
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright (c) 2024 Nordic Semiconductor
* SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
*/

/* Included because partitions must be moved on both cores App and Rad cores to avoid memory
* regions overlapping.
*/
#include "nrf54h20dk_nrf54h20-mem-map-move.dtsi"

&cpurad_rw_partitions {
status = "okay";
};

/ {
chosen {
zephyr,settings_partition = &cpurad_storage_partition;
};
};
19 changes: 19 additions & 0 deletions snippets/nordic-bt-rpc/snippet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#
# Copyright (c) 2024 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

name: nordic-bt-rpc

boards:
nrf54h20dk/nrf54h20/cpurad:
append:
EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpurad.overlay
nrf54h20dk/nrf54h20/cpuapp:
append:
EXTRA_CONF_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.conf
EXTRA_DTC_OVERLAY_FILE: boards/nrf54h20dk_nrf54h20_cpuapp.overlay
nrf5340dk/nrf5340/cpuapp:
append:
EXTRA_CONF_FILE: boards/nrf5340dk_nrf5340_cpuapp.conf
41 changes: 4 additions & 37 deletions subsys/bluetooth/rpc/client/bt_rpc_gap_client.c
Original file line number Diff line number Diff line change
Expand Up @@ -139,15 +139,11 @@ int bt_enable(bt_ready_cb_t cb)


if (IS_ENABLED(CONFIG_SETTINGS)) {
int network_load = 1;

result = settings_subsys_init();
if (result) {
return result;
}
buffer_size_max = 0;
NRF_RPC_CBOR_ALLOC(&bt_rpc_grp, ctx, buffer_size_max);

result = settings_save_one("bt_rpc/network",
&network_load, sizeof(network_load));
nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_SETTINGS_LOAD_RPC_CMD,
&ctx, ser_rsp_decode_void, NULL);
}

return result;
Expand Down Expand Up @@ -2038,32 +2034,3 @@ void bt_foreach_bond(uint8_t id, void (*func)(const struct bt_bond_info *info,
&ctx, ser_rsp_decode_void, NULL);
}
#endif /* (defined(CONFIG_BT_CONN) && defined(CONFIG_BT_SMP)) */

static int rpc_settings_set(const char *key, size_t len_rd, settings_read_cb read_cb,
void *cb_arg)
{
struct nrf_rpc_cbor_ctx ctx;
size_t buffer_size_max = 0;
ssize_t len;
const char *next;

if (!key) {
LOG_ERR("Insufficient number of arguments");
return -ENOENT;
}

len = settings_name_next(key, &next);

if (!strncmp(key, "network", len)) {
NRF_RPC_CBOR_ALLOC(&bt_rpc_grp, ctx, buffer_size_max);

nrf_rpc_cbor_cmd_no_err(&bt_rpc_grp, BT_SETTINGS_LOAD_RPC_CMD,
&ctx, ser_rsp_decode_void, NULL);

}

return 0;
}

SETTINGS_STATIC_HANDLER_DEFINE(bt_gatt_rpc, "bt_rpc", NULL, rpc_settings_set,
NULL, NULL);
4 changes: 4 additions & 0 deletions sysbuild/Kconfig.netcore
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ config NRF_DEFAULT_EMPTY
config NRF_DEFAULT_BLUETOOTH
bool

config NRF_DEFAULT_RPC_HOST
bool

config NRF_DEFAULT_802154
bool

Expand All @@ -66,6 +69,7 @@ config NRF_DEFAULT_IPC_RADIO
choice NETCORE
prompt "Netcore image"
default NETCORE_HCI_IPC if NRF_DEFAULT_BLUETOOTH && NETCORE_REMOTE_BOARD_NAME != ""
default NETCORE_RPC_HOST if NRF_DEFAULT_RPC_HOST && NETCORE_REMOTE_BOARD_NAME != ""
default NETCORE_802154_RPMSG if NRF_DEFAULT_802154 && NETCORE_REMOTE_BOARD_NAME != ""
default NETCORE_MULTIPROTOCOL_RPMSG if NRF_DEFAULT_MULTIPROTOCOL && NETCORE_REMOTE_BOARD_NAME != ""
default NETCORE_IPC_RADIO if NRF_DEFAULT_IPC_RADIO && NETCORE_REMOTE_BOARD_NAME != ""
Expand Down
Loading