Difference between revisions of "Mini2440"

From LinuxMCE
Jump to: navigation, search
m (About)
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 +
[[Category: Hardware]]
 
[[Category: Tutorials]]
 
[[Category: Tutorials]]
 
[[Image:Mini2440.jpg|thumb|200px|mini2440]]
 
[[Image:Mini2440.jpg|thumb|200px|mini2440]]
Line 6: Line 7:
  
 
Specification MINI2440v2  
 
Specification MINI2440v2  
CPU S3C2440A  
+
* CPU S3C2440A 400-533Mhz
MHz 400-533
+
* RAM 64MB  
RAM 64MB  
+
* NOR flash 2MB / Nand Flash 128MB  
NOR flash 2MB  
+
* Ethernet 10/100M Ethernet, RJ-45 connector  
Nand Flash 128MB  
+
* Serial ports 3  
Ethernet 10/100M Ethernet, RJ-45 connector  
+
** RS232 1  
Serial ports 3  
+
** USB Host 1  
RS232 1  
+
** USB Device 1  
USB Host 1  
+
* SD card slot 1  
USB Device 1  
+
* Audio Interface In, Out, Mic  
SD card slot 1  
+
* LCD connector 1  
Audio Interface In, Out, Mic  
+
* Camera Interface 1  
LCD connector 1  
+
* JTAG 10pin JTAG connector  
Camera Interface 1  
+
* Bus 40pin connector  
JTAG 10pin JTAG connector  
+
* GPIO 34pin connector  
Bus 40pin connector  
+
* Dimension 100x100mm  
GPIO 34pin connector  
+
* Linux Open Embeddeed with Ångström  
Dimension 100x100mm  
+
* WinCE WinCE 6.0  
Linux Open Embeddeed with Ångström  
+
WinCE WinCE 6.0  
+
  
 
For more details:http://www.developmentboard.net/index.php/productdetail/Development+board/ARM9/SAMSUNG/S3C2440/MINI2440v2/info/1
 
For more details:http://www.developmentboard.net/index.php/productdetail/Development+board/ARM9/SAMSUNG/S3C2440/MINI2440v2/info/1
 
  
 
= Preparations =
 
= Preparations =
Line 326: Line 324:
  
 
http://www.sereno-online.com/site/2010/05/01/qt-4-6-2-installation-procedure-for-friendlyarm-mini-2440-board/ (Qt 4.6.2 on mini 2440)
 
http://www.sereno-online.com/site/2010/05/01/qt-4-6-2-installation-procedure-for-friendlyarm-mini-2440-board/ (Qt 4.6.2 on mini 2440)
 +
 +
http://wingston.workshopindia.com/wingz/embedded-programming-on-the-mini2440-using-ptxdist/ (NEW)

Latest revision as of 11:27, 4 March 2012

mini2440

About

This is a howto install uboot and a new kernel on the mini2440. Big thanks to BusError for the instructions and guidance. DISCLAIMER: This worked for me, if it eats your cat or burns your kitchen sink, don't blame me.

Specification MINI2440v2

  • CPU S3C2440A 400-533Mhz
  • RAM 64MB
  • NOR flash 2MB / Nand Flash 128MB
  • Ethernet 10/100M Ethernet, RJ-45 connector
  • Serial ports 3
    • RS232 1
    • USB Host 1
    • USB Device 1
  • SD card slot 1
  • Audio Interface In, Out, Mic
  • LCD connector 1
  • Camera Interface 1
  • JTAG 10pin JTAG connector
  • Bus 40pin connector
  • GPIO 34pin connector
  • Dimension 100x100mm
  • Linux Open Embeddeed with Ångström
  • WinCE WinCE 6.0

For more details:http://www.developmentboard.net/index.php/productdetail/Development+board/ARM9/SAMSUNG/S3C2440/MINI2440v2/info/1

Preparations

I used this one: Add the bin dir to the $PATH. If you have a toolchain with another prefix (like arm-linux-) adapt the CROSS_COMPILE environment variable in the next steps.

Setting up the bootloader

Compiling uboot

Clone the git tree:

mkdir uboot ; cd uboot
git clone git://repo.or.cz/u-boot-openmoko/mini2440.git

Setup cross compiling:

export CROSS_COMPILE=arm-none-linux-gnueabi-

or edit your .bashrc eg.

export CROSS_COMPILE=arm-none-linux-gnueabi-
export PS1="\[\033[1;34m\]\u \[\033[0m\]\w:\$: \[\033[0m\]"
#export PS1="\u:\w\$>"
LS_OPTIONS="--color=auto"
alias ls="ls $LS_OPTIONS"

Prepare the mini2440 target:

cd mini2440
make mini2440_config

Compile:

make all

This will give you a "u-boot.bin". If you get an error about a missing whatever-gcc, verifiy if there is a hardcoded CROSS_COMPILE setting in the Makefile

Flashing uboot

We use the installed vivi bootloader to load uboot via usb. Power the board off, set the NOR switch to on, power the board on. You'll get the vivi output on the serial console. Press 'q' to go to the shell and do the "load flash" on address 0 with the size of "u-boot.bin" (238232 bytes in this example):

[q] Goto shell of vivi                                                          
Enter your selection: q                                                         
Supervivi> load flash 0 238232 u                                                
USB host is connected. Waiting a download.                                      

Use the "s3c2410_boot_usb" utility (http://mini2440.googlecode.com/files/s3c2410_boot_usb-20060807.tar.bz2) to upload the "u-boot.bin" via usb:

./s3c2410_boot_usb u-boot.bin 

You'll see something like this as output, ignore the error message:

csum = 0x9a6e
send_file: addr = 0x33f80000, len = 0x0003a298
Error downloading program

and this on the serial console:

Now, Downloading [ADDRESS:30000000h,TOTAL:238242]                               
RECEIVED FILE SIZE:  238242 (232KB/S, 1S)                                       
Downloaded file at 0x30000000, size = 238232 bytes                              
Found block size = 0x0003c000                                                   
Erasing...    ... done                                                          
Writing...    ... done                                                          
Written 238232 bytes                                                            
Supervivi>

Then you see

MINI2440 # saveenv

Saving Environment to NAND...

Erasing Nand...nand_erase: attempt to erase a bad block at page 0x00000260

Try

MINI2440 # nand scrub
...
Really scrub this NAND flash? <y/N>

press y and enter. After erasing make

MINI2440 # nand createbbt

press y and enter. Now you can save the environment

 MINI2440 # saveenv

Now power off the board, set the NOR switch back to off, and power on the board. We verify the version and then prepare config storage in flash:

MINI2440 # version                                                              
                                                                                
U-Boot 1.3.2-dirty-moko12 (Mar  8 2009 - 13:50:19)  

MINI2440 # dynenv set 40000                                                     
device 0 offset 0x40000, size 0x3fc0000                                         
45 4e 56 30 - 00 00 04 00           

MINI2440 # saveenv                                                              
Saving Environment to NAND...                                                   
Erasing Nand...Writing to Nand... done                                          

MINI2440 # reset                                                                

Configure uboot

do a "printenv" to show active settings. Adjust the IP for uboot and the tftp server. We need proper IP connectivity to load the kernel with tftp. "setenv" is your friend. "saveenv" stores the setting to flash.

Kernel

Compilation

Fetch from git:

mkdir kernel ; cd kernel
git clone git://repo.or.cz/linux-2.6/mini2440.git
cd mini2440
mkdir -p ../kernel-bin

Generate .config from mini2440 template:

CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ mini2440_defconfig

(optional) if you want to modify kernel modules use this command afterwards:

(optional if you don't have libncurses5-dev) apt-get install libncurses5-dev
cd ../kernel-bin
make ARCH=arm menuconfig
cd ../mini2440

Compile kernel and modules:

CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/

Generate "uImage" with the "mkimage" tool:

../uboot/mini2440/tools/mkimage -A arm -O linux -T kernel -C none -a 0x30008000 -e 0x30008000 -d ../kernel-bin/arch/arm/boot/zImage /tftpboot/uImage

Kernel Modules

To create the dynamically loaded kernel modules, which would go into the root file system later on do this:

CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ modules
CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm make O=../kernel-bin/ INSTALL_MOD_PATH=.. modules_install

After this step, there should be a directory ../lib which would contain the dynamically loaded modules(drivers). This folder would go to the root file system of your board, for example I have my filesystem on a sd card. I would stick the SD card in the PC, and mount it and then copy the modules as:

 cp ../lib/modules/2.6.32-rc8/ /media/rootfs/lib/modules/ -r

don't forget to

sync
umount /media/*

Flash kernel

Verify partitions, we need the offset for the kernel partition (probably 0x60000):

mtdparts

Erase the kernel partition:

nand erase 60000 <padded size>

Load the kernel with uboot into ram:

tftp 0x32000000 uImage

Note the size, pad it to 512 byte and use the nand write command to flash it:

nand write 32000000 60000 <padded size>.

Configure uboot

We use a nfs chroot for now:

setenv bootargs console=ttySAC0,115200 noinitrd init=/sbin/init mini2440=1tb ip=192.168.80.12 root=/dev/nfs rw nfsroot=192.168.80.1:/home/public/arm

This is helpful for automatic booting:

setenv bootcmd 'nboot.e kernel ; bootm'


Bit Baking Angstrom, and QT Embedded 4

If you are using Fedora follow this link : http://www.electronics.diycinema.co.uk/embedded/mini2440/bitbaking-the-kernel-angstrom-and-qt4-embedded-all-at-once/comment-page-2/#comment-498 , otherwise follow here:

Getting the required software

cd ~
mkdir OE
cd OE
git clone git://repo.or.cz/openembedded/mini2440.git openembedded

Getting other required Softwares

sudo apt-get install gawk diffstat help2man texi2html texinfo build-essential subversion cvs unzip texinfo git-core
sudo dpkg-reconfigure dash

and choose "<No>" from the menu.

Then we create a helper for ourselves:

gedit ~/OE/source-me.txt

and past the following, and change the /home/ashkax to your own home directory address.

export OETREE="/home/ashkax/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"
sudo sysctl vm.mmap_min_addr=0
echo "Altered environment for OE Development"

This file that we just created will be used later on, to setup the compiler... Now lets edit the bitbake configuration file to tell bit bake we like it to compile the QT embedded for us too:

cd ~/OE/openembedded
wget http://www.electronics.diycinema.co.uk/wp-content/uploads/2009/11/local.conf.txt
gedit local.conf.txt
 

now change all the doug to your own user name, save the file and quit gedit. Then

cp local.conf.txt conf/local.conf

Alternatively you can use the original sample file and edit it to your liking:

cd openembedded
gedit mini2440_local_conf_example.conf
cp mini2440_local_conf_example.conf conf/local.conf

Adding QT to baking recipes

gedit ~/OE/openembedded/recipes/images/mini2440-image.bb

it would be something like:

#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

running the bitbake

Now all you have to do is source the script from wherever you put it:

source ~/OE/source-me.txt
cd ~/OE/openembedded/
bitbake mini2440-image


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.

but, for a fun start boot up your mini2440 with the new image that you've just created and issue the following command:

ts_calibrate 
ts_test
qtdemo -qws


Troubleshooting

Write errors

When you have bad blocks in NAND, you'll get write errors. This gives more information: http://wiki.openmoko.org/wiki/NAND_bad_blocks

Clear the flash (do not reset the board till uboot is reinstalled, or you need to use NOR/vivi to reinstall uboot via usb):

nand scrub

Create new bad blocks table:

nand createbbt

Reflash uboot (use the size in the output from the tftp command and pad it to hit 512 byte boundaries for the nand write command)

tftp 0x32000000 u-boot.bin
nand write 32000000 0 <size of u-boot.bin>
reset

Create dynamic partitions:

dynpart
dynenv set u-boot_env
saveenv
reset

And then use write.e to write to the mtdparts, e.g.:

tftp 0x32000000 uImage
nand write.e 32000000 kernel
nboot.e kernel

Python Alignment trap, Segmentation fault

This error and some other errors related to illegal instructions happened because all packages are compiled with -mthumb though the kernel and modules use -mno-thumb. The mix of instruction sets seem to cause problems. A hotfix is to edit your conf/distro/include/angstrom.inc and change the line: ANGSTROM_ARM_INSTRUCTION_SET_armv4t = "thumb" to ANGSTROM_ARM_INSTRUCTION_SET_armv4t = "arm"

The default for the mini2440 is -mno-thumb but for some reason (save memory space, maybe?) the angstrom distro overrides this for all armv4t family processors.



Messed Up Screen Positions( or TS calibration) IN QT

If the resolution is messed up or you can run the ts_calibrate but the hitting points are out of range, it may be because of the boot arguments.. Reboot your system, press a key in startup to go to uboot environment and make sure mini2440=0tb for 3.5" screen, and mini2440=1tb for 7" screen. Try using the commands printenv, and setenv to do so.

Try ts_calibrated after booting.

Links

http://bliterness.blogspot.com/

http://www.developmentboard.net/index.php/productdetail/Development+board/ARM9/SAMSUNG/S3C2440/MINI2440v2/info/1

http://blog.cor-net.org/ (Qt 4.5 on mini2440)

http://wiki.openembedded.net/index.php/Getting_Started

http://www.sereno-online.com/site/2010/05/01/qt-4-6-2-installation-procedure-for-friendlyarm-mini-2440-board/ (Qt 4.6.2 on mini 2440)

http://wingston.workshopindia.com/wingz/embedded-programming-on-the-mini2440-using-ptxdist/ (NEW)