From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stefan Roese Date: Thu, 09 Apr 2015 11:22:27 +0200 Subject: [U-Boot] [PATCH v2] arm: support Thumb-1 with CONFIG_SYS_THUMB_BUILD In-Reply-To: <20150225230946.1b0bb4d8@lilith> References: <1422759336-12239-1-git-send-email-albert.u.boot@aribaud.net> <1424786016-12976-1-git-send-email-albert.u.boot@aribaud.net> <20150225230946.1b0bb4d8@lilith> Message-ID: <552644D3.5060806@denx.de> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Albert, On 25.02.2015 23:09, Albert ARIBAUD wrote: > On Tue, 24 Feb 2015 14:53:36 +0100, Albert ARIBAUD > 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 >> --- >> 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