By Adam Taylor

With the Snickerdoodle up and running and talking to the network, my next step is to develop a simple “hello world” program to run on the current Linux build. It’s very straightforward to do this. All we need is to use is the Xilinx SDK. Because we are developing the program for an existing Linux kernel, we do not need to use a hardware definition or a BSP. Instead we can open SDK and select

file -> open -> new application project

Within the dialog box, select the operating system as Linux and leave all of the other boxes empty, apart from the project name.

Click on next and select the “hello world” example. Once this folder has opened, you will see the helloworld.c file under the src directory within the project explorer. Obviously we can increase the complexity of the program. However, for now I just want to pipe-clean the process of running the application.

The next step is build the source code and generate the ELF file, which will end up under your Debug or Release directories depending upon your current build setting.

To run this file, we need to transfer it into the file system of the SD Card. There are a number of ways we can do this. The simple way is to transfer the ELF file to the SD card using the development PC. The more complex way is to use file sharing over WiFi. To finish off this blog, we will look at both ways.

To do both, we need to download some software for our development PC.

The simplest manner to transfer the “hello world” program into the Linux file system is to insert the SD Card into the development PC and transfer the file. If you are developing on a Linux system this should be no issue. However, if you are running a Windows development PC like I am, then you will run into file system issues. This means your Windows PC will not be able to see the file system without software that can see the Ext2 file system Linux uses. I downloaded the ext2ifs application from http://www.fs-driver.org/, which allowed me to transfer files to the SD Card’s root fs. I had no issues when I later ran the executable from the SD Card.

Of course the more interesting approach enables us to take full advantage of WiFi connectivity to transfer files. To do this, I used WinSCP and enabled remote log on over SSH. Transferring files was then as simple as drag and drop to and from the SD Card in the Snickerdoodle.

But to use WiFi for transferring files, first we have to configure the Snickerdoodle to allow us to access it remotely over SSH. The first thing to do is to set a password for the root account. We do this using the command sudo passwd. You will be asked to enter your chosen password twice, do not forget it. We’ll need it.

The next step is to edit the SSH configuration file. Similar to last week, we can use VI to edit this:

Within the file, scroll down to the line “PermitRootLogin without-password” and comment it out. Then on the line below, enter “PermitRootLogin yes” and then save and exit the file.

With the file saved, exit VI. We can then restart the SSH service before we try to log in. We do this with the command service ssh restart. Once this is completed we can try logging in from Putty using SSH and the Snickerdoodle’s IP address (see last week’s blog for how to connect to a WiFi network). If successful, we should see an interface very similar to an RS-232 serial terminal interface.

If you can log in, close the Putty session and open the WinSCP program. Leave the protocol as default and enter the user name (root) and password and then click connect. This will open a GUI like the one shown below which shows the files on your PC and the Snickerdoodle.

Navigate to where you wish to move the file to on the Snickerdoodle and then find the ELF you wish to run within your workspace. Moving the file is as simple as clicking on upload and then selecting the correct setting from the transfer settings dialog.

To ensure that the program executed correctly, I set the execute permission. Once the program file is uploaded, you should see it in appear under the Snickerdoodle window within WinSCP.

To confirm that it is present, you can use the RS-232 command line to navigate to the target directory for the transfer and then perform an ls command. You should see it present in the target directory.

Within the command line, type sudo ./<programme_name.elf> to execute the program and you should see the resulting “hello world” as shown below:

We can of course use this facility to transfer all sorts of files to and from the Snickerdoodle wirelessly.

The code is available on Github as always.

If you want E book or hardback versions of previous MicroZed chronicle blogs, you can get them below.

First Year E Book here

First Year Hardback here