qemu run a bare-metal assembly program on xilinx-zynq-a9 machine

0

I am following this guide on setting up arm emulation setup. The guide is made taking connex machine as example. I want to follow the guide but using xilinx-zynq-a9 machine since I have some experience working with zynq boards.

So I have made a .bin file by following the tutorial. In the tutorial it says that connex board has 16MB flash and the the CPU starts executing from address 0x0. But this is not the case for zynq SoC, it has OCM (On Chip Memory) (bootrom + RAM) so if I want to run an application I would generally download the program to the OCM and reset the board to start the execution.

Below is the command I execute and the output of the command:

$dd if=/dev/zero of=bin/FLASH_hello_arm.bin bs=131072 count=512
512+0 records in
512+0 records out
67108864 bytes (67 MB, 64 MiB) copied, 0.231956 s, 289 MB/s
$dd if=bin/hello_arm.bin of=bin/FLASH_hello_arm.bin bs=4096 conv=notrunc
0+1 records in
0+1 records out
16 bytes copied, 0.0037652 s, 4.2 kB/s
$qemu-system-arm -M xilinx-zynq-a9 -pflash bin/FLASH_hello_arm.bin -m size=512M -nographic -serial /dev/null -serial /dev/null -singlestep
WARNING: Image format was not specified for 'bin/FLASH_hello_arm.bin' and probing guessed raw.
         Automatically detecting the format is dangerous for raw images, write operations on block 0 will be restricted.
         Specify the 'raw' format explicitly to remove the restrictions.
QEMU 2.5.0 monitor - type 'help' for more information
(qemu) xp /4iw 0x0
0x00000000:  00000000      andeq    r0, r0, r0
0x00000004:  00000000      andeq    r0, r0, r0
0x00000008:  00000000      andeq    r0, r0, r0
0x0000000c:  00000000      andeq    r0, r0, r0
(qemu) info registers 
R00=00000000 R01=00000000 R02=00000000 R03=00000000
R04=00000000 R05=00000000 R06=00000000 R07=00000000
R08=00000000 R09=00000000 R10=00000000 R11=00000000
R12=00000000 R13=00000000 R14=00000000 R15=02b2ff24
PSR=400001d3 -Z-- A svc32
s00=00000000 s01=00000000 d00=0000000000000000
s02=00000000 s03=00000000 d01=0000000000000000
s04=00000000 s05=00000000 d02=0000000000000000
s06=00000000 s07=00000000 d03=0000000000000000
s08=00000000 s09=00000000 d04=0000000000000000
s10=00000000 s11=00000000 d05=0000000000000000
s12=00000000 s13=00000000 d06=0000000000000000
s14=00000000 s15=00000000 d07=0000000000000000
s16=00000000 s17=00000000 d08=0000000000000000
s18=00000000 s19=00000000 d09=0000000000000000
s20=00000000 s21=00000000 d10=0000000000000000
s22=00000000 s23=00000000 d11=0000000000000000
s24=00000000 s25=00000000 d12=0000000000000000
s26=00000000 s27=00000000 d13=0000000000000000
s28=00000000 s29=00000000 d14=0000000000000000
s30=00000000 s31=00000000 d15=0000000000000000
s32=00000000 s33=00000000 d16=0000000000000000
s34=00000000 s35=00000000 d17=0000000000000000
s36=00000000 s37=00000000 d18=0000000000000000
s38=00000000 s39=00000000 d19=0000000000000000
s40=00000000 s41=00000000 d20=0000000000000000
s42=00000000 s43=00000000 d21=0000000000000000
s44=00000000 s45=00000000 d22=0000000000000000
s46=00000000 s47=00000000 d23=0000000000000000
s48=00000000 s49=00000000 d24=0000000000000000
s50=00000000 s51=00000000 d25=0000000000000000
s52=00000000 s53=00000000 d26=0000000000000000
s54=00000000 s55=00000000 d27=0000000000000000
s56=00000000 s57=00000000 d28=0000000000000000
s58=00000000 s59=00000000 d29=0000000000000000
s60=00000000 s61=00000000 d30=0000000000000000
s62=00000000 s63=00000000 d31=0000000000000000
FPSCR: 00000000

As seen the code is not loaded at the location 0x0, is there any way "program" the OCM of the zynq for qemu, like we program flash using dd tool? Does the model also start executing from the OCM or is it any different?

assembly
arm
qemu
bare-metal
zynq
asked on Stack Overflow Aug 25, 2019 by Teja Allani

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0