Atmel Evaluation Board using the SAM7SE Microcontroller AT91SAM7SE-EK AT91SAM7SE-EK Data Sheet

Product codes
AT91SAM7SE-EK
Page of 24
20
6295A–ATARM–27-Mar-07
Application Note
$(CC) -c $(CCFLAGS) main.c -o main.o
lowlevel.o: lowlevel.c
$(CC) -c $(CCFLAGS) lowlevel.c -o lowlevel.o
cstartup.o:  cstartup.S
$(AS) $(ASFLAGS) cstartup.S -o cstartup.o
The last rules describe how to compile source files and link object files together to generate one
binary file per configuration: program running in Flash and program running in SDRAM. It
describes how to compile source files and link object files together. The first line calls the linker
with the previously defined flags, and the addresses of the text and the data segments via the -
Ttext address
 and -Tdata address options. This generates an elf format file, which is converted
to a binary file without any debug information by using the objcopy program.
sdram: $(OBJS)
$(LD) $(LDFLAGS) -Ttext 0x20000000 -Tdata 0x200000 -n -o $(OUTFILE_SDRAM).elf $(OBJS)
$(OBJCOPY) --strip-debug --strip-unneeded $(OUTFILE_SDRAM).elf -O binary 
$(OUTFILE_SDRAM).bin
flash: $(OBJS)
$(LD) $(LDFLAGS) -Ttext 0x100000 -Tdata 0x200000 -n -o $(OUTFILE_FLASH).elf $(OBJS)
$(OBJCOPY) --strip-debug --strip-unneeded $(OUTFILE_FLASH).elf -O binary 
$(OUTFILE_FLASH).bin
4.1.2
Linker File
At link stage, the elf32-littlearm.lds file is sent in option to the linker.
This file describes the order in which the linker must put the different memory sections into the
binary file. The addresses are indicated via the -Ttext and -Tdata options of the linker command
line (see the Makefile chapter).
4.1.2.1
Header
OUTPUT_FORMAT("elf32-littlearm", "elf32-littlearm", "elf32-littlearm")
Set the object file format to elf32-littlearm.
OUTPUT_ARCH(arm)
Specify the machine architecture.
ENTRY(reset)
Set the symbol ‘reset’ as the entry point of the program.
4.1.2.2
Section Organization
The SECTION part deals with the different sections of code used in the project. It tells the linker
where to put the sections it finds while parsing all the project object files.
• .vectors: exception vector table and IRQ handler