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.

DS development > -mcpu=arm946e-s (Anyone help?)

#78695 - acox - Sun Apr 09, 2006 12:37 am

I have some inline assembly that uses a v5 ARM instruction.

If I stick with the default arm920T flags, gcc barfs over the instruction.

If I set the cpu as in the topic of this post, linking fails as many people must have seen before (reproduced below).

I obv. am not using VFPU instructions and in fact I can live without any floating point at all if that could fix me problem.

Can anyone help me either:

1) Trick gcc into letting the v5 instruction pass while compiling for 920T.

2) Make the arm946e-s target work.

Thanks a lot.
Andrew

Code:

$ make
linking fixed.elf
j:\devkitpro\devkitarm\bin\..\lib\gcc\arm-elf\4.0.2\..\..\..\..\arm-elf\bin\ld.e
xe: ERROR: main.o uses VFP instructions, whereas k:/my_devkitPro/fixed/fixed.elf
 does not
j:\devkitpro\devkitarm\bin\..\lib\gcc\arm-elf\4.0.2\..\..\..\..\arm-elf\bin\ld.e
xe: failed to merge target specific data of file main.o
make[1]: *** [/k/my_devkitPro/fixed/fixed.elf] Error 1
make: *** [build] Error 2

_________________
3D on GBA

#78709 - DekuTree64 - Sun Apr 09, 2006 1:49 am

I'm also interested in this. I managed to get it working by using ld to link instead of g++, but then I can't use C++, and I haven't been able to get any standard libraries to link properly with that. Not that I really want to use either those anyway, but still.

As for a temporary workaround, you can look up the opcodes in the ARM architecture reference manual (I have a pdf I could email you if you can't find it, PM me) and encode them manually, just like .word 0x12345678. Not that bad if you make macros for them.
_________________
___________
The best optimization is to do nothing at all.
Therefore a fully optimized program doesn't exist.
-Deku

#78715 - acox - Sun Apr 09, 2006 2:58 am

DekuTree64 wrote:

As for a temporary workaround, you can look up the opcodes in the ARM architecture reference manual (I have a pdf I could email you if you can't find it, PM me) and encode them manually, just like .word 0x12345678. Not that bad if you make macros for them.


Thanks, tried this and nothing barfs even when I stuck junk into the instruction stream. Only problem I have is that all my registers were being assigned for me by gcc, but with this method I'll have to pin two down. But if nothing better comes along this will save my bacon.

I got the ARM ARM recently. I think it is Samsung that have it online among the docs for one of their ARM SOCs.
_________________
3D on GBA

#80044 - acox - Tue Apr 18, 2006 7:32 am

DekuTree64 wrote:
I'm also interested in this. I managed to get it working by using ld to link instead of g++, but then I can't use C++, and I haven't been able to get any standard libraries to link properly with that. Not that I really want to use either those anyway, but still.


I stirred the flags a number of ways and got a clean compile with the following ( even the "clz" v5 instruction in the assembly without encoding it in hex):
Code:

ARCH   :=   -marm -mthumb-interwork \
-march=armv5te

Code:


CFLAGS   :=   -g -Wall -O2\
         -mtune=arm946e-s -mhard-float -mfpu=fpe2 -fomit-frame-pointer\
         -ffast-math \
         $(ARCH)



I don't know yet if this will make valid fpu code though.
_________________
3D on GBA

#80124 - wintermute - Wed Apr 19, 2006 12:26 am

Code:

#---------------------------------------------------------------------------------
# options for code generation
#---------------------------------------------------------------------------------
ARCH   :=   -mthumb -mthumb-interwork \
         -march=armv5te -mtune=arm946e-s -Wa,-mfpu=fpa

CFLAGS   :=   -save-temps -g -Wall -O2\
          -fomit-frame-pointer\
         -ffast-math \
         $(ARCH)


allows everything to link.

Note the -Wa,-mfpu=fpa - this passes the parameter to the assembler, forcing it to mark the output as hard fpa while leaving the compiler in the default soft float ( but marked as hard ) . You don't want these parameters being used on the compiler as it will generate hardware floating point instructions.

The built code works on hardware.

I need to do a bit more testing on this and determine the best way to solve this whole issue. It might involve adding another set of libraries to the multilib options so we have both vfp and fpa marked libraries to link against.
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog

#80133 - acox - Wed Apr 19, 2006 2:30 am

Thanks. I was about to ask what the set of options to compile soft but mark hard was on the other topic.

This combination builds for me :).
_________________
3D on GBA

#87884 - wintermute - Fri Jun 16, 2006 6:14 am

You'll be happy to know that the recent move to eabi fixes all this nonsense and -march=armv5te -mtune=arm946e-s now does what it says on the tin :)
_________________
devkitPro - professional toolchains at amateur prices
devkitPro IRC support
Personal Blog