Skip to contentSkip to conversation

Add ARM Cortex-M3 support

PATCH Superseded Guido Martínez 2 participants 14 messages May 18, 2015 – May 21, 2015 Kbuild

v2 of 5 Superseded Latest is v5 →

lore
Share & tools
lore
#0 lore raw

v2 cover Add ARM Cortex-M3 support

Hi all,

this patchset introduces support for the M3 processors. These processors don't have an MMU and they don't support the regular ARM mode (only Thumb and Thumb2).

The OSELAS 2014.12.0 toolchain is added, along with a few patches to make it usable within BR since it has some quirks. The toolchain is packaged as a .deb package, so I implemented INFLATE.deb so we don't need special EXTRACT_CMDS for it (although that isn't really too ugly, so it's up for discussion).

I'm planning to send a defconfig for the CIAA board[1] once it's mainlined in Linux. But, for now, this config can generate a proper rootfs:
BR2_arm=y
BR2_cortex_m3=y
BR2_TOOLCHAIN_EXTERNAL=y

The changes from v1 (sent by Ezequiel) are:
- Patch 1 was accepted, so dropped it.

- The toolchain checked is not skipped, but done with a different output as Yann suggested.

- This toolchain version is newer than the previous one (2014.12.0 vs (2013.12.2).

- Added a script to implement INFLATE.deb in support/extract/, to avoid custom extract commands. This might also be useful for other packages.

When we sent out v1 there was a discussion about adding BR2_HAS_{ELF,FLAT}_SUPPORT and BR2_HAS_OPTIONAL_MMU to avoid blacklisting each architecture on the ELF, FLAT and MMU configs. I haven't done this for now as it would make it a huge patchset and is a different objective (I think), but I can send a new patch for that if there's interest.

Any comments and testing welcome!

[1] http://www.proyecto-ciaa.com.ar/

--

Guido Mart?nez (6):
arm: update processor types
pkg-utils: implement INFLATE for .deb files
toolchain: allow for stupid toolchains
toolchain: introduce BR2_TOOLCHAIN_HAS_RESOLVER nommu/flat: don't add -elf2flt for some toolchains
toolchain-external: add OSELAS 2014.12.0 Cortex-M3 toolchain

 Makefile                                           |  2 +
 arch/Config.in                                     |  8 ++--
 arch/Config.in.arm                                 |  5 +++
 package/Makefile.in                                |  3 ++
 package/busybox/busybox.mk                         |  3 ++
 package/pkg-utils.mk                               |  1 +
 support/extract/inflate-deb.sh                     |  5 +++
 toolchain/Config.in                                |  6 +++
 toolchain/helpers.mk                               |  6 ++-
 toolchain/toolchain-common.in                      |  6 ++-
 toolchain/toolchain-external/Config.in             | 43 ++++++++++++++++++++++
 .../toolchain-external/toolchain-external.hash     |  4 ++
 toolchain/toolchain-external/toolchain-external.mk | 10 +++++
 13 files changed, 94 insertions(+), 8 deletions(-)
 create mode 100755 support/extract/inflate-deb.sh
Signature · 1 line
2.1.4
#1 lore raw

PATCH v2 1/6 arm: update processor types

Add the Cortex M3 variant. These microcontrollers don't support regular ARM instructions and don't have an MMU.

---
 arch/Config.in                | 8 ++++----
 arch/Config.in.arm            | 5 +++++
 toolchain/toolchain-common.in | 6 ++++--
 3 files changed, 13 insertions(+), 6 deletions(-)
arch/Config.in +4 -4
index 06aff2c..8ff4a05 100644
@@ -244,13 +244,13 @@ config BR2_BINFMT_SUPPORTS_SHARED
 # Set up target binary format
 choice
 	prompt "Target Binary Format"
-	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k)
+	default BR2_BINFMT_ELF if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)
 	default BR2_BINFMT_FDPIC if BR2_bfin
-	default BR2_BINFMT_FLAT if BR2_m68k
+	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
 
 config BR2_BINFMT_ELF
 	bool "ELF"
-	depends on !BR2_bfin && !BR2_m68k
+	depends on !BR2_bfin && !BR2_m68k && !BR2_cortex_m3
 	select BR2_BINFMT_SUPPORTS_SHARED
 	help
 	  ELF (Executable and Linkable Format) is a format for libraries and
@@ -269,7 +269,7 @@ config BR2_BINFMT_FDPIC
 
 config BR2_BINFMT_FLAT
 	bool "FLAT"
-	depends on BR2_bfin || BR2_m68k
+	depends on BR2_bfin || BR2_m68k || BR2_cortex_m3
 	help
 	  FLAT binary is a relatively simple and lightweight executable format
 	  based on the original a.out format. It is widely used in environment
arch/Config.in.arm +5 -0
index f5d317b..44dd47c 100644
@@ -134,6 +134,10 @@ config BR2_cortex_a15
 	select BR2_ARM_CPU_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
+config BR2_cortex_m3
+	bool "cortex-M3"
+	select BR2_ARM_CPU_HAS_THUMB
+	select BR2_ARM_CPU_HAS_THUMB2
 config BR2_fa526
 	bool "fa526/626"
 	select BR2_ARM_CPU_HAS_ARM
@@ -391,6 +395,7 @@ config BR2_GCC_TARGET_CPU
 	default "cortex-a9"	if BR2_cortex_a9
 	default "cortex-a12"	if BR2_cortex_a12
 	default "cortex-a15"	if BR2_cortex_a15
+	default "cortex-m3"	if BR2_cortex_m3
 	default "fa526"		if BR2_fa526
 	default "marvell-pj4"	if BR2_pj4
 	default "strongarm"	if BR2_strongarm
toolchain/toolchain-common.in +4 -2
index d50c908..d71b850 100644
@@ -108,8 +108,10 @@ config BR2_NEEDS_GETTEXT_IF_LOCALE
 	default y if (BR2_NEEDS_GETTEXT && BR2_ENABLE_LOCALE)
 
 config BR2_USE_MMU
-	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
-	default y if !BR2_bfin
+	bool "Enable MMU support"
+	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
+	depends on !BR2_cortex_m3 && !BR2_bfin
+	default y
 	help
 	  If your target has a MMU, you should say Y here.  If you
 	  are unsure, just say Y.
Signature · 1 line
2.1.4
#2 lore raw

PATCH v2 1/6 arm: update processor types

Dear Guido Mart?nez,

toolchain/toolchain-common.in config BR2_NEEDS_GETTEXT_IF_LOCALE · line 113

Quoted 6 lines · Guido Mart?nez

config BR2_USE_MMU

toolchain/toolchain-common.in +3 -2
-	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
-	default y if !BR2_bfin
+	bool "Enable MMU support"
+	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
+	depends on !BR2_cortex_m3 && !BR2_bfin

This breaks things, because now BR2_USE_MMU is empty on architectures others than arm, armeb, sh and xtensa.

What we probably need is something like this:

config BR2_ARCH_MMU_OPTIONAL
bool

config BR2_ARCH_MMU_MANDATORY
bool

and have all ARM cores select BR2_ARCH_MMU_OPTIONAL except Cortex M3, SuperH and Xtensa select BR2_ARCH_MMU_OPTIONAL, all other architectures except Blackfin selecting BR2_ARCH_MMU_MANDATORY.

And then:

	bool "Enable MMU support" if BR2_ARCH_MMU_OPTIONAL
	default y if BR2_ARCH_MMU_MANDATORY || BR2_ARCH_MMU_OPTIONAL

or something like that.

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#3 lore raw

PATCH v2 1/6 arm: update processor types

Quoted 9 lines · Thomas Petazzoni

toolchain/toolchain-common.in config BR2_NEEDS_GETTEXT_IF_LOCALE · line 113

Quoted 6 lines

config BR2_USE_MMU

toolchain/toolchain-common.in +3 -2
-	bool "Enable MMU support" if BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
-	default y if !BR2_bfin
+	bool "Enable MMU support"
+	depends on BR2_arm || BR2_armeb || BR2_sh || BR2_xtensa
+	depends on !BR2_cortex_m3 && !BR2_bfin

This breaks things, because now BR2_USE_MMU is empty on architectures others than arm, armeb, sh and xtensa.

Ugh, stupid me.

Quoted 12 lines

What we probably need is something like this:

config BR2_ARCH_MMU_OPTIONAL
bool

config BR2_ARCH_MMU_MANDATORY
bool

and have all ARM cores select BR2_ARCH_MMU_OPTIONAL except Cortex M3, SuperH and Xtensa select BR2_ARCH_MMU_OPTIONAL, all other architectures except Blackfin selecting BR2_ARCH_MMU_MANDATORY.

Quoted 6 lines

And then:

	bool "Enable MMU support" if BR2_ARCH_MMU_OPTIONAL
	default y if BR2_ARCH_MMU_MANDATORY || BR2_ARCH_MMU_OPTIONAL

or something like that.

Yes, I'll work on something like that.

Sorry for the noise :(

Signature · 2 lines
Guido Mart?nez, VanguardiaSur
www.vanguardiasur.com.ar
#4 lore raw

PATCH v2 1/6 arm: update processor types

Quoted 1 line · Guido Mart?nez

Yes, I'll work on something like that.

I'm sending two patches tidying up the MMU and BINFMT configs. After that I'll respin the m3 series with the changes discussed.

Thanks for the comments!

Signature · 2 lines
Guido Mart?nez, VanguardiaSur
www.vanguardiasur.com.ar
#5 lore raw

PATCH v2 2/6 pkg-utils: implement INFLATE for .deb files

In reply to Guido Martínez

This allows to use packages that are shipped in the .deb format.

---
 Makefile                       | 2 ++
 package/pkg-utils.mk           | 1 +
 support/extract/inflate-deb.sh | 5 +++++
 3 files changed, 8 insertions(+)
 create mode 100755 support/extract/inflate-deb.sh
Makefile +2 -0
index 5c4293b..c20da1f 100644
@@ -339,6 +339,8 @@ KERNEL_ARCH := $(shell echo "$(ARCH)" | sed -e "s/-.*//" \
 ZCAT := $(call qstrip,$(BR2_ZCAT))
 BZCAT := $(call qstrip,$(BR2_BZCAT))
 XZCAT := $(call qstrip,$(BR2_XZCAT))
+export ZCAT BZCAT XZCAT
+
 TAR_OPTIONS = $(call qstrip,$(BR2_TAR_OPTIONS)) -xf
 
 # packages compiled for the host go here
package/pkg-utils.mk +1 -0
index 99a3c1e..196dd36 100644
@@ -77,6 +77,7 @@ INFLATE.tbz  = $(BZCAT)
 INFLATE.tbz2 = $(BZCAT)
 INFLATE.tgz  = $(ZCAT)
 INFLATE.xz   = $(XZCAT)
+INFLATE.deb  = ./support/extract/inflate-deb.sh
 INFLATE.tar  = cat
 # suitable-extractor(filename): returns extractor based on suffix
 suitable-extractor = $(INFLATE$(suffix $(1)))
support/extract/inflate-deb.sh new file +5 -0
new file mode 100755
index 0000000..39e7b52
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+
+DEBFILE=$1
+
+ar fp ${DEBFILE} data.tar.xz | ${XZCAT} -d
Signature · 1 line
2.1.4
#6 lore raw

PATCH v2 2/6 pkg-utils: implement INFLATE for .deb files

Dear Guido Mart?nez,

Quoted 1 line · Guido Mart?nez

+ar fp ${DEBFILE} data.tar.xz | ${XZCAT} -d

Are all Debian .deb packages compressed with the xz compression? How many packages would benefit for this being supported at the package infra level vs. handling it directly in the toolchain-external package?

We normally try to not clutter the package infra with features only useful to one package, especially when the feature can easily be implemented at the package level.

Best regards,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#7 lore raw

PATCH v2 2/6 pkg-utils: implement INFLATE for .deb files

Quoted 9 lines · Thomas Petazzoni

Dear Guido Mart?nez,

Quoted 1 line · Guido Mart?nez

+ar fp ${DEBFILE} data.tar.xz | ${XZCAT} -d

Are all Debian .deb packages compressed with the xz compression? How many packages would benefit for this being supported at the package infra level vs. handling it directly in the toolchain-external package?

I had tried with several packages and found they were all XZ-compressed, but I just tried with ~6000 packages and saw that only 90% are XZ-compressed, so this wouldn't work.

I also don't know of any packages we might want to use are only shipped the .deb format.

Quoted 3 lines

We normally try to not clutter the package infra with features only useful to one package, especially when the feature can easily be implemented at the package level.

Yeah, I agree. I'll drop this and revert back to custom extract commands.

Signature · 2 lines
Guido Mart?nez, VanguardiaSur
www.vanguardiasur.com.ar
#8 lore raw

PATCH v2 3/6 toolchain: allow for stupid toolchains

In reply to Guido Martínez

check_arm_abi builds a test C file to check that the toolchain is working correctly, with the output redirected to /dev/null.

However, some toolchains (OSELAS 2014.12.0, for instance) foolishly append ".gdb" to the output filename for an intermediate file, causing an attempt to write to /dev/null.gdb, which obviously fails.

Fix this by adding changing the output to a temporary file, which is later removed along with any other "suffixed" files.

---
 toolchain/helpers.mk | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
toolchain/helpers.mk +4 -2
index 30eb065..0dc1864 100644
@@ -308,12 +308,14 @@ check_arm_abi = \
 		echo "External toolchain uses the unsuported OABI" ; \
 		exit 1 ; \
 	fi ; \
-	if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o /dev/null - ; then \
+	if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o $(BUILD_DIR)/.br-toolchain-test.tmp - ; then \
+		rm -f $(BUILD_DIR)/.br-toolchain-test.tmp*; \
 		abistr_$(BR2_ARM_EABI)='EABI'; \
 		abistr_$(BR2_ARM_EABIHF)='EABIhf'; \
 		echo "Incorrect ABI setting: $${abistr_y} selected, but toolchain is incompatible"; \
 		exit 1 ; \
-	fi
+	fi ; \
+	rm -f $(BUILD_DIR)/.br-toolchain-test.tmp*
 
 #
 # Check that the external toolchain supports C++
Signature · 1 line
2.1.4
#9 lore raw

PATCH v2 4/6 toolchain: introduce BR2_TOOLCHAIN_HAS_RESOLVER

In reply to Guido Martínez

Add a Kconfig option specifying if the toolchain supports name resolving (or at least has stubs for it) so we can disable packages that depend on that (or they would fail to link). For now, only disable the 'nslookup' tool from BusyBox if there's no resolver support.

---
 package/busybox/busybox.mk             |  3 +++
 toolchain/Config.in                    |  3 +++
 toolchain/toolchain-external/Config.in | 29 +++++++++++++++++++++++++++++
 3 files changed, 35 insertions(+)
package/busybox/busybox.mk +3 -0
index 1ce508a..44416a8 100644
@@ -155,6 +155,9 @@ endif
 # full-blown versions of apps installed by other packages with sym/hard links.
 define BUSYBOX_NOCLOBBER_INSTALL
 	$(SED) 's/^noclobber="0"$$/noclobber="1"/' $(@D)/applets/install.sh
+	$(if $(BR2_TOOLCHAIN_HAS_RESOLVER),,
+		$(call KCONFIG_DISABLE_OPT,CONFIG_NSLOOKUP,$(@D)/.config)
+	)
 endef
 
 define BUSYBOX_KCONFIG_FIXUP_CMDS
toolchain/Config.in +3 -0
index a851ce4..7e66de0 100644
@@ -20,6 +20,9 @@ config BR2_TOOLCHAIN_USES_GLIBC
 config BR2_TOOLCHAIN_USES_UCLIBC
 	bool
 
+config BR2_TOOLCHAIN_HAS_RESOLVER
+	bool
+
 config BR2_TOOLCHAIN_USES_MUSL
 	bool
 	select BR2_USE_WCHAR
toolchain/toolchain-external/Config.in +29 -0
index 6ea6838..3469fbc 100644
@@ -18,6 +18,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARM
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Linaro toolchain for the ARM architecture. It uses Linaro
 	  GCC 2014.09 (based on gcc 4.9), Linaro GDB 2013.10 (based on
@@ -44,6 +45,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_ARMEB
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_1
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Linaro toolchain for the ARM big endian architecture. It
 	  uses Linaro GCC 2014.09 (based on gcc 4.9), Linaro GDB
@@ -69,6 +71,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201405
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the ARM architecture, from
 	  Mentor Graphics. It uses gcc 4.8.3, binutils 2.24.51, glibc
@@ -98,6 +101,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201311
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the ARM architecture, from
 	  Mentor Graphics. It uses gcc 4.8.1, binutils 2.23.52, glibc
@@ -126,6 +130,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201305
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_8
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the ARM architecture, from
 	  Mentor Graphics. It uses gcc 4.7.3, binutils 2.23.52, glibc
@@ -159,6 +164,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A_201109
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	# kernel headers: 2.6.31
 	help
 	  Texas Instruments Arago 2011.09 toolchain, with gcc 4.5.3,
@@ -181,6 +187,7 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	# kernel headers: 2.6.31
 	help
 	  Texas Instruments Arago ARMv5 2011.09 toolchain, with gcc
@@ -199,6 +206,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the MIPS architecture, from
 	  Mentor Graphics. It uses gcc 4.9.1, binutils 2.24.51, glibc
@@ -284,6 +292,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201405
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the MIPS architecture, from
 	  Mentor Graphics. It uses gcc 4.8.3, binutils 2.24.51, glibc
@@ -369,6 +378,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201311
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_11
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the MIPS architecture, from
 	  Mentor Graphics. It uses gcc 4.8.1, binutils 2.23.52, glibc
@@ -457,6 +467,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201405
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the Nios-II architecture,
 	  from Mentor Graphics. It uses gcc 4.8.3, binutils 2.24.51,
@@ -472,6 +483,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the Nios-II architecture,
 	  from Mentor Graphics. It uses gcc 4.7.3, binutils 2.23.52,
@@ -488,6 +500,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201203
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the PowerPC architecture,
 	  from Mentor Graphics. It uses gcc 4.6.3, binutils 2.21.53,
@@ -504,6 +517,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201103
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	# kernel headers: 2.6.38
 	help
 	  Sourcery CodeBench toolchain for the PowerPC architecture,
@@ -536,6 +550,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201009
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	# kernel headers: 2.6.35
 	help
 	  Sourcery CodeBench toolchain for the PowerPC architecture,
@@ -569,6 +584,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201209
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the SuperH architecture,
 	  from Mentor Graphics. It uses gcc 4.7.2, binutils 2.23.51,
@@ -592,6 +608,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201203
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the SuperH architecture,
 	  from Mentor Graphics. It uses gcc 4.6.3, binutils 2.21.53,
@@ -616,6 +633,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201103
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	# kernel headers: 2.6.38
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the SuperH architecture,
 	  from Mentor Graphics. It uses gcc 4.5.2, binutils 2.20,
@@ -641,6 +659,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AMD64_201405
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the amd64 (x86_64)
 	  architectures, from Mentor Graphics. It uses gcc 4.8.3,
@@ -665,6 +684,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201209
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the x86/x86_64
 	  architectures, from Mentor Graphics. It uses gcc 4.7.2,
@@ -692,6 +712,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201203
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_2
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the x86/x86_64
 	  architectures, from Mentor Graphics. It uses gcc 4.6.3,
@@ -720,6 +741,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_X86_201109
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_0
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the x86/x86_64
 	  architectures, from Mentor Graphics. It uses gcc 4.6.1,
@@ -748,6 +770,7 @@ config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2014R1
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain for the Blackfin architecture, from
 	  http://blackfin.uclinux.org.
@@ -764,6 +787,7 @@ config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2013R1
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_10
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain for the Blackfin architecture, from
 	  http://blackfin.uclinux.org.
@@ -780,6 +804,7 @@ config BR2_TOOLCHAIN_EXTERNAL_BLACKFIN_UCLINUX_2012R2
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_5
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain for the Blackfin architecture, from
 	  http://blackfin.uclinux.org.
@@ -794,6 +819,7 @@ config BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_7
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain for the AArch64 architecture, from
 	  http://www.linaro.org/engineering/armv8/
@@ -808,6 +834,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HAS_NATIVE_RPC
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Sourcery CodeBench toolchain for the AArch64 architecture,
 	  from Mentor Graphics. It uses gcc 4.8.3, binutils 2.24,
@@ -823,6 +850,7 @@ config BR2_TOOLCHAIN_EXTERNAL_MUSL_CROSS
 	select BR2_INSTALL_LIBSTDCPP
 	select BR2_HOSTARCH_NEEDS_IA32_LIBS
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain based on the Musl C library, provided by the
 	  musl-cross project. It uses gcc 4.9.2, binutils 2.25 and
@@ -849,6 +877,7 @@ config BR2_TOOLCHAIN_EXTERNAL_SYNOPSYS_ARC_2014_12
 	select BR2_TOOLCHAIN_HAS_THREADS
 	select BR2_TOOLCHAIN_HAS_THREADS_DEBUG
 	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_13
+	select BR2_TOOLCHAIN_HAS_RESOLVER
 	help
 	  Toolchain for the ARC cores, from
 	  https://github.com/foss-for-synopsys-dwc-arc-processors/toolchain/releases
Signature · 1 line
2.1.4
#10 lore raw

PATCH v2 5/6 nommu/flat: don't add -elf2flt for some toolchains

In reply to Guido Martínez

Some toolchains (OSELAS 2014.12.0, for instance) internally do elf2flt conversion without having to add anything to {C,CXX,LD}FLAGS. So, add an option that allows to not add these flags.

---
 package/Makefile.in | 3 +++
 toolchain/Config.in | 3 +++
 2 files changed, 6 insertions(+)
package/Makefile.in +3 -0
index a0c5a7a..0ac1a94 100644
@@ -142,12 +142,15 @@ TARGET_CXXFLAGS = $(TARGET_CFLAGS)
 TARGET_LDFLAGS = $(call qstrip,$(BR2_TARGET_LDFLAGS))
 
 ifeq ($(BR2_BINFMT_FLAT),y)
+# Don't add any flags for toolchains that don't require it
+ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)
 TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
 endif
+endif
 
 ifeq ($(BR2_BINFMT_FLAT_SHARED),y)
 TARGET_LDFLAGS += -mid-shared-library -mshared-library-id=0
toolchain/Config.in +3 -0
index 7e66de0..fd8dc43 100644
@@ -23,6 +23,9 @@ config BR2_TOOLCHAIN_USES_UCLIBC
 config BR2_TOOLCHAIN_HAS_RESOLVER
 	bool
 
+config BR2_TOOLCHAIN_DONT_ELF2FLT
+	bool
+
 config BR2_TOOLCHAIN_USES_MUSL
 	bool
 	select BR2_USE_WCHAR
Signature · 1 line
2.1.4
#11 lore raw

PATCH v2 5/6 nommu/flat: don't add -elf2flt for some toolchains

Dear Guido Mart?nez,

package/Makefile.in TARGET_CXXFLAGS = $(TARGET_CFLAGS) · line 146

Quoted 3 lines · Guido Mart?nez

ifeq ($(BR2_BINFMT_FLAT),y)

package/Makefile.in +2 -0
+# Don't add any flags for toolchains that don't require it
+ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)

An option named "DONT_<something>" really isn't nice.

package/Makefile.in TARGET_CXXFLAGS = $(TARGET_CFLAGS) · line 151

Quoted 5 lines

TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\

package/Makefile.in +0 -0
 	-Wl$(comma)-elf2flt)
 TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)

But the Blackfin toolchain also doesn't need -elf2flt as far as I know, the FLAT toolchain also directly produces FLAT binaries without specifying any flags. Maybe we should instead adjust the logic here instead of working around it?

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#12 lore raw

PATCH v2 5/6 nommu/flat: don't add -elf2flt for some toolchains

Quoted 16 lines · Thomas Petazzoni

Dear Guido Mart?nez,

package/Makefile.in TARGET_CXXFLAGS = $(TARGET_CFLAGS) · line 146

Quoted 3 lines · Guido Mart?nez

ifeq ($(BR2_BINFMT_FLAT),y)

package/Makefile.in +2 -0
+# Don't add any flags for toolchains that don't require it
+ifneq ($(BR2_TOOLCHAIN_DONT_ELF2FLT),y)

An option named "DONT_<something>" really isn't nice.

package/Makefile.in TARGET_CXXFLAGS = $(TARGET_CFLAGS) · line 151

Quoted 5 lines

TARGET_CFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\

package/Makefile.in +0 -0
 	-Wl$(comma)-elf2flt)
 TARGET_CXXFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-Wl$(comma)-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),\
 	-Wl$(comma)-elf2flt)
 TARGET_LDFLAGS += $(if $($(PKG)_FLAT_STACKSIZE),-elf2flt=-s$($(PKG)_FLAT_STACKSIZE),-elf2flt)
Quoted 3 lines

But the Blackfin toolchain also doesn't need -elf2flt as far as I know, the FLAT toolchain also directly produces FLAT binaries without specifying any flags.

Hm, that's right. In that case I don't know why -elf2flt is specified when there's no $(PKG)_FLAT_STACKSIZE. For this particular toolchain it causes the linker to explode while building U-boot, which doesn't happen with other toolchains.

Removing "-Wl$(comma)-elf2flt" from the else-part fixes it too.

I'll into it some more.

Signature · 2 lines
Guido Mart?nez, VanguardiaSur
www.vanguardiasur.com.ar
#13 lore raw

PATCH v2 6/6 toolchain-external: add OSELAS 2014.12.0 Cortex-M3 toolchain

In reply to Guido Martínez

Binary toolchain based on uClibc for Cortex-M3 processor based on GCC 4.9.2.

This toolchain has no resolver support, and runs elf2flt automatically when called. Thus, we don't select BR2_HAS_RESOLVER_SUPPORT and we do select BR2_TOOLCHAIN_DONT_ELF2FLT.

---
 toolchain/toolchain-external/Config.in               | 14 ++++++++++++++
 toolchain/toolchain-external/toolchain-external.hash |  4 ++++
 toolchain/toolchain-external/toolchain-external.mk   | 10 ++++++++++
 3 files changed, 28 insertions(+)
toolchain/toolchain-external/Config.in +14 -0
index 3469fbc..34a0835 100644
@@ -195,6 +195,19 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
 
 	  This toolchain uses software-floating point.
 
+config BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3_201412
+	bool "OSELAS ARM Cortex-M3 2014.12"
+	depends on BR2_arm
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_16
+	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
+	select BR2_LARGEFILE
+	select BR2_INET_IPV6
+	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_TOOLCHAIN_DONT_ELF2FLT
+	help
+	  OSELAS binary toolchain for Cortex-M3.
+
 config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411
 	bool "Sourcery CodeBench MIPS 2014.11"
 	depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
@@ -941,6 +954,7 @@ config BR2_TOOLCHAIN_EXTERNAL_PREFIX
 	default "arm-none-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_ARM201405
 	default "arm-arago-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV7A_201109
 	default "arm-arago-linux-gnueabi" if BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
+	default "arm-cortexm3-uclinuxeabi" if BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3_201412
 	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
 	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
 	default "mips-linux-gnu"         if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201311
toolchain/toolchain-external/toolchain-external.hash +4 -0
index 444ddfd..ada42c8 100644
@@ -74,3 +74,7 @@ sha256 79a1a4be93e2a63acb137170e98bdfbf744bd9ca7b15b76ab512d1e0dfec834e  crossx8
 sha256 aec4d560dc601e397fc86a9759166005afba22ad666d1a48019b5102c534ccc1  crossx86-sh4eb-linux-musl-1.1.6.tar.xz
 sha256 68eda0795aacd4371b45a6c58c5c75e86c0c2fdf7ebc2c0b7d3752462c848260  crossx86-x86_64-linux-musl-1.1.6.tar.xz
 sha256 6bef5ee2cdb9fa35e49ce0a270f6d7c48f3268c6f6345ad5ca0b8137982b4690  crossx86-x86_64-x32-linux-musl-1.1.6.tar.xz
+
+# Oselas Cortex-M3 toolchain
+# Locally calculated
+sha1	75e7ae45b514b10ad64ff5588770434cea755496	oselas.toolchain-2014.12.0-arm-cortexm3-uclinuxeabi-gcc-4.9.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.16-sanitized_2014.12.0_i386.deb
toolchain/toolchain-external/toolchain-external.mk +10 -0
index b293ba9..808ee85 100644
@@ -293,6 +293,9 @@ TOOLCHAIN_EXTERNAL_SOURCE = mips-2014.05-27-mips-linux-gnu-i686-pc-linux-gnu.tar
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411),y)
 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/mips-linux-gnu
 TOOLCHAIN_EXTERNAL_SOURCE = mips-2014.11-22-mips-linux-gnu-i686-pc-linux-gnu.tar.bz2
+else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3_201412),y)
+TOOLCHAIN_EXTERNAL_SITE = http://debian.pengutronix.de/debian/pool/main/o/oselas.toolchain/
+TOOLCHAIN_EXTERNAL_SOURCE = oselas.toolchain-2014.12.0-arm-cortexm3-uclinuxeabi-gcc-4.9.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.16-sanitized_2014.12.0_i386.deb
 else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_NIOSII201305),y)
 TOOLCHAIN_EXTERNAL_SITE = http://sourcery.mentor.com/public/gnu_toolchain/nios2-linux-gnu
 TOOLCHAIN_EXTERNAL_SOURCE = sourceryg++-2013.05-43-nios2-linux-gnu-i686-pc-linux-gnu.tar.bz2
@@ -421,6 +424,13 @@ define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
 	$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_EXTRA_DOWNLOADS) | \
 		$(TAR) $(TAR_STRIP_COMPONENTS)=3 --hard-dereference -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
 endef
+else ifeq ($(BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3_201412),y)
+# Special handling for OSELAS toolchains
+define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
+	mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
+	$(call suitable-extractor,$(TOOLCHAIN_EXTERNAL_SOURCE)) $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE) | \
+		$(TAR) $(TAR_STRIP_COMPONENTS)=5 --hard-dereference -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
+endef
 else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
 # Normal handling of toolchain tarball extraction.
 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
Signature · 1 line
2.1.4