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

applications: nrf5340_audio: Buildprog transport mandatory #20817

Merged
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
5 changes: 5 additions & 0 deletions applications/nrf5340_audio/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ add_compile_definitions(GATEWAY=2)

find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

# Test a configuration file option has been given
if(NOT DEFINED EXTRA_CONF_FILE)
message(FATAL_ERROR "No configuration file specified, set -- -DEXTRA_CONF_FILE=<configuration file>")
endif()

project(NRF5340_AUDIO)

string(TIMESTAMP NRF5340_AUDIO_CORE_APP_COMP_DATE "%a %b %d %H:%M:%S %Y")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

CONFIG_TRANSPORT_BIS=y
CONFIG_AUDIO_DEV=1

## ACL related configs ##
CONFIG_BT_OBSERVER=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

CONFIG_TRANSPORT_BIS=y
CONFIG_AUDIO_DEV=2

CONFIG_BT_CAP_INITIATOR=y
CONFIG_BT_AUDIO=y
Expand Down
26 changes: 17 additions & 9 deletions applications/nrf5340_audio/doc/building.rst
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ The building command for running the script requires providing the following par
- ``release``, ``debug``
- | :ref:`nrf53_audio_app_configuration_files`
| **Note:** For FOTA DFU, you must use :ref:`nrf53_audio_app_building_standard`.
* - Transport type (``-t``)
- Specifies the transport type.
- ``broadcast``, ``unicast``
- :ref:`nrf53_audio_app_overview_architecture`
* - Device type (``-d``)
- Specifies the device type.
- ``headset``, ``gateway``, ``both``
Expand All @@ -107,7 +111,7 @@ For example, the following command builds headset and gateway applications using

.. code-block:: console

python buildprog.py -c app -b debug -d both
python buildprog.py -c app -b debug -d both -t unicast

The command can be run from any location, as long as the correct path to :file:`buildprog.py` is given.

Expand All @@ -132,9 +136,9 @@ The command for programming can look as follows:

.. code-block:: console

python buildprog.py -c both -b debug -d both -p
python buildprog.py -c both -b debug -d both -t unicast -p

This command builds the headset and the gateway applications with ``debug`` version of both the application core binary and the network core binary - and programs each to its respective core.
This command builds the unicast headset and the gateway applications with ``debug`` version of both the application core binary and the network core binary - and programs each to its respective core.
If you want to rebuild from scratch, you can add the ``--pristine`` parameter to the command (west's ``-p`` for cannot be used for a pristine build with the script).

.. note::
Expand All @@ -143,7 +147,7 @@ If you want to rebuild from scratch, you can add the ``--pristine`` parameter to

.. code-block:: console

python buildprog.py -c both -b debug -d both -p --recover_on_fail
python buildprog.py -c both -b debug -d both -t unicast -p --recover_on_fail

Getting help
------------
Expand Down Expand Up @@ -247,17 +251,21 @@ The application supports the following custom configurations:
- | Builds the debug version of the application with the features needed to perform DFU over Bluetooth LE, and includes bootloaders so that the applications on both the application core and network core can be updated.
| See :ref:`nrf53_audio_app_fota` for more information.

.. _nrf53_audio_app_configuration_select_build:

Building the application
========================

Complete the following steps to build the application:

1. Choose the combination of build flags:

a. Choose the device type by using one of the following options:
a. Choose the device type by using one of the following :ref:`CMake options for extra Kconfig fragments <cmake_options>`:

* For headset device: ``-DCONFIG_AUDIO_DEV=1``
* For gateway device: ``-DCONFIG_AUDIO_DEV=2``
* For unicast headset: ``-DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf"``
* For unicast gateway: ``-DEXTRA_CONF_FILE=".\unicast_client\overlay-unicast_client.conf"``
* For broadcast headset: ``-DEXTRA_CONF_FILE=".\broadcast_sink\overlay-broadcast_sink.conf"``
* For broadcast gateway: ``-DEXTRA_CONF_FILE=".\broadcast_source\overlay-broadcast_source.conf"``

#. Choose the application version (:ref:`nrf53_audio_app_building_config_files`) by using one of the following options:

Expand All @@ -269,7 +277,7 @@ Complete the following steps to build the application:

.. code-block:: console

west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -DFILE_SUFFIX=release
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf" -DFILE_SUFFIX=release

This command creates the build files for headset device directly in the :file:`build` directory.
What this means is that you cannot create build files for all devices you want to program, because the subsequent commands will overwrite the files in the :file:`build` directory.
Expand All @@ -285,7 +293,7 @@ The following command example builds the application for :ref:`nrf53_audio_app_f

.. code-block:: console

west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -DFILE_SUFFIX=fota
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf" -DFILE_SUFFIX=fota

The command uses ``-DFILE_SUFFIX=fota`` to pick :file:`prj_fota.conf` instead of the default :file:`prj.conf`.
It also uses the ``--pristine`` to clean the existing directory before starting the build process.
Expand Down
15 changes: 1 addition & 14 deletions applications/nrf5340_audio/doc/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,6 @@ Configuring the nRF5340 Audio applications

|config|

By default, if you have not made any changes to :file:`.conf` files at :file:`applications/nrf5340_audio/`, the nRF5340 :ref:`build script <nrf53_audio_app_building>` builds the :ref:`unicast server (CIS) <nrf53_audio_unicast_server_app>` application in the CIS unidirectional mode as a headset (with :kconfig:option:`CONFIG_TRANSPORT_CIS` set to ``y`` and :kconfig:option:`CONFIG_AUDIO_DEV` set to ``1``).

.. _nrf53_audio_app_configuration_select_build:

Selecting gateway or headset build
**********************************

Given the nRF5340 Audio :ref:`application architecture <nrf53_audio_app_overview>`, the nRF5340 Audio applications can be built for :ref:`either the gateway or the headset role <nrf53_audio_app_overview_gateway_headsets>`:

* The headset build is identified with :kconfig:option:`CONFIG_AUDIO_DEV` Kconfig option set to ``1``.
This is the default configuration.
* The gateway build can be selected by adding :kconfig:option:`CONFIG_AUDIO_DEV` Kconfig option set to ``2`` to the :file:`prj.conf` file.

.. _nrf53_audio_app_configuration_select_bidirectional:

Selecting the CIS bidirectional communication
Expand Down Expand Up @@ -93,7 +80,7 @@ You can use one of the following options, depending on how you decide to build t

.. code-block:: console

west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -Dnrf5340_audio_SHIELD=nrf21540ek -Dipc_radio_SHIELD=nrf21540ek
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf" -Dnrf5340_audio_SHIELD=nrf21540ek -Dipc_radio_SHIELD=nrf21540ek

To set the TX power output, use the ``CONFIG_BT_CTLR_TX_PWR_ANTENNA`` and ``CONFIG_MPSL_FEM_NRF21540_TX_GAIN_DB`` Kconfig options in :file:`applications/nrf5340_audio/sysbuild/ipc_radio/prj.conf`.

Expand Down
15 changes: 9 additions & 6 deletions applications/nrf5340_audio/tools/buildprog/buildprog.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,12 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
raise Exception("Invalid core!")

if device == AudioDevice.headset:
device_flag = "-DCONFIG_AUDIO_DEV=1"
dest_folder = TARGET_DEV_HEADSET_FOLDER
elif device == AudioDevice.gateway:
device_flag = "-DCONFIG_AUDIO_DEV=2"
dest_folder = TARGET_DEV_GATEWAY_FOLDER
else:
raise Exception("Invalid device!")

if build == BuildType.debug:
release_flag = ""
dest_folder /= TARGET_DEBUG_FOLDER
Expand All @@ -122,6 +121,9 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
dest_folder /= TARGET_RELEASE_FOLDER
else:
raise Exception("Invalid build type!")

device_flag = ""

if options.nrf21540:
device_flag += " -Dnrf5340_audio_SHIELD=nrf21540ek"
device_flag += " -Dipc_radio_SHIELD=nrf21540ek"
Expand All @@ -139,13 +141,14 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
if options.transport == Transport.broadcast.name:
if device == AudioDevice.headset:
overlay_flag = f" -DEXTRA_CONF_FILE={BROADCAST_SINK_OVERLAY}"
elif device == AudioDevice.gateway:
else:
overlay_flag = f" -DEXTRA_CONF_FILE={BROADCAST_SOURCE_OVERLAY}"
elif options.transport == Transport.unicast.name:
else:
if device == AudioDevice.headset:
overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_SERVER_OVERLAY}"
elif device == AudioDevice.gateway:
else:
overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_CLIENT_OVERLAY}"

if os.name == 'nt':
release_flag = release_flag.replace('\\', '/')
if pristine:
Expand Down Expand Up @@ -312,7 +315,7 @@ def __main():
parser.add_argument(
"-t",
"--transport",
type=str,
required = True,
choices=[i.name for i in Transport],
default=Transport.unicast.name,
help="Select the transport type",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#

CONFIG_BT_CENTRAL=y
CONFIG_AUDIO_DEV=2

CONFIG_BT_GATT_DYNAMIC_DB=y
CONFIG_BT_GATT_CLIENT=y
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

CONFIG_AUDIO_DEV=1

CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y
CONFIG_BT_GATT_AUTO_RESUBSCRIBE=n
CONFIG_BT_GATT_AUTO_SEC_REQ=n
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ Samples and applications

This section describes the changes related to samples and applications.

|no_changes_yet_note|
nRF5340 Audio applications
--------------------------

.. toggle::

* The :ref:`nrf53_audio_app` :ref:`nrf53_audio_app_building_script` now requires the transport (``-t/--transport``) type to be included.
* The :ref:`nrf53_audio_app` :ref:`nrf53_audio_app_building_standard` now requires an extra :ref:`CMake option to provide extra Kconfig fragments <cmake_options>` to select the device type.

Libraries
=========
Expand Down