cpu_interace: use riscv64-unknown-elf if available else riscv32-unknown-elf

This commit is contained in:
Florent Kermarrec 2018-08-16 10:03:43 +02:00
parent 1610a7f3fb
commit 0831ad5492
1 changed files with 9 additions and 2 deletions

View File

@ -1,4 +1,5 @@
import os import os
from shutil import which
from migen import * from migen import *
@ -35,12 +36,18 @@ def get_cpu_mak(cpu):
cpuflags += "-mffl1 -maddc" cpuflags += "-mffl1 -maddc"
elif cpu == "picorv32": elif cpu == "picorv32":
assert not clang, "picorv32 not supported with clang." assert not clang, "picorv32 not supported with clang."
triple = "riscv64-unknown-elf" if which("riscv64-unknown-elf-gcc"):
triple = "riscv64-unknown-elf"
else:
triple = "riscv32-unknown-elf"
cpuflags = "-D__picorv32__ -mno-save-restore -march=rv32im -mabi=ilp32" cpuflags = "-D__picorv32__ -mno-save-restore -march=rv32im -mabi=ilp32"
clang = False clang = False
elif cpu == "vexriscv": elif cpu == "vexriscv":
assert not clang, "vexriscv not supported with clang." assert not clang, "vexriscv not supported with clang."
triple = "riscv64-unknown-elf" if which("riscv64-unknown-elf-gcc"):
triple = "riscv64-unknown-elf"
else:
triple = "riscv32-unknown-elf"
cpuflags = "-D__vexriscv__ -march=rv32im -mabi=ilp32" cpuflags = "-D__vexriscv__ -march=rv32im -mabi=ilp32"
clang = False clang = False
else: else: