Peter,
Thanks for your help. I received the answer for my problem from the
GnuArm list:
GCC defines the constant __thumb__ when it is compiling in thumb mode,
so all I had to do was to put a test #ifdef __thumb__ ...
regards,
Vital
--- In gbadev@yahoogroups.com, Ped <ped@...> wrote:
>
>
> Hello,
>
> I think there's no easy way how to detect compilation mode, you should
> check your compiler documentation for predefined macros, maybe
there's some
> way how to detect the target machine/mode of compilation, but I
don't recall
> anything like that.
>
> But if you do have control over arm/thumb selection process and
compiler
> spawning, you can simply add your own -D_ARM_COMPILE_ or
-D_THUMB_COMPILE_
> macros to compiler command line, and detect those two in your code with
> simple #ifdef.
>
> I personally never needed anything like this, because all my thumb
code was
> stored in "filename.c" files, and arm code in "filename.a.c" files,
and my
> makefile did detect the .a.c pattern automatically and spawn the
compiler
> with correct flags to produce arm mode code.
>
> But from your question I think you are trying to do some universal
library,
> which can be compiled in both ways, so this will probably not help
you at
> all.
>
> > I am trying to write something like this:
> >
> > #if (compiled in ARM mode)
> > code 1
> > #else // compiled in THUMB mode
> > code 2
> >
> > What the (compile in ARM mode) test would be like?
> > Can anyone help me?
> >
> > thanks,
> > Vital
>
> --
>
> PED - Peter Helcmanovsky - wishing to have 48h days
> Braniskova 7 Kosice 04001 Slovakia / phone +420 721308701
> (_ -- actually in Prag, so don't look after me --
> "~/\~" -=- deRATized RAT -=- Being beyond Yer imagination -=-
> ,_oo_, 7 GODS demo group WWW pages: http://7gods.org
> `'
>