gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > How do you compile ARM code with THUMB code using DevKitAdv?

#10641 - Mr. GBA - Thu Sep 11, 2003 1:33 pm

Hi,

I have two separate files; one which must be compiled in ARM (file1.c); and one which must be compiled in THUMB (file2.c).

I have tried to compile the two files using the compiler options shown below:

gcc -c -O3 -marm file1.c
gcc -c -O3 -mthumb file2.c
gcc -marm -mthumb-interwork -o output.elf file2.o file1.o

objcopy -O binary output.elf output.gba


Once compiled, output.gba only implements code in file2.c and totally disregards code in file1.c.


I would be grateful if anyone could tell me how to efficiently compile ARM and THUMB code.


Thanks.
_________________
my dev/business site:

http://codebytesdev.afraid.org

#10642 - Lupin - Thu Sep 11, 2003 2:24 pm

gcc -c -O3 -marm-interwork file1.c
gcc -c -O3 -mthumb-interwork file2.c
gcc -marm -mthumb-interwork -o output.elf file2.o file1.o

I think this should do (not 100%ly sure, but just try and see if it works ;))

#10646 - Mr. GBA - Thu Sep 11, 2003 3:22 pm

Thanks for the reply Lupin, But -marm-interwork isn't a valid compiler option.

Anymore suggestions are more than welcome...
_________________
my dev/business site:

http://codebytesdev.afraid.org

#10648 - tepples - Thu Sep 11, 2003 3:33 pm

The corrected options are

-marm -mthumb-interwork (compile as interworking-safe ARM)
-mthumb -mthumb-interwork (compile as interworking-safe Thumb)
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.