Aug 13

After being able to compile, debug and execute a C-program for Ubuntu now it is time to repeat this process for the FOX board from ACME. The development environment (compiler/debugger) is already installed so let’s follow the instructions on the developer site from AXIS.

Open a terminal window and navigate to the folder containing the main.c file of the foobar-sample program. In order to compile the program and create an executable called hello_host type the command:

gcc -o hello_host main.c

This compiles the program using the GCC that generates executable for the processor of the computer currently used. In order to execute the program type ./hello_host and press enter.

Next step is to compile is for the target platform. The gcc-cris compiler has been installed, in order to call it from a different location that it is installed in the path to the compiler must be added to the PATH environment variable from Linux. Typing the ECHO $PATH command shows the current PATH variable, at this moment it might contain the path to /usr/local/cris but after a reboot this might be gone.

In order to add this permanent to the PATH variable, enter the command sudo gedit /etc/profile and check if the PATH variable is somewere set in this file. If so, add :/usr/local/cris at the end of the path definition. If it does not exists, add below two lines at the end of the file:

  • PATH=$PATH:/usr/local/cris
  • export PATH

A reboot is required to make this effective, you can also type the two commands in a terminal windows to set them for the current session if you don’t want to reboot now.

Navigate again to the folder containing the main.c file of the foobar-sample program and type gcc-cris –version followed by enter. Indeed, the compiler states:

cris-axis-elf-gcc (GCC) 3.2.1 Axis release R64/1.64

Perfect. Next statements on the developer site are how to compile the program. Something about various libraries that can be used. In order to see which library needs to be used the FOX board needs to be connected. Since this is not the case yet, let’s try the dumb method:

gcc-cris -o hello_target main.c

A lot of warnings are displayed, apparently this is not the way to go. Time to connect the FOX board.

Aug 12

It has been a while since my last post, there were some commercial projects I had to work on. The good news is that it gave me time to think about the work done so far and how to proceed. Some of the conclusions are:

  • First make a simple snake model that uses wheels and moves in 2D only
  • Use standard servo’s and add a small micro controller to each servo to make it digital. As an interface between them and the brains use an existing industrial interface, for example a CAN interface.

The first point to learn step by step and prevent that half way the development it becomes some complex that I loose interest. The second one in order to standardize as much as possible so that parts of the design can be used for other robots as well.

But first the basics, I was able to compile a small program in Anjuta, compile and execute it. Next step is to see if a breakpoint can be set and debugging can start from that point onwards.

Start Anjuta and reload the Hello Word application (foobar sample) and modify the code as listed below:

#include <stdio.h>
int main()
{
printf(“Hello world\n”);
printf(“And again\n”);
return (0);
}

Place the cursor on the second printf statement and place a breakpoint on this line using the Debug | Add breakpoint… option in Anjuta; this places a red stop sign in front of the line. Use the Debug | Run target… option to start execution of the program. A program parameters dialog appears, you can check off the Stop at beginning option so that the program executes until the breakpoint just set.

After pressing the execute button and showing the terminal window only Hello world appears and the program finishes with a message that the reason “exited-normally”. This is not what I had in mind, but I realized (the break did me good) that since the second printf command is not executed it might be that the new program is not build automatically. Pressing F11 (or use the Build | Build menu option) takes care of this, now indeed the debugger stops at the second printf command and continuous to the next statement by pressing F6 (or use the Debug | Step over menu option).

Chapter 5 in the user manual (Help | User’s manual menu option) explains in great detail the options available during a debug session. It does not explain how to automatically build the program when the debug session is started. A quick search on the internet also does not give me the answer.

Anyone?

May 14

It seems I’m not the only one who has a problem with Gutsy Gibbon. A search on the internet shows several hits and possible fixes. Let’s see it it works.

  • You have to comment out the “CDROM” line in your “/etc/apt/sources.list” by typing the following at the Terminal:
    • gksudo gedit /etc/apt/sources.list
  • Once you have your /etc/apt/sources.list file open look for the following line:
    • deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ – Release i386 (20071016)]/ gutsy main restricted
  • Comment the line out so that it looks like the following line:
    • #deb cdrom:[Ubuntu 7.10 _Gutsy Gibbon_ – Release i386 (20071016)]/ gutsy main restricted
  • Save the “/etc/apt/sources.list” file and close it.
  • Update your “/etc/apt/sources.list” by typing the following at the Terminal:
    • sudo apt-get update

All these commands work fine, the CDROM line is the first line in the file on my system. Using the Synaptic Package Manager the build-essential package is located and marked for installation. This triggered the request for the Gutsy Gibbon error and indeed, the installation now works fine. All other packages are marked again for installation and no problems occur during installation of these packages as well.

Now let’s check if a program can be made using Anjuta, a new Generic C project is started with all settings to default. After confirming all settings several scripts are running and NO, again error messages that disappear to fast to see what else is missing. It seemes to be something with int…tool, this might have to do with the option to add internationalization to the project. In the Package Manager there is a package intltool, this is installed and might solve the problem.

Now something funny happened. Previously I always started a new Generic C project and when it failed to generete the required files I closed Anjuta and deleted the folder that was created (foobar-sample). The next time Anjuta was started to test again it complained the project was missing, no problem since I deleted it myself. By mistake I pressed the New button which added a blank file in the IDE after which I created the new project and found the errors again. I closed Anjuta, deleted the folder foobar-sample again and I started Anjuta again. Now no error is displayed, the Newfile#1 is opened again and (even better) when creating a new project with Newfile#1 still open the messages remain visible! YES! More good news, installing the intltool package solved the int…tool error, but there is still an error reported: glib must be installed.

Glib is not a package that is available in the Package Manager, searching what glib is results in the GTK project that provides a Graphical Tool Kit. Since I will not be developing graphical programs I will not install it. After deleting the project again, start Anjuta, create a new Generic C project and set the options Add shared library support and Add internationalization both to NO the project is now created without any errors. Build the project using the Build | Build Project menu option will copile and link it. Finally the program can be executed using the Build | Execute Project menu, the result “Hello world” is displayed in the Terminal box at the bottom.

Finally….

May 13

Another discussion with the experts reveil that next to GCC a set of development essentials are needed. He gave me a list of all the packages he installs in a development PC:

  • autoconf
  • autogen
  • automake1.8
  • automake1.9
  • autotools-dev
  • binutils
  • build-essential
  • cpp
  • cvs
  • dhcp3-server
  • dpkg-dev
  • g++
  • gcc
  • gftp-common
  • gftp-gtk
  • libc6-dev
  • libpcre3
  • libstdc++6-4.0-dev
  • libsvn0 (seems this does not exist, libsvn1 selected instead)
  • libtool
  • linux-kernel-headers (seems this does not exist, linux-kernel-devel selected instead)
  • m4
  • make
  • minicom
  • nfs-common
  • nfs-kernel-server
  • openssh-server
  • portmap
  • smbfs
  • ssh
  • subversion

I’m not sure I need all this but I don’t want to take the risk anymore. Using the Synaptic Package Manager all these packages can be installed, click on the All item to list all available packages, than click on the list of packages and start typing the package, during the typing a search will be executed so you will not need to type the whole package name.

Most packages are already installed, some of them are automatically selected when selecting another one. Libsvn0 and linux-kernel-headers do not exist, instead Linsvn1 and linux-kernel-devel are selected. After the marking process a click on the Apply button starts the installation. However, after a few seconds the disk “Ubuntu 7.10_Gutsy Gibbon_ – Release i386 (20071016)” is requested in the CD-ROM player. The Ubuntu CD-ROM is inserted but the title does not amtch and Ubuntu refuses to continue the installation….

May 7

Chapter 4 of the manual becomes interesting,  it explains how the create a new project. The previous chapter explains that Anjuta works with project files that are located in the folder of the project. In such project files the make files are stored. This might explain why the build menu is disabled, there is no project file in this folder.

Selecting the File | New… | Project option displays a message that it could not find autogen version 5, this can be downloaded from autogen.sourceforge.net. There is no autogen in the Add/Remove application part, it is however available in the Synaptic Package Manager. After installation and selecting the File | New… | Project option a Application Wizzard is started. The first page indeed explains that as part of the process a build file will be generated.

I have no idea what the create, so below settings are based on common sense. As project type there is an Anjuta Plugin in the C tab, it looks tempting to use this one but I decide the click the Generic C project instead. In the next tab a project name is provided that is automaticly added to my development folder in the next tab. I do not want to add internationalization support and after confirming the settings several files are generated. A “Hello World” application is generated automaticly and a build is started. There are several error messages displayed that I need to install more stuff but before I can read them they are gone…..

May 6
GCC

Time to call in the experts. It looks like GCC is installed but I still get error messages it can not be found. The experts tell me that GCC is not by default installed and I should use the System | Administration | Synaptic Package manager to install GCC and all essentials I need for developing programs. It seems GCC is not seen as an application but as a tool.

After typing the password there is a huge list of available packages. A search on GCC still shows a lot of hit, apparently some packages are installed (marked with a green fill check box in front of it). Also the version of the installed package is displayed, the cris-dist 1.64-1 is displayed as well.

There are several GCC 4.1 packages already installed, most of them an Ubuntu spin-off. GCC is now at 4.3.0 but this is not shown yet. I marked all GCC-4.2 packages for installation and clicked the apply button. A message appears that 58MB will be installed. Sounds good….

While browsing through the list also a GCC AVR version seems to exists. This might be something to investigate later on.

The installation took only about 10 seconds, that most was already downloaded but not installed? After closing the package manager and opening Terminal windows it’s time to check if the compiler now actually works. In the folder that contains the previously generated hello.c file the command gcc -o hello_host hello.c is typed, after pressing the enter key no error is displayed but also no messages. Executing the ls command shows that indeed the file hello_host exists! The program can be executed by typing the ./hello_host command and viola: Hello world!

Another piece of advice the experts gave me (and so far they have been right) is to install a proper Integrated Development Environment (IDE) to prevent working with a simple editor and typing all these commands. They advice Anjuta as an IDE. This is an application so clicking the Applications | Add/Remove menu should provide access to this application. Indeed, clicking the Programming category shows Anjunta IDE as an available application. The comments state that it is provided by the Ubuntu community and integrates well with the Ubuntu desktop. Perfect. Checking the check box and pressing the Apply Changes button ask (again) for my password before installation.

After installation it is placed in Applications | Development, launching the program shows a type of explorer. Clicking on the Open button and navigating the my hello.c file triggers a message that there are two plug ins available for editing: Scintilla and GtkSourceview. Let’s start with the first one. The file hello.c is opened and the syntax is highlighted which is a very handy feature for developing programs. The font is very big, clicking the Settings | Scintilla Editor menu this can be changed to 8pt.

In the Settings menu there is also a Plug in menu available. This shows a list of possible plugins that can be used in combination with Anjuta, the plug ins Automake Build, Debugger and Terminal are checked, this add two menus (Build and Debug) next to a series of button at the bottom of Anjuta that toggle a window between breakpoints and a terminal.

Clicking the Build | Compile menu now compiles the program, but this creates the file hello.o and not the executable. For this they need to be linked together, normally these are combined in the Build process however the Build option in the Build menu is disabled. Something is missing, perhaps reading the manual might help.

Apr 28

When reading the site of the GNU Compiler Collection I can not find a simple install package like the one for the FOX board. It does provide a very long manual on how to build the compiler yourself but that might prove to be complex for a beginner like me but I will give it a try.

First step is to host specific installation notes for GCC. On the i?86-*-linux* page it states that binutils 2.13.1 or later is required. So, which version is Ubuntu using? A search on binutils +Ubuntu shows version 2.16.1 is available but that does not tell me if this comes with every Ubuntu installation. Clicking the installation file tiggers the package installer that informs me that a later version is already installed (also 2.16.1). Perfect.

Next step is downloading GCC, an important message tells me that the source code is of little use if I don’t have a C compiler installed. Classical case of the chicken and the egg… There are several binaries available but not for Ubuntu. Searching on the Ubuntu site for GCC shows several comments that under the hood of GCC is used. Perhaps this is already installed but the previous error is caused by something else?

In the Applications menu there is an option to Add/Remove software, clicking this shows not only a list of installed programs but also a list of programs that are supported by Ubuntu! Clicking the programming selection button and showing all open source applications does not show GCC. Selecting all still does not show GCC. Searching for GCC shows a program SysInfo that can give detailed information of the system it is installed on. Checking this program and pressing the update button triggers the installation.

After starting this SysInfo application and clicking on the System button and showing more details it states GCC version 4.1.3 is installed. The good news is that I now know that GCC is available and I learned that searching for available programs is very easy in Ubuntu. The bad news is that the previous error is caused by something else. But what?

Apr 25

From this point forward I have no idea what I’m doing. I do have a lot of experience in developing software for Windows or on embedded micro controllers but not for Linux based systems. I ordered the FOX board from ACME, in order to develop software for it I need a C compiler and a debugger, this software development kit (SDK) can be found on the site of AXIS. After creating an account the compiler and debugger can be downloaded seperatly.

Since I don’t know how to create my own binary it does not make sense to download the source files. Instead the binary can be downloaded but there are two versions: .rpm and .deb. Which one to use? After some searching it seems these are two different package management systems. It also seems that Ubuntu uses the Debian system, when I click on the .deb file a message states that this is a software package and the option is presented to open it with the GDebi Package Installer.

It took some time to type this log, when clicking the install button it started downloading at 84% complete. Seems this is already running in the background to optimize the speed of Firefox. When the download is completed it states this is the GCC for the Axis system, a final click on install prompts me for a password. PANIC! Password? Reading carefully the message it states this is required to prevent automated installations, this still does not tell me what the password is.

The only one I know is the one I use for logon to Ubuntu, so let’s try that. Yes, it works, the installer runs ans ‘cris-dist_1.64-1_i386.deb’ is installed. The same process is repeated for the debugger ‘gdb-cris_6.3.50-cvs20050523-1_i386.deb’.

OK, two items have been installed. Let’s see if we can use them. Clicking the Applications menu does not show any programs. Neither do the other menu options. Hmmm…..

Seems I’m not the only one who has no clou how to do this, on the Axis Developer Wiki they have a how to topic on compiling for CRIS. Using the Places menu the folder Development/SankeBotOne/Hello is created in my home folder using the Create Folder menu option in the file browser. After this a new document is created using the Create Document menu options and the name hello.c is entered. A simple text editor is opened and below code is entered:

#include <stdio.h>
int main(int argc, char *argv[]) {
  printf(“Hello World!\n);
  return 0;
}

After saving and closing the file the Terminal program is started from the Applications|Accessories. Using the cd command the path is changed to Development/SankeBotOne/Hello and the ls command shows indeed the hello.c file is available. Typing the command: gcc -o hello_host hello.c should compile it but instead several errors are reported including stdio.h: no such file or directory.

Now what?

Reading the instructions more carefully it seems this step is for compiling for the host (so the mini ITX board) and not for the target. The compiler installed was for the target, perhaps there is no compiler available for the host. The command stated gcc which stands for GNU Compiler Collection.

Apr 24

Well, waiting did the trick! Ubuntu has installed and is running. I did not test all the IO devices yet like USB or CF but I must say I’m plessantly surprised so far.

Since Ubuntu now runs on the mini-ITX board it’s time to package it in a housing, so far it is just lying on my table.

There are manu mini ITX casings, I decided to use the Procase Noah Mini-ITX Black in combination with a slim-line DVD player (so not the one on the image above). This casing has an integrated power supply and allows 1 PCI32 card, I don’t know what card at this moment but this might come in handy in the near future. In all the case is only 202x97x273mm in size.

Apr 18

When booted from the Ubuntu DVD the first option is selected. Some progress bars later (for about 2 minutes) the Ubuntu desktop appears. Now the big question is: is it installed or just running from DVD? Two icons are shown on the desktop: Examples and Install. A click on the Examples icon confirm my guess that it was not isntalled (also the Install icon might be a hint). An explorer like window opens and shows the content of my PC, seems all Windows files are still there!

Clicking the Install icon starts indeed the installation program. Seems 7 steps are enough to customize the installtion. Step 4 is “how do you want to partition your disk?” Good question, the answers possible are not so clear. Option 1 is “Guided, use entire disk (60Gb).” The guided part sounds good, but after pressing the next button it jumps to step 6. So much for guidance…

Step 6 is for providing your account details. Funny, I can not use a login name that starts with a capital.  Step 7 shows a summary and a warning that all data of the disk will be removed. OK, so be it, farewell Windows.

The installation starts, after the progress bar reaches 15% it states “detecting file systems” and it seems to hang. After waiting for about 10 minutes I decided to reboot the system and run the installer again. Funny is that now in step 4 an additional option is presented: “Guided, resize SCS1 and use freed space”. It seems it was not hanging but formatting? This time I will be more patient since it hangs again at 15%….

I will leave it running overnight.

« Previous Entries