setup: add litex_json2dts to console_scripts.
authorFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 4 Aug 2020 14:07:53 +0000 (16:07 +0200)
committerFlorent Kermarrec <florent@enjoy-digital.fr>
Tue, 4 Aug 2020 14:07:53 +0000 (16:07 +0200)
litex/tools/litex_json2dts.py
setup.py

index 45d5ecf831ede3165b0404d38c0426c0d2651a6a..c0595f529e3582eec42a1b16a352789963616caa 100755 (executable)
@@ -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()
index 59d07529373a517ea6a6123312fec9865cbc299f..efefa52a4a085eed97c1b0812e2b5ae6a0be0228 100755 (executable)
--- 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",