diff mbox

[U-Boot] arch/sh: allow building in big-endian mode

Message ID 20170728211428.7947-1-thomas.petazzoni@free-electrons.com
State Accepted
Commit 90340c87e5eed344f6f947661ff170c8369635db
Delegated to: Nobuhiro Iwamatsu
Headers show

Commit Message

Thomas Petazzoni July 28, 2017, 9:14 p.m. UTC
The SuperH architecture allows to be run in either little or big
endian mode. Some SuperH SoCs get the little vs. big endian decision
through mode pins sampled at reset, so if big endian has been choosen
by HW designers, it cannot be easily changed.

Therefore, it makes sense to allow building U-Boot for SuperH in big
endian mode. To allow this, the only change needed is to adjust the
OUTPUT_FORMAT() in the linker script.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
---
 arch/sh/cpu/u-boot.lds | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Nobuhiro Iwamatsu Aug. 2, 2017, 11:19 p.m. UTC | #1
Applied, thanks!

2017-07-29 6:14 GMT+09:00 Thomas Petazzoni
<thomas.petazzoni@free-electrons.com>:
> The SuperH architecture allows to be run in either little or big
> endian mode. Some SuperH SoCs get the little vs. big endian decision
> through mode pins sampled at reset, so if big endian has been choosen
> by HW designers, it cannot be easily changed.
>
> Therefore, it makes sense to allow building U-Boot for SuperH in big
> endian mode. To allow this, the only change needed is to adjust the
> OUTPUT_FORMAT() in the linker script.
>
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  arch/sh/cpu/u-boot.lds | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds
> index bbf9ff4..f185b4d 100644
> --- a/arch/sh/cpu/u-boot.lds
> +++ b/arch/sh/cpu/u-boot.lds
> @@ -9,7 +9,12 @@
>
>  #include "config.h"
>
> +#ifdef CONFIG_SYS_BIG_ENDIAN
> +OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-sh-linux")
> +#else
>  OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
> +#endif
> +
>  OUTPUT_ARCH(sh)
>
>  MEMORY
> --
> 2.9.4
>
diff mbox

Patch

diff --git a/arch/sh/cpu/u-boot.lds b/arch/sh/cpu/u-boot.lds
index bbf9ff4..f185b4d 100644
--- a/arch/sh/cpu/u-boot.lds
+++ b/arch/sh/cpu/u-boot.lds
@@ -9,7 +9,12 @@ 
 
 #include "config.h"
 
+#ifdef CONFIG_SYS_BIG_ENDIAN
+OUTPUT_FORMAT("elf32-shbig-linux", "elf32-shbig-linux", "elf32-sh-linux")
+#else
 OUTPUT_FORMAT("elf32-sh-linux", "elf32-sh-linux", "elf32-sh-linux")
+#endif
+
 OUTPUT_ARCH(sh)
 
 MEMORY