After testing the operation of the kxps5 accelerometer with i2c-tools i wrote a test application using the i2c-dev interface. If you want to test your code before you write a kernel driver this is definately a good place to start. Once i had the configuration registers set properly and i had a routine for reading the acceleration vectors I stripped down a ds1621 kernel driver to a bare minimum, and then built it back up again to work with the kxps5. I then bitbaked the kxps5 driver as a kernel module, along with hwmon and it works perfectly! :) Next i cross compiled qwt 5.2.0 and plotted the acceleration as function of time. The video below is taken with antialiased lines which slows down the refresh rate but makes them look nice. If you plot it without this enabled it runs very smoothly. Here you see the kxps5 running without an external low pass filter (the internal filter is 1kHz) and despite this the output is pretty stable. What impressed me the most is the sensitivity. When placed on a desk the free fall interrupt indicator lights up if you drop one of the little nuts from the friendlyarm LCD about 10cm away from the device!
The kernel driver for this is now available here.
This is what i should have done to begin with! The instructions are very similar to previous ones except this time we clone the right git repository!
On a fresh copy of Fedora 11 I updated the system and installed the packages reccommended by OE:
su -c “yum install python m4 make wget curl ftp cvs subversion tar bzip2 gzip unzip
python-psyco perl texinfo texi2html diffstat openjade docbook-style-dsssl
docbook-style-xsl docbook-dtds docbook-utils sed bison bc glibc-devel glibc-static
gcc binutils pcre pcre-devel git quilt groff linuxdoc-tools patch linuxdoc-tools
gcc-c++ help2man perl-ExtUtils-MakeMaker”
I then made a folder called OE in my home directory and git cloned the mini2440 repo:
cd ~
mkdir OE
cd OE
git clone git://repo.or.cz/openembedded/mini2440.git openembedded
I then setup the source-me.txt similar to before:
gedit source-me.txt
I put the following in:
export OETREE="/home/doug/OE"
BBPATH=${OETREE}/:${OETREE}/openembedded/
echo Setting up dev env for Ångström
if [ -z ${ORG_PATH} ] ; then
ORG_PATH=${PATH}
export ORG_PATH
fi
if [ -z ${ORG_LD_LIBRARY_PATH} ] ; then
ORG_LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
export ORG_LD_LIBRARY_PATH
fi
PATH=${OETREE}/openembedded/bitbake/bin:${ORG_PATH}
LD_LIBRARY_PATH=
export PATH LD_LIBRARY_PATH BBPATH
export LANG=C
export BB_ENV_EXTRAWHITE="MACHINE DISTRO OETREE ANGSTROM_MODE ANGSTROMLIBC LIBC"
su -c 'sysctl vm.mmap_min_addr=0'
echo "Altered environment for OE Development"
Now all you need to do is setup the local.conf. Simply edit the example and copy it to the right place:
cd openembedded
gedit mini2440_local_conf_example.conf
Read this file and edit as appropriate. I have attached mine as an example. Now copy it to the conf/local.conf
cp mini2440_local_conf_example.conf conf/local.conf
If you want qt4-embedded or any other package included in the build simply edit the recipe in:
openembedded/recipes/images/mini2440-image.bb
I added qt4-embedded:
#Angstrom bootstrap image
IMAGE_PREPROCESS_COMMAND = "create_etc_timestamp"
ANGSTROM_EXTRA_INSTALL ?= ""
DEPENDS = "task-base-extended
psplash-zap
esekeyd u-boot-utils tslib
i2c-tools i2c screen rsync nfs-utils
directfb gdbserver directfb mtd-utils
"
IMAGE_INSTALL = "task-base-extended
${ANGSTROM_EXTRA_INSTALL}
psplash-zap qt4-embedded
esekeyd u-boot-utils tslib-calibrate tslib-tests
i2c-tools i2c screen rsync nfs-utils-client
directfb gdbserver directfb mtd-utils
rsvg pango
"
export IMAGE_BASENAME = "mini2440-image"
IMAGE_LINGUAS = ""
inherit image
Then all you have to do is source the script from wherever you put it:
source source-me.txt
and run bitbake:
bitbake mini2440-image
from the ~/OE/openembedded/ directory..
If you get an error trying to build a package try cleaning it:
bitbake -c clean INSERTPACKAGENAME
Then try and build the image again. Maybe you won't have this problem. I guess it's either because the checksum parser failed to build or my hdd is dodgy. It only happened once on binutils but worked fine after cleaning it.
A few hours later if all goes well you should have images in:
~/OE/oetmp/deploy/glibc/images/mini2440/
Obviously that directory depends on what you setup in the local.conf.
Good luck!
Cross compiling Qt was actually very easy. I used the same machine described in the mini2440 kernel post. If you have a vanilla install of Fedora 11 it's more than likely you'll get some errors due to missing packages so check the list i posted if you can't figure out which ones you need. This is what i did:
The resulting ~74MB will be located in /usr/local/Qt. At first i ran the library from an SD card using a system wide link but later i used NFS.
I ran the library using BusError's mini2440 kernel and an Angstrom base image I cross compiled using OpenEmbedded apriori. In my next post i'll describe how to compile Angstrom Linux for this purpose which also provides the toolchain i used here. Finally when i get access to my mini2440 i'll explain how to use the examples and setup the touch screen which was a little fiddly.
Big thanks to Cor for his post on building Qt which i've relied on heavily here.