public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stefan Roese <sr@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH] arm: support Thumb-1 with CONFIG_SYS_THUMB_BUILD
Date: Tue, 10 Feb 2015 14:36:35 +0100	[thread overview]
Message-ID: <54DA0963.60402@denx.de> (raw)
In-Reply-To: <1422759336-12239-1-git-send-email-albert.u.boot@aribaud.net>

Hi Albert,

On 01.02.2015 03:55, 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.
> 
> This code has been build-tested and run-tested on ED Mini V2,
> both with U-Boot and SPL.
> 
> Signed-off-by: Albert ARIBAUD <albert.u.boot@aribaud.net>

Thanks. This helped me to get Thumb-1 working on the x600 (SPEAr600
with ARM926EJS). Where I some size constraints. So for this patch:

Tested-by: Stefan Roese <sr@denx.de>

But I have another Thumb-1 related problem. I'm also including UBIFS
in my board. And this results in these errors:

{standard input}: Assembler messages:
{standard input}:695: Error: selected processor does not support Thumb mode `mrs r2,cpsr'
{standard input}:696: Error: unshifted register required -- `orr r1,r2,#128'
{standard input}:697: Error: selected processor does not support Thumb mode `msr cpsr_c,r1'
{standard input}:711: Error: selected processor does not support Thumb mode `msr cpsr_c,r2'
{standard input}:766: Error: selected processor does not support Thumb mode `mrs r2,cpsr'
{standard input}:767: Error: unshifted register required -- `orr r4,r2,#128'
{standard input}:768: Error: selected processor does not support Thumb mode `msr cpsr_c,r4'
{standard input}:782: Error: selected processor does not support Thumb mode `msr cpsr_c,r2'
make[2]: *** [fs/ubifs/super.o] Error 1
...

This is because the UBIFS code uses the atomic_foo() functions
and the bitops functions. Which call the local_irq_foo() functions.
And these include the "msr/mrs" instructions, which seem to be
unsupported in Thumb-1, similar to the "mcr" instruction.

I've "solved" this problem by adding these lines to the UBIFS
Makefile:

+# some files can only build in ARM or THUMB2, not THUMB1
+ifdef CONFIG_SYS_THUMB_BUILD
+ifndef CONFIG_HAS_THUMB2
+CFLAGS_lpt.o := -marm
+CFLAGS_lpt_commit.o := -marm
+CFLAGS_super.o := -marm
+CFLAGS_tnc.o := -marm
+CFLAGS_tnc_misc.o := -marm
+endif
+endif

But I'm not really happy with this "solution".

Another option would be to remove all the irq_off/_on stuff from
the atomic_foo() and the bitops functions. We are running in a
single-threaded environment after all in U-Boot. So there should
be no need for such synch mechanisms. But these files are copied
from Linux. And I really don't like to make changes to these files.

And ideas / comments welcome.

BTW: You can easily test this on your ED Mini board as well by
enabling UBI & UBIFS support. Then you also should see those errors.

Thanks,
Stefan

  reply	other threads:[~2015-02-10 13:36 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-01  2:55 [U-Boot] [PATCH] arm: support Thumb-1 with CONFIG_SYS_THUMB_BUILD Albert ARIBAUD
2015-02-10 13:36 ` Stefan Roese [this message]
2015-02-24 13:55   ` Albert ARIBAUD
2015-02-24 13:53 ` [U-Boot] [PATCH v2] " Albert ARIBAUD
2015-02-24 14:00   ` Albert ARIBAUD
2015-02-25 22:09   ` Albert ARIBAUD
2015-04-09  9:22     ` Stefan Roese
2015-04-13 17:47       ` Albert ARIBAUD

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=54DA0963.60402@denx.de \
    --to=sr@denx.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox