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.
This is pretty trivial but i thought i'd post it just incase. Using the mini2440 kernel by BusError the system LEDs are registered under /sys/devices/platform/s3c24xxled.X, where X is the LED number. LEDs 1-4 are located on the system board and LED 5 is the backlight. To control the devices you can do the following:
echo 0 > brightness #turns the backlight off
echo 255 > brightness #turns the backlight on
You can also choose from one of the available triggers, for example..
root@mini2440:/sys/devices/platform/s3c24xx_led.5/leds/backlight# cat trigger
none nand-disk mmc0 timer heartbeat [backlight] gpio default-on
root@mini2440:/sys/devices/platform/s3c24xx_led.5/leds/backlight# echo heartbeat > trigger
Will make your backlight flash on and off like crazy!
Unfortunately there is no PWM control to manage the brightness. This would have been really nice.
The EEPROM can be controlled in a similar way. You can access it in:
/sys/devices/platform/s3c2440-i2c/i2c-adapter/i2c-0/0-0050
Data can be written by using the following command:
echo whatever you want > eeprom
The just do the following to read the memory:
cat eeprom
Thanks to BusError there is a mini2440 kernel available here:
http://code.google.com/p/mini2440/
It took me a little while to get it to compile and i thought i'd post a guide to help anyone else having trouble. Compilation was done using Fedora 11. I used the livecd to install and added some packages afterwards. The main ones are those recommended for openembedded. The page to look at is here:
http://wiki.openembedded.net/index.php/OEandYourDistro
I used:
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 gcc-c++ help2man perl-ExtUtils-MakeMaker"
At first the build generated various errors which were resolved by installing more packages. Unfortunately I do not remember which ones but i've attached a list of all packages i currently have installed in case you get stuck. In each case simply googling the error resulted in a post advising to install a particular package. After that everything worked!
The script i used to build the kernel was based very closely on the one modified by BusError. If i remember correctly I had to change a path near the end of the script. I've attached a copy of the exact same script which worked for reference.
You run the script by simply typing:
sudo sh mini2440-bootstrap-v2.sh
On my laptop using an Intel T7400 CPU this takes about 30-45 minutes depending on the download speeds.
If you use the default install path you should have u-boot.bin and uImage along with some other files in the directory:
/usr/src/mini2440/output
If you don't then something has gone wrong so go back and check the various error messages in the terminal and fix them!
You can then flash these files as per normal.
Downloads:
I'm fairly new to electronics and i've certainly never used I2C before so I built a simple circuit based on a DS1621 I2C thermometer as a test. I got this for a couple of pounds from the seller 'crodnet' on ebay.
I found an old 2.5" laptop drive connector which wasn't large enough to fit on CON5 so i chopped it up and put it on the camera interface. I wired up the SDA and SCL lines along with 3.3V and GND to the veroboard. I also soldered a couple of LEDs, one for the power light and the other wired up through a transistor with the base connected to the thermostat output on the DS1621. This pin can be programmed to go high at a particular temperature.
I then plugged it in and powered up the mini2440. Running i2cdetect showed a new device at 0x48. The other devices are the onboard EEPROM. Looking at the datasheet for the DS1621 the temperature can be read from the location 0xAA. I was able to observe the temperature in hex through i2cget. Converting the output 0x0016 to decimal gives 22.0 degrees. The sensor is pretty neat, it responds almost immediately to the presence of your finger.
Below are the I2C commands i used. I installed i2c tools using opkg.
root@mini2440:~# i2cdetect -l
i2c-0 i2c s3c2410-i2c I2C adapter
root@mini2440:~# i2cdetect s3c2410-i2c
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] Y
0 1 2 3 4 5 6 7 8 9 a b c d e f
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: UU UU UU UU -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
root@mini2440:~# watch --interval=1 i2cget -y s3c2410-i2c 0x48 0xAA w
Every 1.0s: i2cget -y s3c2410-i2c 0x48 0xAA w Tue Sep 15 23:31:25 2009
0x0016
Below is a picture of the device..it looks like a right mess but it works great!
The next stage is compile the driver from the lmsensors package...
After a lot of messing around i cross compiled the mini2440 kernel (massive thanks to buserror) , the Angstrom Linux distribution and Qt 4.5 for Embedded Linux. I was impressed by how quickly the demos run, check out the video below if you're interested:
When i get some time i'll post up some more information on how i got this to work.
Over the last few months i've been playing with a mini2440 ARM9 development board. I'm new to embedded development but now i'm starting to get somewhere i thought i'd post some bits on here to help other people.
The board is available from:
A good place to start is their downloads section where there are all sorts of useful links.