Skip to contentSkip to conversation

spl: socfpga: only gen5 devices and arria10 require sfp image

PATCH New Dalon Westergreen 5 participants 19 messages Sep 6, 2018 – Sep 7, 2018 Kbuild

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 spl: socfpga: only gen5 devices and arria10 require sfp image

Only the Cyclone5/Arria5 and Arria10 devices require the sfp formated image for booting. This path ensures that the file is only generated for those devices.

---
 scripts/Makefile.spl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.spl +2 -1
index 252f13826d..76d08fd92b 100644
@@ -188,7 +188,8 @@ ALL-y	+= $(obj)/$(BOARD)-spl.bin
 endif
 
 ifdef CONFIG_ARCH_SOCFPGA
-ALL-y	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
 endif
 
 ifdef CONFIG_ARCH_SUNXI
Signature · 1 line
2.17.1
#1 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y
scripts/Makefile.spl +6 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 endif
 
 ifdef CONFIG_ARCH_SUNXI
@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
 	$(call if_changed,objcopy)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN) FORCE
+	$(call if_changed,objcopy)
+
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
Signature · 1 line
2.17.1
#2 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 4 lines · Dalon Westergreen

Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

Although not running a Stratix10, I also need a hex image for spl to boot unconfigured CycloneV devices.
However, for this, it is enough to objcopy u-boot.spl.sfp to hex and add the resulting file to the FPGA configuration image.

Quartus does complain about the format a bit, but it does work. Is this different for Stratix10?

Simon

Quoted 51 lines

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y
scripts/Makefile.spl +6 -1
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)      += $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)   += $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
 endif
 
 ifdef CONFIG_ARCH_SUNXI
@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
        $(call if_changed,objcopy)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN) FORCE
+       $(call if_changed,objcopy)
+
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
--

2.17.1

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot

#3 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 10 lines · Simon Goldschmidt

On Thu, Sep 6, 2018 at 5:04 AM Dalon Westergreen <[email protected]> wrote:

Stratix10 requires a hex image of the spl for boot. The heximage is added to the FPGA configuration image and loaded tothe processor memory by the configuration engine.
Although not running a Stratix10, I also need a hex image for spl toboot unconfigured CycloneV devices.However, for this, it is enough to objcopy u- boot.spl.sfp to hex andadd the resulting file to the FPGA configuration image. Quartus does complain about the format a bit, but it does work. Isthis different for Stratix10?

The difference is that in stratix10 the SDM loads the spl image into the HPS onchip ram. The SPL image is actually a part of the fpga configuration image. The tool that adds the image to the fpga configuration image validates its address span, so using objcopy on the binary requires a --change- address. Since the file is always needed for stratix10, it seems prudent to generate it as part of the build.

Quoted 32 lines

Simon

v2: -> add CONFIG_OF_EMBED to include dtb in elf -> generate hex from elf source

configs/socfpga_stratix10_defconfig | 1 +
scripts/Makefile.spl | 6 ++++++ 2 files changed, 7
insertions(+)

(quoted diff) +0 -0

b/configs/socfpga_stratix10_defconfigindex dceadff439..17cc732cbe 100644--- a/configs/socfpga_stratix10_defconfig+++ b/configs/socfpga_stratix10_defconfig@@ -56,3 +56,4 @@ CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y CONFIG_USE_TINY_PRINTF=y+CONFIG_OF_EMBED=ydiff --git a/scripts/Makefile.spl b/scripts/Makefile.splindex 76d08fd92b..b09bd40b2a 100644--- a/scripts/Makefile.spl+++ b/scripts/Makefile.spl@@ -190,6 +190,7 @@ endif
ifdef CONFIG_ARCH_SOCFPGA ALL-$(CONFIG_TARGET_SOCFPGA_GEN5) +=
$(obj)/$(SPL_BIN).sfp ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10) +=
$(obj)/$(SPL_BIN).sfp+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex endif
ifdef CONFIG_ARCH_SUNXI@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-
spl.bin := -O binary -j .start16 -j .resetvec $(obj)/u-boot-x86-16bit-spl.bin:
$(obj)/u-boot-spl FORCE $(call if_changed,objcopy)
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex++$(obj)/$(SPL_BIN).hex:
$(obj)/$(SPL_BIN) FORCE+ $(call if_changed,objcopy)+ LDFLAGS_$(SPL_BIN)
+= -T u-boot-spl.lds $(LDFLAGS_FINAL)
# Avoid 'Not enough room for program headers' error on binutils 2.28
onwards.--2.17.1 _______________________________________________U-Boot mailing listU- Boot at lists.denx.de
https://lists.denx.de/listinfo/u-boot_______________________________________________U-Boot
mailing listU-Boot at lists.denx.dehttps://lists.denx.de/listinfo/u-boot

#4 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

In reply to Dalon Westergreen
Quoted 19 lines · Dalon Westergreen

Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +0 -0
index dceadff439..17cc732cbe 100644

configs/socfpga_stratix10_defconfig CONFIG_DM_USB=y · line 59

Quoted 4 lines
configs/socfpga_stratix10_defconfig +1 -0
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

scripts/Makefile.spl endif · line 193

Quoted 9 lines
scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

scripts/Makefile.spl OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec · line 307

Quoted 12 lines
scripts/Makefile.spl +5 -0
 endif
 
 ifdef CONFIG_ARCH_SUNXI
@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
 	$(call if_changed,objcopy)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN) FORCE
+	$(call if_changed,objcopy)
+

This is generic, separate patch please.

Quoted 4 lines
scripts/Makefile.spl +0 -0
 LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
 
 # Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.
Signature · 2 lines
Best regards,
Marek Vasut
#5 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 10 lines · Marek Vasut

On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The heximage is added to the FPGA configuration image and loaded tothe processor memory by the configuration engine.
v2: -> add CONFIG_OF_EMBED to include dtb in elf -> generate hex from elf source

configs/socfpga_stratix10_defconfig | 1 +
scripts/Makefile.spl | 6 ++++++ 2 files changed, 7
insertions(+)

Quoted 8 lines
(quoted diff) +0 -0

b/configs/socfpga_stratix10_defconfigindex dceadff439..17cc732cbe 100644--- a/configs/socfpga_stratix10_defconfig+++ b/configs/socfpga_stratix10_defconfig@@ -56,3 +56,4 @@ CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y CONFIG_USE_TINY_PRINTF=y+CONFIG_OF_EMBED=y
Why is this needed ? And where did the objcopy hack go ? What is theexplanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot- spl-dtb.bin for objcopy. The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

Quoted 6 lines
scripts/Makefile.splindex renamed from scripts/Makefile.spl +0 -0

76d08fd92b..b09bd40b2a 100644--- a/scripts/Makefile.spl+++ b/scripts/Makefile.spl@@ -190,6 +190,7 @@ endif ifdef CONFIG_ARCH_SOCFPGA ALL-
$(CONFIG_TARGET_SOCFPGA_GEN5) += $(obj)/$(SPL_BIN).sfp ALL-
$(CONFIG_TARGET_SOCFPGA_ARRIA10) += $(obj)/$(SPL_BIN).sfp+ALL-
$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex

Quoted 8 lines

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?
endif ifdef CONFIG_ARCH_SUNXI@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-
16bit-spl.bin := -O binary -j .start16 -j .resetvec $(obj)/u-boot-x86-16bit-
spl.bin: $(obj)/u-boot-spl FORCE $(call if_changed,objcopy)
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex++$(obj)/$(SPL_BIN).hex:
$(obj)/$(SPL_BIN) FORCE+ $(call if_changed,objcopy)+
This is generic, separate patch please.
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)

Will do

Quoted 4 lines

# Avoid 'Not enough room for program headers' error on binutils 2.28 onwards.

#6 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 26 lines · Dalon L Westergreen
Quoted 25 lines · Marek Vasut

On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y
Quoted 9 lines
Quoted 2 lines

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

Quoted 25 lines
Quoted 25 lines
scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

endif

ifdef CONFIG_ARCH_SUNXI

scripts/Makefile.spl +5 -0
@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
 	$(call if_changed,objcopy)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN) FORCE
+	$(call if_changed,objcopy)
+
 
Quoted 6 lines
Quoted 4 lines

This is generic, separate patch please.

LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)

Will do

Thanks

Signature · 2 lines
Best regards,
Marek Vasut
#7 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 12 lines · Marek Vasut

On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:Stratix10 requires a hex image of the spl for boot. The heximage is added to the FPGA configuration image and loaded tothe processor memory by the configuration engine.
v2: -> add CONFIG_OF_EMBED to include dtb in elf -> generate hex from elf source

dwesterg at gmail.com>>--- configs/socfpga_stratix10_defconfig | 1 +
scripts/Makefile.spl | 6 ++++++ 2 files changed, 7
insertions(+)

(quoted diff) +0 -0
Quoted 13 lines

b/configs/socfpga_stratix10_defconfigindex dceadff439..17cc732cbe 100644--- a/configs/socfpga_stratix10_defconfig+++ b/configs/socfpga_stratix10_defconfig@@ -56,3 +56,4 @@ CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y CONFIG_USE_TINY_PRINTF=y+CONFIG_OF_EMBED=y
Why is this needed ? And where did the objcopy hack go ? What is theexplanation here ?
You suggested the use of CONFIG_OF_EMBED as an alternative to using theu-boot- spl-dtb.bin for objcopy.The intent is to ensure that the spl elf has the dtb included, and thena simple objcopy to elf to hex is fine.You no longer need the --change-address as the elf indicates the correctstart address, unlike the binary.
And that's fine with your usecase ? Fine be me then ...

Is it possible to apply CONFIG_OF_EMBED=y only to the SPL build?

Quoted 17 lines
scripts/Makefile.splindex renamed from scripts/Makefile.spl +0 -0

76d08fd92b..b09bd40b2a 100644--- a/scripts/Makefile.spl+++ b/scripts/Makefile.spl@@ -190,6 +190,7 @@ endif ifdef CONFIG_ARCH_SOCFPGA ALL-
$(CONFIG_TARGET_SOCFPGA_GEN5) += $(obj)/$(SPL_BIN).sfp ALL-
$(CONFIG_TARGET_SOCFPGA_ARRIA10) += $(obj)/$(SPL_BIN).sfp+ALL-
$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?
endif ifdef CONFIG_ARCH_SUNXI@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-
16bit-spl.bin := -O binary -j .start16 -j .resetvec $(obj)/u-boot-x86-16bit-
spl.bin: $(obj)/u-boot-spl FORCE $(call if_changed,objcopy)
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex++$(obj)/$(SPL_BIN).hex:
$(obj)/$(SPL_BIN) FORCE+ $(call if_changed,objcopy)+
This is generic, separate patch please.
LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)
Will do
Thanks

#8 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 38 lines · Dalon L Westergreen
Quoted 37 lines · Marek Vasut

On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

Quoted 3 lines
Quoted 1 line

And that's fine with your usecase ? Fine be me then ...

Is it possible to apply CONFIG_OF_EMBED=y only to the SPL build?

I think so, and if not, create CONFIG_SPL_OF_EMBED

Signature · 2 lines
Best regards,
Marek Vasut
#9 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

In reply to Marek Vasut
Quoted 53 lines · Marek Vasut

On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:

On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:

On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 
Quoted 1 line

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

Quoted 24 lines

endif

ifdef CONFIG_ARCH_SUNXI

scripts/Makefile.spl +5 -0
@@ -299,6 +300,11 @@ OBJCOPYFLAGS_u-boot-x86-16bit-spl.bin := -O binary -j .start16 -j .resetvec
 $(obj)/u-boot-x86-16bit-spl.bin: $(obj)/u-boot-spl FORCE
 	$(call if_changed,objcopy)
 
+OBJCOPYFLAGS_$(SPL_BIN).hex = -O ihex
+
+$(obj)/$(SPL_BIN).hex: $(obj)/$(SPL_BIN) FORCE
+	$(call if_changed,objcopy)
+
 

This is generic, separate patch please.

LDFLAGS_$(SPL_BIN) += -T u-boot-spl.lds $(LDFLAGS_FINAL)

Will do

Thanks

#10 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 56 lines · Dalon L Westergreen
Quoted 49 lines · Marek Vasut

On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 
Quoted 1 line

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

Quoted 7 lines

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

Signature · 2 lines
Best regards,
Marek Vasut
#11 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 35 lines · Marek Vasut

On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:On 09/06/2018 05:02 AM, Dalon Westergreen wrote:Stratix10 requires a hex image of the spl for boot. The heximage is added to the FPGA configuration image and loaded tothe processor memory by the configuration engine.
v2: -> add CONFIG_OF_EMBED to include dtb in elf -> generate hex from elf source

dwesterg at gmail.com> <mailto:dwesterg at gmail.com <mailto:[email protected]>>> --- configs/socfpga_stratix10_defconfig | 1 +
scripts/Makefile.spl | 6 ++++++ 2 files changed, 7
insertions(+)

(quoted diff) +0 -0

b/configs/socfpga_stratix10_defconfigindex dceadff439..17cc732cbe 100644--- a/configs/socfpga_stratix10_defconfig+++ b/configs/socfpga_stratix10_defconfig@@ -56,3 +56,4 @@ CONFIG_DM_USB=y CONFIG_USB_DWC2=y CONFIG_USB_STORAGE=y CONFIG_USE_TINY_PRINTF=y+CONFIG_OF_EMBED=y
Why is this needed ? And where did the objcopy hack go ? What is theexplanation here ?
You suggested the use of CONFIG_OF_EMBED as an alternative to using theu-boot- spl-dtb.bin for objcopy.The intent is to ensure that the spl elf has the dtb included, and thena simple objcopy to elf to hex is fine.You no longer need the --change-address as the elf indicates the correctstart address, unlike the binary.
And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.splindex renamed from scripts/Makefile.spl +0 -0

76d08fd92b..b09bd40b2a 100644--- a/scripts/Makefile.spl+++ b/scripts/Makefile.spl@@ -190,6 +190,7 @@ endif ifdef CONFIG_ARCH_SOCFPGA ALL-
$(CONFIG_TARGET_SOCFPGA_GEN5) += $(obj)/$(SPL_BIN).sfp ALL-
$(CONFIG_TARGET_SOCFPGA_ARRIA10) += $(obj)/$(SPL_BIN).sfp+ALL-
$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ? This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be anSPL

Quoted 8 lines

target, but rather atarget for creating combined u-boot + spl images at the top level. Adding
ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex
in Makefile.spl andCONFIG_SPL_TARGET="u-boot-spl.hex"in the socfpga_stratix10_config
results in a build failure with no target for u-boot-spl.hex
I mean, just define CONFIG_SPL_TARGET and it should generate thematching file automatically. See the README, it explains this macro.

I still get:make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.
When i look at all of the other defined CONFIG_SPL_TARGET, for example [dwesterg at dwesterg-mobl u-boot]$ grep -R u-boot-with-spl.bin *......include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCEMakefile:u-boot.ubl: u-boot-with-spl.bin FORCE[dwesterg at dwesterg-mobl u- boot]$
or
[dwesterg at dwesterg-mobl u-boot]$ grep -R u-boot-with-nand-spl.imx *arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u- boot.uim FORCEinclude/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx:
SPL u-boot.bin FORCE
you find the corresponding target in the makefile. There is no target for u- boot-spl.hex,furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.
ifdef CONFIG_TPLSPL_PAYLOAD := tpl/u-boot-with-tpl.binelseSPL_PAYLOAD := u- boot.binendif
OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary
\ --pad-to=$(CONFIG_SPL_PAD_TO)u-boot-with-
spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE $(call
if_changed,pad_cat)
So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGETi see combine spl and u-boot.
--dalon

#12 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 71 lines · Dalon L Westergreen
Quoted 59 lines · Marek Vasut

On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:
On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

Quoted 9 lines

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

I still get:

Quoted 4 lines

make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.

When i look at all of the other defined CONFIG_SPL_TARGET, for example

I guess you did add the u-boot-spl.hex target already ?

Quoted 49 lines

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-spl.bin *

...

...

include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"

Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

Makefile:u-boot.ubl: u-boot-with-spl.bin FORCE

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$

or

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-nand-spl.imx *

arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE

include/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"

Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE

you find the corresponding target in the makefile. There is no target for u-boot-spl.hex,

furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.

ifdef CONFIG_TPL

SPL_PAYLOAD := tpl/u-boot-with-tpl.bin

else

SPL_PAYLOAD := u-boot.bin

endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

                                   --pad-to=$(CONFIG_SPL_PAD_TO)
Quoted 8 lines

u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

        $(call if_changed,pad_cat)

So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGET

i see combine spl and u-boot.

Try this:

include/configs/ls1046a_common.h:#define CONFIG_SPL_TARGET "spl/u-boot-spl.pbl"

Signature · 2 lines
Best regards,
Marek Vasut
#13 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 133 lines · Marek Vasut

On 09/07/2018 06:15 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 23:56 +0200, Marek Vasut wrote:
On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:
On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

I still get:

make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.

When i look at all of the other defined CONFIG_SPL_TARGET, for example

I guess you did add the u-boot-spl.hex target already ?

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-spl.bin *

...

...

include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"

Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

Makefile:u-boot.ubl: u-boot-with-spl.bin FORCE

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$

or

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-nand-spl.imx *

arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE

include/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"

Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE

you find the corresponding target in the makefile. There is no target for u-boot-spl.hex,

furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.

ifdef CONFIG_TPL

SPL_PAYLOAD := tpl/u-boot-with-tpl.bin

else

SPL_PAYLOAD := u-boot.bin

endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

                                   --pad-to=$(CONFIG_SPL_PAD_TO)

u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

        $(call if_changed,pad_cat)
Quoted 9 lines

So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGET

i see combine spl and u-boot.

Try this:

include/configs/ls1046a_common.h:#define CONFIG_SPL_TARGET "spl/u-boot-spl.pbl"

True, but i would still need to add an spl/u-boot-spl.hex target in the main Makefile. What is the benefit of doing this over just adding the hex target in Makefile.spl?

#14 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 138 lines · Dalon L Westergreen
Quoted 137 lines · Marek Vasut

On 09/07/2018 06:15 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 23:56 +0200, Marek Vasut wrote:
On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:
On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

I still get:

make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.

When i look at all of the other defined CONFIG_SPL_TARGET, for example

I guess you did add the u-boot-spl.hex target already ?

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-spl.bin *

...

...

include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"

Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

Makefile:u-boot.ubl: u-boot-with-spl.bin FORCE

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$

or

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-nand-spl.imx *

arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE

include/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"

Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE

you find the corresponding target in the makefile. There is no target for u-boot-spl.hex,

furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.

ifdef CONFIG_TPL

SPL_PAYLOAD := tpl/u-boot-with-tpl.bin

else

SPL_PAYLOAD := u-boot.bin

endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

                                   --pad-to=$(CONFIG_SPL_PAD_TO)

u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

        $(call if_changed,pad_cat)

So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGET

i see combine spl and u-boot.

Quoted 8 lines
Quoted 5 lines

Try this:

include/configs/ls1046a_common.h:#define CONFIG_SPL_TARGET "spl/u-boot-spl.pbl"

True, but i would still need to add an spl/u-boot-spl.hex target in the main Makefile.

What is the benefit of doing this over just adding the hex target in Makefile.spl?

My whole point was that I'd like this:
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
to go away.

If you need to add a target to a Makefile, that's fine of course.

Signature · 2 lines
Best regards,
Marek Vasut
#15 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 146 lines · Marek Vasut

On 09/07/2018 06:40 PM, Dalon L Westergreen wrote:
On Fri, 2018-09-07 at 18:25 +0200, Marek Vasut wrote:
On 09/07/2018 06:15 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 23:56 +0200, Marek Vasut wrote:
On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:
On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

I still get:

make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.

When i look at all of the other defined CONFIG_SPL_TARGET, for example

I guess you did add the u-boot-spl.hex target already ?

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-spl.bin *

...

...

include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"

Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

Makefile:u-boot.ubl: u-boot-with-spl.bin FORCE

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$

or

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-nand-spl.imx *

arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE

include/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"

Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE

you find the corresponding target in the makefile. There is no target for u-boot-spl.hex,

furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.

ifdef CONFIG_TPL

SPL_PAYLOAD := tpl/u-boot-with-tpl.bin

else

SPL_PAYLOAD := u-boot.bin

endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

                                   --pad-to=$(CONFIG_SPL_PAD_TO)

u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

        $(call if_changed,pad_cat)

So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGET

i see combine spl and u-boot.

Try this:

include/configs/ls1046a_common.h:#define CONFIG_SPL_TARGET "spl/u-boot-spl.pbl"

True, but i would still need to add an spl/u-boot-spl.hex target in the main Makefile.

Quoted 8 lines

What is the benefit of doing this over just adding the hex target in Makefile.spl?

My whole point was that I'd like this:
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
to go away.

If you need to add a target to a Makefile, that's fine of course.

Should i move the sfp generation stuff while I am at it? use CONFIG_SPL_TARGET in the gen5 /Arria10 devices as well? I think it would clean things up.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 3282 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180907/aa974e91/attachment.bin>

#16 lore raw

PATCH v2 2/2 spl: socfpga: stratix10: add hex file output for spl image

Quoted 153 lines · Dalon
Quoted 152 lines · Marek Vasut

On 09/07/2018 06:40 PM, Dalon L Westergreen wrote:
On Fri, 2018-09-07 at 18:25 +0200, Marek Vasut wrote:
On 09/07/2018 06:15 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 23:56 +0200, Marek Vasut wrote:
On 09/06/2018 11:26 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 15:41 +0200, Marek Vasut wrote:
On 09/06/2018 03:39 PM, Dalon L Westergreen wrote:
On Thu, 2018-09-06 at 12:09 +0200, Marek Vasut wrote:
On 09/06/2018 05:02 AM, Dalon Westergreen wrote:
Stratix10 requires a hex image of the spl for boot. The hex image is added to the FPGA configuration image and loaded to the processor memory by the configuration engine.

v2:
-> add CONFIG_OF_EMBED to include dtb in elf
-> generate hex from elf source

Signed-off-by Dalon Westergreen <dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>> <mailto:dwesterg at gmail.com <mailto:[email protected]> <mailto:dwesterg at gmail.com <mailto:[email protected]>>>>>>
---
 configs/socfpga_stratix10_defconfig | 1 +
 scripts/Makefile.spl                | 6 ++++++
 2 files changed, 7 insertions(+)
configs/socfpga_stratix10_defconfig +1 -0
index dceadff439..17cc732cbe 100644
@@ -56,3 +56,4 @@ CONFIG_DM_USB=y
 CONFIG_USB_DWC2=y
 CONFIG_USB_STORAGE=y
 CONFIG_USE_TINY_PRINTF=y
+CONFIG_OF_EMBED=y

Why is this needed ? And where did the objcopy hack go ? What is the explanation here ?

You suggested the use of CONFIG_OF_EMBED as an alternative to using the u-boot-spl-dtb.bin for objcopy.
The intent is to ensure that the spl elf has the dtb included, and then a simple objcopy to elf to hex is fine.
You no longer need the --change-address as the elf indicates the correct start address, unlike the binary.

And that's fine with your usecase ? Fine be me then ...

scripts/Makefile.spl +1 -0
index 76d08fd92b..b09bd40b2a 100644
@@ -190,6 +190,7 @@ endif
 ifdef CONFIG_ARCH_SOCFPGA
 ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
 ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/$(SPL_BIN).hex
 

CONFIG_SPL_TARGET "u-boot-spl.hex" can replace this addition I think ?

This doesnt actually work as CONFIG_SPL_TARGET doesnt appear to be an SPL target, but rather a
target for creating combined u-boot + spl images at the top level. Adding

ALL-$(CONFIG_SPL_TARGET) += $(obj)/$(SPL_BIN).hex

in Makefile.spl and
CONFIG_SPL_TARGET="u-boot-spl.hex"
in the socfpga_stratix10_config

results in a build failure with no target for u-boot-spl.hex

I mean, just define CONFIG_SPL_TARGET and it should generate the matching file automatically. See the README, it explains this macro.

I still get:

make: *** No rule to make target 'u-boot-spl.hex', needed by 'all'. Stop.

When i look at all of the other defined CONFIG_SPL_TARGET, for example

I guess you did add the u-boot-spl.hex target already ?

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-spl.bin *

...

...

include/configs/uniphier.h:#define CONFIG_SPL_TARGET "u-boot-with-spl.bin"

Makefile:OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

Makefile:u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

Makefile:u-boot.ubl: u-boot-with-spl.bin FORCE

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$

or

[dwesterg at dwesterg-mobl <mailto:dwesterg@dwesterg-mobl> u-boot]$ grep -R u-boot-with-nand-spl.imx *

arch/arm/mach-imx/Makefile:u-boot-with-nand-spl.imx: spl/u-boot-nand-spl.imx u-boot.uim FORCE

include/configs/m53evk.h:#define CONFIG_SPL_TARGET "u-boot-with-nand-spl.imx"

Makefile:u-boot-with-spl.imx u-boot-with-nand-spl.imx: SPL u-boot.bin FORCE

you find the corresponding target in the makefile. There is no target for u-boot-spl.hex,

furthermore the CONFIG_SPL_TARGET seems to combine spl with uboot to create a combined image.

ifdef CONFIG_TPL

SPL_PAYLOAD := tpl/u-boot-with-tpl.bin

else

SPL_PAYLOAD := u-boot.bin

endif

OBJCOPYFLAGS_u-boot-with-spl.bin = -I binary -O binary \

                                   --pad-to=$(CONFIG_SPL_PAD_TO)

u-boot-with-spl.bin: spl/u-boot-spl.bin $(SPL_PAYLOAD) FORCE

        $(call if_changed,pad_cat)

So I can add a simple u-boot-spl.hex target, but all of the other CONFIG_SPL_TARGET

i see combine spl and u-boot.

Try this:

include/configs/ls1046a_common.h:#define CONFIG_SPL_TARGET "spl/u-boot-spl.pbl"

True, but i would still need to add an spl/u-boot-spl.hex target in the main Makefile.

What is the benefit of doing this over just adding the hex target in Makefile.spl?

My whole point was that I'd like this:
+ALL-$(CONFIG_TARGET_SOCFPGA_STRATIX10) += $(obj)/$(SPL_BIN).hex
to go away.

Quoted 5 lines
Quoted 2 lines

If you need to add a target to a Makefile, that's fine of course.

Should i move the sfp generation stuff while I am at it? use CONFIG_SPL_TARGET

in the gen5 /Arria10 devices as well? I think it would clean things up.

Sure, please do.

Signature · 2 lines
Best regards,
Marek Vasut
#17 lore raw

PATCH v2 1/2 spl: socfpga: only gen5 devices and arria10 require sfp image

In reply to Dalon Westergreen
Quoted 15 lines · Dalon Westergreen

Only the Cyclone5/Arria5 and Arria10 devices require the sfp formated image for booting. This path ensures that the file is only generated for those devices.

---
 scripts/Makefile.spl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.spl +0 -0
index 252f13826d..76d08fd92b 100644

scripts/Makefile.spl ALL-y += $(obj)/$(BOARD)-spl.bin · line 195

Quoted 9 lines
scripts/Makefile.spl +2 -1
@@ -188,7 +188,8 @@ ALL-y	+= $(obj)/$(BOARD)-spl.bin
 endif
 
 ifdef CONFIG_ARCH_SOCFPGA
-ALL-y	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
 endif
 
 ifdef CONFIG_ARCH_SUNXI

What about adding Kconfig option , something like CONFIG_TARGET_SOCFPGA_SFP , using it above and enabling it on Gen5 and A10 ? That way ,we won't have two entries with the same content.

Signature · 2 lines
Best regards,
Marek Vasut
#18 lore raw

PATCH v2 1/2 spl: socfpga: only gen5 devices and arria10 require sfp image

Quoted 26 lines · Marek Vasut

On 09/06/2018 05:02 AM, Dalon Westergreen wrote:

Only the Cyclone5/Arria5 and Arria10 devices require the sfp formated image for booting. This path ensures that the file is only generated for those devices.

---
 scripts/Makefile.spl | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
scripts/Makefile.spl +2 -1
index 252f13826d..76d08fd92b 100644
@@ -188,7 +188,8 @@ ALL-y	+= $(obj)/$(BOARD)-spl.bin
 endif
 
 ifdef CONFIG_ARCH_SOCFPGA
-ALL-y	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_GEN5)	+= $(obj)/$(SPL_BIN).sfp
+ALL-$(CONFIG_TARGET_SOCFPGA_ARRIA10)	+= $(obj)/$(SPL_BIN).sfp
 endif
 
 ifdef CONFIG_ARCH_SUNXI
Quoted 4 lines

What about adding Kconfig option , something like CONFIG_TARGET_SOCFPGA_SFP , using it above and enabling it on Gen5 and A10 ? That way ,we won't have two entries with the same content.

Good idea.