Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
e06f15c
[nrf fromtree] Bluetooth: Controller: Fix inter-operability when BT_P…
cvinayak Sep 22, 2025
398bb45
[nrf fromtree] Bluetooth: Controller: fix assertion check for ptc value
ljd42 Sep 25, 2025
d007b72
[nrf fromtree] Bluetooth: Controller: Fix missing null pointer check
Majistor Sep 29, 2025
015f554
[nrf fromtree] bluetooth: controller: ll_sw: nordic: constant latency…
JordanYates Oct 5, 2025
5ace4d7
[nrf fromtree] Bluetooth: Controller: Fix return types for ll_length
Thalley Oct 2, 2025
fed82c8
[nrf fromtree] Bluetooth: Controller: Fix single switch timer use in …
cvinayak Sep 27, 2025
e8484a4
[nrf fromtree] Bluetooth: Controller: Cosmetic changes to Link Layer …
cvinayak Sep 10, 2025
7e71f0b
[nrf fromtree] Bluetooth: Controller: Use CONFIG_SOC_COMPATIBLE_NRF53…
cvinayak Oct 5, 2025
72c545c
[nrf fromtree] Bluetooth: Controller: Revert relaxed radio packet ass…
cvinayak Sep 20, 2025
3abbb47
[nrf fromtree] Bluetooth: Controller: nRF54L: Fix to improve decrypti…
cvinayak Sep 20, 2025
330d458
[nrf fromtree] Bluetooth: Controller: nRF54L: Fix PPIB interface incl…
cvinayak Oct 22, 2025
87aee81
[nrf fromtree] Bluetooth: Controller: Introduce LL_ASSERT_DBG/ERR
cvinayak May 26, 2025
1b0cff6
[nrf fromtree] Bluetooth: Controller: Reduce assertion check code size
cvinayak Sep 6, 2025
2b3a926
[nrf fromtree] samples: Bluetooth: hci_ipc: Enable HCI vendor-specifi…
cvinayak Sep 9, 2025
3c14757
[nrf fromtree] Bluetooth: Controller: Add code comments related to sh…
cvinayak Oct 18, 2025
7adda96
[nrf fromtree] Bluetooth: Controller: nRF54Lx: Add Controller Privacy…
cvinayak Jun 2, 2025
1ce6311
[nrf fromtree] tests: bsim: Bluetooth: Conditionally compile Controll…
cvinayak Jun 3, 2025
e82ad17
[nrf fromtree] Bluetooth: Controller: nRF54Lx: Enable Controller Priv…
cvinayak Jun 2, 2025
d29fd2f
[nrf fromtree] Bluetooth: Controller: Handle overlapping CIG and ACL
segerlund Oct 22, 2025
163d0de
[nrf fromtree] Bluetooth: Controller: Fix use-after-release in lll_sc…
cvinayak Oct 21, 2025
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
8 changes: 4 additions & 4 deletions doc/connectivity/bluetooth/api/hci.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1085,14 +1085,13 @@ represents.
| Event | Event Code | Event Parameters |
+-------------------------------+------------+-------------------------------+
| Fatal_Error | 0xFF | Subevent_Code, |
| | | Error_Data_Type, |
| | | Error_Data |
+-------------------------------+------------+-------------------------------+

The Error_Data_Type provides an information about what is the Error_Data size
and content.
The Subevent_Code provides an information about what is the Error_Data size and
content.

Error_Data_Type: Size: 1 Octet
Subevent_Code: Size: 1 Octet
+--------------------+--------------------------------------+
| Value | Parameter Description |
+--------------------+--------------------------------------+
Expand Down Expand Up @@ -1157,6 +1156,7 @@ Zephyr Fatal Error event may be generated by k_sys_fatal_error_handler.
| a4 | 4 octets | General purpose register |
| ip | 4 octets | Instruction pointer register |
| lr | 4 octets | Link register |
| pc | 4 octets | Program counter register |
| xpsr | 4 octets | Program status register |
+--------------------+--------------------------------------------+

Expand Down
5 changes: 4 additions & 1 deletion doc/releases/migration-guide-4.3.rst
Original file line number Diff line number Diff line change
Expand Up @@ -91,10 +91,13 @@ Bluetooth
Bluetooth Controller
====================

* The following Kconfig option have been renamed:
* The following have been renamed:

* :kconfig:option:`CONFIG_BT_CTRL_ADV_ADI_IN_SCAN_RSP` to
:kconfig:option:`CONFIG_BT_CTLR_ADV_ADI_IN_SCAN_RSP`
* :c:struct:`bt_hci_vs_fata_error_cpu_data_cortex_m` to
:c:struct:`bt_hci_vs_fatal_error_cpu_data_cortex_m` and now contains the program counter
value.

.. zephyr-keep-sorted-start re(^\w)

Expand Down
6 changes: 3 additions & 3 deletions include/zephyr/bluetooth/hci_vs.h
Original file line number Diff line number Diff line change
Expand Up @@ -222,20 +222,20 @@ struct bt_hci_evt_vs {
uint8_t subevent;
} __packed;

#define BT_HCI_EVT_VS_FATAL_ERROR 0x02

#define BT_HCI_EVT_VS_ERROR_DATA_TYPE_STACK_FRAME 0x01
#define BT_HCI_EVT_VS_ERROR_DATA_TYPE_CTRL_ASSERT 0x02
#define BT_HCI_EVT_VS_ERROR_DATA_TYPE_TRACE 0x03
struct bt_hci_vs_fata_error_cpu_data_cortex_m {
struct bt_hci_vs_fatal_error_cpu_data_cortex_m {
uint32_t a1;
uint32_t a2;
uint32_t a3;
uint32_t a4;
uint32_t ip;
uint32_t lr;
uint32_t pc;
uint32_t xpsr;
} __packed;

#define BT_HCI_EVT_VS_ERROR_CPU_TYPE_CORTEX_M 0x01
struct bt_hci_vs_fatal_error_stack_frame {
uint32_t reason;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Rx ACL and Adv Reports
CONFIG_BT_CTLR_RX_BUFFERS=9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ CONFIG_BT_MAX_CONN=16

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Disable unused Bluetooth features
CONFIG_BT_CTLR_DUP_FILTER_LEN=0
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Rx ACL and Adv Reports
CONFIG_BT_CTLR_RX_BUFFERS=9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ CONFIG_BT_MAX_CONN=2

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Rx ACL and Adv Reports
CONFIG_BT_CTLR_RX_BUFFERS=9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Rx ACL and Adv Reports
CONFIG_BT_CTLR_RX_BUFFERS=9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# ISO Broadcast Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y
CONFIG_BT_CTLR_ADV_PERIODIC=y
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191
CONFIG_BT_CTLR_ADV_ISO=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y
CONFIG_BT_CTLR_DATA_LENGTH_MAX=251
CONFIG_BT_CTLR_ADV_DATA_LEN_MAX=191

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ CONFIG_BT_PERIPHERAL=n

# ISO Receive Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y
CONFIG_BT_CTLR_SYNC_PERIODIC=y
CONFIG_BT_CTLR_SCAN_DATA_LEN_MAX=191
CONFIG_BT_CTLR_SYNC_ISO=y
Expand Down
4 changes: 4 additions & 0 deletions samples/bluetooth/hci_ipc/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -307,7 +307,10 @@ void bt_ctlr_assert_handle(char *file, uint32_t line)
LOG_PANIC();

while (true) {
k_cpu_idle();
};

CODE_UNREACHABLE;
}
#endif /* CONFIG_BT_CTLR_ASSERT_HANDLER */

Expand Down Expand Up @@ -338,6 +341,7 @@ void k_sys_fatal_error_handler(unsigned int reason, const struct arch_esf *esf)
LOG_PANIC();

while (true) {
k_cpu_idle();
};

CODE_UNREACHABLE;
Expand Down
3 changes: 2 additions & 1 deletion samples/bluetooth/hci_uart/overlay-all-bt_ll_sw_split.conf
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ CONFIG_BT_ISO_RX_BUF_COUNT=1

# Controller
CONFIG_BT_LL_SW_SPLIT=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_CTLR_DTM_HCI=y
CONFIG_BT_CTLR_ASSERT_HANDLER=y
CONFIG_BT_HCI_VS_FATAL_ERROR=y

# Rx ACL and Adv Reports
CONFIG_BT_CTLR_RX_BUFFERS=9
Expand Down
27 changes: 27 additions & 0 deletions subsys/bluetooth/controller/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1190,6 +1190,21 @@ rsource "Kconfig.df"
rsource "Kconfig.ll_sw_split"
rsource "Kconfig.dtm"

config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT
bool

config BT_CTLR_ASSERT_DEBUG
bool "Development asserts"
default y
help
This option enables development asserts used for code coverage.

The Controller will continue to function without memory leak or corruption with these
assertion checks disabled. Example, run-time mis-aligned memory access etc. which do
otherwise implicitly cause CPU fault during development testing. But these type of
asserted are essentially required for debugging, code and unit test coverage during
development cycle.

config BT_CTLR_ASSERT_HANDLER
bool "Application Defined Assertion Handler"
help
Expand All @@ -1199,6 +1214,18 @@ config BT_CTLR_ASSERT_HANDLER
and will be invoked whenever the controller code encounters
an unrecoverable error.

config BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE
bool "Assertions optimized for code size"
depends on BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT
default y
help
Optimize Controller assertion check for code size.

Example, reduces assertion check code size for ARM Cortex-M CPUs by using the undefined
instruction exception.
`arm-none-eabi-addr2line` commandline can be used to get the source file and line number
from the program counter value.

config BT_CTLR_VS_SCAN_REQ_RX
bool "Use scan request reporting"
depends on BT_HCI_VS && !BT_CTLR_ADV_EXT
Expand Down
5 changes: 3 additions & 2 deletions subsys/bluetooth/controller/Kconfig.ll_sw_split
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ config BT_LLL_VENDOR_NORDIC
!BT_CTLR_DATA_LENGTH_CLEAR && \
!BT_CTLR_PHY_2M_NRF
select BT_CTLR_PRIVACY_SUPPORT if BT_CTLR_CRYPTO_SUPPORT && \
!SOC_SERIES_NRF51X && \
!SOC_COMPATIBLE_NRF54LX
!SOC_SERIES_NRF51X
select BT_CTLR_CONN_PARAM_REQ_SUPPORT
select BT_CTLR_EXT_REJ_IND_SUPPORT
select BT_CTLR_PER_INIT_FEAT_XCHG_SUPPORT
Expand Down Expand Up @@ -70,6 +69,8 @@ config BT_LLL_VENDOR_NORDIC

select BT_TICKER_PREFER_START_BEFORE_STOP if BT_TICKER_SLOT_AGNOSTIC

select BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE_SUPPORT if CPU_CORTEX_M

default y
help
Use Nordic Lower Link Layer implementation.
Expand Down
66 changes: 60 additions & 6 deletions subsys/bluetooth/controller/hal/debug.h
Original file line number Diff line number Diff line change
@@ -1,31 +1,85 @@
/*
* Copyright (c) 2016 Nordic Semiconductor ASA
* Copyright (c) 2016-2025 Nordic Semiconductor ASA
* Copyright (c) 2016 Vinayak Kariappa Chettimada
*
* SPDX-License-Identifier: Apache-2.0
*/

#include "common/assert.h"

#ifdef CONFIG_BT_CTLR_ASSERT_HANDLER
#if defined(CONFIG_BT_CTLR_ASSERT_HANDLER)
void bt_ctlr_assert_handle(char *file, uint32_t line);

#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE)
BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M));
/* Generate assertion as undefined instruction exception.
*/
#define LL_ASSERT(x) \
do { \
if (unlikely(!(x))) { \
__asm__ inline volatile (".inst 0xde00\n"); \
} \
} while (0)

Check notice on line 22 in subsys/bluetooth/controller/hal/debug.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/controller/hal/debug.h:22 -#define LL_ASSERT(x) \ - do { \ - if (unlikely(!(x))) { \ - __asm__ inline volatile (".inst 0xde00\n"); \ - } \ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile(".inst 0xde00\n"); \ + } \

#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */
/* Generate assertion with file name and line number.
* NOTE: Variable code size increase per assertion check, depends on full file name path string
* length.
*/
#define LL_ASSERT(cond) \
if (!(cond)) { \
if (unlikely(!(cond))) { \
BT_ASSERT_PRINT(cond); \
bt_ctlr_assert_handle(__FILE__, __LINE__); \
}
#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */

#define LL_ASSERT_MSG(cond, fmt, ...) \
if (!(cond)) { \
if (unlikely(!(cond))) { \
BT_ASSERT_PRINT(cond); \
BT_ASSERT_PRINT_MSG(fmt, ##__VA_ARGS__); \
bt_ctlr_assert_handle(__FILE__, __LINE__); \
}
#else

Check notice on line 42 in subsys/bluetooth/controller/hal/debug.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/controller/hal/debug.h:42 -#define LL_ASSERT(cond) \ - if (unlikely(!(cond))) { \ - BT_ASSERT_PRINT(cond); \ - bt_ctlr_assert_handle(__FILE__, __LINE__); \ - } +#define LL_ASSERT(cond) \ + if (unlikely(!(cond))) { \ + BT_ASSERT_PRINT(cond); \ + bt_ctlr_assert_handle(__FILE__, __LINE__); \ + } #endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */ -#define LL_ASSERT_MSG(cond, fmt, ...) \ - if (unlikely(!(cond))) { \ - BT_ASSERT_PRINT(cond); \ - BT_ASSERT_PRINT_MSG(fmt, ##__VA_ARGS__); \ - bt_ctlr_assert_handle(__FILE__, __LINE__); \ - } +#define LL_ASSERT_MSG(cond, fmt, ...) \ + if (unlikely(!(cond))) { \ + BT_ASSERT_PRINT(cond); \ + BT_ASSERT_PRINT_MSG(fmt, ##__VA_ARGS__); \ + bt_ctlr_assert_handle(__FILE__, __LINE__); \ + }
#else /* !CONFIG_BT_CTLR_ASSERT_HANDLER */

#if defined(CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE)
BUILD_ASSERT(IS_ENABLED(CONFIG_CPU_CORTEX_M));
/* Generate assertion as undefined instruction exception.
*/
#define LL_ASSERT(x) \
do { \
if (unlikely(!(x))) { \
__asm__ inline volatile (".inst 0xde00\n"); \
} \
} while (0)

Check notice on line 54 in subsys/bluetooth/controller/hal/debug.h

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

You may want to run clang-format on this change

subsys/bluetooth/controller/hal/debug.h:54 -#define LL_ASSERT(x) \ - do { \ - if (unlikely(!(x))) { \ - __asm__ inline volatile (".inst 0xde00\n"); \ - } \ +#define LL_ASSERT(x) \ + do { \ + if (unlikely(!(x))) { \ + __asm__ inline volatile(".inst 0xde00\n"); \ + } \

#else /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */
#define LL_ASSERT(cond) \
BT_ASSERT(cond)
#endif /* !CONFIG_BT_CTLR_ASSERT_OPTIMIZE_FOR_SIZE */

#define LL_ASSERT_MSG(cond, fmt, ...) \
BT_ASSERT_MSG(cond, fmt, ##__VA_ARGS__)
#endif
#endif /* !CONFIG_BT_CTLR_ASSERT_HANDLER */

/* Fatal asserts.
* The Controller will otherwise misbehave causing memory leak or system-wide memory corruptions due
* to uncontrolled DMA transfers etc.
* It is not safe to disable these assertion checks.
*/
#define LL_ASSERT_ERR(cond) LL_ASSERT(cond)

/* Development asserts.
* The Controller will continue to function without memory leak or corruption with these assertion
* checks disabled. Example, run-time mis-aligned memory access etc. which do otherwise implicitly
* cause CPU fault during development testing. But these type of asserted are essentially required
* for debugging, code and unit test coverage during development cycle.
*/
#if defined(CONFIG_BT_CTLR_ASSERT_DEBUG)
#define LL_ASSERT_DBG(cond) LL_ASSERT(cond)
#else /* !CONFIG_BT_CTLR_ASSERT_DEBUG */
#define LL_ASSERT_DBG(cond) ARG_UNUSED((cond))
#endif /* !CONFIG_BT_CTLR_ASSERT_DEBUG */

#if defined(CONFIG_BT_CTLR_ASSERT_VENDOR)
#define LL_ASSERT_INFO1(cond, param) \
Expand Down
Loading
Loading