Is /Users/alain/wsFreedomStudio/qemu_sifive_s51_sifive_welcome/src/debug/sifive-welcome.elf actually a RISC-V ELF file? What does file /Users/alain/wsFreedomStudio/qemu_sifive_s51_sifive_welcome/src/debug/sifive-welcome.elf say?
I said run file /Users/alain/wsFreedomStudio/qemu_sifive_s51_sifive_welcome/src/debug/sifive-welcome.elf. Clearly trying to run the bare-metal RISC-V binary on x86 or arm64 macOS is not going to work.
Jessica is suggesting running the ‘file’ command with the elf file as an arqument, like:
$ file sifive-welcome.elf
That should give you output like:
$ file sifive-welcome.elf
sifive-welcome.elf: ELF 32-bit LSB executable, UCB RISC-V, version 1 (SYSV), statically linked, with debug_info, not stripped
That is what I see on Ubuntu, should be similar on MacOS (but I have not tried). I don’t know that the ‘file’ command is natively available on MacOS, you may need to install it via homebrew, if not.
So it looks like the ELF file was produced using, possibly, a native toolchain and not the SiFive RISC-V toolchain. Can you do a clean build and look at the build log to see which compiler and linker is being used? Are you building this in Freedom Studio?