Skip to content

Commit e7c0bf1

Browse files
mubinsyed2michalsimek
authored andcommitted
west_commands: lopper_command: Align with latest lopper changes
Include additnal lops execution as per recent changes related to mbv32 device tree generation in lopper. Existing logic copies lopper generated artifacts to workspace directory provided by user (-w option). User needs to copy those files to appropriate directories in zephyr repository manually. Ideally dts and kconfig generated by lopper_command supposed to be copied to zephyr repository targeted by user. It avoids manual work. dts destination path : <zephyr repo path>/boards/amd/mbv32/ Kconfig destination path: <zephyr repo path>/soc/xlnx/mbv32/ Treat -w argument passed by user as zephyr repository path and copy dts and kconfigs to appropriate locations. Signed-off-by: Mubin Sayyed <[email protected]> Message-ID: <[email protected]> State: pending
1 parent e58c7fd commit e7c0bf1

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

scripts/west_commands/lopper_command.py

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import sys
77
import lopper
88
import os
9+
import shutil
910
from west.commands import WestCommand
1011

1112
def get_dir_path(fpath):
@@ -70,8 +71,8 @@ def do_add_parser(self, parser_adder):
7071
"-w",
7172
"--ws_dir",
7273
action="store",
73-
help="Workspace directory where domain will be created (Default: Current Work Directory)",
74-
default='.',
74+
help="Workspace directory (zephyr repository path) where domain will be created (Default: zephyr directory in Current Work Directory)",
75+
default='./zephyr/',
7576
)
7677

7778
return parser
@@ -80,12 +81,29 @@ def do_run(self, args, unknown_args):
8081
sdt = os.path.abspath(args.sdt)
8182
proc = args.proc
8283
workspace = os.path.abspath(args.ws_dir)
84+
workspace = os.path.join(os.path.abspath(args.ws_dir), "lopper_metadata")
85+
if not os.path.exists(workspace):
86+
os.makedirs(workspace)
87+
generated_dts_file = os.path.join(workspace, "mbv32.dts")
88+
workspace_dts_file = os.path.join(os.path.abspath(args.ws_dir), "boards", "amd", "mbv32", "mbv32.dts")
89+
workspace_kconfig_defconfig = os.path.join(os.path.abspath(args.ws_dir), "soc", "xlnx", "mbv32", "Kconfig.defconfig")
90+
generated_kconfig_defconfig = os.path.join(workspace, "Kconfig.defconfig")
91+
workspace_kconfig_soc = os.path.join(os.path.abspath(args.ws_dir), "soc", "xlnx", "mbv32", "Kconfig")
92+
generated_kconfig_soc = os.path.join(workspace, "Kconfig")
8393
lops_dir = os.path.join(get_dir_path(lopper.__file__), "lops")
8494

8595

8696
lops_file = os.path.join(lops_dir, "lop-microblaze-riscv.dts")
97+
lops_file_intc = os.path.join(lops_dir, "lop-mbv-zephyr-intc.dts")
8798
runcmd(f"lopper -f --enhanced -O {workspace} -i {lops_file} {sdt} {workspace}/system-domain.dts -- gen_domain_dts microblaze_riscv_0",
8899
cwd = workspace)
89100
runcmd(f"lopper -f --enhanced -O {workspace} -i {lops_file} {workspace}/system-domain.dts {workspace}/system-zephyr.dts -- gen_domain_dts microblaze_riscv_0 zephyr_dt",
90101
cwd = workspace)
102+
runcmd(f"lopper -f --enhanced -O {workspace} -i {lops_file_intc} {workspace}/system-zephyr.dts {workspace}/mbv32.dts",
103+
cwd = workspace)
104+
105+
shutil.copy(generated_dts_file, workspace_dts_file)
106+
shutil.copy(generated_kconfig_defconfig, workspace_kconfig_defconfig)
107+
shutil.copy(generated_kconfig_soc, workspace_kconfig_soc)
108+
shutil.rmtree(workspace)
91109

0 commit comments

Comments
 (0)