All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 0/4] ARM Cortex-M3 support
@ 2015-01-22 18:33 Ezequiel Garcia
  2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
                   ` (4 more replies)
  0 siblings, 5 replies; 18+ messages in thread
From: Ezequiel Garcia @ 2015-01-22 18:33 UTC (permalink / raw)
  To: buildroot

A small patchset to add support for Cortex-M3 building. It allows
to produce nice Buildroot-based rootfs, on MMUless MCUs such as NXP LPC
Cortex-M3.

The work was originally started by Thomas, who kindly shared with us.
Guido wrote the rest of the patches, and cleaned-up a bit the support
to make it acceptable upstream.

I have tested it and it works fairly well on LPC43xx-based board, with
8 MiB of external SDRAM, which proved to be enough to get to a shell
and run some commands. However, I had to tailor the Busybox configuration
heavily to avoid memory depletion and the OOM assasin.

Comments welcome.

/*
 * As an interesting trivia, this board is the result of the collective effort
 * of Argentine universities and small companies to produce an industrial-grade
 * open board. More info about the Linux port:
 * http://www.proyecto-ciaa.com.ar/devwiki/doku.php?id=desarrollo:linux:linux_en_ciaa-nxp
 * The links are in spanish, though.
 */

Guido Mart?nez (3):
  arm: conditionally support regular ARM instructions
  arm: update processor types
  toolchain: allow for stupid toolchains

Thomas Petazzoni (1):
  toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain

 arch/Config.in                                     |  8 +++----
 arch/Config.in.arm                                 | 28 +++++++++++++++++++++-
 toolchain/helpers.mk                               |  6 ++++-
 toolchain/toolchain-common.in                      |  6 +++--
 toolchain/toolchain-external/Config.in             | 16 +++++++++++++
 .../toolchain-external/toolchain-external.hash     |  3 +++
 toolchain/toolchain-external/toolchain-external.mk | 11 +++++++++
 7 files changed, 70 insertions(+), 8 deletions(-)

-- 
2.2.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions
  2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
@ 2015-01-22 18:33 ` Ezequiel Garcia
  2015-02-02 16:17   ` Romain Naour
  2015-02-02 20:18   ` Thomas Petazzoni
  2015-01-22 18:33 ` [Buildroot] [PATCH 2/4] arm: update processor types Ezequiel Garcia
                   ` (3 subsequent siblings)
  4 siblings, 2 replies; 18+ messages in thread
From: Ezequiel Garcia @ 2015-01-22 18:33 UTC (permalink / raw)
  To: buildroot

From: Guido Mart?nez <guido@vanguardiasur.com.ar>

Until now, all ARM processors supported the original ARM instructions.
However, the Cortex-M variants don't support them, and support only
Thumb/Thumb2 modes.

So, make a Kconfig option for ARM support and use it.

Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
---
 arch/Config.in.arm | 23 ++++++++++++++++++++++-
 1 file changed, 22 insertions(+), 1 deletion(-)

diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index 162191b..a2d113a 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -31,6 +31,9 @@ config BR2_ARM_CPU_HAS_VFPV4
 	bool
 	select BR2_ARM_CPU_HAS_VFPV3
 
+config BR2_ARM_CPU_HAS_ARM
+	bool
+
 config BR2_ARM_CPU_HAS_THUMB
 	bool
 
@@ -58,83 +61,100 @@ choice
 
 config BR2_arm920t
 	bool "arm920t"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV4
 config BR2_arm922t
 	bool "arm922t"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV4
 config BR2_arm926t
 	bool "arm926t"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_MAYBE_HAS_VFPV2
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV5
 config BR2_arm1136jf_s
 	bool "arm1136jf-s"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_VFPV2
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV6
 config BR2_arm1176jz_s
 	bool "arm1176jz-s"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV6
 config BR2_arm1176jzf_s
 	bool "arm1176jzf-s"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_VFPV2
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV6
 config BR2_cortex_a5
 	bool "cortex-A5"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_MAYBE_HAS_NEON
 	select BR2_ARM_CPU_MAYBE_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_cortex_a7
 	bool "cortex-A7"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_NEON
 	select BR2_ARM_CPU_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_cortex_a8
 	bool "cortex-A8"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_NEON
 	select BR2_ARM_CPU_HAS_VFPV3
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_cortex_a9
 	bool "cortex-A9"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_MAYBE_HAS_NEON
 	select BR2_ARM_CPU_MAYBE_HAS_VFPV3
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_cortex_a12
 	bool "cortex-A12"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_NEON
 	select BR2_ARM_CPU_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_cortex_a15
 	bool "cortex-A15"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_NEON
 	select BR2_ARM_CPU_HAS_VFPV4
 	select BR2_ARM_CPU_HAS_THUMB2
 	select BR2_ARM_CPU_ARMV7A
 config BR2_fa526
 	bool "fa526/626"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_ARMV4
 config BR2_pj4
 	bool "pj4"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_VFPV3
 	select BR2_ARM_CPU_ARMV7A
 config BR2_strongarm
 	bool "strongarm sa110/sa1100"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_ARMV4
 config BR2_xscale
 	bool "xscale"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_HAS_THUMB
 	select BR2_ARM_CPU_ARMV5
 config BR2_iwmmxt
 	bool "iwmmxt"
+	select BR2_ARM_CPU_HAS_ARM
 	select BR2_ARM_CPU_ARMV5
 endchoice
 
@@ -318,10 +338,11 @@ endchoice
 
 choice
 	prompt "ARM instruction set"
-	depends on BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2
+	depends on BR2_ARM_CPU_HAS_ARM || BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2
 
 config BR2_ARM_INSTRUCTIONS_ARM_CHOICE
 	bool "ARM"
+	depends on BR2_ARM_CPU_HAS_ARM
 	help
 	  This option instructs the compiler to generate regular ARM
 	  instructions, that are all 32 bits wide.
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
  2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
@ 2015-01-22 18:33 ` Ezequiel Garcia
  2015-02-02 16:18   ` Romain Naour
  2015-01-22 18:33 ` [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains Ezequiel Garcia
                   ` (2 subsequent siblings)
  4 siblings, 1 reply; 18+ messages in thread
From: Ezequiel Garcia @ 2015-01-22 18:33 UTC (permalink / raw)
  To: buildroot

From: Guido Mart?nez <guido@vanguardiasur.com.ar>

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

Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
---
 arch/Config.in                | 8 ++++----
 arch/Config.in.arm            | 5 +++++
 toolchain/toolchain-common.in | 6 ++++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/arch/Config.in b/arch/Config.in
index 890e7e2..6f7d608 100644
--- a/arch/Config.in
+++ b/arch/Config.in
@@ -258,13 +258,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
@@ -283,7 +283,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
diff --git a/arch/Config.in.arm b/arch/Config.in.arm
index a2d113a..1e22ab8 100644
--- a/arch/Config.in.arm
+++ b/arch/Config.in.arm
@@ -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
@@ -396,6 +400,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
diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
index 2ee2019..fd6ef53 100644
--- a/toolchain/toolchain-common.in
+++ b/toolchain/toolchain-common.in
@@ -114,8 +114,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.
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains
  2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
  2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
  2015-01-22 18:33 ` [Buildroot] [PATCH 2/4] arm: update processor types Ezequiel Garcia
@ 2015-01-22 18:33 ` Ezequiel Garcia
  2015-01-25 19:32   ` Thomas Petazzoni
  2015-02-02 16:18   ` Romain Naour
  2015-01-22 18:33 ` [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain Ezequiel Garcia
  2015-02-02 20:19 ` [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Thomas Petazzoni
  4 siblings, 2 replies; 18+ messages in thread
From: Ezequiel Garcia @ 2015-01-22 18:33 UTC (permalink / raw)
  To: buildroot

From: Guido Mart?nez <guido@vanguardiasur.com.ar>

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 2013.12.2, 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 an option to skip this check, so it can be selected
in the OSELAS toolchain.

Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
---
 toolchain/helpers.mk                   | 6 +++++-
 toolchain/toolchain-external/Config.in | 4 ++++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
index 3121da4..d008a4f 100644
--- a/toolchain/helpers.mk
+++ b/toolchain/helpers.mk
@@ -297,13 +297,17 @@ check_arm_abi = \
 	if ! echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabi(hf)?$$' ; then \
 		echo "External toolchain uses the unsuported OABI" ; \
 		exit 1 ; \
-	fi ; \
+	fi
+
+ifneq ($(BR2_ARM_TOOLCHAIN_SKIP_CHECK),y)
+check_arm_abi += ; \
 	if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o /dev/null - ; then \
 		abistr_$(BR2_ARM_EABI)='EABI'; \
 		abistr_$(BR2_ARM_EABIHF)='EABIhf'; \
 		echo "Incorrect ABI setting: $${abistr_y} selected, but toolchain is incompatible"; \
 		exit 1 ; \
 	fi
+endif
 
 #
 # Check that the external toolchain supports C++
diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 50daa66..3b0f4cb 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -1,5 +1,9 @@
 if BR2_TOOLCHAIN_EXTERNAL
 
+config BR2_ARM_TOOLCHAIN_SKIP_CHECK
+	bool
+	default n
+
 choice
 	prompt "Toolchain"
 
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain
  2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
                   ` (2 preceding siblings ...)
  2015-01-22 18:33 ` [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains Ezequiel Garcia
@ 2015-01-22 18:33 ` Ezequiel Garcia
  2015-02-02 16:29   ` Romain Naour
  2015-02-02 20:19 ` [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Thomas Petazzoni
  4 siblings, 1 reply; 18+ messages in thread
From: Ezequiel Garcia @ 2015-01-22 18:33 UTC (permalink / raw)
  To: buildroot

From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>

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

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
---
 toolchain/toolchain-external/Config.in               | 12 ++++++++++++
 toolchain/toolchain-external/toolchain-external.hash |  3 +++
 toolchain/toolchain-external/toolchain-external.mk   | 11 +++++++++++
 3 files changed, 26 insertions(+)

diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
index 3b0f4cb..c9f2bfe 100644
--- a/toolchain/toolchain-external/Config.in
+++ b/toolchain/toolchain-external/Config.in
@@ -192,6 +192,17 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
 
 	  This toolchain uses software-floating point.
 
+config BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3
+	bool "OSELAS ARM Cortex-M3"
+	depends on BR2_arm
+	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
+	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
+	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
+	select BR2_LARGEFILE
+	select BR2_INET_IPV6
+	select BR2_HOSTARCH_NEEDS_IA32_LIBS
+	select BR2_ARM_TOOLCHAIN_SKIP_CHECK
+
 config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411
 	bool "Sourcery CodeBench MIPS 2014.11"
 	depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
@@ -970,6 +981,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
 	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
 	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
 	default "microblazeel-unknown-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_14_3
diff --git a/toolchain/toolchain-external/toolchain-external.hash b/toolchain/toolchain-external/toolchain-external.hash
index 7f211db..f00cce4 100644
--- a/toolchain/toolchain-external/toolchain-external.hash
+++ b/toolchain/toolchain-external/toolchain-external.hash
@@ -56,3 +56,6 @@ sha256 3e1c7c53fadfd3346ab60386c573f07f0617ab119546ec8cb93bc20c23cff2b3  lin32-m
 sha256 b72f7be654a75bb643372f3909de7b8739f0f56bdf8bea98fea41dcecefe6b6b  microblazeel-unknown-linux-gnu.tgz
 sha256 ed2fea022f2def257ca6db09911b73c7102aaa1792d2da2d81371a763e5c2eff  lin32-microblaze-unknown-linux-gnu_14.3_early.tar.xz
 sha256 53ee0b1ad50e651eb14d0b53044b90e7bf7e3cb341ee57fe575bc4c4e142ea37  microblaze-unknown-linux-gnu.tgz
+
+# OSELAS Cortex-M3 toolchain
+sha1  b5a85b489e32c3730673b74e998e08444e36aab4  oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized_2013.12.2_i386.deb
diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
index 5a69eb8..718bedc 100644
--- a/toolchain/toolchain-external/toolchain-external.mk
+++ b/toolchain/toolchain-external/toolchain-external.mk
@@ -287,6 +287,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),y)
+TOOLCHAIN_EXTERNAL_SITE = http://debian.pengutronix.de/debian/pool/main/o/oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized/
+TOOLCHAIN_EXTERNAL_SOURCE = oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized_2013.12.2_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
@@ -417,6 +420,14 @@ 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),y)
+# Special handling for OSELAS toolchains
+define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
+	mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
+	(cd $(@D); ar xvf $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE))
+	$(call suitable-extractor,data.tar.xz) $(@D)/data.tar.xz | \
+		$(TAR) $(TAR_STRIP_COMPONENTS)=5 -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
+endef
 else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
 # Normal handling of toolchain tarball extraction.
 define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
-- 
2.2.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains
  2015-01-22 18:33 ` [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains Ezequiel Garcia
@ 2015-01-25 19:32   ` Thomas Petazzoni
  2015-02-02 16:18   ` Romain Naour
  1 sibling, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2015-01-25 19:32 UTC (permalink / raw)
  To: buildroot

Dear Ezequiel Garcia,

On Thu, 22 Jan 2015 15:33:27 -0300, Ezequiel Garcia wrote:
> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> 
> 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 2013.12.2, 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 an option to skip this check, so it can be selected
> in the OSELAS toolchain.
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>

Instead of skipping the check, can we fix the check instead? Like
outputting to a temporary file, and removing it afterward, or something
like that?

Thanks,

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions
  2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
@ 2015-02-02 16:17   ` Romain Naour
  2015-02-02 20:18   ` Thomas Petazzoni
  1 sibling, 0 replies; 18+ messages in thread
From: Romain Naour @ 2015-02-02 16:17 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> 
> Until now, all ARM processors supported the original ARM instructions.
> However, the Cortex-M variants don't support them, and support only
> Thumb/Thumb2 modes.
> 
> So, make a Kconfig option for ARM support and use it.
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---

[...]

>  choice
>  	prompt "ARM instruction set"
> -	depends on BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2
> +	depends on BR2_ARM_CPU_HAS_ARM || BR2_ARM_CPU_HAS_THUMB || BR2_ARM_CPU_HAS_THUMB2

This prompt is now always displayed, so the depends on can be removed.

>  
>  config BR2_ARM_INSTRUCTIONS_ARM_CHOICE
>  	bool "ARM"
> +	depends on BR2_ARM_CPU_HAS_ARM
>  	help
>  	  This option instructs the compiler to generate regular ARM
>  	  instructions, that are all 32 bits wide.
> 

Best regards,
Romain Naour

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-01-22 18:33 ` [Buildroot] [PATCH 2/4] arm: update processor types Ezequiel Garcia
@ 2015-02-02 16:18   ` Romain Naour
  2015-02-07 18:05     ` Ezequiel Garcia
  2015-02-07 19:47     ` Ezequiel Garcia
  0 siblings, 2 replies; 18+ messages in thread
From: Romain Naour @ 2015-02-02 16:18 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> 
> Add the Cortex M3 variant. These microcontrollers don't support regular
> ARM instructions and don't have an MMU.
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---
>  arch/Config.in                | 8 ++++----
>  arch/Config.in.arm            | 5 +++++
>  toolchain/toolchain-common.in | 6 ++++--
>  3 files changed, 13 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/Config.in b/arch/Config.in
> index 890e7e2..6f7d608 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -258,13 +258,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

What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
Config.in.x instead of black-listing them here ?

>  
>  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
> @@ -283,7 +283,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

Same here with BR2_ARCH_HAS_FLAT_SUPPORT.

>  	help
>  	  FLAT binary is a relatively simple and lightweight executable format
>  	  based on the original a.out format. It is widely used in environment
> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
> index a2d113a..1e22ab8 100644
> --- a/arch/Config.in.arm
> +++ b/arch/Config.in.arm
> @@ -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
> @@ -396,6 +400,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
> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
> index 2ee2019..fd6ef53 100644
> --- a/toolchain/toolchain-common.in
> +++ b/toolchain/toolchain-common.in
> @@ -114,8 +114,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

And here with BR2_ARCH_HAS_MMU_SUPPORT ?

>  	help
>  	  If your target has a MMU, you should say Y here.  If you
>  	  are unsure, just say Y.
> 

Best regards,
Romain Naour

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains
  2015-01-22 18:33 ` [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains Ezequiel Garcia
  2015-01-25 19:32   ` Thomas Petazzoni
@ 2015-02-02 16:18   ` Romain Naour
  2015-02-02 17:32     ` Yann E. MORIN
  1 sibling, 1 reply; 18+ messages in thread
From: Romain Naour @ 2015-02-02 16:18 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> 
> 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 2013.12.2, 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 an option to skip this check, so it can be selected
> in the OSELAS toolchain.
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---
>  toolchain/helpers.mk                   | 6 +++++-
>  toolchain/toolchain-external/Config.in | 4 ++++
>  2 files changed, 9 insertions(+), 1 deletion(-)
> 
> diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> index 3121da4..d008a4f 100644
> --- a/toolchain/helpers.mk
> +++ b/toolchain/helpers.mk
> @@ -297,13 +297,17 @@ check_arm_abi = \
>  	if ! echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabi(hf)?$$' ; then \
>  		echo "External toolchain uses the unsuported OABI" ; \
>  		exit 1 ; \
> -	fi ; \
> +	fi
> +
> +ifneq ($(BR2_ARM_TOOLCHAIN_SKIP_CHECK),y)
> +check_arm_abi += ; \
>  	if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o /dev/null - ; then \
>  		abistr_$(BR2_ARM_EABI)='EABI'; \
>  		abistr_$(BR2_ARM_EABIHF)='EABIhf'; \
>  		echo "Incorrect ABI setting: $${abistr_y} selected, but toolchain is incompatible"; \
>  		exit 1 ; \
>  	fi
> +endif
>  

I looked at this issue and tried to avoid the use of /dev/null.gdb ...
In the Cortex-M toolchain, it seems to have a wrapper around the linker like
this one [1] which append the .gdb suffix.

However, there is no error if "-Wl,-r" (Generate relocatable output) is added in
the gcc's command line but it's not really nice solution because this option
will be there for other toolchains.

Yann proposed to use $BUILD_DIR/br-foo instead of /dev/null and add a comment
why we do that.

What do you think ?

I'm Cc Yann.

[1] https://github.com/m-labs/elf2flt-lm32/blob/master/ld-elf2flt.in

Best regards,
Romain Naour

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain
  2015-01-22 18:33 ` [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain Ezequiel Garcia
@ 2015-02-02 16:29   ` Romain Naour
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Naour @ 2015-02-02 16:29 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
> From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> 
> Binary toolchain based on uClibc for Cortex-M3 processor based on GCC
> 4.8.2.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---
>  toolchain/toolchain-external/Config.in               | 12 ++++++++++++
>  toolchain/toolchain-external/toolchain-external.hash |  3 +++
>  toolchain/toolchain-external/toolchain-external.mk   | 11 +++++++++++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/toolchain/toolchain-external/Config.in b/toolchain/toolchain-external/Config.in
> index 3b0f4cb..c9f2bfe 100644
> --- a/toolchain/toolchain-external/Config.in
> +++ b/toolchain/toolchain-external/Config.in
> @@ -192,6 +192,17 @@ config BR2_TOOLCHAIN_EXTERNAL_ARAGO_ARMV5TE_201109
>  
>  	  This toolchain uses software-floating point.
>  
> +config BR2_TOOLCHAIN_EXTERNAL_OSELAS_ARM_CORTEX_M3
> +	bool "OSELAS ARM Cortex-M3"
> +	depends on BR2_arm
> +	depends on BR2_HOSTARCH = "x86_64" || BR2_HOSTARCH = "x86"
> +	select BR2_TOOLCHAIN_HEADERS_AT_LEAST_3_12
> +	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
> +	select BR2_LARGEFILE
> +	select BR2_INET_IPV6
> +	select BR2_HOSTARCH_NEEDS_IA32_LIBS
> +	select BR2_ARM_TOOLCHAIN_SKIP_CHECK
> +
>  config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_MIPS201411
>  	bool "Sourcery CodeBench MIPS 2014.11"
>  	depends on BR2_mips || BR2_mipsel || BR2_mips64 || BR2_mips64el
> @@ -970,6 +981,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
>  	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_LINARO_AARCH64
>  	default "aarch64-linux-gnu"      if BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_AARCH64
>  	default "microblazeel-unknown-linux-gnu" if BR2_TOOLCHAIN_EXTERNAL_XILINX_MICROBLAZEEL_14_3
> diff --git a/toolchain/toolchain-external/toolchain-external.hash b/toolchain/toolchain-external/toolchain-external.hash
> index 7f211db..f00cce4 100644
> --- a/toolchain/toolchain-external/toolchain-external.hash
> +++ b/toolchain/toolchain-external/toolchain-external.hash
> @@ -56,3 +56,6 @@ sha256 3e1c7c53fadfd3346ab60386c573f07f0617ab119546ec8cb93bc20c23cff2b3  lin32-m
>  sha256 b72f7be654a75bb643372f3909de7b8739f0f56bdf8bea98fea41dcecefe6b6b  microblazeel-unknown-linux-gnu.tgz
>  sha256 ed2fea022f2def257ca6db09911b73c7102aaa1792d2da2d81371a763e5c2eff  lin32-microblaze-unknown-linux-gnu_14.3_early.tar.xz
>  sha256 53ee0b1ad50e651eb14d0b53044b90e7bf7e3cb341ee57fe575bc4c4e142ea37  microblaze-unknown-linux-gnu.tgz
> +
> +# OSELAS Cortex-M3 toolchain
> +sha1  b5a85b489e32c3730673b74e998e08444e36aab4  oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized_2013.12.2_i386.deb
> diff --git a/toolchain/toolchain-external/toolchain-external.mk b/toolchain/toolchain-external/toolchain-external.mk
> index 5a69eb8..718bedc 100644
> --- a/toolchain/toolchain-external/toolchain-external.mk
> +++ b/toolchain/toolchain-external/toolchain-external.mk
> @@ -287,6 +287,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),y)
> +TOOLCHAIN_EXTERNAL_SITE = http://debian.pengutronix.de/debian/pool/main/o/oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized/
> +TOOLCHAIN_EXTERNAL_SOURCE = oselas.toolchain-2013.12.2-arm-cortexm3-uclinuxeabi-gcc-4.8.2-uclibc-0.9.33.2-binutils-2.24-kernel-3.12-sanitized_2013.12.2_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
> @@ -417,6 +420,14 @@ 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),y)
> +# Special handling for OSELAS toolchains
> +define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
> +	mkdir -p $(TOOLCHAIN_EXTERNAL_INSTALL_DIR)
> +	(cd $(@D); ar xvf $(DL_DIR)/$(TOOLCHAIN_EXTERNAL_SOURCE))
> +	$(call suitable-extractor,data.tar.xz) $(@D)/data.tar.xz | \
> +		$(TAR) $(TAR_STRIP_COMPONENTS)=5 -C $(TOOLCHAIN_EXTERNAL_INSTALL_DIR) $(TAR_OPTIONS) -
> +endef
>  else ifneq ($(TOOLCHAIN_EXTERNAL_SOURCE),)
>  # Normal handling of toolchain tarball extraction.
>  define TOOLCHAIN_EXTERNAL_EXTRACT_CMDS
> 

I tried to build some packages to test this toolchain and it fail with
Busybox :-/

/home/naourr/git/buildroot/test/cortexM/host/opt/ext-toolchain/arm-cortexm3-uclinuxeabi/bin/ld.real:
warning: cannot find entry symbol lf2flt; defaulting to 00000000
networking/lib.a(nslookup.o): In function `set_default_dns':
nslookup.c:(.text.set_default_dns+0x12): undefined reference to `__res_state'
nslookup.c:(.text.set_default_dns+0x2c): undefined reference to `__res_state'
networking/lib.a(nslookup.o): In function `nslookup_main':
nslookup.c:(.text.nslookup_main+0x16): undefined reference to `__res_init'
nslookup.c:(.text.nslookup_main+0x20): undefined reference to `__res_state'
collect2: error: ld returned 1 exit status
make[1]: *** [busybox_unstripped] Erreur 1

That's because __UCLIBC_HAS_RESOLVER_SUPPORT__ is not defined in the toolchain
configuration:
opt/sysroot-arm-cortexm3-uclinuxeabi/usr/include/bits/uClibc_config.h

To support this toolchain, we need to have another toolchain option named
BR2_TOOLCHAIN_HAS_RESOLVER_SUPPORT in order to be able to disable
packages/options which needs resolver support.

Best regards,
Romain Naour

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains
  2015-02-02 16:18   ` Romain Naour
@ 2015-02-02 17:32     ` Yann E. MORIN
  0 siblings, 0 replies; 18+ messages in thread
From: Yann E. MORIN @ 2015-02-02 17:32 UTC (permalink / raw)
  To: buildroot

Ezequiel, Romain, All,

On 2015-02-02 17:18 +0100, Romain Naour spake thusly:
> Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
> > From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> > 
> > 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 2013.12.2, 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 an option to skip this check, so it can be selected
> > in the OSELAS toolchain.
> > 
> > Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> > ---
> >  toolchain/helpers.mk                   | 6 +++++-
> >  toolchain/toolchain-external/Config.in | 4 ++++
> >  2 files changed, 9 insertions(+), 1 deletion(-)
> > 
> > diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
> > index 3121da4..d008a4f 100644
> > --- a/toolchain/helpers.mk
> > +++ b/toolchain/helpers.mk
> > @@ -297,13 +297,17 @@ check_arm_abi = \
> >  	if ! echo $${EXT_TOOLCHAIN_TARGET} | grep -qE 'eabi(hf)?$$' ; then \
> >  		echo "External toolchain uses the unsuported OABI" ; \
> >  		exit 1 ; \
> > -	fi ; \
> > +	fi
> > +
> > +ifneq ($(BR2_ARM_TOOLCHAIN_SKIP_CHECK),y)
> > +check_arm_abi += ; \
> >  	if ! echo 'int main(void) {}' | $${__CROSS_CC} -x c -o /dev/null - ; then \
> >  		abistr_$(BR2_ARM_EABI)='EABI'; \
> >  		abistr_$(BR2_ARM_EABIHF)='EABIhf'; \
> >  		echo "Incorrect ABI setting: $${abistr_y} selected, but toolchain is incompatible"; \
> >  		exit 1 ; \
> >  	fi
> > +endif
> >  
> 
> I looked at this issue and tried to avoid the use of /dev/null.gdb ...
> In the Cortex-M toolchain, it seems to have a wrapper around the linker like
> this one [1] which append the .gdb suffix.
> 
> However, there is no error if "-Wl,-r" (Generate relocatable output) is added in
> the gcc's command line but it's not really nice solution because this option
> will be there for other toolchains.
> 
> Yann proposed to use $BUILD_DIR/br-foo instead of /dev/null and add a comment
> why we do that.

Yeah, something like the following:

    diff --git a/toolchain/helpers.mk b/toolchain/helpers.mk
    index 3121da4..44696c0 100644
    --- a/toolchain/helpers.mk
    +++ b/toolchain/helpers.mk
    @@ -298,12 +298,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-temp-out - ; then \
    +           rm -f $(BUILD_DIR)/.br-temp-out*; \
                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-temp-out*

     #
     # Check that the external toolchain supports C++

(does not apply, copy-paste with tab-brokenness)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions
  2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
  2015-02-02 16:17   ` Romain Naour
@ 2015-02-02 20:18   ` Thomas Petazzoni
  1 sibling, 0 replies; 18+ messages in thread
From: Thomas Petazzoni @ 2015-02-02 20:18 UTC (permalink / raw)
  To: buildroot

Dear Ezequiel Garcia,

On Thu, 22 Jan 2015 15:33:25 -0300, Ezequiel Garcia wrote:
> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
> 
> Until now, all ARM processors supported the original ARM instructions.
> However, the Cortex-M variants don't support them, and support only
> Thumb/Thumb2 modes.
> 
> So, make a Kconfig option for ARM support and use it.
> 
> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
> ---
>  arch/Config.in.arm | 23 ++++++++++++++++++++++-
>  1 file changed, 22 insertions(+), 1 deletion(-)

I've applied this patch, after taking into account Romain's comment,
and also after renaming BR2_ARM_INSTRUCTIONS_ARM_CHOICE to
BR2_ARM_INSTRUCTIONS_ARM and removing the hidden option
BR2_ARM_INSTRUCTIONS_ARM outside the choice.

From the commit log:

[Thomas:
  - Remove the dependency in the choice between ARM/Thumb/Thumb-2,
    because basically the choice is now always visible.
  - Replace the BR2_ARM_INSTRUCTIONS_ARM_CHOICE choice option directly
    by BR2_ARM_INSTRUCTIONS_ARM, instead of having this blind option
    defined separately. This means the choice is now always visible,
    even when only the ARM instruction set is supported.]


Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 0/4] ARM Cortex-M3 support
  2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
                   ` (3 preceding siblings ...)
  2015-01-22 18:33 ` [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain Ezequiel Garcia
@ 2015-02-02 20:19 ` Thomas Petazzoni
  2015-02-03  1:05   ` Ezequiel Garcia
  4 siblings, 1 reply; 18+ messages in thread
From: Thomas Petazzoni @ 2015-02-02 20:19 UTC (permalink / raw)
  To: buildroot

Dear Ezequiel Garcia,

On Thu, 22 Jan 2015 15:33:24 -0300, Ezequiel Garcia wrote:

> Guido Mart?nez (3):
>   arm: conditionally support regular ARM instructions
>   arm: update processor types
>   toolchain: allow for stupid toolchains
> 
> Thomas Petazzoni (1):
>   toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain

So as I said, PATCH 1/4 applied. Several comments have been made on the
other patches. Can you respin a new iteration for these?

In the mean time, I'll mark those three patches as 'Changes Requested'
in patchwork, so please remember to send a new version.

Also, if you could send at least one defconfig for a Cortex-M3 board,
it would be good.

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 0/4] ARM Cortex-M3 support
  2015-02-02 20:19 ` [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Thomas Petazzoni
@ 2015-02-03  1:05   ` Ezequiel Garcia
  0 siblings, 0 replies; 18+ messages in thread
From: Ezequiel Garcia @ 2015-02-03  1:05 UTC (permalink / raw)
  To: buildroot

Thomas,

On 02/02/2015 05:19 PM, Thomas Petazzoni wrote:
> Dear Ezequiel Garcia,
> 
> On Thu, 22 Jan 2015 15:33:24 -0300, Ezequiel Garcia wrote:
> 
>> Guido Mart?nez (3):
>>   arm: conditionally support regular ARM instructions
>>   arm: update processor types
>>   toolchain: allow for stupid toolchains
>>
>> Thomas Petazzoni (1):
>>   toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain
> 
> So as I said, PATCH 1/4 applied. Several comments have been made on the
> other patches. Can you respin a new iteration for these?
> 

Sure, we are already looking at the comments.

> In the mean time, I'll mark those three patches as 'Changes Requested'
> in patchwork, so please remember to send a new version.
> 
> Also, if you could send at least one defconfig for a Cortex-M3 board,
> it would be good.
> 

Sure, no problem.
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-02-02 16:18   ` Romain Naour
@ 2015-02-07 18:05     ` Ezequiel Garcia
  2015-02-14 13:51       ` Romain Naour
  2015-02-07 19:47     ` Ezequiel Garcia
  1 sibling, 1 reply; 18+ messages in thread
From: Ezequiel Garcia @ 2015-02-07 18:05 UTC (permalink / raw)
  To: buildroot



On 02/02/2015 01:18 PM, Romain Naour wrote:
> Hi Ezequiel,
> 
> Le 22/01/2015 19:33, Ezequiel Garcia a ?crit :
>> From: Guido Mart?nez <guido@vanguardiasur.com.ar>
>>
>> Add the Cortex M3 variant. These microcontrollers don't support regular
>> ARM instructions and don't have an MMU.
>>
>> Signed-off-by: Guido Mart?nez <guido@vanguardiasur.com.ar>
>> ---
>>  arch/Config.in                | 8 ++++----
>>  arch/Config.in.arm            | 5 +++++
>>  toolchain/toolchain-common.in | 6 ++++--
>>  3 files changed, 13 insertions(+), 6 deletions(-)
>>
>> diff --git a/arch/Config.in b/arch/Config.in
>> index 890e7e2..6f7d608 100644
>> --- a/arch/Config.in
>> +++ b/arch/Config.in
>> @@ -258,13 +258,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
> 
> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
> Config.in.x instead of black-listing them here ?
> 
>>  
>>  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
>> @@ -283,7 +283,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
> 
> Same here with BR2_ARCH_HAS_FLAT_SUPPORT.
> 
>>  	help
>>  	  FLAT binary is a relatively simple and lightweight executable format
>>  	  based on the original a.out format. It is widely used in environment
>> diff --git a/arch/Config.in.arm b/arch/Config.in.arm
>> index a2d113a..1e22ab8 100644
>> --- a/arch/Config.in.arm
>> +++ b/arch/Config.in.arm
>> @@ -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
>> @@ -396,6 +400,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
>> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
>> index 2ee2019..fd6ef53 100644
>> --- a/toolchain/toolchain-common.in
>> +++ b/toolchain/toolchain-common.in
>> @@ -114,8 +114,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
> 
> And here with BR2_ARCH_HAS_MMU_SUPPORT ?
> 

Hm.. shouldn't that be, BR2_ARCH_HAS_OPTIONAL_MMU or something ?

At least that's what it seems: only some architectures expose the build
time config to disable MMU.
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-02-02 16:18   ` Romain Naour
  2015-02-07 18:05     ` Ezequiel Garcia
@ 2015-02-07 19:47     ` Ezequiel Garcia
  2015-02-14 14:43       ` Romain Naour
  1 sibling, 1 reply; 18+ messages in thread
From: Ezequiel Garcia @ 2015-02-07 19:47 UTC (permalink / raw)
  To: buildroot

Hi Romain,

First of all, thanks for the great feedback.

On 02/02/2015 01:18 PM, Romain Naour wrote:
[..]
>> -	default BR2_BINFMT_FLAT if BR2_m68k
>> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
> 
> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
> Config.in.x instead of black-listing them here ?
> 

I've been thinking about this. At first it seemed like a good idea, but
then I realised that Cortex-M3 is not really an architecture, but 
a variant.

Introducing BR2_ARCH_HAS_ELF_SUPPORT would mean selecting it on almost each
architecture and almost each of the ARM variants, except Cortex-M3.

So, it seems like it would be an elegant way of doing this, but I'm not sure
it's worth such an invasive change.
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-02-07 18:05     ` Ezequiel Garcia
@ 2015-02-14 13:51       ` Romain Naour
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Naour @ 2015-02-14 13:51 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

[snip]
>>> diff --git a/toolchain/toolchain-common.in b/toolchain/toolchain-common.in
>>> index 2ee2019..fd6ef53 100644
>>> --- a/toolchain/toolchain-common.in
>>> +++ b/toolchain/toolchain-common.in
>>> @@ -114,8 +114,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
>>
>> And here with BR2_ARCH_HAS_MMU_SUPPORT ?
>>

Sorry for the delay...

> 
> Hm.. shouldn't that be, BR2_ARCH_HAS_OPTIONAL_MMU or something ?
> 
> At least that's what it seems: only some architectures expose the build
> time config to disable MMU.
> 

I think we need BR2_ARCH_HAS_MMU_SUPPORT if there is an MMU in the CPU and
BR2_ARCH_HAS_OPTIONAL_MMU if the MMU can be disabled.

The BR2_ARCH_HAS_OPTIONAL_MMU should automatically select
BR2_ARCH_HAS_MMU_SUPPORT when set to y.

Then BR2_arm, BR2_armeb, BR2_sh and BR2_xtensa should select
BR2_ARCH_HAS_OPTIONAL_MMU.

And all other architecture should select BR2_ARCH_HAS_MMU_SUPPORT except
BR2_bfin and BR2_cortex_m3.

So BR2_USE_MMU look like this:

config BR2_USE_MMU
	boot "Enable MMU support" if BR2_ARCH_HAS_OPTIONAL_MMU
	default y if BR2_ARCH_HAS_MMU_SUPPORT

When looking again at your patch, there is an error when another architecture
like i386 is selected.
BR2_USE_MMU must be set to y in that case.

What do you think ?

Best regards,
Romain

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [Buildroot] [PATCH 2/4] arm: update processor types
  2015-02-07 19:47     ` Ezequiel Garcia
@ 2015-02-14 14:43       ` Romain Naour
  0 siblings, 0 replies; 18+ messages in thread
From: Romain Naour @ 2015-02-14 14:43 UTC (permalink / raw)
  To: buildroot

Hi Ezequiel,

Le 07/02/2015 20:47, Ezequiel Garcia a ?crit :
> Hi Romain,
> 
> First of all, thanks for the great feedback.

You're welcome :)

> 
> On 02/02/2015 01:18 PM, Romain Naour wrote:
> [..]
>>> -	default BR2_BINFMT_FLAT if BR2_m68k
>>> +	default BR2_BINFMT_FLAT if BR2_m68k || BR2_cortex_m3
>>
>> What do you think about adding BR2_ARCH_HAS_EFL_SUPPORT in each architecture
>> Config.in.x instead of black-listing them here ?
>>
> 
> I've been thinking about this. At first it seemed like a good idea, but
> then I realised that Cortex-M3 is not really an architecture, but 
> a variant.
> 
> Introducing BR2_ARCH_HAS_ELF_SUPPORT would mean selecting it on almost each
> architecture and almost each of the ARM variants, except Cortex-M3.
> 
> So, it seems like it would be an elegant way of doing this, but I'm not sure
> it's worth such an invasive change.
> 

We may introduce BR2_ARCH_HAS_ELF_SUPPORT as an hidden option which is set to y
by default except for BR2_bfin, BR2_m68k and BR2_cortex_m3. (like for BR2_USE_MMU)

config BR2_ARCH_HAS_ELF_SUPPORT
	bool
	default y if !(BR2_bfin || BR2_m68k || BR2_cortex_m3)

What other developer think ?

Best regards,
Romain

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2015-02-14 14:43 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-22 18:33 [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Ezequiel Garcia
2015-01-22 18:33 ` [Buildroot] [PATCH 1/4] arm: conditionally support regular ARM instructions Ezequiel Garcia
2015-02-02 16:17   ` Romain Naour
2015-02-02 20:18   ` Thomas Petazzoni
2015-01-22 18:33 ` [Buildroot] [PATCH 2/4] arm: update processor types Ezequiel Garcia
2015-02-02 16:18   ` Romain Naour
2015-02-07 18:05     ` Ezequiel Garcia
2015-02-14 13:51       ` Romain Naour
2015-02-07 19:47     ` Ezequiel Garcia
2015-02-14 14:43       ` Romain Naour
2015-01-22 18:33 ` [Buildroot] [PATCH 3/4] toolchain: allow for stupid toolchains Ezequiel Garcia
2015-01-25 19:32   ` Thomas Petazzoni
2015-02-02 16:18   ` Romain Naour
2015-02-02 17:32     ` Yann E. MORIN
2015-01-22 18:33 ` [Buildroot] [PATCH 4/4] toolchain-external: add OSELAS 2013.12.2 Cortex-M3 toolchain Ezequiel Garcia
2015-02-02 16:29   ` Romain Naour
2015-02-02 20:19 ` [Buildroot] [PATCH 0/4] ARM Cortex-M3 support Thomas Petazzoni
2015-02-03  1:05   ` Ezequiel Garcia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.