Forums | developer.brewmp.com Forums | developer.brewmp.com

Developer

Forums

Has anyone managed to successfully compile in Thumb mode using GCC yet ?

Last I knew of this was only possible using the expensive compiler.

I used Tyndals walkthrough to set up GCC, has anyone worked out how to exdend it to work in Thumb mode ?

Thanks.

Yeap, I did, but a long time ago.. :)
It works like a charm, you only need to keep AEEModGen.c and AEEAppGen.c in ARM mode, and use thumb-interwork..

Yeap, I did, but a long time ago.. :)
It works like a charm, you only need to keep AEEModGen.c and AEEAppGen.c in ARM mode, and use thumb-interwork..

This is AWESOME news.
I know its a little lazy but could you post a quick "how to"?
I've never used GCC or anything like this before getting into Brew so my compiler settings / setup knowledge is very weak.
for example "you only need to keep AEEModGen.c and AEEAppGen.c in ARM mode, and use thumb-interwork.." - I dont know how to do that.
Many thanks.

This is AWESOME news.
I know its a little lazy but could you post a quick "how to"?
I've never used GCC or anything like this before getting into Brew so my compiler settings / setup knowledge is very weak.
for example "you only need to keep AEEModGen.c and AEEAppGen.c in ARM mode, and use thumb-interwork.." - I dont know how to do that.
Many thanks.

IIRC, is -mthumb -mthumb-interwork, but hey, don't trust my memory.. :)
I guess this thread has some examples:
http://brewforums.qualcomm.com/showthread.php?t=6998&highlight=thumb

IIRC, is -mthumb -mthumb-interwork, but hey, don't trust my memory.. :)
I guess this thread has some examples:
http://brewforums.qualcomm.com/showthread.php?t=6998&highlight=thumb

I see. I tried using -mthumb as shown:
#-----------------------------------------------------------------------
# Compiler code generation options
# Add $(TARG) to the CODE line if you're building a Thumb binary (at
# the moment, this doesn't work).
#-----------------------------------------------------------------------
END = -mlittle-endian
TARG = -mthumb
CODE = $(END) $(TARG) -fshort-enums -fno-builtin
but I get a zillion of the following errors:
warning: interworking not enabled
internal error: dangerous error
It compiles fine without the $(TARG) in the "CODE" line and its 102 Kb.
"the moment, this doesn't work" was written in there when I first followed Tyndals guide. If a solution has been found can someone please help me ?

I see. I tried using -mthumb as shown:
#-----------------------------------------------------------------------
# Compiler code generation options
# Add $(TARG) to the CODE line if you're building a Thumb binary (at
# the moment, this doesn't work).
#-----------------------------------------------------------------------
END = -mlittle-endian
TARG = -mthumb
CODE = $(END) $(TARG) -fshort-enums -fno-builtin
but I get a zillion of the following errors:
warning: interworking not enabled
internal error: dangerous error
It compiles fine without the $(TARG) in the "CODE" line and its 102 Kb.
"the moment, this doesn't work" was written in there when I first followed Tyndals guide. If a solution has been found can someone please help me ?

Did you try this?
TARG = -mthumb -mthumb-interwork

Did you try this?
TARG = -mthumb -mthumb-interwork

Yea, it still didnt work sadly.
Would you mind looking at my MakeFile ?
- Many thanks. (I really wanna work this out !)

Yea, it still didnt work sadly.
Would you mind looking at my MakeFile ?
- Many thanks. (I really wanna work this out !)

Hmm, the errors are the same?
I never had this "internal error: dangerous error" :confused:
If the error is only during linkage, try this:
LIBDIRS = -L$(GCC_LIBPATH) -Lc:/gnude/arm-elf/lib/thumb
Also, you'll need to add some explicit rules for ModGen/AppGen and define somewhere in your makefile a new CFLAGS options without -mthumb, like this:
AEEModGen.o: AEEModGen.c
$(GCC) $(CFLAGS_NOTHUMB) -o AEEModGen.o AEEModGen.c

Hmm, the errors are the same?
I never had this "internal error: dangerous error" :confused:
If the error is only during linkage, try this:
LIBDIRS = -L$(GCC_LIBPATH) -Lc:/gnude/arm-elf/lib/thumb
Also, you'll need to add some explicit rules for ModGen/AppGen and define somewhere in your makefile a new CFLAGS options without -mthumb, like this:
AEEModGen.o: AEEModGen.c
$(GCC) $(CFLAGS_NOTHUMB) -o AEEModGen.o AEEModGen.c

QUOTE:
"Did you try this?
TARG = -mthumb -mthumb-interwork
....
Hmm, the errors are the same?"
I think they are the same because "-mthumb-interwork" was already being used just not from the TARG section - so adding it to the TARG section just meant it was in there twice - hence no difference.
You are correct, the errors are ONLY in the linkage.
I've done this: (Added the "thumb" on the end)
"If the error is only during linkage, try this:"
LIBDIRS = -L$(GCC_LIBPATH) -Lc:/gnude/arm-elf/lib/thumb
But not this:
Also, you'll need to add some explicit rules for ModGen/AppGen and define somewhere in your makefile a new CFLAGS options without -mthumb, like this:
AEEModGen.o: AEEModGen.c
$(GCC) $(CFLAGS_NOTHUMB) -o AEEModGen.o AEEModGen.c
Ive tried a few things but cant seem to get it right. [I really dont know what Im donig !]
Attached is the resulting output when I build if it helps.
Thanks for your help so far but could you tell me exactly what I need to do to:
1 - make a new CFLAGS options without -mthumb
2 - use that to add some explicit rules for ModGen/AppGen.
NB: The makefile was generated using visual studio . NET.

QUOTE:
"Did you try this?
TARG = -mthumb -mthumb-interwork
....
Hmm, the errors are the same?"
I think they are the same because "-mthumb-interwork" was already being used just not from the TARG section - so adding it to the TARG section just meant it was in there twice - hence no difference.
You are correct, the errors are ONLY in the linkage.
I've done this: (Added the "thumb" on the end)
"If the error is only during linkage, try this:"
LIBDIRS = -L$(GCC_LIBPATH) -Lc:/gnude/arm-elf/lib/thumb
But not this:
Also, you'll need to add some explicit rules for ModGen/AppGen and define somewhere in your makefile a new CFLAGS options without -mthumb, like this:
AEEModGen.o: AEEModGen.c
$(GCC) $(CFLAGS_NOTHUMB) -o AEEModGen.o AEEModGen.c
Ive tried a few things but cant seem to get it right. [I really dont know what Im donig !]
Attached is the resulting output when I build if it helps.
Thanks for your help so far but could you tell me exactly what I need to do to:
1 - make a new CFLAGS options without -mthumb
2 - use that to add some explicit rules for ModGen/AppGen.
NB: The makefile was generated using visual studio . NET.

1. Try inverting the libraries order:
LIBDIRS = -Lc:/gnude/arm-elf/lib/thumb -L$(GCC_LIBPATH)
or remove the -L$(GCC_LIBPATH) at all.
As for ModGen/AppGen, I guess the easiest way is add something like this in your makefile (it's the command line you generated for building the other files, withouth the -mthumb option). Adjust the path for AEEModGen.c as necessary, and also make another line like this replace ModGen with AppGen
AEEModGen.o: AEEModGen.c
C:\gnude\bin\arm-elf-gcc -fno-exceptions -fno-rtti -ffunction-sections -fno-unwind-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PRO?GRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm?-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\g?nude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEModGen.o AEEModGen.c

1. Try inverting the libraries order:
LIBDIRS = -Lc:/gnude/arm-elf/lib/thumb -L$(GCC_LIBPATH)
or remove the -L$(GCC_LIBPATH) at all.
As for ModGen/AppGen, I guess the easiest way is add something like this in your makefile (it's the command line you generated for building the other files, withouth the -mthumb option). Adjust the path for AEEModGen.c as necessary, and also make another line like this replace ModGen with AppGen
AEEModGen.o: AEEModGen.c
C:\gnude\bin\arm-elf-gcc -fno-exceptions -fno-rtti -ffunction-sections -fno-unwind-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PRO?GRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm?-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\g?nude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEModGen.o AEEModGen.c

If I remove -L$(GCC_LIBPATH) it says "cannot find -lgcc" when linking. Then stops with return code '0x1' so Ive left that in.
Ive changed my makefile so that anything compiled on the "AEESRCPATH" is compiled using CFLAGS_NOTHUMB. Anything else uses CFLAGS.
This seems to work as during the compilation process I can see that there is no -mthumb next to AEEModGen/AEEAppGen.
So the bottom line is Im pretty sure that I am now compiling correctly with regards to this.
My new MakeFile is attatched in the zip file.
Now when I try to load the game the phone instantly resets. Its got to be something to do with the errors I am still getting during linking.
Attatched in the zip file is the output I am getting during the compilation / linking process.
Are there any linking/compiling options I am using which can conflict with using thumb mode ?
Is there any code I could be using which works in ARM mode but not in Thumb mode ?
Do the errors mean anything to anyone ?
- Bambos.

If I remove -L$(GCC_LIBPATH) it says "cannot find -lgcc" when linking. Then stops with return code '0x1' so Ive left that in.
Ive changed my makefile so that anything compiled on the "AEESRCPATH" is compiled using CFLAGS_NOTHUMB. Anything else uses CFLAGS.
This seems to work as during the compilation process I can see that there is no -mthumb next to AEEModGen/AEEAppGen.
So the bottom line is Im pretty sure that I am now compiling correctly with regards to this.
My new MakeFile is attatched in the zip file.
Now when I try to load the game the phone instantly resets. Its got to be something to do with the errors I am still getting during linking.
Attatched in the zip file is the output I am getting during the compilation / linking process.
Are there any linking/compiling options I am using which can conflict with using thumb mode ?
Is there any code I could be using which works in ARM mode but not in Thumb mode ?
Do the errors mean anything to anyone ?
- Bambos.

Hmm ok.
LIBDIRS Needed "-Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb" so it could find the -mthumb-interwork compiled version of something. Then all the errors went away.
This is what it looks like now:
LIBDIRS = -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnude/arm-elf/lib/thumb -L$(GCC_LIBPATH)
it also works without the -L$(GCC_LIBPATH) so Im convinced that its working.
The mod is now 72k. [It was 102 in ARM mode]
BUT, when I run the game on the phone it still instantly resets.
NB: Just to be explicit, the game works perfectly when compiled in ARM mode.
Does anyone know whats wrong ?

Hmm ok.
LIBDIRS Needed "-Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb" so it could find the -mthumb-interwork compiled version of something. Then all the errors went away.
This is what it looks like now:
LIBDIRS = -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnude/arm-elf/lib/thumb -L$(GCC_LIBPATH)
it also works without the -L$(GCC_LIBPATH) so Im convinced that its working.
The mod is now 72k. [It was 102 in ARM mode]
BUT, when I run the game on the phone it still instantly resets.
NB: Just to be explicit, the game works perfectly when compiled in ARM mode.
Does anyone know whats wrong ?

Great, compiled and linked: one step done! :cool:
Do you really need to make it run?! :D :p
Are you sure AppGen / ModGen are compiled in ARM mode?

Great, compiled and linked: one step done! :cool:
Do you really need to make it run?! :D :p
Are you sure AppGen / ModGen are compiled in ARM mode?

Heres the output for the first 3 files that are made, they include AEEAppGen/AEEModGen.
As far as I can tell they are not compiled using -mthumb, therefore they are comiled in ARM mode. (Is this assumption correct or is there more to it than that ?)
Every other file is compiled using -mthumb.
---------------------------------------------------------------
OBJECT AEEMOD~1.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEMOD~1.o c:\PROGRA~1\BREWSD~1.3\src\AEEMOD~1.c
---------------------------------------------------------------
---------------------------------------------------------------
OBJECT CROCPI~1.o
C:\gnude\bin\arm-elf-g++ -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -mthumb -fno-rtti -o CROCPI~1.o CROCPI~1.cpp
---------------------------------------------------------------
---------------------------------------------------------------
OBJECT AEEAPP~1.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEAPP~1.o c:\PROGRA~1\BREWSD~1.3\src\AEEAPP~1.c
What aboutGCCResolver ? Does that have to be ARM / Thumb ?
OBJECT GCCResolver.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -mthumb -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o GCCResolver.o C:\gnude\GCCResolver.c
With regards to thumb/arm stuff is there anything that could be incorrect in the elf-to-mod phase or is it only the compilation that counts ? Heres the elf-to-mod phase...
C:\gnude\bin\arm-elf-ld -Ttext 0 --no-warn-mismatch -Map D:\brew\CROCPI~
1\crocpinball.map --cref --emit-relocs -entry AEEMod_Load --gc-sections -o D:\br
ew\CROCPI~1\crocpinball.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnud
e/arm-elf/lib/thumb AEEMOD~1.o CROCPI~1.o AEEAPP~1.o AppStd.o adler32.o crc32.otinfgzip.o tinflate.o tinfzlib.o MORPHE~1.o MORPHE~2.o MORPHE~3.o MORPHE~4.o MOE939~1.o MOA748~1.o MOB3F4~1.o MO0DF5~1.o MO2528~1.o MO955F~1.o MO88B6~1.o MO1DDE~1.o MO0A0F~1.o Ball.o Circle.o COLLIS~1.o Engine.o Flipper.o LIGHTS~1.o Line.oLogic.o Path.o STATEC~1.o DEVICE~1.o GCCResolver.o -lgcc -lsupc++ -lc C:\gnude\BREWelf2mod.exe D:\brew\CROCPI~1\crocpinball.elf D:\brew\CROCPI~1\crocpinball.mod
Thanks.

Heres the output for the first 3 files that are made, they include AEEAppGen/AEEModGen.
As far as I can tell they are not compiled using -mthumb, therefore they are comiled in ARM mode. (Is this assumption correct or is there more to it than that ?)
Every other file is compiled using -mthumb.
---------------------------------------------------------------
OBJECT AEEMOD~1.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEMOD~1.o c:\PROGRA~1\BREWSD~1.3\src\AEEMOD~1.c
---------------------------------------------------------------
---------------------------------------------------------------
OBJECT CROCPI~1.o
C:\gnude\bin\arm-elf-g++ -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -mthumb -fno-rtti -o CROCPI~1.o CROCPI~1.cpp
---------------------------------------------------------------
---------------------------------------------------------------
OBJECT AEEAPP~1.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o AEEAPP~1.o c:\PROGRA~1\BREWSD~1.3\src\AEEAPP~1.c
What aboutGCCResolver ? Does that have to be ARM / Thumb ?
OBJECT GCCResolver.o
C:\gnude\bin\arm-elf-gcc -fno-exceptions -ffunction-sections -fno-unwind
-tables -c -DDYNAMIC_APP -mcpu=arm7tdmi -mapcs-frame -mthumb-interwork -mlittle-endian -fshort-enums -fno-builtin -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -Os -fsigned-char -fshort-wchar -mthumb -IC:\PROGRA~1\BREWSD~1.3\inc -IC:\gnude\lib\gcc-lib\arm-elf\3.3.1\include -IC:\gnude\arm-elf\include -o GCCResolver.o C:\gnude\GCCResolver.c
With regards to thumb/arm stuff is there anything that could be incorrect in the elf-to-mod phase or is it only the compilation that counts ? Heres the elf-to-mod phase...
C:\gnude\bin\arm-elf-ld -Ttext 0 --no-warn-mismatch -Map D:\brew\CROCPI~
1\crocpinball.map --cref --emit-relocs -entry AEEMod_Load --gc-sections -o D:\br
ew\CROCPI~1\crocpinball.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnud
e/arm-elf/lib/thumb AEEMOD~1.o CROCPI~1.o AEEAPP~1.o AppStd.o adler32.o crc32.otinfgzip.o tinflate.o tinfzlib.o MORPHE~1.o MORPHE~2.o MORPHE~3.o MORPHE~4.o MOE939~1.o MOA748~1.o MOB3F4~1.o MO0DF5~1.o MO2528~1.o MO955F~1.o MO88B6~1.o MO1DDE~1.o MO0A0F~1.o Ball.o Circle.o COLLIS~1.o Engine.o Flipper.o LIGHTS~1.o Line.oLogic.o Path.o STATEC~1.o DEVICE~1.o GCCResolver.o -lgcc -lsupc++ -lc C:\gnude\BREWelf2mod.exe D:\brew\CROCPI~1\crocpinball.elf D:\brew\CROCPI~1\crocpinball.mod
Thanks.

AHA !
I had set up my make file to surpress some warnings cos they were irrelevant when I was building in ARM Mode.
Now I get:
C:\gnude\bin\arm-elf-ld -Ttext 0 -Map D:\brew\CROCPI~1\crocpinball.map
--cref --emit-relocs -entry AEEMod_Load --gc-sections -o D:\brew\CROCPI~1\crocpi
nball.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnude/arm-elf/lib/thum
b AEEMOD~1.o CROCPI~1.o AEEAPP~1.o AppStd.o adler32.o crc32.o tinfgzip.o tinflate.o tinfzlib.o MORPHE~1.o MORPHE~2.o MORPHE~3.o MORPHE~4.o MOE939~1.o MOA748~1.o MOB3F4~1.o MO0DF5~1.o MO2528~1.o MO955F~1.o MO88B6~1.o MO1DDE~1.o MO0A0F~1.o Ball.o Circle.o COLLIS~1.o Engine.o Flipper.o LIGHTS~1.o Line.o Logic.o Path.o STATEC~1.o DEVICE~1.o GCCResolver.o -lgcc -lsupc++ -lc/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb/libgcc.a(_divsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_umodsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_modsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_dvmd_tls.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_call_via_rX.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
C:\gnude\BREWelf2mod.exe D:\brew\CROCPI~1\crocpinball.elf D:\brew\CROCPI~1\crocpinball.mod
Quoting from another forum entry "if you ignore the warnings then it'll crash if the functions are called from thumb mode"
- Which explains it !
My next problem is:
How do I get the aforementioned files to support interworking ???
- Thanks.
EDIT:
Ok just done some reading. Apparently there are 4 types of libgcc.a.
lib/gcc/arm-elf/3.4.3
lib/gcc/arm-elf/3.4.3/thumb
lib/gcc/arm-elf/3.4.3/interwork
ib/gcc/arm-elf/3.4.3/thumb/interwork
The first is compiled with no options.
The second with -mthumb
the third with -mthumb-interwork
the forth with -mthumb -mthumb-interwork.
I got that info from here: http://groups.yahoo.com/group/lpc2000/message/6593
Judging from the error message i get I suspect I need to use a version of libgcc.a that supports interworking.
The question is where do I get this from ?
I used Tyndals walkthrough to install gnude (I believe I have version 3.3.1) but I do not have the "interworking" directories. I only have the first 2 (no options and -mthumb). Where can I get a version of libgcc.a that supports interworking ?
- Thanks.

AHA !
I had set up my make file to surpress some warnings cos they were irrelevant when I was building in ARM Mode.
Now I get:
C:\gnude\bin\arm-elf-ld -Ttext 0 -Map D:\brew\CROCPI~1\crocpinball.map
--cref --emit-relocs -entry AEEMod_Load --gc-sections -o D:\brew\CROCPI~1\crocpi
nball.elf -Lc:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb -Lc:/gnude/arm-elf/lib/thum
b AEEMOD~1.o CROCPI~1.o AEEAPP~1.o AppStd.o adler32.o crc32.o tinfgzip.o tinflate.o tinfzlib.o MORPHE~1.o MORPHE~2.o MORPHE~3.o MORPHE~4.o MOE939~1.o MOA748~1.o MOB3F4~1.o MO0DF5~1.o MO2528~1.o MO955F~1.o MO88B6~1.o MO1DDE~1.o MO0A0F~1.o Ball.o Circle.o COLLIS~1.o Engine.o Flipper.o LIGHTS~1.o Line.o Logic.o Path.o STATEC~1.o DEVICE~1.o GCCResolver.o -lgcc -lsupc++ -lc/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/thumb/libgcc.a(_divsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_umodsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_modsi3.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_dvmd_tls.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
/cygdrive/c/gnude/bin/arm-elf-ld: Warning: c:/gnude/lib/gcc-lib/arm-elf/3.3.1/th
umb/libgcc.a(_call_via_rX.o) does not support interworking, whereas D:\brew\CROCPI~1\crocpinball.elf does
C:\gnude\BREWelf2mod.exe D:\brew\CROCPI~1\crocpinball.elf D:\brew\CROCPI~1\crocpinball.mod
Quoting from another forum entry "if you ignore the warnings then it'll crash if the functions are called from thumb mode"
- Which explains it !
My next problem is:
How do I get the aforementioned files to support interworking ???
- Thanks.
EDIT:
Ok just done some reading. Apparently there are 4 types of libgcc.a.
lib/gcc/arm-elf/3.4.3
lib/gcc/arm-elf/3.4.3/thumb
lib/gcc/arm-elf/3.4.3/interwork
ib/gcc/arm-elf/3.4.3/thumb/interwork
The first is compiled with no options.
The second with -mthumb
the third with -mthumb-interwork
the forth with -mthumb -mthumb-interwork.
I got that info from here: http://groups.yahoo.com/group/lpc2000/message/6593
Judging from the error message i get I suspect I need to use a version of libgcc.a that supports interworking.
The question is where do I get this from ?
I used Tyndals walkthrough to install gnude (I believe I have version 3.3.1) but I do not have the "interworking" directories. I only have the first 2 (no options and -mthumb). Where can I get a version of libgcc.a that supports interworking ?
- Thanks.

OK I downloaded the libraries for GNU 3.4.3 and placed them in my current gnude directory.
I can now rebuild with in thumb mode without recieving any errors.
However when I run the mod on the phone It gets as far as the AEEMod_CreateInstance method in AEEModGen.c then hangs.
Im using an LG VX 8000, it just stays on the App Manager Screen with the hourglass in the middle. I have to take the battery out to reset the phone.
Anyone got any ideas ?

OK I downloaded the libraries for GNU 3.4.3 and placed them in my current gnude directory.
I can now rebuild with in thumb mode without recieving any errors.
However when I run the mod on the phone It gets as far as the AEEMod_CreateInstance method in AEEModGen.c then hangs.
Im using an LG VX 8000, it just stays on the App Manager Screen with the hourglass in the middle. I have to take the battery out to reset the phone.
Anyone got any ideas ?

I seemed to have succesfully gotten my app to compile in THUMB mode with no warnings, and created the mod file using the latest Brewelf2mod.exe.
I compiled everything in THUMB mode except for AEEModGen.c and AEEAppGen.c.
Whenever I try to launch this on the device it powercycles the phone...
any ideas?

I seemed to have succesfully gotten my app to compile in THUMB mode with no warnings, and created the mod file using the latest Brewelf2mod.exe.
I compiled everything in THUMB mode except for AEEModGen.c and AEEAppGen.c.
Whenever I try to launch this on the device it powercycles the phone...
any ideas?

about a million possibilities
global data, bad code.
hard to say, try an application that you know works, such as the helloworld with the same process, if it works, its your code, if it doesn't its the process

about a million possibilities
global data, bad code.
hard to say, try an application that you know works, such as the helloworld with the same process, if it works, its your code, if it doesn't its the process

definitely something in the process. Code runs fine when compiled without THUMB mode. Getting the same error as bambous when linking, the THUMB libraries in Gnude tools are not built with thumb-interwork support...

definitely something in the process. Code runs fine when compiled without THUMB mode. Getting the same error as bambous when linking, the THUMB libraries in Gnude tools are not built with thumb-interwork support...

Did you ever figure this out bambos? I'm at the same problem with the gnude libraries not having thumb-interwork... Where did you find the downloads for 3.43?

Did you ever figure this out bambos? I'm at the same problem with the gnude libraries not having thumb-interwork... Where did you find the downloads for 3.43?

I got it from http://www.gnuarm.com/.
I just pulled the /interwork and thumb/interwork folders into my existing gnu directory and tried the build process with those paths. It compiled and linked with no errors.
BUT, it still didnt work. After trying several things it always either hung or reset the phone when I launched the app.
So yes, we have exactly the same problem.
I've given up for the time being as I have to do another project but this is something I MUSTto be able to do in the future as I have introduced exception handling into my code base which has made the mod file a LOT bigger [170k in ARM mode !]
I think the suggestion above is very good, I was going to try the same build process with the helloworld app and see if it worked, then keep introducing things until it stopped working to find the problem. I just lack the time at the moment. Obviously if our build process doesnt work with the helloworld app then its something to do with that. But I have no idea what it could be as Im sure that its now correct.
If you manage to find out anything useful then please post it here !

I got it from http://www.gnuarm.com/.
I just pulled the /interwork and thumb/interwork folders into my existing gnu directory and tried the build process with those paths. It compiled and linked with no errors.
BUT, it still didnt work. After trying several things it always either hung or reset the phone when I launched the app.
So yes, we have exactly the same problem.
I've given up for the time being as I have to do another project but this is something I MUSTto be able to do in the future as I have introduced exception handling into my code base which has made the mod file a LOT bigger [170k in ARM mode !]
I think the suggestion above is very good, I was going to try the same build process with the helloworld app and see if it worked, then keep introducing things until it stopped working to find the problem. I just lack the time at the moment. Obviously if our build process doesnt work with the helloworld app then its something to do with that. But I have no idea what it could be as Im sure that its now correct.
If you manage to find out anything useful then please post it here !

Just an update.
I downlaoded the GNUARM 3.4.3 toolchain and tried that with the MaxFileCount program which is about as simple as it gets.
Tried linking to both the interwork and thumb/interwork libraries. Always powercycles the phone when attempting to launch the application.
(No -mthumb on AEEModGen.c and AEEAppGen.c)
Compiled without the '-mthumb' option, the maxfilecount app runs fine.
I did have to use the '-msoft-float' so the app would link with libgcc correctlly.
May try gcc 4.0 next...

Just an update.
I downlaoded the GNUARM 3.4.3 toolchain and tried that with the MaxFileCount program which is about as simple as it gets.
Tried linking to both the interwork and thumb/interwork libraries. Always powercycles the phone when attempting to launch the application.
(No -mthumb on AEEModGen.c and AEEAppGen.c)
Compiled without the '-mthumb' option, the maxfilecount app runs fine.
I did have to use the '-msoft-float' so the app would link with libgcc correctlly.
May try gcc 4.0 next...

Hmmm.. thats very fustrating.
Well done for trying though. At least it proves that its probably not the code !

Hmmm.. thats very fustrating.
Well done for trying though. At least it proves that its probably not the code !

Your problem may be due to GCC's -funit-at-a-time optimization flag. It was introduced in GCC 3.4, is enabled by -O2 and -Os, and can cause GCC to reorder functions within a translation unit. If the functions in AEEModGen.c are reordered, then AEEMod_Load may not be the first function in your mod file, and trouble will ensue. See [thread=7163]this thread[/thread] for some ways to prevent that.

Your problem may be due to GCC's -funit-at-a-time optimization flag. It was introduced in GCC 3.4, is enabled by -O2 and -Os, and can cause GCC to reorder functions within a translation unit. If the functions in AEEModGen.c are reordered, then AEEMod_Load may not be the first function in your mod file, and trouble will ensue. See [thread=7163]this thread[/thread] for some ways to prevent that.

Ugh, I'm going bonkers here. Been running in circles for days.
I guess previously I was not actually compiling with GNUARM 3.4.3 but rather Gnude 3.3.1 and linking with the GNUARM 3.4.3 thumb libs.
Trying to compile with GNUARM 3.4.3 results in tons of errors when running BREWElf2Mod.exe
.
.
BFD: alltel.elf: invalid string offset 432385 >= 22280 for section `.strtab'
BFD: alltel.elf: invalid string offset 480002 >= 22280 for section `.strtab'
BFD: alltel.elf: invalid string offset 425729 >= 22280 for section `.strtab'
.
.
any ideas?

Ugh, I'm going bonkers here. Been running in circles for days.
I guess previously I was not actually compiling with GNUARM 3.4.3 but rather Gnude 3.3.1 and linking with the GNUARM 3.4.3 thumb libs.
Trying to compile with GNUARM 3.4.3 results in tons of errors when running BREWElf2Mod.exe
.
.
BFD: alltel.elf: invalid string offset 432385 >= 22280 for section `.strtab'
BFD: alltel.elf: invalid string offset 480002 >= 22280 for section `.strtab'
BFD: alltel.elf: invalid string offset 425729 >= 22280 for section `.strtab'
.
.
any ideas?

not sure how it is related, but if I don't remove the run-time type information ie remove the '-fno-rtti' then BREWElf2mod.exe doesn't complain about the elf generated by 3.4.3, but unfortunately the mod file is huge w/o that switch

not sure how it is related, but if I don't remove the run-time type information ie remove the '-fno-rtti' then BREWElf2mod.exe doesn't complain about the elf generated by 3.4.3, but unfortunately the mod file is huge w/o that switch

We've been working on this for ages. [Ive tried a few things since and gotten nowhere]
It may be worth asking someone who knows a lot about this stuff and has a complete and functional gnude directory with all the trimmings that we KNOW should work.
And get them to make it available for download.
If our stuff still doesnt work then at least we know its our code and we can start working on finding out what the problem with regards to that.
Is anyone willing to put there working gnude directory somewhere available for download !?

We've been working on this for ages. [Ive tried a few things since and gotten nowhere]
It may be worth asking someone who knows a lot about this stuff and has a complete and functional gnude directory with all the trimmings that we KNOW should work.
And get them to make it available for download.
If our stuff still doesnt work then at least we know its our code and we can start working on finding out what the problem with regards to that.
Is anyone willing to put there working gnude directory somewhere available for download !?

Minor Success!
Just enough to give me encouragement.
Didn't get THUMB mode working, but reading the thread Noah posted about breaking apart AEEModGen.c to force AEEMod_Load to be loaded first allowed me to get a working build with GCC 4.0.1!
for some reason -fno-unit-at-a-time did not correct this problem.
The benefit (although not as good as thumb) is that 4.0.1 seems to be a better compiler than 3.3.1 and my mod file went from 160k down to 128k just by using GCC 4.0.1. I can compile a thumb version just fine which is 86k. Even this is a little better because now the app just hangs on launch as opposed to causing data aborts.
To get gcc 4.0.1 working I had to.
[HTML]1. Update my Cygwin install 1.5.18-1 already had cygwin installed so setup.exe just brought me up to the latest version
2. Install the 4.0.1 toolchain from GNUARM.com
3. link with the /interwork libs
4. Break AEEModGen.c into two files MyAEEModLoad.c (just contains AEEMod_load) and MyAEEModGen.c which contains the rest of the functions
5. Be sure MyAEEModLoad.o is the first input to the linker.[/HTML]
hope that helps somebody.

Minor Success!
Just enough to give me encouragement.
Didn't get THUMB mode working, but reading the thread Noah posted about breaking apart AEEModGen.c to force AEEMod_Load to be loaded first allowed me to get a working build with GCC 4.0.1!
for some reason -fno-unit-at-a-time did not correct this problem.
The benefit (although not as good as thumb) is that 4.0.1 seems to be a better compiler than 3.3.1 and my mod file went from 160k down to 128k just by using GCC 4.0.1. I can compile a thumb version just fine which is 86k. Even this is a little better because now the app just hangs on launch as opposed to causing data aborts.
To get gcc 4.0.1 working I had to.
[HTML]1. Update my Cygwin install 1.5.18-1 already had cygwin installed so setup.exe just brought me up to the latest version
2. Install the 4.0.1 toolchain from GNUARM.com
3. link with the /interwork libs
4. Break AEEModGen.c into two files MyAEEModLoad.c (just contains AEEMod_load) and MyAEEModGen.c which contains the rest of the functions
5. Be sure MyAEEModLoad.o is the first input to the linker.[/HTML]
hope that helps somebody.

You might also be able to get some useful input at Yahoo Groups for GNUARM
The guy who compiles the GNUARM tools for www.gnuarm.com posts here as well as many other experienced people.

You might also be able to get some useful input at Yahoo Groups for GNUARM
The guy who compiles the GNUARM tools for www.gnuarm.com posts here as well as many other experienced people.

just wanted to say thank you for this.
-fno-unit-at-a-time fixed my problems (for now) my app finally runs on a device.
Thanks again
Adrian

just wanted to say thank you for this.
-fno-unit-at-a-time fixed my problems (for now) my app finally runs on a device.
Thanks again
Adrian