[PATCH] arm: ARMv4 assembly compatibility

Sergei Antonov saproj at gmail.com
Wed Aug 17 10:27:39 CEST 2022


On Tue, 16 Aug 2022 at 19:17, Andre Przywara <andre.przywara at arm.com> wrote:
>
> On Wed, 10 Aug 2022 12:04:46 +0300
> Sergei Antonov <saproj at gmail.com> wrote:
>
> Hi,
>
> > There is currently a problem that U-Boot can not work on ARMv4
> > because assembly imlementations of memcpy() and some other functions
> > use "bx lr" instruction that is not available on ARMv4 ("mov pc, lr"
> > should be used instead).
>
> So there is a comment in the current code, right above what's shown here in
> the first hunk, which says:
> /*
>  * We only support cores that support at least Thumb-1 and thus we use
>  * 'bx lr'
>  */

I did not notice it. Thanks.

> This was added by Tom in commit 431afb4ef9fe, when he removed some code
> very close to what you are adding back now.
>
> So what is the story here? This commit seems to suggest U-Boot doesn't support
> even ARMv5 without "T", has this changed? There are probably other code
> places which would need adjustment to run on ARMv4?

I can not explain why there was __ARM_ARCH_5E__ in the removed code. I
am dealing with the issue that ARMv4 ("four" without letter "t") does
not understand "bx lr" while ARMv4T does. The device on which I run
modern U-Boot has FA526 - a CPU similar to ARM810 which is ARMv4
without Thumb. Its MIDR register is 0x66015261 which means that
Architecture=1.

> Tom, can you say why support for Thumb-less code / older architectures was
> dropped? No users, I guess?
>
> Sergei, can you say what is this for? Are you adding support for a SoC
> with an ARM810 core from 1996?

Yes.
And U-Boot for this device is already working: able to boot Linux and
do TFTP stuff. My company is going to use it on hundreds of devices.
It would be great for us to not have to patch U-Boot locally and have
ARMv4-compatible assembly in the mainline.


More information about the U-Boot mailing list