From aed0dcee4ca3bbeb8feafb62ba283147b52bdedc Mon Sep 17 00:00:00 2001 From: Florent Kermarrec Date: Tue, 4 Aug 2020 16:07:53 +0200 Subject: [PATCH] setup: add litex_json2dts to console_scripts. --- litex/tools/litex_json2dts.py | 13 ++++++++----- setup.py | 1 + 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/litex/tools/litex_json2dts.py b/litex/tools/litex_json2dts.py index 45d5ecf8..c0595f52 100755 --- a/litex/tools/litex_json2dts.py +++ b/litex/tools/litex_json2dts.py @@ -176,7 +176,7 @@ def generate_dts(d): for name in ["rgb_led_r0", "rgb_led_g0", "rgb_led_b0"]: if name in d["csr_bases"]: - + dts += """ {pwm_name}: pwm@{pwm_csr_base:x} {{ compatible = "litex,pwm"; @@ -357,7 +357,7 @@ def generate_dts(d): # ICAPBitstream ------------------------------------------------------------------------------------ if "icap_bit" in d["csr_bases"]: - + dts += """ fpga0: icap@{icap_csr_base:x} {{ compatible = "litex,fpga-icap"; @@ -448,7 +448,7 @@ def generate_dts(d): };""" # SDCARD ------------------------------------------------------------------------------------------- - + if "sdcore" in d["csr_bases"]: dts += """ @@ -510,8 +510,7 @@ def generate_dts(d): return dts -if __name__ == "__main__": - +def main(): parser = argparse.ArgumentParser(description="LiteX's CSR JSON to Linux DTS generator") parser.add_argument("csr_json", help="CSR JSON file") args = parser.parse_args() @@ -519,3 +518,7 @@ if __name__ == "__main__": d = json.load(open(args.csr_json)) print(generate_dts(d)) + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 59d07529..efefa52a 100755 --- a/setup.py +++ b/setup.py @@ -43,6 +43,7 @@ setup( "litex_sim=litex.tools.litex_sim:main", "litex_read_verilog=litex.tools.litex_read_verilog:main", "litex_simple=litex.boards.targets.simple:main", + "litex_json2dts=litex.tools.litex_json2dts:main", # short names "lxterm=litex.tools.litex_term:main", "lxserver=litex.tools.litex_server:main", -- 2.30.2