#780 - anli - Fri Jan 10, 2003 4:12 pm
Hello!
I think its a "mess" to use the gnu utils actually, so probably I am doing
something wrong. Do I really need to do all this?
First of all, I am using crt0.s and lnkscript by Jeff. I put those two files in the same directory as my project.
Secondly, I copy this files to my project dir:
For arm:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\crtend.o
For thumb:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\crtend.o
For interwork:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork\crtend.o
I also put a main.cpp or main.c in the directory with my code.
(I have not done something big enough for splitting up in many files yet, or maybe I have without actually doing it). The entry function is called AgbMain.
Then I create a Makefile and put in the same directory. It typically contains something like this:
(I have an environment variable named DEVKITADV containing
"d:\devkitadv").
Now
1. Is there a way to just tell the linker "I am linking for the thumb
instruction set" instead of copying the files crtbegin.o and crtend.o to
the project directory, or in any way mention crtbegin.o and crtend.o in
my Makefile?
2. Is there a way to get rid of giving long paths to ld with the -L switch to
the C/C++/math runtime libraries? The paths I have now is clearly
version dependent, so when I am using a newer version of gcc some
time, I need to change all my makefiles.
3. If I dont put crt0.o first in the command line to ld, but something else,
the ROM will not start with crt0, and therefore be unusable. Is there a
way to configure the lnkscript so the ROM will always start with crt0.o?
This is of course of academic interest, since I am always able to assure
that crt0.o is first on the command line to ld, but I am just curious.
over and out
/anli
Last edited by anli on Fri Jan 10, 2003 5:04 pm; edited 4 times in total
I think its a "mess" to use the gnu utils actually, so probably I am doing
something wrong. Do I really need to do all this?
First of all, I am using crt0.s and lnkscript by Jeff. I put those two files in the same directory as my project.
Secondly, I copy this files to my project dir:
For arm:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\crtend.o
For thumb:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\thumb\crtend.o
For interwork:
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork\crtbegin.o and
e:\devkitadv\lib\gcc-lib\arm-agb-elf\3.0.2\interwork\crtend.o
I also put a main.cpp or main.c in the directory with my code.
(I have not done something big enough for splitting up in many files yet, or maybe I have without actually doing it). The entry function is called AgbMain.
Then I create a Makefile and put in the same directory. It typically contains something like this:
Code: |
hello.gba: hello.elf objcopy -O binary hello.elf hello.gba hello.elf: crt0.o main.o ld -L${DEVKITADV}/lib/gcc-lib/arm-agb-elf/3.0.2 \ -L${DEVKITADV}/arm-agb-elf/lib -o hello.elf -T lnkscript \ crt0.o crtbegin.o crtend.o main.o -lc -lm -lgcc main.o: main.cpp g++ -c -O3 -marm -o main.o main.cpp crt0.o: crt0.s as crt0.s -o crt0.o |
(I have an environment variable named DEVKITADV containing
"d:\devkitadv").
Now
1. Is there a way to just tell the linker "I am linking for the thumb
instruction set" instead of copying the files crtbegin.o and crtend.o to
the project directory, or in any way mention crtbegin.o and crtend.o in
my Makefile?
2. Is there a way to get rid of giving long paths to ld with the -L switch to
the C/C++/math runtime libraries? The paths I have now is clearly
version dependent, so when I am using a newer version of gcc some
time, I need to change all my makefiles.
3. If I dont put crt0.o first in the command line to ld, but something else,
the ROM will not start with crt0, and therefore be unusable. Is there a
way to configure the lnkscript so the ROM will always start with crt0.o?
This is of course of academic interest, since I am always able to assure
that crt0.o is first on the command line to ld, but I am just curious.
over and out
/anli
Last edited by anli on Fri Jan 10, 2003 5:04 pm; edited 4 times in total