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, Hachiko 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
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"
This will trigger the installation of a features set onto the final root file system, like tcf-agent and gdbserver.
bitbake tiny-image
At the end of the build process, the image will be saved inside directory:
/home/architech/architech_sdk/architech/hachiko-tiny/yocto/build/tmp/deploy/images/hachiko
sudo tar -xjf /home/architech/architech_sdk/architech/hachiko-tiny/yocto/build/tmp/deploy/images/hachiko/tiny-image-hachiko.tar.bz2 -C /home/architech/architech_sdk/architech/hachiko-tiny/sysroot/
Note
sudo password is: “architech“
To deploy the root file system, you are going to need an USB flash drive.
Warning
The USB flash drive content will be lost forever!
sfdisk /path/to/your/USB/device << EOF
0,
EOF
mkfs.ext2 /path/to/your/USB/device/partition
sudo tar -xjf /home/architech/architech_sdk/architech/hachiko-tiny/yocto/build/tmp/deploy/images/hachiko/tiny-image-hachiko-tiny.tar.bz2 -C /path/to/usb/media
cp /home/architech/architech_sdk/architech/hachiko-tiny/yocto/build/tmp/deploy/images/hachiko/uImage /path/to/usb/media/boot
cp /home/architech/architech_sdk/architech/hachiko-tiny/yocto/build/tmp/deploy/images/hachiko/uImage-rza1-hachiko.dtb /path/to/usb/media/boot/rza1-hachiko.dtb
On Hachiko there is the dedicated serial console connector CN2
which you can connect, by means of a mini-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 ttyUSBX 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:
Host
sudo dmesg -c
Host
dmesg
[ 2912.634893] usb 3-4: >new full-speed USB device number 6 using xhci_hcd
[ 2912.658153] usb 3-4: >New USB device found, idVendor=0403, idProduct=6001
[ 2912.658160] usb 3-4: >New USB device strings: Mfr=1, Product=2, SerialNumber=3
[ 2912.658164] usb 3-4: >Product: Hachiko Rev. B
[ 2912.658167] usb 3-4: >Manufacturer: AVNET EMG ITALY
[ 2912.658169] usb 3-4: >SerialNumber: A6XGP6WP
[ 2912.660753] ftdi_sio 3-4:1.0: >FTDI USB Serial Device converter detected
[ 2912.660801] usb 3-4: >Detected FT232RL
[ 2912.660805] usb 3-4: >Number of endpoints 2
[ 2912.660809] usb 3-4: >Endpoint 1 MaxPacketSize 64
[ 2912.660812] usb 3-4: >Endpoint 2 MaxPacketSize 64
[ 2912.660815] usb 3-4: >Setting MaxPacketSize 64
[ 2912.661102] usb 3-4: >FTDI USB Serial Device converter now attached to ttyUSB0
As you can see, here the device has been recognized as ttyUSB0.
Now that you know the device name, run minicom:
Host
sudo minicom -ws
If minicom is not installed, you can install it with:
Host
sudo apt-get install minicom
then you can setup your port with these parameters:
+-----------------------------------------------------------------------+
| A - Serial Device : /dev/ttyUSB0 |
| 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 ttyUSB0, just replace ttyUSB0 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
hachiko 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.
CN2 is used also to provide the power to the board, so, as soon as your serial terminal emulator is ready you start getting messages from the board.
The time to create a simple HelloWorld! application using Eclipse has come.
Use an ethernet cable to connect the board (connector XF1) 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 Hachiko 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/hachiko-tiny/toolchain/sysroots/i686-pokysdk-linux/usr/bin/arm-poky-linux-uclibceabi/arm-poky-linux-uclibceabi-gdb
/home/architech/architech_sdk/architech/hachiko-tiny/sysroot/lib
/home/architech/architech_sdk/architech/hachiko-tiny/sysroot/usr/lib
Important
If debug does not work, check on the board if tcf-agent is running and gdbserver has been installed.