Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: force gcc to NOT use thumb? - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

force gcc to NOT use thumb? Rate Topic: -----

#1 User is offline   webshaker 

  • Regular Contributor
  • PipPipPip
  • Group: Members
  • Posts: 220
  • Joined: 07-October 10

Posted 11 December 2010 - 01:09 PM

Hi.

I'm using a Beagleboard with gcc
I'm looking for the parameter to use to ask gcc to not use thumb instruction !!!

does anybody know hox I con do that?

Thank's
Etienne
When you have eliminated the impossible, whatever remains, however improbable, must be the truth
0

#2 User is offline   isogen74 

  • Super Contributor
  • PipPipPipPip
  • Group: Members
  • Posts: 1097
  • Joined: 20-March 07

Posted 11 December 2010 - 04:54 PM

The gcc options are:

-mthumb or -marm


Iso
When optimizing software, consider that the quickest code to run is the bit you removed from the call path.
0

#3 User is offline   webshaker 

  • Regular Contributor
  • PipPipPip
  • Group: Members
  • Posts: 220
  • Joined: 07-October 10

Posted 11 December 2010 - 10:09 PM

Hum.

-marm seems to work thank's
but I still have some interrogation

I have tried this command

gcc -S -marm add.c

an the code produced is


.arch armv7-a
...
.file "add.c"
.text
.align 2
.global add
.type add, %function
add:
@ args = 0, pretend = 0, frame = 8
@ frame_needed = 1, uses_anonymous_args = 0
@ link register save eliminated.
...
bx lr
.size add, .-add
.ident "GCC: (Ubuntu/Linaro 4.4.4-14ubuntu5) 4.4.5"
.section .note.GNU-stack,"",%progbits

My problem is about the
bx lr instruction.

Bx intruction Does it not supposed to swap between ARM and thumb mode ?

Etienne
When you have eliminated the impossible, whatever remains, however improbable, must be the truth
0

#4 User is offline   scott 

  • Regular Contributor
  • PipPipPip
  • Group: Members.
  • Posts: 205
  • Joined: 05-October 06

Posted 04 January 2011 - 03:00 PM

View Postwebshaker, on 11 December 2010 - 10:09 PM, said:

My problem is about the
bx lr instruction.

Bx intruction Does it not supposed to swap between ARM and thumb mode ?


BX <reg> is available in both ARM and Thumb state. It uses the low bit of the register value to determine if the destination is in ARM state (0) or Thumb state (1). In the case above if the caller is in Thumb state the low bit of LR will be set.

If you're compiling for a old ARM processor (e.g. XScale) that does not have Thumb state and therefore does not have BX in ARM state, then you should use -mcpu=... to tell the compiler.

You may have been thinking of the 'BLX <offset>' instruction which always switches state. The choice of using 'BLX <offset>' or 'BL <offset>' can be made by the linker, both the caller and callee states are known.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic