Skip to content

Commit

Permalink
riscv targets: add is_cross, is_bare & cross_compiler properties
Browse files Browse the repository at this point in the history
  • Loading branch information
PhilippvK committed Jul 22, 2024
1 parent ce4a8a5 commit 91e2d9d
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions mlonmcu/target/riscv/riscv.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,6 +287,25 @@ def fpu(self):
def has_fpu(self):
return self.fpu != "none"

@property
def is_cross(self):
return True

@property
def is_bare(self):
if "elf" in self.riscv_gcc_prefix:
return True
elif "linux" in self.riscv_gcc_prefix:
return False
else:
return None # unknown

@property
def cross_compiler(self):
if not self.is_cross:
return None
return f"{self.riscv_gcc_basename}-g++"

@property
def toolchain(self):
value = self.config.get("mlif.toolchain", None)
Expand All @@ -311,6 +330,7 @@ def get_platform_defs(self, platform):
ret["RISCV_MCPU"] = self.cpu
# llvm/clang only!
ret["RISCV_ATTR"] = self.attr
ret["RISCV_LINUX"] = not self.is_bare # TODO: add -static if linux gcc is used

def feature_helper(attrs):
# TODO
Expand All @@ -336,6 +356,7 @@ def get_backend_config(self, backend, optimized_layouts=False, optimized_schedul
"target_model": f"etiss-{arch_clean}",
# "target_model": f"{self.name}-{arch_clean}",
"target_num_cores": 1, # TODO: also add for non-riscv targets
"cross_compiler": self.cross_compiler,
# "target_device": ?,
# "target_libs": ?,
# "target_tag": ?,
Expand Down

0 comments on commit 91e2d9d

Please sign in to comment.