Subject: Re: Building for both ARM V4 and ARM V5 systems
To: Bucky Katz <firstname.lastname@example.org>
From: Richard Earnshaw <Richard.Earnshaw@buzzard.freeserve.co.uk>
Date: 08/05/2006 02:04:42
On Fri, 04 Aug 2006 16:32:00 PDT, Bucky Katz wrote:
> 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.