[U-Boot] [PATCH v2] arm: support Thumb-1 with CONFIG_SYS_THUMB_BUILD

Stefan Roese sr at denx.de
Thu Apr 9 11:22:27 CEST 2015


Hi Albert,

On 25.02.2015 23:09, Albert ARIBAUD wrote:
> On Tue, 24 Feb 2015 14:53:36 +0100, Albert ARIBAUD
> <albert.u.boot at aribaud.net> wrote:
>> When building a THumb-1-only target with CONFIG_SYS_THUMB_BUILD,
>> some files fail to build, most of the time because they include
>> mcr instructions, which only exist for Thumb-2.
>>
>> Thos patch introduces a Kconfig option CONFIG_THUMB2 and uses
>> it to select between Thumb-2 and ARM mode for the aforementioned
>> files.
>>
>> Signed-off-by: Albert ARIBAUD <albert.u.boot at aribaud.net>
>> ---
>> This patch has been build-tested and run-tested on ED Mini V2,
>> above the "edmini: switch to SPL" patch, and found to reduce
>> U-Boot size by 25% and SPL size by 14%... and to run fine. :)
>>
>> This patch has also been tested against side effects on the
>> non-Thumb wireless_space target. The binaries produced with
>> and without ths patch were found to differ only by their
>> version string.
>>
>> Changes in v2:
>> - fixed a typo in the commit message
>> - added file arch/arm/thumb1/include/asm/proc-armv/system.h,
>>    which overrides arch/arm/include/asm/proc-armv/system.h
>>    when building for Thumb-1 and provides non-functional but
>>    Thumb-compilable IRQ and FIQ related macros and functions.
>
> Ok, this does not fare as good as I have hoped, because there are also
> thumb1-unfrendly macros in arch/arm/include/asm/cache.h, this time with
> mcr and mrc instructions.
>
> /me hates macros used as inline functions. :(
>
> I cannot just replace the macros with empty inline functions as I did
> with arch/arm/include/asm/proc-armv/system.h, since this would cause
> cache to not work. :(
>
> This leaves only one solution: when buildding for thumb1, replace the
> macros in cache.h with plain function prototypes, and provide simple
> ARM-state implementations for these. We'll lose a bit of performance as
> instead of a single mcr or mrc instruction, we'll have a call switching
> from Thumb to ARM state, the mcr/mrc instruction, and a return to Thumb
> state. Hopefully that won't hurt performance too much.
>
> V3 in the works.

Any update on this?

Thanks,
Stefan



More information about the U-Boot mailing list