samples/drivers/mbox: Convert to sysbuild and add support for nrf5340bsim

Convert this sample application build to sysbuild,
and add support for the nrf5340bsim target.

Signed-off-by: Alberto Escolar Piedras <alberto.escolar.piedras@nordicsemi.no>
This commit is contained in:
Alberto Escolar Piedras 2023-10-24 10:24:55 +02:00 committed by Maureen Helm
commit eab2d89f53
8 changed files with 87 additions and 35 deletions

View file

@ -6,35 +6,19 @@
cmake_minimum_required(VERSION 3.20.0)
set(REMOTE_ZEPHYR_DIR ${CMAKE_CURRENT_BINARY_DIR}/mbox_ipc_remote-prefix/src/mbox_ipc_remote-build/zephyr)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
if("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp")
set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet")
elseif("${BOARD}" STREQUAL "adp_xc7k_ae350")
set(BOARD_REMOTE "adp_xc7k_ae350")
elseif("${BOARD}" STREQUAL "mimxrt595_evk_cm33")
set(BOARD_REMOTE "nrf5340dk_nrf5340_cpunet")
if(("${BOARD}" STREQUAL "nrf5340dk_nrf5340_cpuapp") OR
("${BOARD}" STREQUAL "nrf5340bsim_nrf5340_cpuapp") OR
("${BOARD}" STREQUAL "adp_xc7k_ae350") OR
("${BOARD}" STREQUAL "mimxrt595_evk_cm33"))
message(STATUS "${BOARD} compile as Main in this sample")
else()
message(FATAL_ERROR "${BOARD} is not supported for this sample")
endif()
message(STATUS "${BOARD} compile as Main in this sample")
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(mbox_ipc)
enable_language(C ASM)
target_sources(app PRIVATE src/main.c)
include(ExternalProject)
ExternalProject_Add(
mbox_ipc_remote
SOURCE_DIR ${APPLICATION_SOURCE_DIR}/remote
INSTALL_COMMAND "" # This particular build system has no install command
CMAKE_CACHE_ARGS -DBOARD:STRING=${BOARD_REMOTE}
BUILD_BYPRODUCTS "${REMOTE_ZEPHYR_DIR}/${KERNEL_BIN_NAME}"
# NB: Do we need to pass on more CMake variables?
BUILD_ALWAYS True
)