|
| 1 | +# Copyright (c) 2023 Nordic Semiconductor ASA |
| 2 | +# SPDX-License-Identifier: Apache-2.0 |
| 3 | + |
| 4 | +if(NOT("${SB_CONFIG_NET_CORE_BOARD}" STREQUAL "")) |
| 5 | + set(NET_APP hci_rpmsg) |
| 6 | + set(NET_APP_SRC_DIR ${ZEPHYR_BASE}/samples/bluetooth/${NET_APP}) |
| 7 | + |
| 8 | + ExternalZephyrProject_Add( |
| 9 | + APPLICATION ${NET_APP} |
| 10 | + SOURCE_DIR ${NET_APP_SRC_DIR} |
| 11 | + BOARD ${SB_CONFIG_NET_CORE_BOARD} |
| 12 | + ) |
| 13 | + |
| 14 | + set(${NET_APP}_CONF_FILE |
| 15 | + ${NET_APP_SRC_DIR}/nrf5340_cpunet_iso-bt_ll_sw_split.conf |
| 16 | + CACHE INTERNAL "" |
| 17 | + ) |
| 18 | + |
| 19 | + # For the simulated board, the application core build will produce the final executable |
| 20 | + # for that, we give it the path to the netcore image |
| 21 | + set(NET_LIBRARY_PATH ${CMAKE_BINARY_DIR}/${NET_APP}/zephyr/zephyr.elf) |
| 22 | + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG |
| 23 | + "CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS=\"${NET_LIBRARY_PATH}\"\n" |
| 24 | + ) |
| 25 | + |
| 26 | + if (NOT ("${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}" STREQUAL "")) |
| 27 | + set_property(TARGET ${NET_APP} APPEND_STRING PROPERTY CONFIG |
| 28 | + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" |
| 29 | + ) |
| 30 | + set_property(TARGET ${DEFAULT_IMAGE} APPEND_STRING PROPERTY CONFIG |
| 31 | + "CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX=${SB_CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}\n" |
| 32 | + ) |
| 33 | + endif() |
| 34 | + |
| 35 | + # Let's build the net core library first |
| 36 | + add_dependencies(${DEFAULT_IMAGE} ${NET_APP}) |
| 37 | +endif() |
| 38 | + |
| 39 | +# Let's meet the expectation of finding the final executable in zephyr/zephyr.exe |
| 40 | +add_custom_target(final_executable |
| 41 | + ALL |
| 42 | + COMMAND |
| 43 | + ${CMAKE_COMMAND} -E copy |
| 44 | + ${CMAKE_BINARY_DIR}/${DEFAULT_IMAGE}/zephyr/zephyr.exe |
| 45 | + ${CMAKE_BINARY_DIR}/zephyr/zephyr.exe |
| 46 | + DEPENDS ${DEFAULT_IMAGE} |
| 47 | +) |
0 commit comments