Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Korsgaard <peter@korsgaard.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 02/16] arch/arm: Cortex-M3 provides only Thumb-2
Date: Thu, 17 Mar 2016 12:08:36 +0100	[thread overview]
Message-ID: <874mc5745n.fsf@dell.be.48ers.dk> (raw)
In-Reply-To: <20160317090326.3dbeffb1@free-electrons.com> (Thomas Petazzoni's message of "Thu, 17 Mar 2016 09:03:26 +0100")

>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni@free-electrons.com> writes:

Hi,

 >> I do agree about the change itself, but I also think that HAS_THUMB2 should 
 >> select HAS_THUMB instead. Also, I think the BR2_ARM_INSTRUCTIONS_THUMB2 option 
 >> should be removed, because in the end it's just compiling in thumb mode. In arm 
 >> mode, we also don't have separate options for armv5, armv6, armv7.

 > I originally started to remove BR2_ARM_INSTRUCTIONS_THUMB2, and have a
 > single BR2_ARM_INSTRUCTIONS_THUMB that simply says "use Thumb for that
 > core", which would be Thumb1 for old ARM cores, and Thumb2 for ARMv7.

 > However, there are cases where packages really need to know whether
 > Thumb1 or Thumb2 is used. For example, glibc or musl don't build in
 > Thumb1, so we force ARM instructions. This is fine for Thumb1, because
 > all cores that support Thumb1 also support the ARM instruction set.

 > However, glibc and musl build fine in Thumb2, so there's no reason to
 > force using the ARM instruction set. And Thumb2 is different than
 > Thumb1 in that respect: there are some cores that implement *only*
 > Thumb2 and not ARM (basically, the ARMv7-M ones).

 > So, if we remove BR2_ARM_INSTRUCTIONS_THUMB, we will have to change:

 > ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
 > GLIBC_EXTRA_CFLAGS += -marm
 > endif

 > to something like:

 > ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB):$(BR2_CPU_HAS_THUMB2),y:)
 > GLIBC_EXTRA_CFLAGS += -marm
 > endif

 > And so on everywhere where we need to do things depending on whether
 > Thumb1 or Thumb2 is used.

Yes. A quick grep shows that we only need to do this in a few places:

git grep 'ifeq.*BR2_ARM_INSTRUCTIONS_THUMB),y'
package/dmalloc/dmalloc.mk:ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
package/glibc/glibc.mk:ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
package/libglib2/libglib2.mk:ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)
package/qt/qt.mk:ifeq ($(BR2_ARM_INSTRUCTIONS_THUMB),y)

Notice that we don't seem to do it for musl?

 > So, while using Thumb1 or Thumb2 is just a matter of passing -mthumb to
 > gcc and would therefore lead us to think that a single options is
 > sufficient, I found it clearer to keep two separate options.

Is there any other situations where we want to know the difference
between thumb1 and thumb2? It might make sense to default to thumb
instructions for systems supporting thumb2, but not for systems using
thumb1 and the tradeoff is less clear - But that is also simple to do in
kconfig with:

default BR2_ARM_INSTRUCTIONS_THUMB if BR2_ARM_CPU_HAS_THUMB2

It is really a question about trading off complexity in one place vs
adding it somewhere else, so I'm not sure. You could argue that having a
single thumb kconfig option would be simpler for users though (on the
other hand, having explicit thumb1/thumb2 is perhaps clearer).

-- 
Bye, Peter Korsgaard

  reply	other threads:[~2016-03-17 11:08 UTC|newest]

Thread overview: 68+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-16 21:43 [Buildroot] [PATCH 00/16] ARM Cortex-M support Thomas Petazzoni
2016-03-16 21:43 ` [Buildroot] [PATCH 01/16] arch/arm: introduce and use BR2_ARM_CPU_ARMV7M Thomas Petazzoni
2016-03-16 22:29   ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 02/16] arch/arm: Cortex-M3 provides only Thumb-2 Thomas Petazzoni
2016-03-16 22:43   ` Arnout Vandecappelle
2016-03-17  8:03     ` Thomas Petazzoni
2016-03-17 11:08       ` Peter Korsgaard [this message]
2016-03-17 13:06         ` Thomas Petazzoni
2016-03-17 20:36     ` Thomas Petazzoni
2016-03-17 22:34       ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 03/16] arch/arm: add Cortex-M4 entry Thomas Petazzoni
2016-03-16 22:50   ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 04/16] uclibc: Enable compile in thumb mode when selected Thomas Petazzoni
2016-03-16 23:01   ` Arnout Vandecappelle
2016-03-17 11:21   ` Peter Korsgaard
2016-03-17 13:10     ` Thomas Petazzoni
2016-03-17 21:25     ` Thomas Petazzoni
2016-03-17 21:44       ` Peter Korsgaard
2016-03-17 22:03         ` Thomas Petazzoni
2016-03-17 22:18           ` Peter Korsgaard
2016-03-16 21:43 ` [Buildroot] [PATCH 05/16] uclibc: disable DOPIC on ARM noMMU Thomas Petazzoni
2016-03-16 23:09   ` Arnout Vandecappelle
2016-03-17  8:06     ` Thomas Petazzoni
2016-03-17 10:32       ` Max Filippov
2016-03-17 11:00         ` Thomas Petazzoni
2016-03-17 11:39           ` Max Filippov
2016-03-16 21:43 ` [Buildroot] [PATCH 06/16] uclibc: NPTL thread implementation only available on MMU platforms Thomas Petazzoni
2016-03-16 23:11   ` Arnout Vandecappelle
2016-03-17 12:14   ` Peter Korsgaard
2016-03-17 13:11     ` Thomas Petazzoni
2016-03-17 19:45       ` Waldemar Brodkorb
2016-03-17 20:08         ` Peter Korsgaard
2016-03-16 21:43 ` [Buildroot] [PATCH 07/16] musl: build broken on Thumb, use ARM mode Thomas Petazzoni
2016-03-16 23:14   ` Arnout Vandecappelle
2016-03-17  8:10     ` Thomas Petazzoni
2016-03-16 21:43 ` [Buildroot] [PATCH 08/16] toolchain-buildroot: update glibc comment for noMMU Thomas Petazzoni
2016-03-16 23:18   ` Arnout Vandecappelle
2016-03-18 20:49     ` Thomas Petazzoni
2016-03-18 20:59       ` Peter Korsgaard
2016-03-18 21:33       ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 09/16] toolchain-buildroot: don't show musl on noMMU platforms Thomas Petazzoni
2016-03-16 23:26   ` Arnout Vandecappelle
2016-03-18 20:51     ` Thomas Petazzoni
2016-03-18 21:42       ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 10/16] arch/arm: add support for hard-float on Cortex-M4 Thomas Petazzoni
2016-03-16 23:45   ` Arnout Vandecappelle
2016-03-17  8:16     ` Thomas Petazzoni
2016-03-18 21:47       ` Arnout Vandecappelle
2016-03-18 22:29         ` Thomas Petazzoni
2016-03-16 21:43 ` [Buildroot] [PATCH 11/16] package/Makefile.in: adjust LDFLAGS for elf2flt Thomas Petazzoni
2016-03-16 23:48   ` Arnout Vandecappelle
2016-03-16 21:43 ` [Buildroot] [PATCH 12/16] elf2flt: use new upstream site and add ARM patch Thomas Petazzoni
2016-03-16 23:50   ` Arnout Vandecappelle
2016-03-17  8:18     ` Thomas Petazzoni
2016-03-17 18:53       ` Mike Frysinger
2016-03-17 19:41         ` Waldemar Brodkorb
2016-03-17 20:34         ` Thomas Petazzoni
2016-03-17 20:45           ` Mike Frysinger
2016-03-17 19:39   ` Waldemar Brodkorb
2016-03-16 21:43 ` [Buildroot] [PATCH 13/16] elf2flt: disable Werror to avoid build issues Thomas Petazzoni
2016-03-16 23:53   ` Arnout Vandecappelle
2016-03-17  8:18     ` Thomas Petazzoni
2016-03-17  1:40   ` Mike Frysinger
2016-03-17  8:19     ` Thomas Petazzoni
2016-03-17 18:57       ` Mike Frysinger
2016-03-16 21:43 ` [Buildroot] [PATCH 14/16] afboot-stm32: use the Buildroot toolchain Thomas Petazzoni
2016-03-16 21:43 ` [Buildroot] [PATCH 15/16] configs/stm32f429_disco: new configuration for STM32F429 Discovery board Thomas Petazzoni
2016-03-16 21:43 ` [Buildroot] [PATCH 16/16] configs/stm32f469_disco: new configuration for STM32F469 " Thomas Petazzoni

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=874mc5745n.fsf@dell.be.48ers.dk \
    --to=peter@korsgaard.com \
    --cc=buildroot@busybox.net \
    /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