Anda di halaman 1dari 8

Installation of ARM C Cross compiler (GNUARM 3.4.

3) in Linux
------------------------------------------------------------------------------------

1) Open the Terminal window on linux system


2) Login with root username.
------ (for ex. in ubuntu system, $ sudo -i, given the root password)
3) Copy the gnuarm.tar on cd/pendrive to root system
------- (ex. root@IOTA/# cp /media/disk/gnuarm.tar .)
4) Extract the gnuarm tar file
------- (ex. root@IOTA/# tar -xvf gnuarm.tar)
5) Verify the arm c cross compiler has installed or not
------- (ex. root@IOTA/# cd /usr/local/gnuarm-3.4.3/)
6) Shows the list of files
-------(root@IOTA /usr/local/gnuarm3.4.3/# ls)
Procedures for Compilation of ARM C and Downloading the Hex file to
ARM7 Board
-------------------------------------------------------------------------------------------------

In C Compilation we need of three files on one folder.

1. start.s (ASM File) - Load the Base Address of our application / program to be
download into ARM 7.
2. app_main.c (Our C Program)
3. target.ld (Loader File) - ARM7 Board configuration file.

 Make your own directory

root@IOTA/# mkdir led_on


root@IOTA/# cd led_on
root@IOTA /led_on/#

 Copy the above three files into led_on directory

root@IOTA /led_on/# cp /media/disk/linux_gnuarm/* .


root@IOTA /led_on/# ls (list the files)

 Open the C source file with vi editor.

root@IOTA /led_on/# vi led_main.c

 Compile the start.s assembler file

root@IOTA /led_on/# arm-elf-gcc -c led_start.s

 Compile the led_main.c program file

root@IOTA /led_on/# arm-elf-gcc -c -I ./ led_main.c

 Check the led_start.o led_main.o files are created

root@IOTA /led_on/# ls

 Make the (Enahanced Linker Format file) elf file


root@IOTA /led_on/# arm-elf-gcc -T target.ld -o led.elf -nostartfiles led_start.o
led_main.o

 check the led.elf file to been created

root@IOTA /led_on/# ls

 converting the .elf to .hex file (led.elf to led.hex)

root@IOTA /led_on/# arm-elf-objcopy -O ihex led.elf led.hex

 verify the led.hex file to been created

root@IOTA /led_on/# ls

 download the .hex to ARM7 Board

root@IOTA /led_on/# lpc21isp led.hex /dev/ttyS0 38400 12000