cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Highlighted
663 Views
Registered: ‎05-20-2019

Error while running Qemu-Microblaze

Jump to solution

I am trying to run a simple c program on qemu-microblaze using the following command.

./microblazeel-softmmu/qemu-system-microblazeel -M microblaze-fdt -m 256 -serial mon:stdio -display none -device loader,file=/home/dheeraj/Documents/try.out -hw-dtb /home/dheeraj/Documents/system-top.dtb

I used an example project in vivado and exported it to sdk to get HDF file and then used DTG to get dts and then compiled it to get dtb file.

try.c file contains the following code

int main(void){
int a = 0 ;
int b =0;
return a+b ;
}

I used the mb-gcc executable present in /home/dheeraj/Downloads/Xilinx/SDK/2018.3/gnu/microblaze/lin/bin/mb-gcc to compile the try.c file.

I get the following error.

qemu: fatal: unknown mts reg 34b9

IN: PC=314
rmsr=0 resr=0 rear=0 debug=0 imm=fffff4b9 iflags=0 fsr=0
btaken=1 btarget=210 mode=kernel(saved=kernel) eip=0 ie=0
r00=00000000 r01=00000000 r02=00000000 r03=00000000
r04=00000000 r05=00000000 r06=00000000 r07=fffff4b9
r08=00000000 r09=00000000 r10=00000000 r11=00000000
r12=00000000 r13=00000000 r14=00000000 r15=00000000
r16=00000000 r17=00000000 r18=00000000 r19=00000000
r20=00000000 r21=00000000 r22=00000000 r23=00000000
r24=00000000 r25=00000000 r26=00000000 r27=00000000
r28=00000000 r29=00000000 r30=00000000 r31=00000000


Aborted (core dumped)

Where is the mistake in my approach?

0 Kudos
1 Solution

Accepted Solutions
Highlighted
527 Views
Registered: ‎05-20-2019

The above errors occured only when i  use the elf file generated using the mb-gcc seperately. These errors didn't appear when i used the elf file generated using SDK. The difference is that SDK uses a linker file to properly map the memory of the machine and the place where the program is loaded. Using the linker file along with mb-gcc seperately aslo worked.

View solution in original post

6 Replies
Highlighted
Moderator
Moderator
650 Views
Registered: ‎12-04-2016

Hi @dheeraj_golla 

Tried at my end with mb-gcc shipped with petalinux tool.

source petalinux's settings.sh

test.c

#include <stdio.h>
int main(void){
int a = 0 ;
int b =0;
return a+b ;
}

mb-gcc -c test.c -o test returned no errors and I can generate executable

 

 

0 Kudos
Highlighted
642 Views
Registered: ‎05-20-2019
Hi @shabbirk
The error occurs when i use that executable as a standalone program in qemu
0 Kudos
Highlighted
Moderator
Moderator
630 Views
Registered: ‎12-04-2016

Hi @dheeraj_golla 

Can you refer to this forum thread

https://forums.xilinx.com/t5/Embedded-Linux/Standalone-in-QEMU-Microblaze/td-p/775954

 

Best Regards

Shabbir

0 Kudos
Highlighted
622 Views
Registered: ‎05-20-2019
Hi @shabbirk
I did try following that thread and made that change to my dts before compiling it. The error doesn't change. And i also want to know if there is some other option to compile c files without using the mb-gcc file inside SDK.
0 Kudos
Highlighted
590 Views
Registered: ‎05-20-2019
I also tried using a mb.dtb file i found online and it now says
qemu-system-microblazeel: Trying to execute code outside RAM or ROM at 0x0000000000000000
This usually means one of the following happened:

(1) You told QEMU to execute a kernel for the wrong machine type, and it crashed on startup (eg trying to run a raspberry pi kernel on a versatilepb QEMU machine)
(2) You didn't give QEMU a kernel or BIOS filename at all, and QEMU executed a ROM full of no-op instructions until it fell off the end
(3) Your guest kernel has a bug and crashed by jumping off into nowhere

This is almost always one of the first two, so check your command line and that you are using the right type of kernel for this machine.
If you think option (3) is likely then you can try debugging your guest with the -d debug options; in particular -d guest_errors will cause the log to include a dump of the guest register state at this point.

Execution cannot continue; stopping here.
Any ideas on where the error is?
0 Kudos
Highlighted
528 Views
Registered: ‎05-20-2019

The above errors occured only when i  use the elf file generated using the mb-gcc seperately. These errors didn't appear when i used the elf file generated using SDK. The difference is that SDK uses a linker file to properly map the memory of the machine and the place where the program is loaded. Using the linker file along with mb-gcc seperately aslo worked.

View solution in original post