FAQ Hero Banner

The Question and the Answer

ZedBoard - Setting up a ARM development environment in Linux
ZedBoard - Setting up a ARM development environment in Linux
ZedBoard - Setting up a ARM development environment in Linux
Question:

Now that I have my ZedBoard up and running and my network is configured, can you help with some code to run on it?

Answer:

Well now that you have your Zedboard up and running, and your network is configured to talk to the outside world, let's get some code running on this thing!

First some environmental comments.  I am a big fan of Ubuntu.  I like it's feel and it's ease of use when it comes to installing packages using the apt-get command.  I will be writing just about all of these blog posts using Ubuntu as my host OS unless otherwise specified (like if it is a Windows post, or another flavor of Linux such as Fedora).

I have installed on a development box Ubuntu 12.04 LTS.  The only thing I selected during the install was to install OpenSSH so I could actually interface to the thing.  We are going to install just a single additional package to allow us to compile ARM code, and it's going to be really really simple to do!

Open up a command terminal on the local machine, or in my case open putty and connect to your box.

In the event that you do not have SSH installed and would like it installed then here is the command:

# sudo apt-get install update
# sudo apt-get install openssh-server

Now that you are at the prompt either on your local machine or via SSH, we can install the arm gcc tools:

$ sudo apt-get install gcc-arm-linux-gnueabi

Once the package is installed, you now have the ability to compile applications for your Zedboard! Woot!

I am going to go to my home directory and create a folder to do some development in, and then compile a hello world application:

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
#include
int main()
{
printf("Hello World!\n");
return 0;
}
^C

So we have our source file, now we need to compile it.  The application we will use is arm-linux-gnueabi-gcc .

$ arm-linux-gnueabi-gcc -o helloworld helloworld.c

Ok, so now we have our application written and compiled.  But now what?  We can't run it on our development box because it isn't ARM based.  So we need to get it over to our Zedboard.  The Zedboard conveniently ships with a FTP server running on it!  So all we need to do is connect to our Zedboard and drop our file there.

zynqgeek@beth:~/arm-devel$ ftp 192.168.2.210
Connected to 192.168.2.210.
220 Operation successful
Name (192.168.2.210:tim): root
230 Operation successful
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
200 Operation successful
150 Directory listing
total 27
drwxr-xr-x    2 12319    300           2048 Jan  9  2012 bin
drwxr-xr-x    4 12319    300           3072 Jan  1 00:00 dev
drwxr-xr-x    4 12319    300           1024 Jan  1 00:00 etc
drwxr-xr-x    3 12319    300           2048 Jul 12  2012 lib
drwxr-xr-x   11 12319    300           1024 Jan  9  2012 licenses
lrwxrwxrwx    1 12319    300             11 Jan  9  2012 linuxrc -> bin/busybox
drwx------    2 root     0            12288 Jan  9  2012 lost+found
drwxr-xr-x    2 12319    300           1024 Aug 21  2010 mnt
drwxr-xr-x    2 12319    300           1024 Aug 21  2010 opt
dr-xr-xr-x   48 root     0                0 Jan  1 00:00 proc
drwxr-xr-x    2 12319    300           1024 Jan  1 00:07 root
drwxr-xr-x    2 12319    300           1024 Jan  9  2012 sbin
drwxr-xr-x   12 root     0                0 Jan  1 00:00 sys
drwxrwxrwt    2 root     0               40 Jan  1 00:00 tmp
drwxr-xr-x    5 12319    300           1024 Mar 30  2012 usr
drwxr-xr-x    4 12319    300           1024 Oct 25  2010 var
226 Operation successful
ftp> cd root
250 Operation successful
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 (155393.0 kB/s)
ftp> ls
200 Operation successful
150 Directory listing
total 9
-rw-r--r--    1 root     0             7797 Jan  1 00:25 helloworld
-rw-r--r--    1 root     0              512 Jul 12  2012 logo.bin
226 Operation successful
ftp> quit
221 Operation successful
zynqgeek @beth:~/arm-devel$

Cool.  So now our our Zedboard in the /root folder we have a file called helloworld.  We need to change it's properties outever so our shell knows it can be executed.  To do this we will use chmod:

zynq>
zynq> cd /root
zynq> ls
helloworld  logo.bin
zynq> chmod +x helloworld
zynq> ls -al
total 12
drwxr-xr-x    2 12319    300           1024 Jan  1 00:25 .
drwxr-xr-x   17 12319    300           1024 Jan  1 00:00 ..
-rw-------    1 root     0               92 Jan  1 00:28 .ash_history
-rwxr-xr-x    1 root     0             7797 Jan  1 00:25 helloworld
 -rw-r--r--    1 root     0              512 Jul 12  2012 logo.bin

You will notice that the helloworld app now has the ability to be executed.  Well, what are you waiting for!? let's do it!

zynq> ./helloworld
Hello World!

Woohoo!  How cool is that!?.  So now, you are well on your way to application development for the ARM cores running within the Zynq-7000 EPP on you Zedboard.

Xilinx Tools:

Note:  I want to put this in here since it is important.  The above how-to simply just shows you how to get a file running on an ARM processor, in this case on your Zedboard.  If you want to take full advantage of your Zynq-7000 EPP platform you really want to go and download the free Xilinx tools here:

http://www.xilinx.com/support/download/index.htm

They are rather large I know, but well worth it.  I will put together a how-to for the Xilinx tools soon so you can see what else is out there!  Also check the Zedboard.org site as often as possible for the latest updates, how-to's and user guides.

ZedBoard - Setting up a ARM development environment in Linux