tools/litex_json2dts_linux.py: improved cpu_isa_extension attribute (fdc) and fixed kernel panic during rocket booting with linux

This commit is contained in:
Gwenhael Goavec-Merou 2024-04-06 08:13:56 +02:00
parent 06009c57a3
commit 3864615f6f
1 changed files with 19 additions and 2 deletions

View File

@ -33,8 +33,25 @@ def generate_dts(d, initrd_start=None, initrd_size=None, initrd=None, root_devic
cpu_name = d["constants"].get("config_cpu_name")
cpu_arch = cpu_architectures[cpu_name]
cpu_isa = d["constants"].get("config_cpu_isa", None) # kernel < 6.6.0
cpu_isa_base = cpu_isa[:5] # kernel >= 6.6.0
cpu_isa_extensions = "\"i\", \"m\", \"a\"" # kernel >= 6.6.0
# kernel >= 6.6.0
cpu_isa_base = cpu_isa[:5]
cpu_isa_extensions = "\"i\"" # default
# Append with optionals
if "m" in cpu_isa[5:]:
cpu_isa_extensions += ", \"m\""
if "a" in cpu_isa[5:]:
cpu_isa_extensions += ", \"a\""
if "f" in cpu_isa[5:]:
cpu_isa_extensions += ", \"f\""
if "d" in cpu_isa[5:]:
cpu_isa_extensions += ", \"d\""
if "d" in cpu_isa[5:]:
cpu_isa_extensions += ", \"c\""
# rocket specific extensions
if "rocket" in cpu_name:
cpu_isa_extensions += ", \"zicsr\", \"zifencei\", \"zihpm\""
cpu_mmu = d["constants"].get("config_cpu_mmu", None)
# Header ---------------------------------------------------------------------------------------