setup: add litex_json2dts to console_scripts.

This commit is contained in:
Florent Kermarrec 2020-08-04 16:07:53 +02:00
parent b64209b38b
commit aed0dcee4c
2 changed files with 9 additions and 5 deletions

View File

@ -176,7 +176,7 @@ def generate_dts(d):
for name in ["rgb_led_r0", "rgb_led_g0", "rgb_led_b0"]: for name in ["rgb_led_r0", "rgb_led_g0", "rgb_led_b0"]:
if name in d["csr_bases"]: if name in d["csr_bases"]:
dts += """ dts += """
{pwm_name}: pwm@{pwm_csr_base:x} {{ {pwm_name}: pwm@{pwm_csr_base:x} {{
compatible = "litex,pwm"; compatible = "litex,pwm";
@ -357,7 +357,7 @@ def generate_dts(d):
# ICAPBitstream ------------------------------------------------------------------------------------ # ICAPBitstream ------------------------------------------------------------------------------------
if "icap_bit" in d["csr_bases"]: if "icap_bit" in d["csr_bases"]:
dts += """ dts += """
fpga0: icap@{icap_csr_base:x} {{ fpga0: icap@{icap_csr_base:x} {{
compatible = "litex,fpga-icap"; compatible = "litex,fpga-icap";
@ -448,7 +448,7 @@ def generate_dts(d):
};""" };"""
# SDCARD ------------------------------------------------------------------------------------------- # SDCARD -------------------------------------------------------------------------------------------
if "sdcore" in d["csr_bases"]: if "sdcore" in d["csr_bases"]:
dts += """ dts += """
@ -510,8 +510,7 @@ def generate_dts(d):
return dts return dts
if __name__ == "__main__": def main():
parser = argparse.ArgumentParser(description="LiteX's CSR JSON to Linux DTS generator") parser = argparse.ArgumentParser(description="LiteX's CSR JSON to Linux DTS generator")
parser.add_argument("csr_json", help="CSR JSON file") parser.add_argument("csr_json", help="CSR JSON file")
args = parser.parse_args() args = parser.parse_args()
@ -519,3 +518,7 @@ if __name__ == "__main__":
d = json.load(open(args.csr_json)) d = json.load(open(args.csr_json))
print(generate_dts(d)) print(generate_dts(d))
if __name__ == "__main__":
main()

View File

@ -43,6 +43,7 @@ setup(
"litex_sim=litex.tools.litex_sim:main", "litex_sim=litex.tools.litex_sim:main",
"litex_read_verilog=litex.tools.litex_read_verilog:main", "litex_read_verilog=litex.tools.litex_read_verilog:main",
"litex_simple=litex.boards.targets.simple:main", "litex_simple=litex.boards.targets.simple:main",
"litex_json2dts=litex.tools.litex_json2dts:main",
# short names # short names
"lxterm=litex.tools.litex_term:main", "lxterm=litex.tools.litex_term:main",
"lxserver=litex.tools.litex_server:main", "lxserver=litex.tools.litex_server:main",