Difference between revisions of "Gumstix Verdex"

From New IAC Wiki
Jump to navigation Jump to search
 
(32 intermediate revisions by the same user not shown)
Line 1: Line 1:
To set up build environment:
+
=Installing the build environment=
<pre>source  ~/gumstix/gumstix-oe/extras/profile</pre>
+
 
 +
The main instructions are on the gumstix.net
 +
[http://gumstix.net/wiki/index.php?title=Build_Environment_Ubuntu_9.04 wiki],
 +
but that page has several details that are now obsolete. Here are the steps I did:
 +
mkdir ~/gumstix
 +
cd ~/gumstix
 +
svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe
 +
cat gumstix-oe/extras/profile >> .bashrc
 +
. .bashrc
 +
 
 +
gcc-4.3 gives a lot of errors, but gcc-4.1 works '''so far'''
 +
There is a problem documented [http://old.nabble.com/Gumstix-%2B-Debian-%2B-bitbake-td27276271.html here]
 +
about duplicate getline functions.
 +
 
 +
Then to set up a cross-compilation environment:
 +
bitbake gcc-cross
 +
 
 +
[[Gumstix_BitBake_onDAQ]]
 +
 
 +
;Note
 +
:It fails if there are any error messages so follow all the installation requests until it starts saying it is "Handling BitBake files"...
 +
preferred version 2.5 of glibc not available (for item virtual/arm-angstrom-linux-gnueabi-libc-for-gcc)
 +
 
 +
You need to install Pysco
 +
 
 +
svn co http://codespeak.net/svn/psyco/dist/ psyco-dist
 +
 
 +
To make an image to burn onto the gumstix use:
 +
bitbake gumstix-basic-image
 +
where "gumstix-basic-image" is a recipe from the directory gumstix-oe/com.gumstix.collection/packages/images/
 +
 
 +
The cross-compiler binaries can be found in:
 +
gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-*
 +
 
 +
=Compiling=
 +
==To set up build environment==
 +
source  ~/gumstix/gumstix-oe/extras/profile
 
Executables for cross-compiling are stored in:
 
Executables for cross-compiling are stored in:
<pre>/home/brian/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin</pre>
+
/home/brian/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin
 +
And the PATH can be set with:
 +
PATH=$PATH:/home/brian/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin
 +
 
 +
==To compile==
 +
arm-angstrom-linux-gnueabi-g++ cgi.cpp vfatregister.cpp vfatedit.cpp vfati2c.cpp -o vfat$i.cgi -lcgicc
 +
And if you need to link against cgicc (for web interfaces) add both of the arguments
 +
-I/home/brian/gumstix/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/libcgicc-3.2.3-r0/cgicc-3.2.3
 +
-L/home/brian/gumstix/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/libcgicc-3.2.3-r0/cgicc-3.2.3/cgicc/.libs
  
 +
===Compiling Hello ===
 +
 +
Now that the cross compiler is installed on the DAQ machine it is time to try and compile the simplest program, download it to the gumstix, and see if it will run.
 +
 +
Here is the source code
 +
 +
<pre>
 +
#include <stdio.h>
 +
 +
int main(void)
 +
{
 +
  printf("Hello Gummy\n");
 +
  return 0;
 +
}
 +
 +
</pre>
 +
 +
 +
I put it on the DAQ machine in the subdirectory
 +
 +
~/gumstix/Hello/ Hello.c
 +
 +
I compiled it with the command
 +
 +
  ~/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin/gcc Hello.c
 +
 +
 +
 +
It made the binary a.out
 +
 +
I copied it over to the gumstix using scp
 +
 +
scp a.out root@134.50.3.175:
 +
 +
and it ran
 +
 +
root@gumstix-custom-verdex:~$ ./a.out
 +
Hello Gummy
 +
 +
=== Compile cMsg libraries===
 +
 +
[[Gumstix_cMsg]]
 +
 +
 +
 +
=Flashing the gumstix=
 +
 +
== Serial Com using Macbook USB ==
 +
 +
I was able to use the USB port of my Macbook pro to communicate with the Gumstix using a USB to serial cable and a serial adapter plugged into the gumstix board.
 +
 +
Minicom and the Virtual comport driver were two pieces of software I needed to install on the Macbook.
 +
 +
 +
The first software was a Virtual COM port driver available at
 +
 +
http://www.ftdichip.com/Drivers/VCP.htm
 +
 +
 +
after installing I restarted the Macbook and found the following file had been installed
 +
 +
<pre>
 +
bash-3.2$ ls /dev/tty.usb*
 +
/dev/tty.usbserial-FTC9IF6E
 +
</pre>
 +
 +
 +
The next step was to install minicom. Minicom was easy if you have already install MacPorts.  The command is
 +
 +
sudo port install Minicom
 +
 +
You now need to set the port driver location within minicom using the -s switch
 +
 +
<pre>
 +
minicom -s
 +
</pre>
 +
 +
speed baud parity and stop bit = 115200 8N1
 +
 +
 +
;Note:  The driver only shows up if the USB-Serial cable is plugged in.  You don't need something plugged into the serial port.
  
 
<p>If the Gumstix won't boot, you can (rather slowly) flash the filesystem over [http://www.gumstix.net/Software/view/Developer-how-to-s/Reflashing-using-a-serial-connection/111.html serial].
 
<p>If the Gumstix won't boot, you can (rather slowly) flash the filesystem over [http://www.gumstix.net/Software/view/Developer-how-to-s/Reflashing-using-a-serial-connection/111.html serial].
Line 11: Line 136:
 
If the gumstix will boot, then flashing from RAM disk over ssh is faster, but if the process fails or gets interrupted you'll have to fall back on the serial method. Remounting the filesystem read-only may not work, and the whole processed failed.
 
If the gumstix will boot, then flashing from RAM disk over ssh is faster, but if the process fails or gets interrupted you'll have to fall back on the serial method. Remounting the filesystem read-only may not work, and the whole processed failed.
 
[http://www.gumstix.net/Software/view/Developer-how-to-s/Reflashing-from-a-linux-login-session/111.html Reflash over ssh]
 
[http://www.gumstix.net/Software/view/Developer-how-to-s/Reflashing-from-a-linux-login-session/111.html Reflash over ssh]
 +
 +
=Changes necessary from the default image=
 +
==Boa config==
 +
Boa is a webserver designed for small/embedded platforms
 +
 +
In /etc/boa/boa.conf change the following lines:
 +
{| border="1" cellpadding="5"
 +
! From !! To
 +
|-
 +
| #ServerName www.your.org.here || ServerName gumstix
 +
|-
 +
| ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ || ScriptAlias /cgi-bin/ /var/www/cgi-bin/
 +
|-
 +
|}
 +
 +
Stop and then start boa with:
 +
/etc/init.d/boa stop
 +
/etc/init.d/boa start
 +
 +
===Add the following files===
 +
These are the files for the cgicc (C++ cgi script) library. Copy from the bitbake to the /usr/lib/ directory
 +
*libcgicc.so.5
 +
*libcgicc.so
 +
*libcgicc.so.5.0.1
 +
 +
===Install additional packages===
 +
ipkg install libstdc++6
 +
 +
===Suid cgi-bin===
 +
Programs that run I2C directly need to be suid as root so they have permissions to make I2C system calls.
 +
chown root /var/www/cgi-bin/vfat*.cgi
 +
chmod u+s /var/www/cgi-bin/vfat*.cgi
 +
 +
===Add home PATH===
 +
*'''optional'''
 +
Make a file in /etc/profile.d/ that contains the following:
 +
#!/bin/sh
 +
export PATH=$PATH/home/root/bin:

Latest revision as of 18:27, 25 June 2010

Installing the build environment

The main instructions are on the gumstix.net wiki, but that page has several details that are now obsolete. Here are the steps I did:

mkdir ~/gumstix
cd ~/gumstix
svn co https://gumstix.svn.sourceforge.net/svnroot/gumstix/trunk gumstix-oe
cat gumstix-oe/extras/profile >> .bashrc
. .bashrc

gcc-4.3 gives a lot of errors, but gcc-4.1 works so far There is a problem documented here about duplicate getline functions.

Then to set up a cross-compilation environment:

bitbake gcc-cross

Gumstix_BitBake_onDAQ

Note
It fails if there are any error messages so follow all the installation requests until it starts saying it is "Handling BitBake files"...
preferred version 2.5 of glibc not available (for item virtual/arm-angstrom-linux-gnueabi-libc-for-gcc)

You need to install Pysco

svn co http://codespeak.net/svn/psyco/dist/ psyco-dist

To make an image to burn onto the gumstix use:

bitbake gumstix-basic-image

where "gumstix-basic-image" is a recipe from the directory gumstix-oe/com.gumstix.collection/packages/images/

The cross-compiler binaries can be found in:

gumstix-oe/tmp/cross/bin/arm-angstrom-linux-gnueabi-*

Compiling

To set up build environment

source  ~/gumstix/gumstix-oe/extras/profile

Executables for cross-compiling are stored in:

/home/brian/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin

And the PATH can be set with:

PATH=$PATH:/home/brian/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin

To compile

arm-angstrom-linux-gnueabi-g++ cgi.cpp vfatregister.cpp vfatedit.cpp vfati2c.cpp -o vfat$i.cgi -lcgicc

And if you need to link against cgicc (for web interfaces) add both of the arguments

-I/home/brian/gumstix/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/libcgicc-3.2.3-r0/cgicc-3.2.3 
-L/home/brian/gumstix/gumstix-oe/tmp/work/armv5te-angstrom-linux-gnueabi/libcgicc-3.2.3-r0/cgicc-3.2.3/cgicc/.libs

Compiling Hello

Now that the cross compiler is installed on the DAQ machine it is time to try and compile the simplest program, download it to the gumstix, and see if it will run.

Here is the source code

#include <stdio.h>

int main(void)
{
  printf("Hello Gummy\n");
  return 0;
}


I put it on the DAQ machine in the subdirectory

~/gumstix/Hello/ Hello.c

I compiled it with the command

 ~/gumstix/gumstix-oe/tmp/cross/arm-angstrom-linux-gnueabi/bin/gcc Hello.c


It made the binary a.out

I copied it over to the gumstix using scp

scp a.out root@134.50.3.175:

and it ran

root@gumstix-custom-verdex:~$ ./a.out
Hello Gummy

Compile cMsg libraries

Gumstix_cMsg


Flashing the gumstix

Serial Com using Macbook USB

I was able to use the USB port of my Macbook pro to communicate with the Gumstix using a USB to serial cable and a serial adapter plugged into the gumstix board.

Minicom and the Virtual comport driver were two pieces of software I needed to install on the Macbook.


The first software was a Virtual COM port driver available at

http://www.ftdichip.com/Drivers/VCP.htm


after installing I restarted the Macbook and found the following file had been installed

bash-3.2$ ls /dev/tty.usb*
/dev/tty.usbserial-FTC9IF6E


The next step was to install minicom. Minicom was easy if you have already install MacPorts. The command is

sudo port install Minicom

You now need to set the port driver location within minicom using the -s switch

minicom -s 

speed baud parity and stop bit = 115200 8N1


Note
The driver only shows up if the USB-Serial cable is plugged in. You don't need something plugged into the serial port.

If the Gumstix won't boot, you can (rather slowly) flash the filesystem over serial.

Correct alignment of the TTL RS232 adapter

If the gumstix will boot, then flashing from RAM disk over ssh is faster, but if the process fails or gets interrupted you'll have to fall back on the serial method. Remounting the filesystem read-only may not work, and the whole processed failed. Reflash over ssh

Changes necessary from the default image

Boa config

Boa is a webserver designed for small/embedded platforms

In /etc/boa/boa.conf change the following lines:

From To
#ServerName www.your.org.here ServerName gumstix
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/ ScriptAlias /cgi-bin/ /var/www/cgi-bin/

Stop and then start boa with:

/etc/init.d/boa stop
/etc/init.d/boa start

Add the following files

These are the files for the cgicc (C++ cgi script) library. Copy from the bitbake to the /usr/lib/ directory

  • libcgicc.so.5
  • libcgicc.so
  • libcgicc.so.5.0.1

Install additional packages

ipkg install libstdc++6

Suid cgi-bin

Programs that run I2C directly need to be suid as root so they have permissions to make I2C system calls.

chown root /var/www/cgi-bin/vfat*.cgi
chmod u+s /var/www/cgi-bin/vfat*.cgi

Add home PATH

  • optional

Make a file in /etc/profile.d/ that contains the following:

#!/bin/sh
export PATH=$PATH/home/root/bin: