Skip to content

Commit 1708837

Browse files
Appana Durga Kedareswara raoaescolar
authored andcommitted
runners: add support for xsdb (Xilinx System Debugger)
Add support for xsdb(Xilinx System Debugger) used with AMD's FPGA and SOC platforms, it is a user-friendly, interactive, and scriptable command line interface, by design choice it's expected that platforms to have xsdb scripts present inside their platform code. xsdb runner has bitstream and fsbl optional arguments, bitstream is needed for fpga targets and fsbl is needed for SOC targets, added support for both options. Signed-off-by: Appana Durga Kedareswara rao <[email protected]>
1 parent 74266e5 commit 1708837

File tree

2 files changed

+57
-0
lines changed

2 files changed

+57
-0
lines changed

scripts/west_commands/runners/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ def _import_runner_module(runner_name):
6060
'teensy',
6161
'trace32',
6262
'uf2',
63+
'xsdb',
6364
'xtensa',
6465
# zephyr-keep-sorted-stop
6566
]
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
# Copyright (c) 2024 Advanced Micro Devices, Inc.
2+
#
3+
# SPDX-License-Identifier: Apache-2.0
4+
5+
"""Runner for flashing with xsdb CLI, the official programming
6+
utility from AMD platforms.
7+
"""
8+
import argparse
9+
import os
10+
from runners.core import ZephyrBinaryRunner, RunnerCaps, RunnerConfig
11+
12+
class XSDBBinaryRunner(ZephyrBinaryRunner):
13+
def __init__(self, cfg: RunnerConfig, config=None, bitstream=None,
14+
fsbl=None):
15+
super(XSDBBinaryRunner, self).__init__(cfg)
16+
self.elf_file = cfg.elf_file
17+
if not config:
18+
cfgfile_path = os.path.join(cfg.board_dir, 'support')
19+
default = os.path.join(cfgfile_path, 'xsdb.cfg')
20+
if os.path.exists(default):
21+
config = default
22+
self.xsdb_cfg_file = config
23+
self.bitstream = bitstream
24+
self.fsbl = fsbl
25+
26+
@classmethod
27+
def name(cls):
28+
return 'xsdb'
29+
30+
@classmethod
31+
def capabilities(cls):
32+
return RunnerCaps(flash_addr=True)
33+
34+
@classmethod
35+
def do_add_parser(cls, parser):
36+
parser.add_argument('--config', help='if given, override default config file')
37+
parser.add_argument('--bitstream', help='path to the bitstream file')
38+
parser.add_argument('--fsbl', help='path to the fsbl elf file')
39+
40+
@classmethod
41+
def do_create(
42+
cls, cfg: RunnerConfig, args: argparse.Namespace
43+
) -> "XSDBBinaryRunner":
44+
return XSDBBinaryRunner(cfg, config=args.config,
45+
bitstream=args.bitstream, fsbl=args.fsbl)
46+
47+
def do_run(self, command, **kwargs):
48+
if self.bitstream and self.fsbl:
49+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.bitstream, self.fsbl]
50+
elif self.bitstream:
51+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.bitstream]
52+
elif self.fsbl:
53+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.fsbl]
54+
else:
55+
cmd = ['xsdb', self.xsdb_cfg_file]
56+
self.check_call(cmd)

0 commit comments

Comments
 (0)