Subject: Re: Building for both ARM V4 and ARM V5 systems
To: Richard Earnshaw <Richard.Earnshaw@buzzard.freeserve.co.uk>
From: Bucky Katz <bucky@picovex.com>
List: port-arm
Date: 08/05/2006 08:10:31
Richard Earnshaw <Richard.Earnshaw@buzzard.freeserve.co.uk> writes:
> On Fri, 04 Aug 2006 16:32:00 PDT, Bucky Katz wrote:
>>
>> Hi,
>>
>> We're in an interesting situation where we need to support both ARM V4
>> and ARM V5 devices. We've encountered a bit of a toolchain issue we're
>> not sure how best to resolve. Obviously, since ARM V5 is a superset
>> of ARM V4, the conservative thing to do is have the compiler generate
>> ARMV V4 instructions, since they will work on both kinds of systems.
>>
>> Unfortunately, we've found a corner case where that doesn't quiet
>> work. Consider a device that is mmapped into user space, or a device
>> driver that has to access such a device. Suppose the device has 16
>> bit wide registers. The "obvious" way to access the device is by
>> using something like
>>
>> volatile ushort ptr = /* WHATEVER THE DEVICE ADDRESS is MAPPED to */
>> ushort value;
>>
>> *ptr = value; /* If you want to store to the device */
>> value = *ptr; /* If you want to read from it. */
>>
>> The problem is that the compiler generates two byte operations for
>> such a reference, rather than one half word operation, for V4.
>
> Nonsense. ARMv4 has half-word operations and if you use -march=armv4 the
> compiler will use them.
>
> I think you must be confusing the default user-space build options which
> are essentially ARMv3.
Aha! Thanks.
User-space and the kernel are both built with the same ARM
toolchain. Is this correct? If so, then if I don't specify -march or
-mcpu in my kernel builds, I get ARM v3 code by default, right?
As far as I could find, none of the arm ports specify -march or -mcpu
in kernel builds. Did I miss where that is done?
Bucky