Skip to content

Commit 5e0d266

Browse files
Appana Durga Kedareswara raonashif
authored andcommitted
runners: xsdb: Add support for optional bl31, pdi, system.dtb arguments
This update enhances the runner script to optionally accept bl31, pdi, and system.dtb as arguments. These inputs are not mandatory and will only be used if explicitly provided. This allows for more flexible boot configurations, especially useful when testing different firmware and system setups without modifying the script. Signed-off-by: Appana Durga Kedareswara rao <appana.durga.kedareswara.rao@amd.com>
1 parent d2393de commit 5e0d266

File tree

2 files changed

+73
-2
lines changed

2 files changed

+73
-2
lines changed

scripts/west_commands/runners/xsdb.py

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
class XSDBBinaryRunner(ZephyrBinaryRunner):
1515
def __init__(self, cfg: RunnerConfig, config=None, bitstream=None,
16-
fsbl=None):
16+
fsbl=None, pdi=None, bl31=None, dtb=None):
1717
super().__init__(cfg)
1818
self.elf_file = cfg.elf_file
1919
if not config:
@@ -24,6 +24,9 @@ def __init__(self, cfg: RunnerConfig, config=None, bitstream=None,
2424
self.xsdb_cfg_file = config
2525
self.bitstream = bitstream
2626
self.fsbl = fsbl
27+
self.pdi = pdi
28+
self.bl31 = bl31
29+
self.dtb = dtb
2730

2831
@classmethod
2932
def name(cls):
@@ -38,13 +41,17 @@ def do_add_parser(cls, parser):
3841
parser.add_argument('--config', help='if given, override default config file')
3942
parser.add_argument('--bitstream', help='path to the bitstream file')
4043
parser.add_argument('--fsbl', help='path to the fsbl elf file')
44+
parser.add_argument('--pdi', help='path to the base/boot pdi file')
45+
parser.add_argument('--bl31', help='path to the bl31(ATF) elf file')
46+
parser.add_argument('--system-dtb', help='path to the system.dtb file')
4147

4248
@classmethod
4349
def do_create(
4450
cls, cfg: RunnerConfig, args: argparse.Namespace
4551
) -> "XSDBBinaryRunner":
4652
return XSDBBinaryRunner(cfg, config=args.config,
47-
bitstream=args.bitstream, fsbl=args.fsbl)
53+
bitstream=args.bitstream, fsbl=args.fsbl,
54+
pdi=args.pdi, bl31=args.bl31, dtb=args.system_dtb)
4855

4956
def do_run(self, command, **kwargs):
5057
if self.bitstream and self.fsbl:
@@ -53,6 +60,12 @@ def do_run(self, command, **kwargs):
5360
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.bitstream]
5461
elif self.fsbl:
5562
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.fsbl]
63+
elif self.pdi and self.bl31 and self.dtb:
64+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.pdi, self.bl31, self.dtb]
65+
elif self.pdi and self.bl31:
66+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.pdi, self.bl31]
67+
elif self.pdi:
68+
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file, self.pdi]
5669
else:
5770
cmd = ['xsdb', self.xsdb_cfg_file, self.elf_file]
5871
self.check_call(cmd)

scripts/west_commands/tests/test_xsdb.py

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,81 @@
1313
"config": None,
1414
"bitstream": None,
1515
"fsbl": None,
16+
"pdi": None,
17+
"bl31": None,
18+
"dtb": None,
1619
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF],
1720
},
1821
{
1922
"config": "custom_cfg_path",
2023
"bitstream": None,
2124
"fsbl": None,
25+
"pdi": None,
26+
"bl31": None,
27+
"dtb": None,
2228
"expected_cmd": ["xsdb", "custom_cfg_path", RC_KERNEL_ELF],
2329
},
2430
{
2531
"config": None,
2632
"bitstream": "bitstream_path",
2733
"fsbl": None,
34+
"pdi": None,
35+
"bl31": None,
36+
"dtb": None,
2837
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "bitstream_path"],
2938
},
3039
{
3140
"config": None,
3241
"bitstream": None,
3342
"fsbl": "fsbl_path",
43+
"pdi": None,
44+
"bl31": None,
45+
"dtb": None,
3446
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "fsbl_path"],
3547
},
3648
{
3749
"config": None,
3850
"bitstream": "bitstream_path",
3951
"fsbl": "fsbl_path",
52+
"pdi": None,
53+
"bl31": None,
54+
"dtb": None,
4055
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "bitstream_path", "fsbl_path"],
4156
},
57+
{
58+
"config": None,
59+
"bitstream": None,
60+
"fsbl": None,
61+
"pdi": "pdi_path",
62+
"bl31": None,
63+
"dtb": None,
64+
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "pdi_path"],
65+
},
66+
{
67+
"config": None,
68+
"bitstream": None,
69+
"fsbl": None,
70+
"pdi": "pdi_path",
71+
"bl31": "bl31_path",
72+
"dtb": None,
73+
"expected_cmd": ["xsdb", "default_cfg_path", RC_KERNEL_ELF, "pdi_path", "bl31_path"],
74+
},
75+
{
76+
"config": None,
77+
"bitstream": None,
78+
"fsbl": None,
79+
"pdi": "pdi_path",
80+
"bl31": "bl31_path",
81+
"dtb": "dtb_path",
82+
"expected_cmd": [
83+
"xsdb",
84+
"default_cfg_path",
85+
RC_KERNEL_ELF,
86+
"pdi_path",
87+
"bl31_path",
88+
"dtb_path",
89+
],
90+
},
4291
]
4392

4493

@@ -54,6 +103,9 @@ def test_xsdbbinaryrunner_init(check_call, path_exists, tc, runner_config):
54103
config=tc["config"],
55104
bitstream=tc["bitstream"],
56105
fsbl=tc["fsbl"],
106+
pdi=tc["pdi"],
107+
bl31=tc["bl31"],
108+
dtb=tc["dtb"],
57109
)
58110

59111
runner.do_run("flash")
@@ -73,6 +125,12 @@ def test_xsdbbinaryrunner_create(check_call, path_exists, tc, runner_config):
73125
args.extend(["--bitstream", tc["bitstream"]])
74126
if tc["fsbl"]:
75127
args.extend(["--fsbl", tc["fsbl"]])
128+
if tc["pdi"]:
129+
args.extend(["--pdi", tc["pdi"]])
130+
if tc["bl31"]:
131+
args.extend(["--bl31", tc["bl31"]])
132+
if tc["dtb"]:
133+
args.extend(["--system-dtb", tc["dtb"]])
76134

77135
parser = argparse.ArgumentParser(allow_abbrev=False)
78136
XSDBBinaryRunner.add_parser(parser)

0 commit comments

Comments
 (0)