Skip to content

Commit 0af51b0

Browse files
evgeniy-paltsevcarlescufi
authored andcommitted
ARC: nSIM: west: launch cores in direct order for simulation run
We've reversed core launch order to workaround issue of ARConnect initialization interfere with secondary cores startup (we don't want to workaround it in runtime as it's only possible in case of debug session). However it bring us new issues with the simulation run: - mismatch arcnum (core ID) with ARConnect ID - mismatch arcnum (core ID) with CPU name in nSIM instruction traces To avoid these issues let's use direct core order for simulation runs. Signed-off-by: Evgeniy Paltsev <PaltsevEvgeniy@gmail.com> Signed-off-by: Eugeniy Paltsev <Eugeniy.Paltsev@synopsys.com>
1 parent ae08206 commit 0af51b0

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

scripts/west_commands/runners/mdb.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,16 @@ def is_flash_cmd_need_exit_immediately(mdb_runner):
3434
else:
3535
return True
3636

37+
def smp_core_order(mdb_runner, id):
38+
if is_simulation_run(mdb_runner):
39+
# for simulation targets we start cores in direct order (core 0 first, core 1 second, etc...)
40+
# otherwise we face mismatch arcnum (code ID) with ARConnect ID and core ID in instruction traces
41+
return id
42+
else:
43+
# for HW targets we want to start the primary core last, to avoid ARConnect initialization interfere
44+
# with secondary cores startup - so we reverse start order
45+
return mdb_runner.cores - 1 - id
46+
3747
def mdb_do_run(mdb_runner, command):
3848
commander = "mdb64"
3949

@@ -81,7 +91,7 @@ def mdb_do_run(mdb_runner, command):
8191
if i > 0: mdb_sub_cmd += ['-prop=download=2']
8292
mdb_sub_cmd += mdb_basic_options + mdb_target + [mdb_runner.elf_name]
8393
mdb_runner.check_call(mdb_sub_cmd, cwd=mdb_runner.build_dir)
84-
mdb_multifiles += ('core{}'.format(mdb_runner.cores-1-i) if i == 0 else ',core{}'.format(mdb_runner.cores-1-i))
94+
mdb_multifiles += ('core{}' if i == 0 else ',core{}').format(smp_core_order(mdb_runner, i))
8595

8696
# to enable multi-core aware mode for use with the MetaWare debugger,
8797
# need to set the NSIM_MULTICORE environment variable to a non-zero value

scripts/west_commands/tests/test_mdb.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
'-prop=download=2', '-nooptions', '-nogoifmain',
5656
'-toggle=include_local_symbols=1',
5757
'-nsim', TEST_BOARD_NSIM_ARGS, RC_KERNEL_ELF]
58-
TEST_NSIM_CORES_LAUNCH = [TEST_DRIVER_CMD, '-multifiles=core1,core0',
58+
TEST_NSIM_CORES_LAUNCH = [TEST_DRIVER_CMD, '-multifiles=core0,core1',
5959
'-run', '-cl']
6060

6161
# mdb-hw

0 commit comments

Comments
 (0)