Search This Blog

Saturday, March 26, 2011

Developing Linux OS for ARM - Part II

With the previous understanding of Part I, the first thing that you need to get is the toolchain. The toolchain might be available in source form as well as in the form of a binary. To avoid the effort of compiling the toolchain, we will start off with a binary. CodeSourcery provides regular, validated releases of the GNU Toolchain for arm processor. The version of the toolchain that we are using can be downloaded from the following link:

After downloading this package, extract it to some location (In my case, I have pasted at the following path: /home/sanket/Downloads/Embedded_Linux_Complete/Packages/GNU_GCC_toolchain).

Download the AT91Bootstrap source from the following link:

The AT91Bootstrap sources will differ based on the media where the secondary level bootloader is located. In our case, we want our secondary bootloader to be loaded in the dataflash and hence we will download the corresponding package. Alternate option for the secondary level bootloader would have been NAND flash.
Extract the AT91Bootstrap source, change to the board directory as shown below:

$cd AT91Bootstrap/Bootstrap-v1.10/board/

at91cap9adk     at91sam9261ek     at91sam9g20ek     at91sam9xeek
at91sam9260ek     at91sam9263ek     at91sam9rlek

Select your board by going into the corresponding board directory.

/board$ cd at91sam9260ek/
/board/at91sam9260ek$ ls

at91sam9260ek.c    dataflash    nandflash

Select your media by going into the corresponding directory. In our case the media for the secondary bootloader would be dataflash.

/at91sam9260ek$ cd dataflash/
at91sam9260ek/dataflash$ ls

at91sam9260ek.h       dataflash_at91sam9260ek.elf       Makefile

dataflash$ make clean

rm -f *.o *.bin *.elf *.map

Before building the sources, check out the location of your compiler toolchain. In
my case, it is


While running make we would be specifying the entire path. This is required if you have not installed the toolchain. In our case, instead of installing we have just extracted the tar ball image of the toolchain and hence we need to specify the path as shown below:

/dataflash$ make CROSS_COMPILE=/home/sanket/Downloads/Embedded_Linux_Complete/Package/GNU_GCC_toolchain/arm-2007q1/bin/arm-none-linux-gnueabi-

If everything is fine (compiler path and bootstrap source) a binary file (dataflash_at91sam9260ek.bin) will be generated in the current directory at the end of the compilation process.

/dataflash$ ls

at91sam9260ek.h        crt0_gnu.o        dataflash_at91sam9260ek.elf
dataflash.o     div0.o    main.o    pmc.o    string.o _udivsi3.o
at91sam9260ek.o    dataflash_at91sam9260ek.bin    debug.o     gpio.o    Makefile    
sdramc.o     udiv.o      _umodsi3.o

continue ......................................

1 comment: