diff mbox series

[04/10] xtensa: Define PLATFORM_ELFFLAGS

Message ID 20240519-qemu-xtensa-v1-4-8fff0cb11c19@flygoat.com
State Changes Requested
Delegated to: Tom Rini
Headers show
Series xtensa: Enable qemu-xtensa board | expand

Commit Message

Jiaxun Yang May 19, 2024, 8:53 p.m. UTC
u-boot.elf target requiures it to work.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
---
 arch/xtensa/config.mk | 3 +++
 1 file changed, 3 insertions(+)

Comments

Max Filippov May 20, 2024, 3:18 p.m. UTC | #1
On Sun, May 19, 2024 at 1:53 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>
> u-boot.elf target requiures it to work.

Typo.

> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
> ---
>  arch/xtensa/config.mk | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/arch/xtensa/config.mk b/arch/xtensa/config.mk
> index b0809999e403..3ec936272f25 100644
> --- a/arch/xtensa/config.mk
> +++ b/arch/xtensa/config.mk
> @@ -7,3 +7,6 @@ PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
>                      -ffunction-sections -fdata-sections
>
>  LDFLAGS_FINAL += --gc-sections
> +
> +PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
> +

This fixes endianness as little for the whole architecture, but xtensa cores
may be either little or big endian.
Jiaxun Yang May 20, 2024, 3:59 p.m. UTC | #2
在2024年5月20日五月 下午4:18,Max Filippov写道:
> On Sun, May 19, 2024 at 1:53 PM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
>>
>> u-boot.elf target requiures it to work.
>
> Typo.
>
>> Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
>> ---
>>  arch/xtensa/config.mk | 3 +++
>>  1 file changed, 3 insertions(+)
>>
>> diff --git a/arch/xtensa/config.mk b/arch/xtensa/config.mk
>> index b0809999e403..3ec936272f25 100644
>> --- a/arch/xtensa/config.mk
>> +++ b/arch/xtensa/config.mk
>> @@ -7,3 +7,6 @@ PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
>>                      -ffunction-sections -fdata-sections
>>
>>  LDFLAGS_FINAL += --gc-sections
>> +
>> +PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
>> +
>
> This fixes endianness as little for the whole architecture, but xtensa cores
> may be either little or big endian.

Hi Max,

Thanks for reviewing, I can just add a branch with ifdef CONFIG_SYS_BIG_EDNIAN
if you wish, but I think all CPUs U-Boot support are little endian only?

I have an ongoing series[1] fixing endian selection options, please let me know if
U-Boot do work with big endian Xtensa.

Thanks.

[1]: https://patchwork.ozlabs.org/project/uboot/patch/20240519-aarch64-be-v1-11-75cc328eddfa@flygoat.com/

>
> -- 
> Thanks.
> -- Max
Max Filippov May 21, 2024, 7:12 a.m. UTC | #3
On Mon, May 20, 2024 at 9:00 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
> >> diff --git a/arch/xtensa/config.mk b/arch/xtensa/config.mk
> >> index b0809999e403..3ec936272f25 100644
> >> --- a/arch/xtensa/config.mk
> >> +++ b/arch/xtensa/config.mk
> >> @@ -7,3 +7,6 @@ PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
> >>                      -ffunction-sections -fdata-sections
> >>
> >>  LDFLAGS_FINAL += --gc-sections
> >> +
> >> +PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
> >> +
> >
> > This fixes endianness as little for the whole architecture, but xtensa cores
> > may be either little or big endian.
>
> Thanks for reviewing, I can just add a branch with ifdef CONFIG_SYS_BIG_EDNIAN
> if you wish, but I think all CPUs U-Boot support are little endian only?
>
> I have an ongoing series[1] fixing endian selection options, please let me know if
> U-Boot do work with big endian Xtensa.

I had an impression that there's nothing endian-specific in the xtensa port,
so it should work for both little- and big-endian cores. Let me test whether
it's true though (:

> [1]: https://patchwork.ozlabs.org/project/uboot/patch/20240519-aarch64-be-v1-11-75cc328eddfa@flygoat.com/
Max Filippov May 22, 2024, 7:09 a.m. UTC | #4
On Tue, May 21, 2024 at 12:12 AM Max Filippov <jcmvbkbc@gmail.com> wrote:
> On Mon, May 20, 2024 at 9:00 AM Jiaxun Yang <jiaxun.yang@flygoat.com> wrote:
> > >> diff --git a/arch/xtensa/config.mk b/arch/xtensa/config.mk
> > >> index b0809999e403..3ec936272f25 100644
> > >> --- a/arch/xtensa/config.mk
> > >> +++ b/arch/xtensa/config.mk
> > >> @@ -7,3 +7,6 @@ PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
> > >>                      -ffunction-sections -fdata-sections
> > >>
> > >>  LDFLAGS_FINAL += --gc-sections
> > >> +
> > >> +PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
> > >> +
> > >
> > > This fixes endianness as little for the whole architecture, but xtensa cores
> > > may be either little or big endian.
> >
> > Thanks for reviewing, I can just add a branch with ifdef CONFIG_SYS_BIG_EDNIAN
> > if you wish, but I think all CPUs U-Boot support are little endian only?
> >
> > I have an ongoing series[1] fixing endian selection options, please let me know if
> > U-Boot do work with big endian Xtensa.
>
> I had an impression that there's nothing endian-specific in the xtensa port,
> so it should work for both little- and big-endian cores. Let me test whether
> it's true though (:

Yep, I can confirm that. Importing big endian xtensa core files into the current
u-boot (I tested this one:
  https://github.com/jcmvbkbc/xtensa-toolchain-build/blob/master/overlays/xtensa_test_kc705_be.tar.gz
matching cross-compiler is available here:
  https://github.com/foss-xtensa/toolchain/releases/download/2019.03/x86_64-2019.03-xtensa-test_kc705_be-elf.tar.gz
)
and building it for xtfpga produces a working image.
diff mbox series

Patch

diff --git a/arch/xtensa/config.mk b/arch/xtensa/config.mk
index b0809999e403..3ec936272f25 100644
--- a/arch/xtensa/config.mk
+++ b/arch/xtensa/config.mk
@@ -7,3 +7,6 @@  PLATFORM_CPPFLAGS += -D__XTENSA__ -mlongcalls -mforce-no-pic \
 		     -ffunction-sections -fdata-sections
 
 LDFLAGS_FINAL += --gc-sections
+
+PLATFORM_ELFFLAGS += -B xtensa -O elf32-xtensa-le
+