1# Copyright (c) 2023 Nordic Semiconductor ASA 2# Copyright (c) 2018 Oticon A/S 3# SPDX-License-Identifier: Apache-2.0 4 5find_package(BabbleSim) 6 7zephyr_library() 8 9if (CONFIG_BOARD_NRF54L15BSIM_NRF54L15_CPUFLPR) 10 message(FATAL_ERROR "Targeting the nrf54l15bsim/nrf54l15/cpuflpr core is not yet supported") 11endif() 12 13# Due to the BLE controller assumption about enum size 14zephyr_compile_options( 15 -fshort-enums 16) 17# Structures layouts needs to match in the interface between the runner and the embedded SW 18# The nrfx HAL uses enums in its definitions,so they need to have the same size in both, 19# as both the HW models and embedded SW use them. 20target_compile_options(native_simulator INTERFACE -fshort-enums) 21 22zephyr_library_sources( 23 irq_handler.c 24 cpu_wait.c 25 argparse.c 26 nsi_if.c 27 native_remap.c 28 soc/nrfx_coredep.c 29 common/bstests_entry.c 30 common/cmsis/cmsis.c 31 common/trace_hook.c 32) 33 34# Include sync_rtc from real SOC code if enabled 35zephyr_library_sources_ifdef(CONFIG_NRF53_SYNC_RTC 36 ${ZEPHYR_BASE}/soc/nordic/nrf53/sync_rtc.c 37 ) 38 39target_sources(native_simulator INTERFACE 40 common/bsim_args_runner.c 41 common/bsim_extra_cpu_if_stubs.c 42 common/phy_sync_ctrl.c 43 common/runner_hooks.c 44 common/posix_arch_if.c 45 common/trace_hook.c 46) 47 48if (CONFIG_IPC_SERVICE AND CONFIG_BOARD_NRF5340BSIM_NRF5340_CPUAPP) 49 zephyr_library_sources( 50 ipc_backend.c 51 ) 52endif() 53 54zephyr_include_directories( 55 soc 56 common 57 common/cmsis 58 ${NSI_DIR}/common/src/include 59 ${ZEPHYR_BASE}/soc/nordic/common 60) 61 62zephyr_library_include_directories( 63 ${BSIM_COMPONENTS_PATH}/libUtilv1/src/ 64 ${BSIM_COMPONENTS_PATH}/libPhyComv1/src/ 65 ${BSIM_COMPONENTS_PATH}/libRandv2/src/ 66 ${ZEPHYR_BASE}/kernel/include 67 ${ZEPHYR_BASE}/arch/posix/include 68 common/ 69) 70 71set(libpath ${BSIM_OUT_PATH}/lib) 72set_property(TARGET native_simulator APPEND PROPERTY RUNNER_LINK_LIBRARIES 73 ${libpath}/libUtilv1.32.a 74 ${libpath}/libPhyComv1.32.a 75 ${libpath}/lib2G4PhyComv1.32.a 76 ${libpath}/libRandv2.32.a 77) 78 79target_compile_options(native_simulator INTERFACE 80 "-DNSI_PRIMARY_MCU_N=${CONFIG_NATIVE_SIMULATOR_PRIMARY_MCU_INDEX}") 81 82add_subdirectory(${ZEPHYR_BASE}/boards/native/common/extra_args/ 83 ${CMAKE_CURRENT_BINARY_DIR}/extra_args 84) 85 86include(../common/natsim_config.cmake) 87