Skip to content

Commit 398234b

Browse files
committed
arch-test: Honor CROSS_COMPILE for custom toolchain
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
1 parent bbfe6dc commit 398234b

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

tests/arch-test-target/rv32emu/riscof_rv32emu.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def initialise(self, suite, work_dir, archtest_env):
7272
# Note the march is not hardwired here, because it will change for each
7373
# test. Similarly the output elf name and compile macros will be assigned later in the
7474
# runTests function
75-
self.compile_cmd = 'riscv{1}-unknown-elf-gcc -march={0}\
75+
self.compile_cmd = os.getenv("CROSS_COMPILE") + 'gcc -march={0}\
7676
-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles -g\
7777
-T '+self.pluginpath+'/env/link.ld\
7878
-I '+self.pluginpath+'/env/\

tests/arch-test-target/sail_cSim/riscof_sail_cSim.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ def __init__(self, *args, **kwargs):
4141
def initialise(self, suite, work_dir, archtest_env):
4242
self.suite = suite
4343
self.work_dir = work_dir
44-
self.objdump_cmd = 'riscv{1}-unknown-elf-objdump -D {0} > {2};'
45-
self.compile_cmd = 'riscv{1}-unknown-elf-gcc -march={0} \
44+
self.objdump_cmd = os.getenv("CROSS_COMPILE") + 'objdump -D {0} > {2};'
45+
self.compile_cmd = os.getenv("CROSS_COMPILE") + 'gcc -march={0} \
4646
-static -mcmodel=medany -fvisibility=hidden -nostdlib -nostartfiles\
4747
-T '+self.pluginpath+'/env/link.ld\
4848
-I '+self.pluginpath+'/env/\
@@ -63,11 +63,11 @@ def build(self, isa_yaml, platform_yaml):
6363
self.isa += 'f'
6464
if "D" in ispec["ISA"]:
6565
self.isa += 'd'
66-
objdump = "riscv{0}-unknown-elf-objdump".format(self.xlen)
66+
objdump = os.getenv("CROSS_COMPILE") + "objdump".format(self.xlen)
6767
if shutil.which(objdump) is None:
6868
logger.error(objdump+": executable not found. Please check environment setup.")
6969
raise SystemExit(1)
70-
compiler = "riscv{0}-unknown-elf-gcc".format(self.xlen)
70+
compiler = os.getenv("CROSS_COMPILE") + "gcc".format(self.xlen)
7171
if shutil.which(compiler) is None:
7272
logger.error(compiler+": executable not found. Please check environment setup.")
7373
raise SystemExit(1)

0 commit comments

Comments
 (0)