Search the web
Sign In
New User? Sign Up
gbadev
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Show off your group to the world. Share a photo of your group with us.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
Detecting Thumb and Arm mode at compile time   Message List  
Reply | Forward Message #15005 of 15019 |
Re: [gbadev] Detecting Thumb and Arm mode at compile time


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
`'






Thu Aug 3, 2006 8:41 am

ped7g
Offline Offline
Send Email Send Email

Forward
Message #15005 of 15019 |
Expand Messages Author Sort by Date

Hello, 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...
Vital
vitalhb
Offline Send Email
Aug 2, 2006
11:32 pm

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...
Ped
ped7g
Offline Send Email
Aug 3, 2006
8:55 am

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, ...
Vital
vitalhb
Offline Send Email
Aug 3, 2006
7:05 pm
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help