1# Copyright (c) 2023 Nordic Semiconductor ASA
2# SPDX-License-Identifier: Apache-2.0
3
4set(zephyr_build_path ${APPLICATION_BINARY_DIR}/zephyr)
5get_property(CCACHE GLOBAL PROPERTY RULE_LAUNCH_COMPILE)
6
7target_link_options(native_simulator INTERFACE
8  "-T ${ZEPHYR_BASE}/boards/native/common/natsim_linker_script.ld")
9
10set(nsi_config_content
11  ${nsi_config_content}
12  "NSI_BUILD_OPTIONS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,INTERFACE_COMPILE_OPTIONS>,\ >"
13  "NSI_BUILD_PATH:=${zephyr_build_path}/NSI"
14  "NSI_CC:=${CCACHE} ${CMAKE_C_COMPILER}"
15  "NSI_OBJCOPY:=${CMAKE_OBJCOPY}"
16  "NSI_EMBEDDED_CPU_SW:=${zephyr_build_path}/${KERNEL_ELF_NAME} ${CONFIG_NATIVE_SIMULATOR_EXTRA_IMAGE_PATHS}"
17  "NSI_EXE:=${zephyr_build_path}/${KERNEL_EXE_NAME}"
18  "NSI_EXTRA_SRCS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,INTERFACE_SOURCES>,\ >"
19  "NSI_LINK_OPTIONS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,INTERFACE_LINK_OPTIONS>,\ >"
20  "NSI_EXTRA_LIBS:=$<JOIN:$<TARGET_PROPERTY:native_simulator,RUNNER_LINK_LIBRARIES>,\ >"
21  "NSI_PATH:=${NSI_DIR}/"
22  "NSI_N_CPUS:=${CONFIG_NATIVE_SIMULATOR_NUMBER_MCUS}"
23  "NSI_LOCALIZE_OPTIONS:=--localize-symbol=CONFIG_* $<JOIN:$<TARGET_PROPERTY:native_simulator,LOCALIZE_EXTRA_OPTIONS>,\ >"
24)
25
26string(REPLACE ";" "\n" nsi_config_content "${nsi_config_content}")
27
28file(GENERATE OUTPUT "${zephyr_build_path}/NSI/nsi_config"
29  CONTENT "${nsi_config_content}"
30)
31