06-03-2019 01:52 AM
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?
06-16-2019 10:54 PM
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.
06-03-2019 03:00 AM
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
06-03-2019 03:16 AM
06-03-2019 04:24 AM
Can you refer to this forum thread
https://forums.xilinx.com/t5/Embedded-Linux/Standalone-in-QEMU-Microblaze/td-p/775954
Best Regards
Shabbir
06-03-2019 04:45 AM
06-06-2019 11:16 PM
06-16-2019 10:54 PM
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.