cmake: emu: nsim: Allow all nsim platform use mdb
Currently the default runner of nsim_hs_smp is mdb, the runner of other nsim platform is nsimdrv, user can't change the default runner unless he uses west command(--runner). With this change cmake will choose runner according to BOARD_DEBUG_RUNNER or BOARD_FLASH_RUNNER. so if add -DBOARD_FLASH_RUNNER=mdb-nsim or -DBOARD_DEBUG_RUNNER=mdb-nsim to cmake command, the apllication will be run with mdb. Signed-off-by: Jingru Wang <jingru@synopsys.com>
This commit is contained in:
parent
f1c8fcac8b
commit
cd87366016
2 changed files with 42 additions and 44 deletions
|
@ -2,29 +2,18 @@
|
|||
set(EMU_PLATFORM nsim)
|
||||
|
||||
if(NOT (CONFIG_SOC_NSIM_HS_SMP OR CONFIG_SOC_NSIM_HS6X_SMP))
|
||||
board_set_flasher_ifnset(arc-nsim)
|
||||
board_set_debugger_ifnset(arc-nsim)
|
||||
board_set_flasher_ifnset(arc-nsim)
|
||||
board_set_debugger_ifnset(arc-nsim)
|
||||
|
||||
board_runner_args(arc-nsim "--props=${BOARD}.props")
|
||||
set(NSIM_PROPS "${BOARD}.props")
|
||||
endif()
|
||||
|
||||
if(${CONFIG_SOC_NSIM_EM})
|
||||
board_runner_args(arc-nsim "--props=nsim_em.props")
|
||||
board_runner_args(mdb-nsim "--nsim_args=mdb_em.args")
|
||||
elseif(${CONFIG_SOC_NSIM_EM7D_V22})
|
||||
board_runner_args(arc-nsim "--props=nsim_em7d_v22.props")
|
||||
board_runner_args(mdb-nsim "--nsim_args=mdb_em7d_v22.args")
|
||||
elseif(${CONFIG_SOC_NSIM_SEM})
|
||||
board_runner_args(arc-nsim "--props=nsim_sem.props")
|
||||
board_runner_args(mdb-nsim "--nsim_args=mdb_sem.args")
|
||||
elseif(${CONFIG_SOC_NSIM_HS})
|
||||
board_runner_args(arc-nsim "--props=nsim_hs.props")
|
||||
board_runner_args(mdb-nsim "--nsim_args=mdb_hs.args")
|
||||
elseif(${CONFIG_SOC_NSIM_HS_SMP})
|
||||
board_runner_args(mdb-nsim "--cores=${CONFIG_MP_NUM_CPUS}" "--nsim_args=mdb_hs_smp.args")
|
||||
elseif(${CONFIG_SOC_NSIM_HS6X})
|
||||
board_runner_args(arc-nsim "--props=nsim_hs6x.props")
|
||||
board_runner_args(mdb-nsim "--nsim_args=mdb_hs6x.args")
|
||||
elseif(${CONFIG_SOC_NSIM_HS6X_SMP})
|
||||
board_runner_args(mdb-nsim "--cores=${CONFIG_MP_NUM_CPUS}" "--nsim_args=mdb_hs6x_smp.args")
|
||||
string(REPLACE "nsim" "mdb" MDB_ARGS "${BOARD}.args")
|
||||
if((CONFIG_SOC_NSIM_HS_SMP OR CONFIG_SOC_NSIM_HS6X_SMP))
|
||||
board_runner_args(mdb-nsim "--cores=${CONFIG_MP_NUM_CPUS}" "--nsim_args=${MDB_ARGS}")
|
||||
else()
|
||||
board_runner_args(mdb-nsim "--nsim_args=${MDB_ARGS}")
|
||||
endif()
|
||||
|
||||
board_finalize_runner_args(arc-nsim)
|
||||
|
|
|
@ -1,46 +1,54 @@
|
|||
# SPDX-License-Identifier: Apache-2.0
|
||||
if((${CONFIG_SOC_NSIM_HS_SMP}) OR (${CONFIG_SOC_NSIM_HS6X_SMP}))
|
||||
if("${BOARD_DEBUG_RUNNER}" STREQUAL "mdb-nsim" OR "${BOARD_FLASH_RUNNER}" STREQUAL "mdb-nsim")
|
||||
# mdb is required to run nsim multicore targets
|
||||
find_program(
|
||||
MDB
|
||||
mdb
|
||||
)
|
||||
set(MDB_BASIC_OPTIONS -nooptions -nogoifmain -toggle=include_local_symbols=1)
|
||||
|
||||
if(${CONFIG_SOC_NSIM_HS_SMP})
|
||||
set(MDB_ARGS mdb_hs_smp.args)
|
||||
elseif(${CONFIG_SOC_NSIM_HS6X_SMP})
|
||||
set(MDB_ARGS mdb_hs6x_smp.args)
|
||||
# remove previous .sc.project folder which has temporary settings for MDB.
|
||||
set(MDB_OPTIONS ${CMAKE_COMMAND} -E rm -rf ${APPLICATION_BINARY_DIR}/.sc.project)
|
||||
if(CONFIG_MP_NUM_CPUS GREATER 1)
|
||||
set(MULTIFILES ${MDB} -multifiles=)
|
||||
foreach(val RANGE ${CONFIG_MP_NUM_CPUS})
|
||||
if(val LESS CONFIG_MP_NUM_CPUS)
|
||||
MATH(EXPR PSET_NUM "${CONFIG_MP_NUM_CPUS}-${val}")
|
||||
MATH(EXPR CORE_NUM "${CONFIG_MP_NUM_CPUS}-${val}-1")
|
||||
if(PSET_NUM GREATER 0)
|
||||
list(APPEND MDB_OPTIONS &&)
|
||||
endif()
|
||||
list(APPEND MDB_OPTIONS ${MDB} -pset=${PSET_NUM} -psetname=core${CORE_NUM})
|
||||
if(PSET_NUM GREATER 1)
|
||||
list(APPEND MDB_OPTIONS -prop=download=2)
|
||||
set(MULTIFILES ${MULTIFILES}core${CORE_NUM},)
|
||||
else()
|
||||
set(MULTIFILES ${MULTIFILES}core${CORE_NUM})
|
||||
endif()
|
||||
list(APPEND MDB_OPTIONS ${MDB_BASIC_OPTIONS} -nsim @${BOARD_DIR}/support/${MDB_ARGS} ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME})
|
||||
endif()
|
||||
endforeach()
|
||||
list(APPEND MDB_OPTIONS && NSIM_MULTICORE=1 ${MULTIFILES} -run -cl)
|
||||
else()
|
||||
list(APPEND MDB_OPTIONS && ${MDB} ${MDB_BASIC_OPTIONS} -nsim @${BOARD_DIR}/support/${MDB_ARGS} -run -cl)
|
||||
endif()
|
||||
|
||||
string(REPLACE ";" " " MDB_COMMAND "${MDB_OPTIONS}")
|
||||
add_custom_target(run
|
||||
COMMAND
|
||||
${MDB} -pset=1 -psetname=core0 -prop=ident=0x00000050 -cmpd=soc
|
||||
@${BOARD_DIR}/support/${MDB_ARGS} ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} &&
|
||||
${MDB} -pset=2 -psetname=core1 -prop=download=2 -prop=ident=0x00000150 -cmpd=soc
|
||||
@${BOARD_DIR}/support/${MDB_ARGS} ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME} &&
|
||||
NSIM_MULTICORE=1 ${MDB} -multifiles=core0,core1 -cmpd=soc -run -cl
|
||||
${MDB_OPTIONS}
|
||||
${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
|
||||
DEPENDS ${logical_target_for_zephyr_elf}
|
||||
WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
|
||||
COMMENT "MDB COMMAND: ${MDB_COMMAND} ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
)
|
||||
else()
|
||||
find_program(
|
||||
NSIM
|
||||
nsimdrv
|
||||
)
|
||||
|
||||
if(${CONFIG_SOC_NSIM_EM})
|
||||
set(NSIM_PROPS nsim_em.props)
|
||||
elseif(${CONFIG_SOC_NSIM_EM7D_V22})
|
||||
set(NSIM_PROPS nsim_em7d_v22.props)
|
||||
elseif(${CONFIG_SOC_NSIM_SEM})
|
||||
set(NSIM_PROPS nsim_sem.props)
|
||||
elseif(${CONFIG_SOC_NSIM_HS})
|
||||
set(NSIM_PROPS nsim_hs.props)
|
||||
elseif(${CONFIG_SOC_NSIM_HS6X})
|
||||
set(NSIM_PROPS nsim_hs6x.props)
|
||||
endif()
|
||||
|
||||
add_custom_target(run
|
||||
COMMAND
|
||||
${NSIM}
|
||||
|
@ -49,6 +57,7 @@ add_custom_target(run
|
|||
${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}
|
||||
DEPENDS ${logical_target_for_zephyr_elf}
|
||||
WORKING_DIRECTORY ${APPLICATION_BINARY_DIR}
|
||||
COMMENT "nSIM COMMAND: ${NSIM} -propsfile ${BOARD_DIR}/support/${NSIM_PROPS} ${APPLICATION_BINARY_DIR}/zephyr/${KERNEL_ELF_NAME}"
|
||||
USES_TERMINAL
|
||||
)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue