This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

TR : (Problems) Building a standalone executable for ARM


Hi,

I am trying to have one of my program running on an ARM target which
theoritically can boot from its internal flash.
I use arm-elf-gcc and had to face many problems :
       - first of all I had to create a binary file from the ELF
generated by arm-elf-gcc
       - I must specify which memory area will be used for .text (in
flash), .data and .bss sections (in SRAM)

I have built the binutils, gcc, insight and newlib for arm-elf targets
with Cygwin. However, I have problem using crt0.o so I decided to get
rid of it and define my own entry point (a function called “_start”
defined in “compteur.c” source file). The board I’m working on has 2
flash and 2 sram (internal and external for each type).

Here is my makefile :
CFLAGS= -mcpu=arm7tdmi -march=armv4t -O2 -Wall
LFLAGS= -Ttext 0x0 -Tdata 0x1ff0000 -Tbss 0x800000 -e _start
#-Tmap.ld
OFILES= utils.o compteur.o

all : utils.o compteur.o compteur.elf compteur.img compteur.bin clean
utils.o : utils.c utils.h Makefile
	arm-elf-gcc -c utils.c $(CFLAGS)
compteur.o : compteur.c utils.o
	arm-elf-gcc -c compteur.c $(CFLAGS)
compteur.elf : compteur.o map.ld
	arm-elf-ld -o compteur.elf $(OFILES) $(LFLAGS)
compteur.img : compteur.elf
	arm-elf-objcopy --strip-debug compteur.elf compteur.img
compteur.bin : compteur.img
	arm-elf-objcopy -O binary compteur.img compteur.bin

I also tried a .ld linker script (which didn’t work neither I) but as I
don’t think I need to use such complex declarations. Has anyone an idea
about what is going wrong with my makefile? As I don’t use anymore the
crt0.o file, maybe I should make some initializations to replace it?

Please help me!
I wish you all a nice weekend and hope an answer will be waiting for me
on Monday morning…

Gilles



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]