Skip to content

Commit e671e98

Browse files
committed
applications: nrf5340_audio: Buildprog transport mandatory
OCT-3328 Now forces the -t/--transport option in buildprog as mandatory Signed-off-by: Graham Wacey <graham.wacey@nordicsemi.no>
1 parent 889f929 commit e671e98

File tree

9 files changed

+45
-25
lines changed

9 files changed

+45
-25
lines changed

applications/nrf5340_audio/CMakeLists.txt

+5
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ add_compile_definitions(GATEWAY=2)
1212

1313
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
1414

15+
# Test a configuration file option has been given
16+
if(NOT DEFINED EXTRA_CONF_FILE)
17+
message(FATAL_ERROR "No configuration file specified, set -DEXTRA_CONF_FILE=<configuration file>")
18+
endif()
19+
1520
project(NRF5340_AUDIO)
1621

1722
string(TIMESTAMP NRF5340_AUDIO_CORE_APP_COMP_DATE "%a %b %d %H:%M:%S %Y")

applications/nrf5340_audio/broadcast_sink/overlay-broadcast_sink.conf

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66

77
CONFIG_TRANSPORT_BIS=y
8+
CONFIG_AUDIO_DEV=1
89

910
## ACL related configs ##
1011
CONFIG_BT_OBSERVER=y

applications/nrf5340_audio/broadcast_source/overlay-broadcast_source.conf

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66

77
CONFIG_TRANSPORT_BIS=y
8+
CONFIG_AUDIO_DEV=2
89

910
CONFIG_BT_CAP_INITIATOR=y
1011
CONFIG_BT_AUDIO=y

applications/nrf5340_audio/doc/building.rst

+14-8
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,10 @@ The building command for running the script requires providing the following par
9898
- ``release``, ``debug``
9999
- | :ref:`nrf53_audio_app_configuration_files`
100100
| **Note:** For FOTA DFU, you must use :ref:`nrf53_audio_app_building_standard`.
101+
* - Transport type (``-t``)
102+
- Specifies the transpoert type.
103+
- ``broadcast``, ``unicast``
104+
- :ref:`nrf53_audio_app_overview_broadcast_unicast`
101105
* - Device type (``-d``)
102106
- Specifies the device type.
103107
- ``headset``, ``gateway``, ``both``
@@ -107,7 +111,7 @@ For example, the following command builds headset and gateway applications using
107111

108112
.. code-block:: console
109113
110-
python buildprog.py -c app -b debug -d both
114+
python buildprog.py -c app -b debug -d both -t unicast
111115
112116
The command can be run from any location, as long as the correct path to :file:`buildprog.py` is given.
113117

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

133137
.. code-block:: console
134138
135-
python buildprog.py -c both -b debug -d both -p
139+
python buildprog.py -c both -b debug -d both -t unicast -p
136140
137-
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.
141+
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.
138142
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).
139143

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

144148
.. code-block:: console
145149
146-
python buildprog.py -c both -b debug -d both -p --recover_on_fail
150+
python buildprog.py -c both -b debug -d both -t unicast -p --recover_on_fail
147151
148152
Getting help
149153
------------
@@ -256,8 +260,10 @@ Complete the following steps to build the application:
256260

257261
a. Choose the device type by using one of the following options:
258262

259-
* For headset device: ``-DCONFIG_AUDIO_DEV=1``
260-
* For gateway device: ``-DCONFIG_AUDIO_DEV=2``
263+
* For unicast headset: ``-DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf"``
264+
* For unicast gateway: ``-DEXTRA_CONF_FILE=".\unicast_client\overlay-unicast_client.conf"``
265+
* For broadcast headset: ``-DEXTRA_CONF_FILE=".\broadcast_sink\overlay-broadcast_sink.conf"``
266+
* For broadcast gateway: ``-DEXTRA_CONF_FILE=".\broadcast_source\overlay-broadcast_source.conf"``
261267

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

@@ -269,7 +275,7 @@ Complete the following steps to build the application:
269275

270276
.. code-block:: console
271277
272-
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -DFILE_SUFFIX=release
278+
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf" -DFILE_SUFFIX=release
273279
274280
This command creates the build files for headset device directly in the :file:`build` directory.
275281
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.
@@ -285,7 +291,7 @@ The following command example builds the application for :ref:`nrf53_audio_app_f
285291

286292
.. code-block:: console
287293
288-
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -DFILE_SUFFIX=fota
294+
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DEXTRA_CONF_FILE=".\unicast_server\overlay-unicast_server.conf" -DFILE_SUFFIX=fota
289295
290296
The command uses ``-DFILE_SUFFIX=fota`` to pick :file:`prj_fota.conf` instead of the default :file:`prj.conf`.
291297
It also uses the ``--pristine`` to clean the existing directory before starting the build process.

applications/nrf5340_audio/doc/configuration.rst

+1-14
Original file line numberDiff line numberDiff line change
@@ -9,21 +9,8 @@ Configuring the nRF5340 Audio applications
99

1010
|config|
1111

12-
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``).
13-
1412
.. _nrf53_audio_app_configuration_select_build:
1513

16-
Selecting gateway or headset build
17-
**********************************
18-
19-
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>`:
20-
21-
* The headset build is identified with :kconfig:option:`CONFIG_AUDIO_DEV` Kconfig option set to ``1``.
22-
This is the default configuration.
23-
* The gateway build can be selected by adding :kconfig:option:`CONFIG_AUDIO_DEV` Kconfig option set to ``2`` to the :file:`prj.conf` file.
24-
25-
.. _nrf53_audio_app_configuration_select_bidirectional:
26-
2714
Selecting the CIS bidirectional communication
2815
*********************************************
2916

@@ -93,7 +80,7 @@ You can use one of the following options, depending on how you decide to build t
9380

9481
.. code-block:: console
9582
96-
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -DCONFIG_AUDIO_DEV=1 -Dnrf5340_audio_SHIELD=nrf21540ek -Dipc_radio_SHIELD=nrf21540ek
83+
west build -b nrf5340_audio_dk/nrf5340/cpuapp --pristine -- -CONFIG_AUDIO_DEV=1 -Dnrf5340_audio_SHIELD=nrf21540ek -Dipc_radio_SHIELD=nrf21540ek
9784
9885
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`.
9986

applications/nrf5340_audio/tools/buildprog/buildprog.py

+12-3
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,12 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
107107
raise Exception("Invalid core!")
108108

109109
if device == AudioDevice.headset:
110-
device_flag = "-DCONFIG_AUDIO_DEV=1"
111110
dest_folder = TARGET_DEV_HEADSET_FOLDER
112111
elif device == AudioDevice.gateway:
113-
device_flag = "-DCONFIG_AUDIO_DEV=2"
114112
dest_folder = TARGET_DEV_GATEWAY_FOLDER
115113
else:
116114
raise Exception("Invalid device!")
115+
117116
if build == BuildType.debug:
118117
release_flag = ""
119118
dest_folder /= TARGET_DEBUG_FOLDER
@@ -122,6 +121,9 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
122121
dest_folder /= TARGET_RELEASE_FOLDER
123122
else:
124123
raise Exception("Invalid build type!")
124+
125+
device_flag = ""
126+
125127
if options.nrf21540:
126128
device_flag += " -Dnrf5340_audio_SHIELD=nrf21540ek"
127129
device_flag += " -Dipc_radio_SHIELD=nrf21540ek"
@@ -141,11 +143,18 @@ def __build_cmd_get(cores: Core, device: AudioDevice, build: BuildType,
141143
overlay_flag = f" -DEXTRA_CONF_FILE={BROADCAST_SINK_OVERLAY}"
142144
elif device == AudioDevice.gateway:
143145
overlay_flag = f" -DEXTRA_CONF_FILE={BROADCAST_SOURCE_OVERLAY}"
146+
else:
147+
raise Exception("Invalid device type!")
144148
elif options.transport == Transport.unicast.name:
145149
if device == AudioDevice.headset:
146150
overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_SERVER_OVERLAY}"
147151
elif device == AudioDevice.gateway:
148152
overlay_flag = f" -DEXTRA_CONF_FILE={UNICAST_CLIENT_OVERLAY}"
153+
else:
154+
raise Exception("Invalid device type!")
155+
else:
156+
raise Exception("Invalid transport type!")
157+
149158
if os.name == 'nt':
150159
release_flag = release_flag.replace('\\', '/')
151160
if pristine:
@@ -312,7 +321,7 @@ def __main():
312321
parser.add_argument(
313322
"-t",
314323
"--transport",
315-
type=str,
324+
required = True,
316325
choices=[i.name for i in Transport],
317326
default=Transport.unicast.name,
318327
help="Select the transport type",

applications/nrf5340_audio/unicast_client/overlay-unicast_client.conf

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
#
66

77
CONFIG_BT_CENTRAL=y
8+
CONFIG_AUDIO_DEV=2
89

910
CONFIG_BT_GATT_DYNAMIC_DB=y
1011
CONFIG_BT_GATT_CLIENT=y

applications/nrf5340_audio/unicast_server/overlay-unicast_server.conf

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
55
#
66

7+
CONFIG_AUDIO_DEV=1
8+
79
CONFIG_BT_GATT_AUTO_DISCOVER_CCC=y
810
CONFIG_BT_GATT_AUTO_RESUBSCRIBE=n
911
CONFIG_BT_GATT_AUTO_SEC_REQ=n

doc/nrf/releases_and_maturity/migration/migration_guide_3.0.rst

+8
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@ Samples and applications
2929

3030
This section describes the changes related to samples and applications.
3131

32+
nRF5340 Audio applications
33+
--------------------------
34+
35+
.. toggle::
36+
37+
* The :ref:`nrf53_audio_app` :ref:`nrf53_audio_app_building_script` now requires the transport (-t/--transport) type to be included.
38+
* The :ref:`nrf53_audio_app` :ref:`nrf53_audio_app_building_standard` now requires a configuration overlay compile option to be included.
39+
3240
|no_changes_yet_note|
3341

3442
Libraries

0 commit comments

Comments
 (0)