Skip to contentSkip to conversation

sh: Fix Buildroot sh targets to match gnuconfig targets

PATCH New Phil Edworthy 4 participants 8 messages May 9, 2011 – Jul 18, 2011 Journalling flash file system V2 (JFFS2)

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

sh2eb and sh2a_nofpueb gnuconfig targets are no longer supported in Buildroot. This patch replaces these Buildroot targets with sh2 and sh2a respectively, and adds sh4a targets as these are widely used.

To build for devices without an fpu, the relevant toolchain flags will have to be specified.

---
 fs/jffs2/Config.in                     |    4 ++--
 target/Config.in.arch                  |   32 +++++++++++++++++++-------------
 toolchain/elf2flt/elf2flt/config.sub   |    8 ++++----
 toolchain/toolchain-external/Config.in |    4 ++--
 toolchain/uClibc/uclibc.mk             |    4 ++--
 5 files changed, 29 insertions(+), 23 deletions(-)
fs/jffs2/Config.in +2 -2
index 5748fbb..9a96d7d 100644
@@ -94,8 +94,8 @@ choice
 	prompt "Endianess"
 	default BR2_TARGET_ROOTFS_JFFS2_BE if BR2_armeb || \
 			BR2_avr32 || BR2_m68k || BR2_mips || \
-			BR2_powerpc || BR2_sh2a_nofpueb || BR2_sh2eb || \
-			BR2_sh3eb || BR2_sh4eb || BR2_sparc
+			BR2_powerpc || BR2_sh2 || BR2_sh2a || \
+			BR2_sh3eb || BR2_sh4eb || BR2_sh4aeb || BR2_sparc
 
 config BR2_TARGET_ROOTFS_JFFS2_LE
 	bool "little-endian"
target/Config.in.arch +19 -13
index 7c80945..e128034 100644
@@ -211,18 +211,22 @@ choice
 	help
 	  Specific CPU variant to use
 
-config BR2_sh2a_nofpueb
-	bool "sh2a_nofpueb"
-config BR2_sh2eb
-	bool "sh2eb"
+config BR2_sh2
+	bool "sh2 (SH2 big endian)"
+config BR2_sh2a
+	bool "sh2a (SH2A big endian)"
 config BR2_sh3
-	bool "sh3"
+	bool "sh3 (SH3 little endian)"
 config BR2_sh3eb
-	bool "sh3eb"
+	bool "sh3eb (SH3 big endian)"
 config BR2_sh4
-	bool "sh4"
+	bool "sh4 (SH4 little endian)"
 config BR2_sh4eb
-	bool "sh4eb"
+	bool "sh4eb (SH4 big endian)"
+config BR2_sh4a
+	bool "sh4a (SH4A little endian)"
+config BR2_sh4aeb
+	bool "sh4aeb (SH4A big endian)"
 endchoice
 
 #
@@ -482,12 +486,14 @@ config BR2_ARCH
 	default "mips"		if BR2_mips
 	default "mipsel"	if BR2_mipsel
 	default "powerpc"	if BR2_powerpc
-	default "sh2a_nofpueb"	if BR2_sh2a_nofpueb
-	default "sh2eb"		if BR2_sh2eb
+	default "sh2"		if BR2_sh2
+	default "sh2a"		if BR2_sh2a
 	default "sh3"		if BR2_sh3
 	default "sh3eb"		if BR2_sh3eb
 	default "sh4"		if BR2_sh4
 	default "sh4eb"		if BR2_sh4eb
+	default "sh4a"		if BR2_sh4a
+	default "sh4aeb"	if BR2_sh4aeb
 	default "sh64"		if BR2_sh64
 	default "sparc"		if BR2_sparc
 	default "x86_64"	if BR2_x86_64
@@ -503,10 +509,10 @@ config BR2_ARCH
 config BR2_ENDIAN
 	string
 	default "LITTLE" if BR2_arm || BR2_bfin || BR2_i386 || BR2_mipsel || \
-			    BR2_sh3 || BR2_sh4 || BR2_x86_64 || BR2_sh64
+			    BR2_sh3 || BR2_sh4 || BR2_sh4a || BR2_x86_64 || BR2_sh64
 	default "BIG"    if BR2_armeb || BR2_avr32 || BR2_m68k || BR2_mips || \
-			    BR2_powerpc || BR2_sh2a_nofpueb || BR2_sh2eb || \
-			    BR2_sh3eb || BR2_sh4eb || BR2_sparc
+			    BR2_powerpc || BR2_sh2 || BR2_sh2a || \
+			    BR2_sh3eb || BR2_sh4eb || BR2_sh4aeb || BR2_sparc
 
 config BR2_GCC_TARGET_TUNE
 	string
toolchain/elf2flt/elf2flt/config.sub +4 -4
index 4279c84..2072457 100755
@@ -262,7 +262,7 @@ case $basic_machine in
 	| pdp10 | pdp11 | pj | pjl \
 	| powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
 	| pyramid \
-	| sh | sh[1234] | sh[23]e | sh[34]eb | shbe | shle | sh[1234]le | sh3ele \
+	| sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
 	| sh64 | sh64le \
 	| sparc | sparc64 | sparc64b | sparc86x | sparclet | sparclite \
 	| sparcv8 | sparcv9 | sparcv9b \
@@ -342,8 +342,8 @@ case $basic_machine in
 	| powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
 	| pyramid-* \
 	| romp-* | rs6000-* \
-	| sh-* | sh[1234]-* | sh[23]e-* | sh[34]eb-* | shbe-* \
-	| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
+	| sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* \
+	| sheb-* | shbe-* | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
 	| sparc-* | sparc64-* | sparc64b-* | sparc86x-* | sparclet-* \
 	| sparclite-* \
 	| sparcv8-* | sparcv9-* | sparcv9b-* | strongarm-* | sv1-* | sx?-* \
@@ -1097,7 +1097,7 @@ case $basic_machine in
 	we32k)
 		basic_machine=we32k-att
 		;;
-	sh3 | sh4 | sh[34]eb | sh[1234]le | sh[23]ele)
+	sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele)
 		basic_machine=sh-unknown
 		;;
 	sh64)
toolchain/toolchain-external/Config.in +2 -2
index cb489bd..36118ac 100644
@@ -88,7 +88,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_POWERPC201009
 
 config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201009
 	bool "CodeSoucery SH 2010.09"
-	depends on BR2_sh4 || BR2_sh4eb
+	depends on BR2_sh4a || BR2_sh4aeb
 	select BR2_TOOLCHAIN_EXTERNAL_GLIBC
 	select BR2_INSTALL_LIBSTDCPP
 	help
@@ -103,7 +103,7 @@ config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH201009
 
 config BR2_TOOLCHAIN_EXTERNAL_CODESOURCERY_SH2A_201009
 	bool "CodeSoucery SH 2010.09"
-	depends on BR2_sh2a_nofpueb || BR2_sh2eb
+	depends on BR2_sh2a
 	select BR2_TOOLCHAIN_EXTERNAL_UCLIBC
 	select BR2_INSTALL_LIBSTDCPP
 	help
toolchain/uClibc/uclibc.mk +2 -2
index 19256bb..3173ef4 100644
@@ -182,14 +182,14 @@ ifeq ($(UCLIBC_TARGET_ARCH),sh)
 	/bin/echo "# CONFIG_SH2 is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# CONFIG_SH3 is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# CONFIG_SH4 is not set" >> $(UCLIBC_DIR)/.oldconfig
-ifeq ($(BR2_sh2a_nofpueb),y)
+ifeq ($(BR2_sh2a),y)
 	$(SED) 's,# CONFIG_SH2A is not set,CONFIG_SH2A=y,g' $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_FLAT_SEP_DATA is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_SHARED_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
 endif
-ifeq ($(BR2_sh2eb),y)
+ifeq ($(BR2_sh2),y)
 	$(SED) 's,# CONFIG_SH2 is not set,CONFIG_SH2=y,g' $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_FDPIC_ELF is not set" >> $(UCLIBC_DIR)/.oldconfig
 	/bin/echo "# UCLIBC_FORMAT_FLAT is not set" >> $(UCLIBC_DIR)/.oldconfig
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

Hello,

Quoted 7 lines · On Mon, 09 May 2011 14:12:53 +0100 Phil Edworthy <[email protected]>…

sh2eb and sh2a_nofpueb gnuconfig targets are no longer supported in Buildroot. This patch replaces these Buildroot targets with sh2 and sh2a respectively, and adds sh4a targets as these are widely used.

To build for devices without an fpu, the relevant toolchain flags will have to be specified.

Thanks a lot for coming back so quickly with an updated patch and clarification about SuperH support. That's really nice!

A few questions/comments below, though.

fs/jffs2/Config.in choice · line 98

Quoted 12 lines
fs/jffs2/Config.in +2 -2
index 5748fbb..9a96d7d 100644
@@ -94,8 +94,8 @@ choice
 	prompt "Endianess"
 	default BR2_TARGET_ROOTFS_JFFS2_BE if BR2_armeb || \
 			BR2_avr32 || BR2_m68k || BR2_mips || \
-			BR2_powerpc || BR2_sh2a_nofpueb || BR2_sh2eb || \
-			BR2_sh3eb || BR2_sh4eb || BR2_sparc
+			BR2_powerpc || BR2_sh2 || BR2_sh2a || \
+			BR2_sh3eb || BR2_sh4eb || BR2_sh4aeb || BR2_sparc

Not your fault, but we should probably try to use BR2_ENDIAN here, in order to have the big/little endian list of architectures in a common location and not duplicated here in JFFS2. But that's a separate matter, and should be fixed in a separate patch.

toolchain/elf2flt/elf2flt/config.sub

Quoted 4 lines
toolchain/elf2flt/elf2flt/config.sub +0 -0
index 4279c84..2072457 100755

Just curious, as I have never used Buildroot to build a toolchain for non-MMU platforms (only used pre-built Blackfin toolchains so far). How does this elf2flt thing fits into the toolchain build process ?

Instead of patching this config.sub file, wouldn't it be possible to use the one we have in package/gnuconfig/ ? Or, put it differently, is there an upstream location for elf2flt we could use instead of having its source code directly into the Buildroot tree ?

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

Hi Thomas,

Quoted 8 lines
Quoted 5 lines · On Mon, 09 May 2011 14:12:53 +0100 Phil Edworthy <[email protected]>…

sh2eb and sh2a_nofpueb gnuconfig targets are no longer supported in Buildroot. This patch replaces these Buildroot targets with sh2 and sh2a respectively, and adds sh4a targets as these are widely used.

Quoted 5 lines
Quoted 2 lines

To build for devices without an fpu, the relevant toolchain flags will have to be specified.

Thanks a lot for coming back so quickly with an updated patch and clarification about SuperH support. That's really nice!

Well I use Buildroot a lot for SH4A devices and appreciate all the hard work that has gone into it.

Quoted 9 lines
Quoted 9 lines
fs/jffs2/Config.in +0 -1
index 5748fbb..9a96d7d 100644
@@ -94,8 +94,8 @@ choice
    prompt "Endianess"
    default BR2_TARGET_ROOTFS_JFFS2_BE if BR2_armeb || \
          BR2_avr32 || BR2_m68k || BR2_mips || \
-         BR2_powerpc || BR2_sh2a_nofpueb || BR2_sh2eb || \
Quoted 8 lines

fs/jffs2/Config.in choice · line 98

Quoted 3 lines
fs/jffs2/Config.in +2 -1
-         BR2_sh3eb || BR2_sh4eb || BR2_sparc
+         BR2_powerpc || BR2_sh2 || BR2_sh2a || \
+         BR2_sh3eb || BR2_sh4eb || BR2_sh4aeb || BR2_sparc

Not your fault, but we should probably try to use BR2_ENDIAN here, in order to have the big/little endian list of architectures in a common location and not duplicated here in JFFS2. But that's a separate matter, and should be fixed in a separate patch.

Yes, I thought that as well. I took the view that a simple update for the moment was best.

Quoted 9 lines

toolchain/elf2flt/elf2flt/config.sub

Quoted 4 lines
toolchain/elf2flt/elf2flt/config.sub +0 -0
index 4279c84..2072457 100755

Just curious, as I have never used Buildroot to build a toolchain for non-MMU platforms (only used pre-built Blackfin toolchains so far). How does this elf2flt thing fits into the toolchain build process ?

Quoted 4 lines

Instead of patching this config.sub file, wouldn't it be possible to use the one we have in package/gnuconfig/ ? Or, put it differently, is there an upstream location for elf2flt we could use instead of having its source code directly into the Buildroot tree ?

When I created this patch I tried to build some SH toolchains using BR. This failed for both SH2A and SH4A and I probably can't find the time to fix these at the moment. I only use the pre-built CodeSourcery toolchains.

So to answer your question about elf2flt, I don't know. However, I noticed the targets were wrong so I thought it would make sense to correct it as its related. Unfortunately, I know nothing about elf2flt...

Thanks
Phil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20110510/fcc99450/attachment.html>

#3 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

Hello,

Quoted 7 lines · On Tue, 10 May 2011 08:34:19 +0100 PHIL.EDWORTHY at renesas.com wrote:
Quoted 4 lines

Not your fault, but we should probably try to use BR2_ENDIAN here, in order to have the big/little endian list of architectures in a common location and not duplicated here in JFFS2. But that's a separate matter, and should be fixed in a separate patch.

Yes, I thought that as well. I took the view that a simple update for the moment was best.

Sure.

Quoted 7 lines

When I created this patch I tried to build some SH toolchains using BR. This failed for both SH2A and SH4A and I probably can't find the time to fix these at the moment. I only use the pre-built CodeSourcery toolchains.

So to answer your question about elf2flt, I don't know. However, I noticed the targets were wrong so I thought it would make sense to correct it as its related. Unfortunately, I know nothing about elf2flt...

Ok :-)

Thanks again,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#4 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

In reply to Thomas Petazzoni

Thomas, All,

Quoted 3 lines · On Tuesday 10 May 2011 084704 Thomas Petazzoni wrote:

Just curious, as I have never used Buildroot to build a toolchain for non-MMU platforms (only used pre-built Blackfin toolchains so far). How does this elf2flt thing fits into the toolchain build process ?

elf2flt provides its own linker to replace ld when the output is the flat ELF format. When installing, elf2flt renames the original ld coming from the binutils, installs its own ld.elf2flt linker and a ld wrapper that checks the arguments. If the format is flat ELF, then the wrapper calls to the ld.elf2flt linker; otherwise, it calls to the original linker.

So one first installs binutils as usual, and then install elf2flt.

Basically.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
| --==< O_o >==-- '------------.-------:  X  AGAINST      |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL    |  """  conspiracy.  |
'------------------------------'-------'------------------'--------------------'
#5 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

Quoted 5 lines · On Tue, 10 May 2011 10:01:31 +0200 "Yann E. MORIN"…
Quoted 3 lines · On Tuesday 10 May 2011 084704 Thomas Petazzoni wrote:

Just curious, as I have never used Buildroot to build a toolchain for non-MMU platforms (only used pre-built Blackfin toolchains so far). How does this elf2flt thing fits into the toolchain build process ?

Quoted 7 lines

elf2flt provides its own linker to replace ld when the output is the flat ELF format. When installing, elf2flt renames the original ld coming from the binutils, installs its own ld.elf2flt linker and a ld wrapper that checks the arguments. If the format is flat ELF, then the wrapper calls to the ld.elf2flt linker; otherwise, it calls to the original linker.

So one first installs binutils as usual, and then install elf2flt.

Thanks Yann for these details. I'm wondering if this actually works fine in Buildroot or not.

Do you know if elf2flt has a well-known upstream location, so that we can use it instead of having the source code inside the BR tree?

Thanks!

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#6 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

Thomas, All,

Quoted 14 lines · On Tuesday 10 May 2011 102047 Thomas Petazzoni wrote:
Quoted 11 lines · On Tue, 10 May 2011 10:01:31 +0200 "Yann E. MORIN"…
Quoted 3 lines · On Tuesday 10 May 2011 084704 Thomas Petazzoni wrote:

Just curious, as I have never used Buildroot to build a toolchain for non-MMU platforms (only used pre-built Blackfin toolchains so far). How does this elf2flt thing fits into the toolchain build process ?

elf2flt provides its own linker to replace ld when the output is the flat ELF format. When installing, elf2flt renames the original ld coming from the binutils, installs its own ld.elf2flt linker and a ld wrapper that checks the arguments. If the format is flat ELF, then the wrapper calls to the ld.elf2flt linker; otherwise, it calls to the original linker.

Quoted 4 lines
Quoted 1 line

So one first installs binutils as usual, and then install elf2flt.

Thanks Yann for these details. I'm wondering if this actually works fine in Buildroot or not.

At least, it works fine in crosstool-NG! ;-)

Quoted 2 lines

Do you know if elf2flt has a well-known upstream location, so that we can use it instead of having the source code inside the BR tree?

The (very light!) home seems to be hosted at uClinux.org:
http://uclinux.org/bFLT/

The latest release tarball I could find is really really old:
http://uclinux.org/pub/uClinux/utilities/elf2flt-20020214.tar.gz

Crosstool-NG is using the cvs repository:
http://cvs.uclinux.org/cgi-bin/cvsweb.cgi/elf2flt/

And:
cvs -z3 -d:pserver:anonymous at cvs.uclinux.org:/var/cvs co -P elf2flt

The repository is not really live, but was last touched 5 weeks ago (which is not that old). It mostly gets fixes nowadays.

Regards,
Yann E. MORIN.

Signature · 6 lines
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +0/33 662376056 | Software  Designer | \ / CAMPAIGN     |   ^                |
| --==< O_o >==-- '------------.-------:  X  AGAINST      |  /e\  There is no  |
| http://ymorin.is-a-geek.org/ | (*_*) | / \ HTML MAIL    |  """  conspiracy.  |
'------------------------------'-------'------------------'--------------------'
#7 lore raw

PATCH 1/1 sh: Fix Buildroot sh targets to match gnuconfig targets

In reply to Phil Edworthy
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Phil" == Phil Edworthy <[email protected]> writes:

Phil> sh2eb and sh2a_nofpueb gnuconfig targets are no longer supported Phil> in Buildroot. This patch replaces these Buildroot targets with sh2 Phil> and sh2a respectively, and adds sh4a targets as these are widely Phil> used.

Phil> To build for devices without an fpu, the relevant toolchain flags Phil> will have to be specified.

Phil> Signed-off-by: Phil Edworthy <[email protected]>

Committed, sorry for the slow response.

Signature · 1 line
Bye, Peter Korsgaard