Run a .spim file using spim in Ubuntu - mips

For Some purpose , I am writing a MIPS file for finding the second largest element of an array
How do I run it to get the output?
I need the command lines for spim stimulator
Iam using Ubuntu 16.04 xenial by the way

I can think of a few legit reasons for needing to run a MIPS simulator via command line instead of a GUI. If that is your situation than I would suggest using MARS instead of QtSpim. You can download it at http://courses.missouristate.edu/kenvollmar/mars/
MARS does have a full GUI but unlike QtSpim it can also run via CLI. Its a Java implementation so it will run on any OS.

Related

cannot open /lib/ld-linux-aarch64.so.1 in qemu or gem5

I am trying to simulate a simple Hello world ARM example on my desktop computer. I tried both qemu and gem5. Both gives a similar error. They cannot find ld-linux-aarch64.so.1. Actually I cannot find it either. If I could find it, I will show it with -L (in qemu) or --redirects (in gem5).
The file is:
armhello: ELF 64-bit LSB shared object, ARM aarch64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux-aarch64.so.1, BuildID[sha1]=23a21b7a545ac510923b6b3713d2bbee092f820a, for GNU/Linux 3.7.0, not stripped
It is compiled with: aarch64-linux-gnu-gcc
I am trying to run it in qemu with:
qemu-aarch64 armhello
I got this error:
/lib/ld-linux-aarch64.so.1: No such file or directory
I try to run it in gem5 with: (simpleARM.py points to my executable (named as armhello))
build/ARM/gem5.opt configs/tutorial/simpleARM.py
I got this error:
panic: panic condition fd < 0 occurred: Failed to open file /lib/ld-linux-aarch64.so.1.
How can I solve this?
Note: I know it works when compiled --static. But I need to run more complex binaries that are dynamically linked and I cannot change those. This is just an example.
For gem5 you can use --redirects and --interp-dir: How to run a dynamically linked executable syscall emulation mode se.py in gem5?
For qemu you need -L: Using dynamic linker with qemu-arm
same problem on x86_64 machine docker build with an arm64 docker image:
FROM multiarch/qemu-user-static:x86_64-aarch64 as qemu
FROM alpine
COPY --from=qemu /usr/bin/qemu-aarch64-static /usr/bin/
# add this line to resolve
RUN apk add libc6-compat

How can I execute a C program on Qemu riscv and observe the output?

What should be the best approach to run a C code in Qemu riscv and observe the output? I installed Qemu riscv following this link.What should I do now?
https://risc-v-getting-started-guide.readthedocs.io/en/latest/linux-qemu.html
You probably want to use the static user mode version of Qemu for most applications.
Then make sure to compile for RISC-V with the -static flag, and call qemu-riscv64-static [executable].
I highly recommend this, the system mode is a massive pain to handle if you don't need it
(have fun debugging the UART).
You can use libriscv to run RISC-V programs: https://github.com/fwsGonzo/libriscv
Inside the emulator folder there are 2 ways to build the emulator. build.sh produces emulators that run programs with no instruction listing. debug.sh produces debugging variant that shows the state of registers and instructions all the way through the program.
Building Qemu from sources is complete overkill.

File transfer between RISCV - Qemu and Host

I am following steps provided on
https://www.cnx-software.com/2018/03/16/how-to-run-linux-on-risc-v-with-qemu-emulator/.
and trying to bootup riscv qemu on linux.
I was able to boot the qemu successfully, but now I want to run my own hello world program on riscv-qemu.
I have cross compiled my hello world program using riscv gnu toolchain on my host system, but I am looking for a shared directory to place my executable, so that I can run the compiled code on riscv-qemu after booting it up.
Any help is appreciated. thank you.
Glad you found the RISC-V qemu instructions useful.
I also wrote some tutorials about copying files to QEMU either
1. Mounting the image to add or delete file
2. Via a network connection
I'm not sure thr RISC-V qemu image supports Ethernet (yet), so the first method may be the only option.

how to install tcl on solaris sparc

I have a solaris machine configuration: SunOS indevel07 5.10 Generic_147440-15 sun4v sparc sun4v. I am trying to install expect utility on this. expect utility requires tcl to be installed. I have tried to install that too, but i am getting errors. I have downloaded the tcl-8.5.12-sol10-sparc-local.gz and expect-5.45-sol10-sparc-local.gz from sunfreeware. I have unzipped them and tried to install them like pkgadd -d pkgname. I am getting errors like:
ERROR: attribute verification of </usr/local/man/man3/Tcl_Seek.3> failed
pathname does not exist
There are lots of errors like this. I tried to troubleshoot it by googling but could not find anything about it. I am stuck with my development because of this.
Try building Tcl/Tk and Expect from the source. Here is the instruction - How to Compile Tcl. Expect download - Obtaining Expect for UNIX. That worked for me on Solaris 10 and I did not hit any serious bumps.
For those who want to install tcl please refer this URL. it has got steps to do that. URL: http://www.wellho.net/mouth/1174_Installing-Tcl-and-Expect-on-Solaris-10-a-checklist.html

Matlab R2010b setting up MySql

I'm trying to setting up a mySql connection using Matlab, I have read I few tutorial but unfortunately I can't get work of them. I had tried to compile the source(.cpp) but I got the following error:
Error: Could not detect a compiler on local system
which can compile the specified input file(s)
C:\PROGRA~1\MATLAB\R2010B\BIN\MEX.PL: Error: No compiler options file could be found to compile source code. Please run "mex -setup" to rectify.
So I I typed "mex -setup"
Please choose your compiler for building external interface (MEX) files:
Would you like mex to locate installed compilers [y]/n? y
Select a compiler:
[0] None
Compiler:
but there is no compiler.
Anybody can help me, how can I make a connection between matlab and mysql, I'm using windows 7 64 bit and Matlab 2010b.
I already installed wampserver.
Have you tried to establish MySQL connection from MATLAB using JBCC connector?
I did it successfully and put the complete workflow with the code example (requires Database Toolbox) in this question:
connection of MATLAB 7.0 and MYSQL
Haven't try on 64-bit though. Please let me know if it will fail.
UPDATE
You can also try the following submissions to File Exchange that do not require the Database toolbox:
queryMySQL
Access a MySQL database
I'm guessing you installed Matlab 64-bit as well, which does NOT come with a built-in MEX compiler (32-bit version uses lcc). You have a few options, but the easiest is to install Visual C++ Express (it's free! http://www.microsoft.com/express/Windows/) which will give you a 64-bit compatible compiler in the mex -setup listing. You'll have to double check which versions of the compiler 2010b is compatible with though.
Caveat: I tried this once and couldn't get it to work, but it was with like 2007b or something, and I didn't try that hard, I just installed 32-bit Matlab.