Skip to content

Commit

Permalink
arch-test: Honor CROSS_COMPILE for custom toolchain
Browse files Browse the repository at this point in the history
This commit supports an alternate or custom toolchain according to the
CROSS_COMPILE environment variable.

Reference:
  https://riscof.readthedocs.io/en/add-fxlen/plugins.html
  • Loading branch information
jserv committed Oct 9, 2023
1 parent bbfe6dc commit 398234b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion tests/arch-test-target/rv32emu/riscof_rv32emu.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def initialise(self, suite, work_dir, archtest_env):
# Note the march is not hardwired here, because it will change for each
# test. Similarly the output elf name and compile macros will be assigned later in the
# runTests function
self.compile_cmd = 'riscv{1}-unknown-elf-gcc -march={0}\
self.compile_cmd = os.getenv("CROSS_COMPILE") + 'gcc -march={0}\
-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -g\
-T '+self.pluginpath+'/env/link.ld\
-I '+self.pluginpath+'/env/\
Expand Down
8 changes: 4 additions & 4 deletions tests/arch-test-target/sail_cSim/riscof_sail_cSim.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ def __init__(self, *args, **kwargs):
def initialise(self, suite, work_dir, archtest_env):
self.suite = suite
self.work_dir = work_dir
self.objdump_cmd = 'riscv{1}-unknown-elf-objdump -D {0} > {2};'
self.compile_cmd = 'riscv{1}-unknown-elf-gcc -march={0} \
self.objdump_cmd = os.getenv("CROSS_COMPILE") + 'objdump -D {0} > {2};'
self.compile_cmd = os.getenv("CROSS_COMPILE") + 'gcc -march={0} \
-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles\
-T '+self.pluginpath+'/env/link.ld\
-I '+self.pluginpath+'/env/\
Expand All @@ -63,11 +63,11 @@ def build(self, isa_yaml, platform_yaml):
self.isa += 'f'
if "D" in ispec["ISA"]:
self.isa += 'd'
objdump = "riscv{0}-unknown-elf-objdump".format(self.xlen)
objdump = os.getenv("CROSS_COMPILE") + "objdump".format(self.xlen)
if shutil.which(objdump) is None:
logger.error(objdump+": executable not found. Please check environment setup.")
raise SystemExit(1)
compiler = "riscv{0}-unknown-elf-gcc".format(self.xlen)
compiler = os.getenv("CROSS_COMPILE") + "gcc".format(self.xlen)
if shutil.which(compiler) is None:
logger.error(compiler+": executable not found. Please check environment setup.")
raise SystemExit(1)
Expand Down

0 comments on commit 398234b

Please sign in to comment.