This is the mail archive of the crossgcc@sources.redhat.com mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ARM: Forcing halfword operation for (short *)?


On Tue, 2004-11-09 at 15:22, Toralf Lund wrote:
> Sigh... Another problem with my ARM setup, after trying to access some 
> additional hardware... Seems like I still have a lot to learn about the 
> fine level of control over I/O-operations...
> 
> Anyhow, the problem this time is the access size of a specific write 
> operation. Consider the following function, which is a simplified 
> version of one actually appearing in my application:
> 
> int eraseTest()
> {
>   volatile unsigned short *sector=(unsigned short *)0x10000000;
>  
>   *sector=(unsigned short )0x0030;
> }
> 
> The code generated for this is (from 'objdump -d' output):

> [sample code indicating use or strb]

You need to tell the compiler that you are running the code on a core
that has half-word memory instructions.  Early ARM processors did not
have these instructions, and the default for some gcc configurations
assume this restriction.

If you know the CPU you will be running the code on you can use
-mcpu=<name> when compiling.  See the manual for the list of known CPUs
(it's a long list these days).  If you don't see an exact match, there's
usually one that will be close enough for your purposes.

R.

------
Want more information?  See the CrossGCC FAQ, http://www.objsw.com/CrossGCC/
Want to unsubscribe? Send a note to crossgcc-unsubscribe@sources.redhat.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]