Re: [arm-gnu] Thumb mode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [arm-gnu] Thumb mode



On Friday 22 January 2010 15:28:02 Kishore wrote:
> On Friday 22 Jan 2010 5:15:37 am Charles Manning wrote:
> > On Thursday 21 January 2010 04:45:10 Kishore wrote:
> > > Is there any way of informing the compiler to compile ISR's in ARM
> > > mode? The way i currently know is by compiling the file that contains
> > > the ISR without the -mthumb compiler option.
> > >
> > > The problem i have is that my build system puts in the -mthumb option
> > > globally and i override that with -marm option for files containing the
> > > ISR's. However, I would curious to know if there is another method like
> > > a function attribute to the same effect.
> >
> > While Carlos has given you adequate answer, it leaves me wondering why
> > you'd want to do this.
> >
> > While ARM  mode is faster on some devices that is not true for all
> > devices.
>
> Actually, i have not yet concluded that I want to run in thumb mode. I had
> read recently that thumb mode results in smaller and faster code on some
> processors and so i wanted to try it. First i wanted to test whether my
> program works fully when compiled in thumb. I am happy to say that i
> observed no change in functioning of my program when compiled in thumb
> mode.
>
> Now for the performance front. I am still evaluating this. There is a ~35%
> size reduction. I am not pressed for size as i have a AT91SAM7S256 with 256
> KB of flash and even in ARM mode I am consuming only about 90 KB (Release
> mode O3, O2 results in smaller but slower code). I am really interested on
> the speed front that I am yet to test. Does anyone have any comments on
> this?

SOmetimes ARM wiill be faster and sometimes Thumb. There are so many 
dependencies on how you have configured things that there is only Lord 
Kelvin's answer: "To measure is to know".


-O3 optimises for speed, -Os for size. Look at the gcc man pages for more 
details on optimisation.