From 631a6a765adba1b761e76add3bfa73e98eb17585 Mon Sep 17 00:00:00 2001 From: Alberto Escolar Piedras Date: Wed, 1 Nov 2023 13:46:43 +0100 Subject: [PATCH] Bluetooth samples: broadcast audio source: Add sysbuild support So that for both the simulated nrf5340 and real HW nrf5340dk we build both network and application core images. Signed-off-by: Alberto Escolar Piedras --- .../broadcast_audio_source/Kconfig.sysbuild | 10 +++++ .../broadcast_audio_source/sample.yaml | 1 + .../broadcast_audio_source/sysbuild.cmake | 44 +++++++++++++++++++ 3 files changed, 55 insertions(+) create mode 100644 samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild create mode 100644 samples/bluetooth/broadcast_audio_source/sysbuild.cmake diff --git a/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild new file mode 100644 index 00000000000..37a6b66c7f4 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_source/Kconfig.sysbuild @@ -0,0 +1,10 @@ +# Copyright 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +source "share/sysbuild/Kconfig" + +config NET_CORE_BOARD + string + default "nrf5340dk_nrf5340_cpunet" if $(BOARD) = "nrf5340dk_nrf5340_cpuapp" + default "nrf5340_audio_dk_nrf5340_cpunet" if $(BOARD) = "nrf5340_audio_dk_nrf5340_cpuapp" + default "nrf5340bsim_nrf5340_cpunet" if $(BOARD) = "nrf5340bsim_nrf5340_cpuapp" diff --git a/samples/bluetooth/broadcast_audio_source/sample.yaml b/samples/bluetooth/broadcast_audio_source/sample.yaml index 1c3904d8c82..a8f99290ce3 100644 --- a/samples/bluetooth/broadcast_audio_source/sample.yaml +++ b/samples/bluetooth/broadcast_audio_source/sample.yaml @@ -12,6 +12,7 @@ tests: - qemu_x86 - nrf5340dk_nrf5340_cpuapp tags: bluetooth + sysbuild: true sample.bluetooth.broadcast_audio_source.bt_ll_sw_split: harness: bluetooth platform_allow: diff --git a/samples/bluetooth/broadcast_audio_source/sysbuild.cmake b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake new file mode 100644 index 00000000000..c150913cc55 --- /dev/null +++ b/samples/bluetooth/broadcast_audio_source/sysbuild.cmake @@ -0,0 +1,44 @@ +# Copyright (c) 2023 Nordic Semiconductor ASA +# SPDX-License-Identifier: Apache-2.0 + +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) + # For builds in the nrf5340, we build the netcore image with the controller + + set(NET_APP hci_ipc) + set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) + + ExternalZephyrProject_Add( + APPLICATION ${NET_APP} + SOURCE_DIR ${NET_APP_SRC_DIR} + BOARD ${SB_CONFIG_NET_CORE_BOARD} + ) + + set(${NET_APP}_CONF_FILE + ${NET_APP_SRC_DIR}/nrf5340_cpunet_iso-bt_ll_sw_split.conf + CACHE INTERNAL "" + ) + + # Let's build the net core library first + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) + + if("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") + # For the simulated board, the application core build will produce the final executable + # for that, we give it the path to the netcore image + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" + ) + endif() +endif() + +if(("${BOARD}" MATCHES "native") OR ("${BOARD}" MATCHES "bsim")) + # Let's meet the expectation of finding the final executable in zephyr/zephyr.exe + add_custom_target(final_executable + ALL + COMMAND + ${CMAKE_COMMAND} -E copy + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe + DEPENDS ${DEFAULT_IMAGE} + ) +endif()