Skip to content

Commit edae439

Browse files
committed
scripts: west_commands: Fix for flash into ram.
When users try to debug while flashing into ram, JLink/Linkserver would fail to flash straight to ram. Each with their own issues. Both would reset after load which would flush the ram and point the PC to flash. Linkserver treated the ram as inaccessible, and the added memory region in board.cmake has the incorrect size for the region and is already included inside linkserver. Signed-off-by: Emilio Benavente <emilio.benavente@nxp.com>
1 parent f3a3ad3 commit edae439

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

boards/nxp/mimxrt1170_evk/board.cmake

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,7 @@
66

77
if(CONFIG_SOC_MIMXRT1176_CM7 OR CONFIG_SECOND_CORE_MCUX)
88
board_runner_args(pyocd "--target=mimxrt1170_cm7")
9-
board_runner_args(jlink "--device=MIMXRT1176xxxA_M7" "--reset-after-load")
10-
# ITCM is not defined in RT1170's LinkServer device file
11-
board_runner_args(linkserver "--override=/device/memory/-=\{\"location\":\"0x00000000\",\
12-
\"size\":\"0x00040000\",\"type\":\"RAM\"\}")
9+
board_runner_args(jlink "--device=MIMXRT1176xxxA_M7")
1310

1411
if(${BOARD_REVISION} STREQUAL "A")
1512
board_runner_args(linkserver "--device=MIMXRT1176xxxxx:MIMXRT1170-EVK")

scripts/west_commands/run_common.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ def do_run_common_image(command, user_args, user_runner_args, used_cmds,
421421
# the board has enabled this functionality, check if the board should be
422422
# reset or not. If this is not specified in the board/soc file, leave it up to
423423
# the runner's default configuration to decide if a reset should occur.
424-
if runner_cls.capabilities().reset and '--no-reset' not in final_argv:
424+
if runner_cls.capabilities().reset and '--no-reset' not in final_argv and len(board_image_count):
425425
if board_image_count is not None:
426426
reset = True
427427

scripts/west_commands/runners/linkserver.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,10 @@ def do_run(self, command, **kwargs):
150150
['-ex', f'target remote {self.gdb_host}:{self.gdb_port}'])
151151

152152
if command == 'debug':
153-
gdb_cmd += [ '-ex', 'load', '-ex', 'monitor reset']
153+
# If the flash node points to ram, linserver treats
154+
# the ram as inaccessible and does not flash.
155+
gdb_cmd += ['-ex', 'set mem inaccessible-by-default off']
156+
gdb_cmd += ['-ex', 'monitor reset', '-ex', 'load']
154157

155158
if command == 'attach':
156159
linkserver_cmd += ['--attach']

0 commit comments

Comments
 (0)