This document will guide you from importing the virtual machine to debugging an Hello World! example on a customized Linux distribution you will generate with OpenEmbedded/Yocto toolchain.
The development environment is provided as a virtual disk (to be used by a VirtualBox virtual machine) which you can download from this page:
Important
Compute the MD5SUM value of the zip file you downloaded and compare it to the golden one you find in the download page.
Uncompress the file, and you will get a .vdi file that is our virtual disk image. The environment contains the SDK for all the boards provided by Architech, ZedBoard included.
For being able to use it, you first need to install VirtualBox (version 4.2.10 or higher). You can get VirtualBox installer from here:
https://www.virtualbox.org/wiki/Downloads
Download the version that suits your host operating system. You need to download and install the Extension Pack as well.
Important
Make sure that the extension pack has the same version of VirtualBox.
Install the software with all the default options.
We need to setup a port forwarding rule to let you (later) use the virtual machine as a local repository of packages.
Note
The virtual machine must be off
Building an entire system from the ground up is a business that can take up to several hours. To improve the performances of the overall build process, you can, if your computer has enough resources, assign more than one processor to the virtual machine.
Note
The virtual machine must be off
The VBox addictions add functionalities to the virtual machine such as better graphic driver and more. It is already installed in the SDK but is important re-install it to configuring correctly the virtual machine with your operating system.
2. Click on the virtual box menu to the voice Devices and select Insert Guest Additions CD Images.... A message box will appear at the start of the installation, click on run button
Important
A working internet connection, several GB of free disk space and several hours are required by the build process
gedit conf/local.conf
EXTRA_IMAGE_FEATURES_append = " tools-debug debug-tweaks"
IMAGE_INSTALL_append = " tcf-agent gdbserver"
or
EXTRA_IMAGE_FEATURES_append = " tools-debug debug-tweaks"
IMAGE_FEATURES_append = " eclipse-debug"
This will trigger the installation of a features set onto the final root file system, like tcf-agent and gdbserver.
bitbake core-image-minimal-dev
At the end of the build process, the image will be saved inside directory:
/home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard
sudo tar -xzf /home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard/core-image-minimal-dev-zedboard.tar.gz -C /home/architech/architech_sdk/architech/zedboard/sysroot/
Note
sudo password is: “architech“
Warning
The following instruction will make you overwrite your SD card content, it will be lost forever! If you have important data on it, make sure you do a backup of your data on the SD card before catching up with the next steps.
Create two partitions on the SD card you mean to use to boot the board. The first one has to be a FAT16 (name it boot), 64MB will be more than enough. Create the second partition as an EXT2 (name it rootfs), make it big enough to fill the free space on the disk size.
Run this command:
mkdir -p /home/architech/Documents/zedboard
to create the directory that will be used to save a few files you need to download from the Internet:
Now, we assume that the first partition of the SD card gets mounted (in your SDK virtual machine) under:
/media/boot
while the second partition gets mounted under:
/media/rootfs
Warning
If that’s not the case for your configuration, please find out which are the proper mounting points for those two partitions on your system and replace them in the following instructions.
Ok then, we can finally deploy bootloader and kernel on the first partition of the SD card:
cp /home/architech/Documents/zedboard/BOOT.BIN /media/boot/
cp /home/architech/Documents/zedboard/uEnv.txt /media/boot/
cp /home/architech/Documents/zedboard/devicetree.dtb /media/boot/
cp /home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard/uImage /media/boot/
and the root file system on the second partition of the SD card:
sudo rm -rf /media/rootfs/*
sudo tar -xzf /home/architech/architech_sdk/architech/zedboard/yocto/build/tmp/deploy/images/zedboard/core-image-minimal-dev-zedboard.tar.gz -C /media/rootfs/
Important
sudo password is architech
Make sure everything has been written on the SD card:
sync
and unmount the SD card from your system.
Make sure that ZedBoard boot mode (JP7-JP11) and MIO0 (JP6) jumpers are set like in the following picture:
Insert the SD card you just prepared inside socket J12.
Connect the external power adapter to ZedBoard connector J20 and move switch SW8 to the “On” position.
And now proceed by setting up the serial console.
On ZedBoard there is an USB-UART port (J14) labeled UART
which you can connect, by means of a micro-USB cable, to your personal computer.
Note
Every operating system has its own killer application to give you a serial terminal interface. In this guide, we are assuming your host operating system is Ubuntu.
On a Linux (Ubuntu) host machine, the console is seen as a ttyACMX device and you can access to it by means of an application like minicom.
Minicom needs to know the name of the serial device. The simplest way for you to discover the name of the device is by looking to the kernel messages, so:
sudo dmesg -c
dmesg
[29629.785374] usb 3-2: >new full-speed USB device number 4 using xhci_hcd
[29629.806908] usb 3-2: >New USB device found, idVendor=04b4, idProduct=0008
[29629.806915] usb 3-2: >New USB device strings: Mfr=1, Product=2, SerialNumber=4
[29629.806919] usb 3-2: >Product: Cypress-USB2UART-0123456
[29629.806922] usb 3-2: >Manufacturer: 2012 Cypress Semiconductor
[29629.806925] usb 3-2: >SerialNumber: 0201258B0816
[29629.858654] cdc_acm 3-2:1.0: >This device cannot do calls on its own. It is not a modem.
[29629.858705] cdc_acm 3-2:1.0: >ttyACM0: USB ACM device
[29629.859345] usbcore: registered new interface driver cdc_acm
[29629.859347] cdc_acm: USB Abstract Control Model driver for USB modems and ISDN adapters
As you can see, here the device has been recognized as /dev/ttyACM0.
Now that you know the device name, run minicom:
sudo minicom -ws
If minicom is not installed, you can install it with:
sudo apt-get install minicom
then you can setup your port with these parameters:
+-----------------------------------------------------------------------+
| A - Serial Device : /dev/ttyACM0 |
| B - Lockfile Location : /var/lock |
| C - Callin Program : |
| D - Callout Program : |
| E - Bps/Par/Bits : 115200 8N1 |
| F - Hardware Flow Control : No |
| G - Software Flow Control : No |
| |
| Change which setting? |
+-----------------------------------------------------------------------+
| Screen and keyboard |
| Save setup as dfl |
| Save setup as.. |
| Exit |
| Exit from Minicom |
+--------------------------+
If on your system the device has not been recognized as /dev/ttyACM0, just replace /dev/ttyACM0 with the proper device.
Once you are done configuring the serial port, you are back to minicom main menu and you can select exit.
Give root to the login prompt:
Board
zedboard login: root
and press Enter.
Note
Sometimes, the time you spend setting up minicom makes you miss all the output that leads to the login and you see just a black screen, press Enter then to get the login prompt.
The time to create a simple HelloWorld! application using Eclipse has come.
Note
Use an ethernet cable to connect the board (connector J11) to your PC. Configure your workstation ip address as 192.168.0.100. Make sure the board can be seen by your host machine:
ifconfig eth0 192.168.0.10
ping 192.168.0.10
If the output is similar to this one:
64 bytes from 192.168.0.100: icmp_req=1 ttl=64 time=0.946 ms
64 bytes from 192.168.0.100: icmp_req=2 ttl=64 time=0.763 ms
64 bytes from 192.168.0.100: icmp_req=3 ttl=64 time=0.671 ms
64 bytes from 192.168.0.100: icmp_req=4 ttl=64 time=0.793 ms
then the ethernet connection is ok. Enable the remote debug with Yocto by typing this command on ZedBoard console:
/etc/init.d/tcf-agent restart
On the Host machine, follow these steps to let Eclipse deploy and debug your application:
/home/architech/architech_sdk/architech/zedboard/toolchain/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-gnueabi/arm-poky-linux-gnueabi-gdb
/home/architech/architech_sdk/architech/zedboard/sysroot/lib
/home/architech/architech_sdk/architech/zedboard/sysroot/usr/lib
Important
If debug does not work, check on the board if tcf-agent is running and gdbserver has been installed. You can ignore the message “Cannot access memory at address 0x0”.