Sorry, you need to enable JavaScript to visit this website.

Testing code on QEMU

An Anonymous poster asked that I write up a brief tutorial on how to get your ARM code running in QEMU to see how it runs without having to have hardware.  This is a flow I hadn't thought of, but I do agree it is definitely a useful topic to write about.

First, if you are on Windows, you will want to follow this blog post to get your self setup with VirtualBox to bring up a 64 bit Linux environment.

Next, follow this blog post to get qemu downloaded and up and running.

You are also going to want to follow this blog post to get your ARM development enviornment up and running.  The alternative to this is to download and install the Xilinx tools, and then do your ARM code development in the Xilinx SDK tool.  To get the tools downloaded and installed, check out this blog post.

Ok, now we are to the point where, regardless of you being on Windows or Linux, you are good to go for configuration.

So let's write a simple hello world c program, cross compile it for ARM, push it to the qemu machine, and then run it.  Cool.

First, let's write our hello world program.  I usually use vi to edit files, however here I will just use the cat command so I can show you what the file contents are:

    zynqgeek@beth:~$ cd
    zynqgeek@beth:~$ mkdir arm-devel
    zynqgeek@beth:~$ cd arm-devel/
    zynqgeek@beth:~/arm-devel$ touch helloworld.c
    zynqgeek@beth:~/arm-devel$ cat > helloworld.c
    int main()
    printf("Hello World!\n");
    return 0;

Where the ^C is hitting ctrl-c on your keyboard.

Ok, now that I have my file, we need to compile it (note if this doesn't work go back and follow the instructions for setting up your development environment).

zynqgeek@beth:~$ arm-linux-gnueabi-gcc -o helloworld helloworld.c

Ok, now that we have our file, we need to get it to our qemu virtual machine.  To do this, we are going to do need two command terminals open, so pop open another xterm or open another ssh session.

In terminal window 0, we are going to be running qemu - this simple will just be executing a single bash script.  In terminal window 1 we will be ftp'ing our file to the qemu VM.

In terminal 0:

*navigate to where you have downloaded and uncompressed the zynq_linux.tar.gz archive*

    root@sue:~# cd zynq_linux/
    root@sue:~/zynq_linux# ./

    Starting rcS...
    ++ Mounting filesystem
    ++ Setting up mdev
    eth0: link up (1000/FULL)
    ++ Starting telnet daemon
    ++ Starting http daemon
    ++ Starting ftp daemon
    ++ Starting dropbear (ssh) daemon
    rcS Complete
So let's make sure that we now have our ftp server up and running on our qemu vm.  We will list the processes that are running:
    zynq> ps | grep "ftpd"
      600 root       0:00 tcpsvd 0:21 ftpd ftpd -w /
      620 root       0:00 grep ftpd
We see two items, the first is our ftp server - woot!  The second is the command of us looking for the ftp server.
Note:  If do not see the server running, you can execute this command:
    zynq> tcpsvd 0:21 ftpd ftpd -w /&
Cool!  Now all we need to do is go to our terminal 1 and make a connection to our qemu VM ftp server and upload our helloworld program.
If you take a look in the start_qemu script, you will see that there are a number of port forwarding assignments, specifically port 21 (the tcp/ip port that ftp uses) is forwarded to port 10021 locally.  So we will make our connection on that.
In terminal 1:
    zynqgeek@beth:~/arm-devel# ls
    helloworld  helloworld.c
    zynqgeek@beth:~/arm-devel# ftp localhost 10021
    Connected to localhost.
    220 Operation successful
    Name (localhost:tim): root
    230 Operation successful
    Remote system type is UNIX.
    Using binary mode to transfer files.
    ftp> put helloworld
    local: helloworld remote: helloworld
    200 Operation successful
    150 Ok to send data
    226 Operation successful
    7797 bytes sent in 0.00 secs (104304.9 kB/s)
    ftp> quit
Now, jump back to terminal 0 (our qemu VM):
    zynq> cd /
    zynq> ls
    README          lib             opt             sys
    bin             licenses        proc            tmp
    dev             linuxrc         ps    
    etc             lost+found      root            usr
    helloworld      mnt             sbin            var
    zynq> chmod +x helloworld
    zynq> ./helloworld
    Hello World!
One quick note: Don't forget the chmod +x command - the file won't have execution privileges when being created by ftpd, you need to add those.
So there you have it, this is a nice way to test our your arm code without needing hardware in the loop.  Enjoy!
Note:  Since the output of SDK is an .elf file, I am still working on the best way to get your code over from SDK to qemu.  I do believe there is a how-to on this from Xilinx, but I can't find it right now - I will check again in the morning.


Hi, your knowledge are vast, compliments.

You can create some guidelines for dealing with hardware in PL and build the driver / module for linux ?

Example AXI 4 Fifo stream ecc ...


Thanks for your support! I'm glad you are finding the information here useful!

As for the PSPL interaction - I've been working on this - should be done soon. I just want to make sure it is as concise as possible as not to confuse anyone.

If you take a look in the start_qemu script, you will see that there are a number of port forwarding assignments, specifically port 21 (the tcp/ip port that ftp uses) is forwarded to port 10021 locally. So we will make our connection on that.

how to move files,
that are present in zynq terminal to local host terminal?

It does mean we rely on QEMU's emulation of an Essay Help structural design identical real hardware, but that's OK. If we find difference, we can fix QEMU. In live out, the development is attractive stable..

Stomach overweight is a run of the mill inconvenience for the two men and women. Wretchedly, it is never certain inconvenience that one believes that its less requesting to arrange Super fit expert ampere fortune that we age Online essay writing service in UK

Can you operate it in a manner of gaining knowledge of on how to program virtualization software program I am also learning to the development and I am currently, working on a project which is related to programming? and I used to get help from Best Essay Writing Service UK in my college projects to submit on time. 

Network virtualization deals with creating virtual interfaces made out of physical interfaces. One such example is Ethernet bonding driver wherein one or more physical Ethernet interfaces are bound together to create a single network interface. Get dissertation writing help for student help.

Good to know about the details of the workshops planned to be conducted on Saturday. This seems to be a wonderful opportunity for those who are looking for a good reference about the specified topics. Thanks for sharing the details of the workshops. Great Tips who can write my coursework. I Have to Thanks To You to Share It Many points have extremely useful

Stomach overweight is a run of the mill inconvenience for the 2 males and females. Wretchedly, it is by no means positive inconvenience that one believes that its less inquiring for to set up Super in shape expert ampere fortune that we age Online essay writing service UK.


It breaks your heart and demotivates you if you put a lot of hard work and efforts into something and still do not get the desired results. Students can relate to this quite often. They spend hours on researching and writing for an essay assignment and sacrifice a lot on other activities and still, they remain underappreciated with average or below average grades on the assignment. So why not hire professional academic writing services like London Custom Essay Writers UK to have your work professionally done and get good grades on it along with saving your time and energy.

That's very nice from you! The reason why I come to this forum so often is that you guys respond and help the other member. I was searching that Arm code for a while I even Searched it on Stack Overflow but didn't find the desirable answer that I needed. Thank you once again for sharing the code as I am an Essay writer and I had to write an assignment on the ARM.