From 48911115dafe32810adb1e6a7ab43dde73a573a7 Mon Sep 17 00:00:00 2001 From: duc-nx Date: Thu, 25 Jul 2024 15:15:52 -0400 Subject: [PATCH] Add MacOS tool in assemble.sh (#248) Most of us use Mac. I suggest change the command to native mactool. Update: This script will now detect if MacOS or not and use the tool accordingly. Summary: Test Plan: Co-authored-by: duc-nx <> --- runtime/assemble.sh | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/runtime/assemble.sh b/runtime/assemble.sh index a70c7bb0..a79ff161 100755 --- a/runtime/assemble.sh +++ b/runtime/assemble.sh @@ -1,13 +1,19 @@ #!/bin/sh - set -e -rm -f bin/*.a +# Detect the operating system +if [ "$(uname)" = "Darwin" ]; then + # macOS + GCC_PREFIX="riscv64-elf-" +else + # Assume Linux + GCC_PREFIX="riscv-none-elf-" +fi +rm -f bin/***.a for ext in i imc do - riscv-none-elf-gcc -c -mabi=ilp32 -march=rv32${ext} -mcmodel=medlow asm.S -o bin/nexus-rt.o - riscv-none-elf-ar crs bin/riscv32${ext}-unknown-none-elf.a bin/nexus-rt.o + ${GCC_PREFIX}gcc -c -mabi=ilp32 -march=rv32${ext} -mcmodel=medlow asm.S -o bin/nexus-rt.o + ${GCC_PREFIX}ar crs bin/riscv32${ext}-unknown-none-elf.a bin/nexus-rt.o done - rm bin/nexus-rt.o