I tried this recipe : How to run a bare metal ELF file on QEMU? to run bare metal AArch64 executables on QEMU (and it worked). I'd like to do the same for 64-bit SPARCv9 executables (preferably starting from C/C++, not assembly) - I tried the examples in this link : Run SPARC assembly in QEMU, but that one runs in user-mode Linux, does syscall translation to the host system, etc.
Example :
int main(int argc, char **argv) {
volatile int a = 11, b = 13, c = 7, d = 5;
return a + b - c - d;
}
How do I run this example as a bare metal Sparcv9 executable AND connect gdb to it ?
Any of the available 64-bit boards in qemu/hw/sparc64/ would be fine. Thank you.