Rainbow Electronics QIL-A9260-C11 User Manual

EMBEDDED AND NETWORK COMPUTING TECHNOLOGIES
GETTING STARTED
WITH THE QIL-A9260
Calao Systems
334 rue des Vingt Toises Le MagistèreII 38950 Saint Martin Le Vinoux France Phone = +33 (0)4 76 56 38 05 Fax = +33 (0)4 76 56 38 06
E-mail = sales@calao-systems.com
= support@calao-systems.com
Datasheet GSG-00006-A01 1/34
TABLE OF CONTENTS
Section 1...............................................................................................................................................3
1.Introduction...................................................................................................................................3
Section 2 ..............................................................................................................................................4
1.QIL-A9260 from scratch..............................................................................................................4
1.1.AT91Bootstrap......................................................................................................................4
1.2.U-Boot...................................................................................................................................5
1.3.Linux Kernel.........................................................................................................................6
Section 3...............................................................................................................................................8
1.Buildroot ......................................................................................................................................8
1.1.Buildroot installation.............................................................................................................8
1.2.How to install the Root FS on the QIL-A9260.....................................................................8
Section 4.............................................................................................................................................11
1.1.The uClibc toolchain...........................................................................................................11
1.2.«Hello world» application...................................................................................................12
1.3.Debugging an application...................................................................................................13
Section 5.............................................................................................................................................15
1.SAM-BA.....................................................................................................................................15
1.1.Introduction.........................................................................................................................15
1.1.How to use SAM-BA .........................................................................................................16
Section 6.............................................................................................................................................21
1.Errata...........................................................................................................................................21
Section 7.............................................................................................................................................22
1.Revision History.........................................................................................................................22
1.1.Revision History.................................................................................................................22
Section 8.............................................................................................................................................23
1.COPYRIGHT..............................................................................................................................23
Annexe................................................................................................................................................24
UBOOT list commands.................................................................................................................24
Datasheet GSG-00006-A01 2/34

SECTION 1

1. Introduction

This getting started guide is aimed at helping the reader become familiar with the QIL­A9260. First, we'll describe how to build the AT91Bootstrap loader, Uboot, and the linux kernel from the source code. We will see how to generate the root file system from buildroot. Then we will present you how to make and debug a software application with the uClibc toolchain. Eventually we will show you how to use the SAM-BA utility which allow to program the nand flash memory embedded on the QIL-A9260 module.
Datasheet GSG-00006-A01 3/34

SECTION 2

1. QIL-A9260 from scratch

1.1. AT91Bootstrap

The AT91Bootstrap loader is used to download the second level bootloader that is to say UBOOT from the NAND Flash memory. When the AT91SAM9260 boots, the AT91 Bootstrap loader is copied into the 4Kbytes internal SRAM and executed by branching at address 0x0000_0000 after remap.
Here are the steps needed to compile the AT91bootstrap loader.
Download the source code from the calao ftp site
cd AT91BOOTLOADER/board/qil-a9260/nandflash/
Edit the make file to set the name of the cross compiler you are using.
set CROSS_COMPILE=arm-elf- for example
then issue the make command
Datasheet GSG-00006-A01 4/34
The file generated by your cross-compiler should be less than 4096 bytes.
For more information about the AT91 Bootstrap loader see the following link:
http://www.atmel.com/dyn/resources/prod_documents/doc6277.pdf
Once the compilation ended, you should have the file named nandflash_qil-a9260.bin

1.2. U-Boot

U-Boot is downloaded from the nand flash to the last megabyte of the SDRAM by the AT91 bootstrap loader. The first level bootloader is configured to download 196Kbytes from the nand flash (offset: 0x20000) in the SDRAM memory (offset: 0x23F00000).
Here are the steps needed to compile U-Boot.
Download the source code from the calao ftp site.
cd UBOOT
make qil-a9260_config
Edit the makefile to set the name of the cross compiler you are using.
ifeq ($(ARCH),arm) CROSS_COMPILE = arm-linux- endif
issue the make command
Once the compilation ended, you should have a binary file named u-boot.bin
Datasheet GSG-00006-A01 5/34
Note: We used the DENX toolchain to built u-boot.You can download this cross-compilation
toolchain from the following adress:
ftp://mirror.switch.ch/mirror/eldk/eldk/3.1.1/arm-linux-x86/iso/arm-2005-03-06.iso

1.3. Linux Kernel

The linux kernel will be setup and built in the usual way. First we 'll configure the kernel with the default configuration files. There are 2 configuration files for the kernel:
qil-a9260_jffs2_defconfig
qil-a9260_cpio_defconfig
The first configuration file allows to built a kernel which mount the root file system from the first nand flash partition (/dev/mtd1). The second one allows to built a kernel bound to a root file system (cpio archive).
Here are the steps needed to compile the linux kernel.
cd LINUX_KERNEL_V2.6.21/
make qil-a9260_jffs2_defconfig or qil-a9260_cpio_defconfig
If you want to change the linux kernel configuration issue the following command:
make menuconfig
Once configured and saved, edit the makefile and specify the name of your cross-compiler. Then issue the make command to built the kernel
make uImage
Datasheet GSG-00006-A01 6/34
Once the compilation ended, you should have a binary file named uImage in the
/ARCH/ARM/BOOT/ directory
Datasheet GSG-00006-A01 7/34

SECTION 3

1. Buildroot

Buildroot allows to generate both a cross-compilation toolchain and a jffs2 root file system for the QIL-A9260 module.

1.1. Buildroot installation

Here are the steps needed to install a cross compiler & generate a root file system:
Download the source code from the calao ftp site
The configuration step is very similar to the linux kernel. Indeed, if you want to custumize buildroot issue the following command:
make menuconfig
Once everything is configured, issue the make command
Note: You could also custumize busybox by issuing the following command:
make busybox-menuconfig
make
Once finished, we should obtain a rootfs.arm.jffs2 which could be program in one of the available nand flash partition.

1.2. How to install the Root FS on the QIL-A9260

The QIL-A9260 boots a linux kernel pre-installed in the nand flash memory. Here is a brief description of the nand flash memory mapping.On the first partition, we reserved the first 16Mbytes for the linux kernels. Indeed at the 0x000A0000 offset we put a rescue linux kernel bound to a compressed cpio rfs image and at the 0x400000 offset we put a second linux kernel which mounts the RFS from the 2nd partition. Then we find two 120 Mbytes partitions. We put on the first one the default jffs2 root file system and let the second one available for the user.
Here is the list of the default partitions:
0x00000000-0x01000000 : "Uboot & Kernel" 0x01000000-0x08800000 : "Root FS" 0x08800000-0x10000000 : "FS"
Note: You can customize the nand flash memory mapping by editing the board-qil-a9260.c located in the /arch/arm/mach-at91/ directory of the linux kernel source tree.
Datasheet GSG-00006-A01 8/34
/* * NAND flash */
static struct mtd_partition __initdata ek_nand_partition[] = {
{
.name = "Uboot & Kernel", .offset = 0x00000000,
.size = 16 * 1024 * 1024, }, {
.name = "Root FS",
.offset = 0x01000000,
.size = 120 * 1024 * 1024, }, {
.name = "FS",
.offset = 0x08800000,
.size = 120 * 1024 * 1024, },
};
If you want to install your customized root file system quickly without destroying the default one, you can put it on the second partition and modify the u-boot bootargs variable.
Now, let's see how we can do that !!!
First, we need to transfer the jffs2 root file system to the target. Several possibilities are available: By pluging a usb memory key containing the RFS on the MB-QIL-A9260 USB port or by downloading it via tftp from a host.
Here is an example using a usb memory key
We can copy your root filesystem on a USB memory key and then mount it as it describes below:
# mount -t vfat /dev/sda1 /mnt
#cp mnt/rootfs.arm.jffs2 /root #umount /mnt
# ls -al drwxr-xr-x 2 root root 0 Jan 1 00:02 . drwxr-xr-x 16 rootroot 0 Jan 1 00:00 ..
-rw-r—r-- 1 root root 720 Jan 1 00:03 .ash_history
-rw-r—r-- 1 root root 0 Apr 6 2007 .bash_history
-rw-r—r-- 1 root root 175 Apr 6 2007 .bash_logout
-rw-r—r-- 1 root root 161 Apr 6 2007 .bash_profile
-rw-r—r-- 1 root root 1711 Apr 6 2007 .bashrc
-rw-r—r-- 1 root root 2228224 Jan 1 00:02 rootfs.arm.jffs2
Datasheet GSG-00006-A01 9/34
Let's erase the second partition with the following command:
# flash_eraseall -j /dev/mtd2 Erasing 128 Kibyte @ 77e0000 -- 99 % complete. Cleanmarker written at 77e0000.
Let's copy the new root file system on the second partition # flashcp rootfs.arm.jffs2 /dev/mtd2
Now reboot the QIL-A9260 by issuing the following command # reboot
During the reboot, press a key when you will see the uboot countdown:
Hit any key to stop autoboot: 0
Now you can modify the u-boot bootargs variable
QIL-A9260> printenv bootdelay=3 baudrate=115200 ethaddr=00:0D:00:0D:00:AB netmask=255.255.255.0 autostart=yes serverip=192.168.1.15 ipaddr=192.168.1.100 bootargs=rootfstype=jffs2 root=/dev/mtdblock1 bootcmd=nboot 21000000 0 500000 stdin=serial stdout=serial stderr=serial
Environment size: 252/4092 bytes QIL-A9260> setenv bootargs rootfstype=jffs2 root=/dev/mtdblock2 QIL-A9260> saveenv Saving Environment to dataflash... QIL-A9260>
Now you can reset the QIL-A9260 and see if the new RFS is ok !!!!!
Datasheet GSG-00006-A01 10/34

SECTION 4

1.1. The uClibc toolchain

Buildroot provides a cross compilation toolchain for the QIL-A9260. It is located in the following directory /QIL-A9260_build_arm/staging_dir/bin. If you want to use the µClibc toochain set your PATH environnement variable with the directory below.
Note: Usually, software development is done on a host computer using a cross-compilation toolchain. However you can choose to install the cross-compilation toolchain in the target root file system via the buildroot configuration menu.
Datasheet GSG-00006-A01 11/34
Loading...
+ 23 hidden pages