Commit graph

2414 commits

Author SHA1 Message Date
Andries Kruithof
d64293b185 Bluetooth: Audio: unittest fails when BT_MAX_CONN = 1
There is a unittest to verify that the distribute broadcast code procedure
is not called with the same peer twice. This test requires a minimum
of two connections, so we disable this test when only 1 connection
can be made

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-12-09 09:50:00 +01:00
Andries Kruithof
6f180e49f9 Bluetooth: Audio: set correct project name in CMakeList.txt
Some of the unittests had an incorrect project name in the
CMakeList.txt file
This is corrected here

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-12-06 22:20:57 +01:00
Théo Battrel
d5d3ac7427 Tests: Bluetooth: Build Host with different configurations
The new `host_config_variants` goal is to be able to test specific set
of configurations when building the Host without the need of having a
specific application for it.

The first test check that the Host build correctly with
`CONFIG_BT_SMP_OOB_LEGACY_PAIR_ONLY` enabled.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-12-06 18:20:21 +01:00
Emil Gydesen
e12096ee4a tests: Bluetooth: Tester: Increase RTT_MESSAGE_SIZE
Sets CONFIG_LOG_BACKEND_RTT_MESSAGE_SIZE=256 as some log
messages are longer than 128 (default) and may be truncated
with the existing configuration and implementation.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:55 +01:00
Emil Gydesen
0ae976166f Bluetooth: CAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Emil Gydesen
ab9ee0817d Bluetooth: BAP: Add broadcast source callback structs
These callbacks are trigger for changes that affect the entire
broadcast source, such as the BIG started and terminated events.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-06 15:17:06 +01:00
Alexander Svensen
49e5a0dc5a bluetooth: tester: audio: Add NULL checks
- Add NULL checks for broadcast_source_stop
- Add NULL checks for broadcast_source_release
- Return -ESRCH if trying to stop ext_adv before creation

Signed-off-by: Alexander Svensen <alexander.svensen@nordicsemi.no>
2024-12-06 12:13:03 +01:00
Emil Gydesen
49a458e5aa tests: Bluetooth: Update PTS ICS with new spec versions
Added support for BAP 1.0.2, CSIS 1.01, PACS 1.0.2, PBP 1.0.1
Enabled support for extended adv in the LL (mandatory requirement)
Enabled support for multiple BIGs support in the LL.

Due to a bug in the BT qualification tool, the following
features are values in the .bqw file are manually added
<Feature>BAP 4/1</Feature>
<Feature>BAP 26/1</Feature>
<Feature>BAP 49/1</Feature>
<Feature>BAP 62/1</Feature>
<Feature>BAP 77/1</Feature>
<Feature>BAP 83/1</Feature>
<Feature>CSIP 3/1</Feature>
<Feature>CSIP 8/1</Feature>
<Feature>PBP 10/1</Feature>

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-12-05 16:13:55 -05:00
Sergey Korotkov
2ee0e38929 Bluetooth: Host: more secure defaults for key size and legacy pairing
Default the Minimum encryption key size to 16.
Key with reduced size is easier to brut force.
Disable LE legacy pairing by default since it's not secure.

These defaults should suite majority of newly developed applications.
It's better to use sensible more secure defaults,
so applications that really need less secure option consciously change it,
not the other way around.
This may help to prevent downgrade attacks.

Signed-off-by: Sergey Korotkov <sergey.korotkov@nordicsemi.no>
2024-12-04 12:10:54 +01:00
Stine Akredalen
6c0306622e Bluetooth: fix GATT service reregistering
* Fixed issue with reregistering of GATT services.
* Added unit tests covering the GATT reregistering scenario.

Signed-off-by: Stine Åkredalen <stine.akredalen@nordicsemi.no>
2024-12-04 12:10:22 +01:00
alperen sener
b78eea256b Tests: Bluetooth: Tester: Mesh DFUM and BLOB should have own elements
Moving the blob client, dfd server and dfu server to their own
elements and increasing the CONFIG_BT_MESH_TX_SEG_MAX to 8 to fit
new composition data into composition data page status message.

Standalone mesh blob client and DFU distributor/update server models
requires one element and those elements only contain the main models
and the models they extend to.

Referring to MshMBT_v1.0 Section 6.1:
The BLOB Transfer Client model defines the messages listed in Table 6.1
, and requires one element: the BLOB Transfer Client Main element. The
BLOB Transfer Client Main element contains the BLOB Transfer Client
main model.

And referring to MshDFU_v1.0 Sections 6.1.1 and 6.2.1:
6.1.1
The Firmware Update Server model adds the state instances listed in
Table 6.1 and Table 6.2 and the messages listed in Table 6.3 to the
model it extends, and requires one element: the Firmware Update Main
element. The Firmware Update Main element contains the Firmware Update
Server main model and all the models that the main model extends.
6.2.1
The Firmware Distribution Server model adds the state instances listed
in Table 6.7 and Table 6.8 and the messages listed in Table 6.9 to the
model it extends, and requires one element: the Firmware Distribution
Main element. The Firmware Distribution Main element contains the
Firmware Distribution Server main model and all the models that the
main model extends.

Signed-off-by: alperen sener <alperen.sener@nordicsemi.no>
2024-12-04 09:23:44 +01:00
Johan Hedberg
8b02141ca7 Bluetooth: Controller: Replace BT_CTLR with HAS_BT_CTLR
Deprecate BT_CTLR, and add a new HAS_BT_CTLR as a virtual option which
specific users (like BT_LL_SW_SPLIT) select. This also means that we can
remove all places that were forcefully enabling the BT_CTLR option, and
instead we now depend on devicetree to get some local LL HCI driver
enabled which in turn also enables the HAS_BT_CTLR option.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-12-03 10:16:44 +01:00
Pieter De Gendt
e9e64bab35 drivers: bluetooth: hci: Place API into iterable section
Add wrapper DEVICE_API macro to all bt_hci_driver_api instances.

Signed-off-by: Pieter De Gendt <pieter.degendt@basalte.be>
2024-11-29 14:49:53 +01:00
Valerio Setti
ba34d602fa tests: bt_crypto: fix kconfig for qemu_cortex_m3
Increase test and main stack sizes for the qemu_cortex_m3 platform
in order to be able to successfully run the test.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
55c0b2ea45 tests: bt: enable entropy sources where missing
Moving from TinyCrypt to PSA Crypto API caused an entropy source
to be always required, so this commit adds it in tests where
necessary.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
65751c1c33 tests: bt: add Mbed TLS headers to the build
Include Mbed TLS headers to the build system. This is required
because these tests do not follow the "standard build pattern"
of Mbed TLS in Zephyr, otherwise include files would be already
available after the library has been linked. In these examples
some BT source files and Kconfigs are manually added to the
CmakeLists.txt file bypassing the standard library build pattern,
so Mbed TLS headers must also be added manually.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
7c1b5059ca tests: bluetooth: replace TinyCrypt with PSA in unit tests
Replace all references to TinyCrypt with PSA Crypto API in BT unit
tests.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
0f4875b7d0 bt-mesh: deprecate BT_MESH_USES_TINYCRYPT
Since the TinyCrypt library is being deprecated in Zephyr, this
commit set TinyCrypt usage in BT mesh as deprecated and it sets
Mbed TLS PSA Crypto API as the default option (when TF-M is not
available).
Tests are also updated in this commit.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
f4592382bb bt: use PSA for HCI ECC and rename BT_TINYCRYPT_ECC
This commit sets PSA Crypto API as the default library to perform
ECC-DH in HCI, replacing TinyCrypt (which is being deprecated).
Therefore the symbol BT_TINYCRYPT_ECC is renamed as BT_SEND_ECC_EMULATION.
References in samples/tests are also fixed.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Valerio Setti
da9ab6f593 bt: crypto/host: remove CONFIG_BT_USE_PSA_API symbol
CONFIG_BT_USE_PSA_API was used in BT crypto/host modules to select
PSA crypto API over TinyCrypt (which was the default until now).
Since TinyCrypt is being deprecated and PSA crypto API is the new
standard library for crypto operations, CONFIG_BT_USE_PSA_API is
no more needed.

Signed-off-by: Valerio Setti <vsetti@baylibre.com>
2024-11-27 16:40:47 -05:00
Théo Battrel
66ff97e69b Bluetooth: Host: Deprecate BT_BUF_ACL_RX_COUNT symbol
Because the number of ACL RX buffers must be at least the number of
maximum connections plus one, increasing `CONFIG_BT_MAX_CONN` could
inadvertently lead to a build failure if the number of ACL RX buffers is
not also increased. This dependency may not be obvious to users.

To address this issue, this commit deprecates the
`CONFIG_BT_BUF_RX_COUNT` Kconfig symbol and computes the value in
`buf.h` using the new `BT_BUF_RX_COUNT` define. Note that the default
value and the minimum range value have been changed to 0 to "disable"
the option.

Additionally, to allow users to increase the number of ACL RX buffers,
this commit introduces the new `CONFIG_BT_BUF_RX_COUNT_EXTRA` Kconfig
symbol. The value of this symbol will be added to the computed value of
`BT_BUF_RX_COUNT`.

The configurations of tests and samples have been updated to reflect
these changes.

Signed-off-by: Théo Battrel <theo.battrel@nordicsemi.no>
2024-11-27 10:30:59 +01:00
Aytürk Düzen
55bc3acf58 tests: bluetooth: tester: make hci_ipc confs generic for multi-core
nrf5340_hci_ipc.conf and nrf5340_hci_ipc_cpunet.conf were board specific
rename them for generic multi-core board support

Signed-off-by: Aytürk Düzen <ayturk.duzen@nordicsemi.no>
2024-11-27 08:16:50 +01:00
Aleksander Wasaznik
18fd49ea0e Bluetooth: Tester: Increase config values to make tests pass
Without this PTS tests do not pass. These values are copied from a
commit aimed at unifying the prj.conf files in this directory. I do not
know which of these are strictly necessary to make the tests pass.
Copying them all poses no harm since the unification will be done later
anyway.

Co-authored-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-11-27 08:16:18 +01:00
Aleksander Wasaznik
5a8daffc32 Bluetooth: Tester: Use BT_L2CAP_SEG_RECV for L2CAP tests
This API gives better control on L2CAP COC credits and suits better
for Upper Tester implementation.

Co-authored-by: Szymon Janc <szymon.janc@codecoup.pl>
Signed-off-by: Aleksander Wasaznik <aleksander.wasaznik@nordicsemi.no>
2024-11-27 08:16:18 +01:00
Emil Gydesen
e73bfb92c7 tests: Bluetooth: ASCS: Fix various issues in ASCS unit tests
The ASCS unit tests had various errors after adding support for
dynamic registration.
Several tests did not properly clean up after failure, causing other
tests to fail when they shouldn't.

Moved the register tests to their own file as they should not
do the register in the "before" function.

The test_ascs_unregister_with_ases_in_config_state test was also
removed, as it had both issues and the state that it wants to test
cannot be reached with the current API - It is not possible to
put an ASE in the configured state without callbacks,
and registered callbacks prevents us from calling
bt_bap_unicast_server_unregister to trigger the case as that can
only be done if callbacks are unregistered. Since unregistering
callbacks also puts all ASEs to the idle state, it is not possible
to call bt_bap_unicast_server_unregister for a non-idle ASE.

The testcase.yaml was also missing some Kconfig options to
properly enable the client tests.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-26 15:43:13 -05:00
Anas Nashif
b207035851 tests: add integration_platforms and misc optimizations
Add integration_platforms to many tests that use platform_allow to
manage scope of pull_request CI.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2024-11-26 00:12:07 +01:00
Andries Kruithof
bb3bab7a34 Bluetooth: Audio: implement the distribute broadcast code procedure
Implemenation of the distribute broadcast code CAP procedure, as well
as unittesting

Signed-off-by: Andries Kruithof <andries.kruithof@nordicsemi.no>
2024-11-25 21:52:53 +01:00
Emil Gydesen
322b177549 samples: Bluetooth: Reduce heap for hci_ipc
Reducing the heap requirement for the hci_ipc sample from
8KiB to 4KiB. It has been tested in various configurations to
work with 2300, but 4KiB was used to provide some leeway for
future updates.

The heap requirement is not documented, and it is unclear why
values lower than 2300 (not exact number) won't boot, and should
be investigated further.

Memory has become a very scarce resource for especially the ISO
builds for the nRF5340, which is why this is getting reduced.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-25 21:52:15 +01:00
Johan Hedberg
3063f18942 Bluetooth: Host: Remove unnecessary hci_driver.h includes
None of these files actually use anything from the hci_driver.h header
file.

Signed-off-by: Johan Hedberg <johan.hedberg@silabs.com>
2024-11-22 11:37:12 +01:00
Omkar Kulkarni
b160063efb Tests: Bluetooth: mesh_shell: Update prj.conf
Updates and aligns the project config file to enable usage of multiple
keys so that users are not required to manually update the project
config file for testing most common mesh scenarios requiring multiple
netkeys and appkeys.

Signed-off-by: Omkar Kulkarni <omkar.kulkarni@nordicsemi.no>
2024-11-21 14:46:47 +01:00
Emil Gydesen
c4fbe38219 Bluetooth: BAP: Depend on BT_PER_ADV_SYNC instead of select
Change the select of BT_PER_ADV_SYNC and BT_EXT_ADV to
depends on. This is an effort to reduce the use of
select for Kconfig options.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
4c86a5cc8d Bluetooth: BAP: Depend on BT_PAC_{SNK,SRC} instead of select
Modify ASCS and BAP Broadcast sink to depend on the PAC options
instead of selecting them.

Since Kconfig does not support "depends on X if Y",
a select for PAC_{SRC,SNK} is used depending on
ASCS_ASE_{SRC,SNK}.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
c0f86011cb Bluetooth: BAP: Depend on BT_ISO_SYNC_RECEIVER instead of select
The BAP Kconfigs option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
d22c7b0cf2 Bluetooth: BAP: Depend on BT_ISO_BROADCASTER instead of select
The BAP_BROADCAST_SOURCE Kconfig option now depends on
BT_ISO_BROADCASTER instead of selecting it.

This is an effort to reduce the use of select in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
df6b5981bf Bluetooth: Audio: depends on GATT instead of select
Modify the Kconfig options to depend on the GATT
features rather than selecting them.

This is part of an effort to reduce the amount of
selects we use in LE Audio.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-21 09:19:47 +01:00
Emil Gydesen
0fa9701a26 Bluetooth: Tester: Added flag parameter to CAP stop cmd
Added a flag parameter so that it is possible
to use the bt_cap_initiator_unicast_audio_stop to perform
disable+stop without releasing the streams by setting the
RELEASE flag.

This allows us to use the bt_cap_initiator_unicast_audio_stop
function to just disable streams without releasing them,
as that is requested by some PTS tests such as
CAP/INI/UST/BV-40-C.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-18 13:18:32 -05:00
Emil Gydesen
1f55b8d8a4 tests: Bluetooth: Tester: Increase conn interval
Increase the conn interval from 30 to 60 for more stability
in test with multiple lower testers (up to 3).

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-18 13:18:00 -05:00
Emil Gydesen
f9b5de2d0a tests: Bluetooth: Tester: Set conn = NULL in btp_gap
bt_conn_le_create logs an error if the provided conn is
not NULL. This small change cleans up the log a bit to
avoid the warning.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-16 15:25:41 -05:00
Emil Gydesen
75f5f71200 tests: Bluetooth: Tester: Redefine service IDs as hex
Everything else is defined as hex, so it makes sense to
be consistent. This will also make it easier to find the
service IDs in the logs that primarily already log
commands and events as hex.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-16 15:24:08 -05:00
Emil Gydesen
9a5fa367ba tests: Bluetooth: Tester: Format BTP cmd/evt/rsp logs as hex
Since the values are defined as hex, e.g. 0x82, it is easier
to compare with the log if they also log them as such.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-16 15:24:08 -05:00
Troels Nilsson
fa3bfa5453 Bluetooth: Controller: Add margin to ISOALs time offset
To ensure payloads are delivered in time for the first subevent
in framed BIS, ISOAL now enforces a (configurable) margin of
the calculated time offset

Without this margin, it has been observed that a broadcaster
can end up consistently missing the first subevent in every third
event in a 7.5 ms ISO with a 10 ms SDU interval

The margin is a conservative 2 ms by default, but can likely be
set a lot lower for most implementations and HWs

Signed-off-by: Troels Nilsson <trnn@demant.com>
2024-11-16 15:08:59 -05:00
Timothy Keys
e976a01bed Bluetooth: Host: Unit test for bt_le_cs_set_valid_chmap_bits
Add coverage of the bt_le_cs_set_valid_chmap_bits function to unit tests

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2024-11-16 14:58:14 -05:00
Timothy Keys
97399d4027 Bluetooth: Host: Remove code causing build error
This code is redundant and causes a build error if called more than
once.

Signed-off-by: Timothy Keys <timothy.keys@nordicsemi.no>
2024-11-16 14:58:14 -05:00
Emil Gydesen
8386929944 tests: Bluetooth: Tester: Log conn changes
Log the address and the err/reason values in the connected
and disconnect callbacks.

Since these values are not part of the BTP events it is
difficult to follow the order and reason why disconnects
happen when debugging.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-16 14:56:51 -05:00
Emil Gydesen
8703381764 Bluetooth: Host: Add conversion macros from ms to various units
Add conversion macros from milliseconds to various units.
The purpose of these macros is to make it more clear/easier
for users to set and read values using milliseconds rather
than the various BT units which may be in 0.625, 1.25 or 10ms
units.

This is especially useful when comparing related values using
different units, such as advertising interval (0.625ms units)
and periodic advertising interval units (1.25ms units).

Users will have to be aware that these macros can provide slightly
different values than what is provided, if the provided values
do not match the units.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-11-16 14:06:03 -05:00
Nidhal BEN OTHMEN
a199f7f9d3 tests: bluetooth: tester: Fix bluetooth tester for nucleo_wba55cg
Fix compilation error by specifying usart1 to be used for uart-pipe.
Add a board-specific configuration file to disable the console,
so, the usart1 will be used only for bluetooth and to specify
the BT_HCI_TX_STACK_SIZE.

Signed-off-by: Nidhal BEN OTHMEN <nidhal.benothmen@st.com>
2024-11-16 13:29:39 -05:00
Vinayak Kariappa Chettimada
525ba389bc tests: Bluetooth: tester: Workaround Bus Fault in nRF53x using full RAM
Workaround failing autopts weekly run due to tester
application having Bus Fault in the nRF53 NET core hci_ipc
firmware at startup.

Having atleast 32 bytes free in nRF53x hci_ipc sample to
avoid Bus Fault when Zephyr Kernel does SYSINIT calls.

Reduce supported ISO Broadcaster instance and ISO TX buffer
counts in the Controller hci_ipc firmware.

Add sysbuild support for tester application so that the
build is CI verified.

sysbuild commandline for LE audio PTS testing:

  # west build --sysbuild -b nrf5340_audio_dk/nrf5340/cpuapp
    -d build/tester tests/bluetooth/tester
    -DEXTRA_CONF_FILE="overlay-le-audio.conf"

Signed-off-by: Vinayak Kariappa Chettimada <vich@nordicsemi.no>
2024-11-08 09:25:28 -06:00
Szymon Janc
2f6a65c8a4 test: bluetooth: Update ICS to TCRL 2024-2
GAP PAST (and BAP) tests were also enabled since controller support is
under review.

This also adds bqw file which is exported draft project from
Qualification Workspace.

Signed-off-by: Szymon Janc <szymon.janc@codecoup.pl>
2024-11-06 17:38:36 -05:00
Emil Gydesen
5ebe1194be tests: Bluetooth: Tester: Fix use of uninitialized cig_id for CAP
The CAP tests used u_group->cig->index but the u_group->cig may
have been deleted when the stream is released, which meant
that u_group->cig == NULL when e.g. unicast_stop_complete_cb
was called and that could cause failing tests as the index
would just be a uninitialized value.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-31 09:23:16 -05:00
Emil Gydesen
3a8ce6efb4 tests: Bluetooth: tester: Add logging of messages for BTP
Add log statements for each command, event and response
for debugging purposes.

Tests do not send enough of these to clutter the IUT logs
and it is useful for debugging to more easily determine
what command triggered a function call or when the
responses and events are sent to the AutoPTS client.

Signed-off-by: Emil Gydesen <emil.gydesen@nordicsemi.no>
2024-10-30 14:27:23 -05:00