Skip to contentSkip to conversation

Makefile: Add target to generate hex output for combined spl and dtb

PATCH Superseded Siew Chin Lim 3 participants 5 messages Feb 19, 2021 – Feb 24, 2021 Kbuild

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Makefile: Add target to generate hex output for combined spl and dtb

From: Dalon Westergreen <[email protected]>

Some architectures, Stratix10/Agilex, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
Makefile +6 -5
index 4da46dea39..f1adc9aa23 100644
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
 
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \
@@ -1935,6 +1930,12 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
include/configs/socfpga_soc64_common.h +1 -1
index fdcd7d3e9a..1af359466c 100644
@@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1 MB */
scripts/Makefile.spl +8 -0
index ea4e045769..625e06d0d9 100644
@@ -229,6 +229,9 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/u-boot-spl-dtb.hex
+INPUTS-$(CONFIG_TARGET_SOCFPGA_AGILEX)		+= $(obj)/u-boot-spl-dtb.hex
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 
@@ -389,6 +392,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)
 
Signature · 1 line
2.13.0
#1 lore raw

PATCH 1/1 Makefile: Add target to generate hex output for combined spl and dtb

Quoted 71 lines · Siew Chin Lim

From: Dalon Westergreen <[email protected]>

Some architectures, Stratix10/Agilex, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
Makefile +6 -5
index 4da46dea39..f1adc9aa23 100644
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -R .resetvec)
 
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \
@@ -1935,6 +1930,12 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA),dts/dt.dtb) \
 		$(if $(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA),dts/dt.dtb)
include/configs/socfpga_soc64_common.h +1 -1
index fdcd7d3e9a..1af359466c 100644
@@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1 MB */
scripts/Makefile.spl +3 -0
index ea4e045769..625e06d0d9 100644
@@ -229,6 +229,9 @@ ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/u-boot-spl-dtb.hex
+INPUTS-$(CONFIG_TARGET_SOCFPGA_AGILEX)		+= $(obj)/u-boot-spl-dtb.hex
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 

scripts/Makefile.spl $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE · line 401

Quoted 10 lines
scripts/Makefile.spl +5 -0
@@ -389,6 +392,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE
 MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex --change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)

The commit message / subject doesn't make it clear that you're doing something for SoCFPGA here, and I seem to recall this change being proposed a while ago and it wasn't clear that this is really the best default path forward I thought?

Quoted 4 lines
Signature · 2 lines
-- 
2.13.0
Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210219/c65444f7/attachment.sig>
#2 lore raw

PATCH 1/1 Makefile: Add target to generate hex output for combined spl and dtb

Hi Tom,

Quoted 99 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, February 20, 2021 5:02 AM
To: Lim, Elly Siew Chin <[email protected]>
Cc: u-boot at lists.denx.de; Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: Re: [PATCH] Makefile: Add target to generate hex output for combined spl and dtb

Quoted 19 lines · Siew Chin Lim

From: Dalon Westergreen <[email protected]>

Some architectures, Stratix10/Agilex, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
Makefile +0 -0
index 4da46dea39..f1adc9aa23 100644

Makefile OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ · line 1264

Quoted 2 lines
Makefile +0 -0
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -

R .resetvec)

Quoted 11 lines
Makefile +0 -5
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \
@@ -1935,6 +1930,12 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:

Makefile spl/u-boot-spl.bin: spl/u-boot-spl · line 1940

Quoted 10 lines
Makefile +6 -0
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA ),dts/dt.dtb) \

Makefile spl/u-boot-spl.bin: spl/u-boot-spl · line 1941

Quoted 2 lines
Makefile +0 -0
 		$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA ),dts/d

scripts/Makefile.spl ifneq

Quoted 19 lines

t.dtb) diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index fdcd7d3e9a..1af359466c 100644

include/configs/socfpga_soc64_common.h +1 -1
@@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1 MB */
scripts/Makefile.spl index renamed from scripts/Makefile.spl +0 -0

ea4e045769..625e06d0d9 100644

scripts/Makefile.spl +0 -0
@@ -229,6 +229,9 @@ ifneq

($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

scripts/Makefile.spl ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

Quoted 4 lines
scripts/Makefile.spl +1 -0
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/u-boot-spl-

dtb.hex

scripts/Makefile.spl ifneq · line 233

Quoted 1 line
scripts/Makefile.spl +1 -0
+INPUTS-$(CONFIG_TARGET_SOCFPGA_AGILEX)		+= $(obj)/u-

boot-spl-dtb.hex

Quoted 8 lines
scripts/Makefile.spl +1 -0
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 
@@ -389,6 +392,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin
 FORCE  MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
Quoted 14 lines

scripts/Makefile.spl $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE · line 401

Quoted 8 lines
scripts/Makefile.spl +6 -0
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex
+--change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)

The commit message / subject doesn't make it clear that you're doing something for SoCFPGA here, and I seem to recall this change being proposed a while ago and it wasn't clear that this is really the best default path forward I thought?

Noted. I will resend the patch and enhance the message / subject .

I have checked again with the team about this, we still would like to generate the 'u-boot-spl-dtb.hex' for socfpga soc64 devices by default during u-boot compilation which is always needed by customer to generate the final configuration bitstream. Can you please advise if this is not the right way for the implementation?

Thanks,
Siew Chin

Quoted 7 lines
Quoted 4 lines
scripts/Makefile.spl +0 -1
--

2.13.0

--
Tom

#3 lore raw

PATCH 1/1 Makefile: Add target to generate hex output for combined spl and dtb

Quoted 116 lines · Elly Siew Chin

Hi Tom,

Quoted 99 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, February 20, 2021 5:02 AM
To: Lim, Elly Siew Chin <[email protected]>
Cc: u-boot at lists.denx.de; Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: Re: [PATCH] Makefile: Add target to generate hex output for combined spl and dtb

Quoted 19 lines · Siew Chin Lim

From: Dalon Westergreen <[email protected]>

Some architectures, Stratix10/Agilex, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
Makefile +0 -0
index 4da46dea39..f1adc9aa23 100644

Makefile OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \ · line 1264

Quoted 2 lines
Makefile +0 -0
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary \
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -

R .resetvec)

Quoted 11 lines
Makefile +0 -5
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \
@@ -1935,6 +1930,12 @@ spl/u-boot-spl.bin: spl/u-boot-spl
 	@:

Makefile spl/u-boot-spl.bin: spl/u-boot-spl · line 1940

Quoted 10 lines
Makefile +6 -0
 	$(SPL_SIZE_CHECK)
 
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA ),dts/dt.dtb) \

Makefile spl/u-boot-spl.bin: spl/u-boot-spl · line 1941

Quoted 2 lines
Makefile +0 -0
 		$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA ),dts/d

scripts/Makefile.spl ifneq

Quoted 19 lines

t.dtb) diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index fdcd7d3e9a..1af359466c 100644

include/configs/socfpga_soc64_common.h +1 -1
@@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1 MB */
scripts/Makefile.spl index renamed from scripts/Makefile.spl +0 -0

ea4e045769..625e06d0d9 100644

scripts/Makefile.spl +0 -0
@@ -229,6 +229,9 @@ ifneq

($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

scripts/Makefile.spl ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

Quoted 4 lines
scripts/Makefile.spl +1 -0
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/u-boot-spl-

dtb.hex

scripts/Makefile.spl ifneq · line 233

Quoted 1 line
scripts/Makefile.spl +1 -0
+INPUTS-$(CONFIG_TARGET_SOCFPGA_AGILEX)		+= $(obj)/u-

boot-spl-dtb.hex

Quoted 8 lines
scripts/Makefile.spl +1 -0
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 
@@ -389,6 +392,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin
 FORCE  MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
Quoted 14 lines

scripts/Makefile.spl $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE · line 401

Quoted 8 lines
scripts/Makefile.spl +6 -0
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex
+--change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)

The commit message / subject doesn't make it clear that you're doing something for SoCFPGA here, and I seem to recall this change being proposed a while ago and it wasn't clear that this is really the best default path forward I thought?

Quoted 4 lines

Noted. I will resend the patch and enhance the message / subject .

I have checked again with the team about this, we still would like to generate the 'u-boot-spl-dtb.hex' for socfpga soc64 devices by default during u-boot compilation which is always needed by customer to generate the final configuration bitstream. Can you please advise if this is not the right way for the implementation?

I think the changes are fine then, please just update the commit message, thanks!

Signature · 8 lines
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210223/291d360f/attachment.sig>
#4 lore raw

PATCH 1/1 Makefile: Add target to generate hex output for combined spl and dtb

Hi Tom,

Quoted 139 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Wednesday, February 24, 2021 12:29 AM
To: Lim, Elly Siew Chin <[email protected]>
Cc: u-boot at lists.denx.de; Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: Re: [PATCH] Makefile: Add target to generate hex output for combined spl and dtb

Quoted 32 lines · Elly Siew Chin

Hi Tom,

Quoted 30 lines

-----Original Message-----
From: Tom Rini <[email protected]>
Sent: Saturday, February 20, 2021 5:02 AM
To: Lim, Elly Siew Chin <[email protected]>
Cc: u-boot at lists.denx.de; Marek Vasut <[email protected]>; Tan, Ley Foon <[email protected]>; See, Chin Liang <[email protected]>; Simon Goldschmidt <[email protected]>; Chee, Tien Fong <[email protected]>; Westergreen, Dalon <[email protected]>; Simon Glass <[email protected]>; Gan, Yau Wai <[email protected]>
Subject: Re: [PATCH] Makefile: Add target to generate hex output for combined spl and dtb

Quoted 14 lines · Siew Chin Lim

From: Dalon Westergreen <[email protected]>

Some architectures, Stratix10/Agilex, require a hex formatted spl that combines the spl image and dtb. This adds a target to create said hex file with and offset of SPL_TEXT_BASE.

---
 Makefile                               | 11 ++++++-----
 include/configs/socfpga_soc64_common.h |  2 +-
 scripts/Makefile.spl                   |  8 ++++++++
 3 files changed, 15 insertions(+), 6 deletions(-)
Quoted 5 lines
Quoted 5 lines

Makefile OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary

Quoted 5 lines
Makefile +0 -0
index 4da46dea39..f1adc9aa23 100644
@@ -1263,11 +1263,6 @@ OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary

\

Quoted 16 lines
Quoted 16 lines

Makefile OBJCOPYFLAGS_u-boot-nodtb.bin := -O binary · line 1264

Quoted 2 lines
Makefile +0 -0
 		$(if $(CONFIG_X86_16BIT_INIT),-R .start16 -R .resetvec) \
 		$(if $(CONFIG_MPC85XX_HAVE_RESET_VECTOR),-R .bootpg -

R .resetvec)

Quoted 13 lines
Makefile +0 -5
-OBJCOPYFLAGS_u-boot-spl.hex = $(OBJCOPYFLAGS_u-boot.hex)
-
-spl/u-boot-spl.hex: spl/u-boot-spl FORCE
-	$(call if_changed,objcopy)
-
 binary_size_check: u-boot-nodtb.bin FORCE
 	@file_size=$(shell wc -c u-boot-nodtb.bin | awk '{print $$1}') ; \
 	map_size=$(shell cat u-boot.map | \ @@ -1935,6 +1930,12 @@

spl/u-boot-spl.bin: spl/u-boot-spl

Makefile +0 -0
 	@:
 	$(SPL_SIZE_CHECK)
Quoted 9 lines
Quoted 9 lines

Makefile spl/u-boot-spl.bin: spl/u-boot-spl

Quoted 8 lines
Makefile +6 -0
+spl/u-boot-spl-dtb.bin: spl/u-boot-spl
+	@:
+
+spl/u-boot-spl-dtb.hex: spl/u-boot-spl
+	@:
+
 spl/u-boot-spl: tools prepare \
 		$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_SPL_OF_PLATDATA

Quoted 4 lines
Quoted 4 lines

),dts/dt.dtb) \

Quoted 2 lines

$(if

$(CONFIG_OF_SEPARATE)$(CONFIG_OF_EMBED)$(CONFIG_TPL_OF_PLATDATA

Quoted 15 lines
Quoted 15 lines

),dts/d

Quoted 6 lines

t.dtb) diff --git a/include/configs/socfpga_soc64_common.h b/include/configs/socfpga_soc64_common.h
index fdcd7d3e9a..1af359466c 100644

include/configs/socfpga_soc64_common.h unsigned int cm_get_l4_sys_free_clk_hz(void); · line 206

Quoted 8 lines
include/configs/socfpga_soc64_common.h +1 -1
@@ -200,7 +200,7 @@ unsigned int cm_get_l4_sys_free_clk_hz(void);
  * 0x8000_0000 ...... End of SDRAM_1 (assume 2GB)
  *
  */
-#define CONFIG_SPL_TARGET		"spl/u-boot-spl.hex"
+#define CONFIG_SPL_TARGET		"spl/u-boot-spl-dtb.hex"
 #define CONFIG_SPL_MAX_SIZE		CONFIG_SYS_INIT_RAM_SIZE
 #define CONFIG_SPL_STACK		CONFIG_SYS_INIT_SP_ADDR
 #define CONFIG_SPL_BSS_MAX_SIZE		0x100000	/* 1

MB */

Quoted 6 lines
Quoted 6 lines

scripts/Makefile.spl ifneq

Quoted 5 lines
scripts/Makefile.spl index renamed from scripts/Makefile.spl +0 -0

ea4e045769..625e06d0d9 100644

scripts/Makefile.spl +0 -0
@@ -229,6 +229,9 @@ ifneq

($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

Quoted 4 lines
Quoted 4 lines

scripts/Makefile.spl ifneq ($(CONFIG_TARGET_SOCFPGA_GEN5)$(CONFIG_TARGET_SOCFPGA_ARRIA10),)

Quoted 4 lines
scripts/Makefile.spl +1 -0
 INPUTS-y	+= $(obj)/$(SPL_BIN).sfp
 endif
 
+INPUTS-$(CONFIG_TARGET_SOCFPGA_STRATIX10)	+= $(obj)/u-

boot-spl-

Quoted 28 lines
Quoted 11 lines

dtb.hex

scripts/Makefile.spl ifneq · line 233

Quoted 1 line
scripts/Makefile.spl +1 -0
+INPUTS-$(CONFIG_TARGET_SOCFPGA_AGILEX)		+= $(obj)/u-

boot-spl-dtb.hex

Quoted 8 lines
scripts/Makefile.spl +1 -0
+
 ifdef CONFIG_ARCH_SUNXI
 INPUTS-y	+= $(obj)/sunxi-spl.bin
 
@@ -389,6 +392,11 @@ $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin
 FORCE  MKIMAGEFLAGS_sunxi-spl.bin = -T sunxi_egon \
 	-n $(CONFIG_DEFAULT_DEVICE_TREE)
 
Quoted 14 lines

scripts/Makefile.spl $(obj)/$(SPL_BIN).sfp: $(obj)/$(SPL_BIN).bin FORCE · line 401

Quoted 8 lines
scripts/Makefile.spl +6 -0
+OBJCOPYFLAGS_u-boot-spl-dtb.hex := -I binary -O ihex
+--change-address=$(CONFIG_SPL_TEXT_BASE)
+
+$(obj)/u-boot-spl-dtb.hex: $(obj)/u-boot-spl-dtb.bin FORCE
+	$(call if_changed,objcopy)
+
 $(obj)/sunxi-spl.bin: $(obj)/$(SPL_BIN).bin FORCE
 	$(call if_changed,mkimage)

The commit message / subject doesn't make it clear that you're doing something for SoCFPGA here, and I seem to recall this change being proposed a while ago and it wasn't clear that this is really the best default path forward I thought?

Noted. I will resend the patch and enhance the message / subject .

Quoted 8 lines
Quoted 1 line

I have checked again with the team about this, we still would like to generate

the 'u-boot-spl-dtb.hex' for socfpga soc64 devices by default during u-boot compilation which is always needed by customer to generate the final configuration bitstream.

Quoted 1 line

Can you please advise if this is not the right way for the implementation?

I think the changes are fine then, please just update the commit message, thanks!

I have sent 2cd patch for review. Thanks.

Quoted 3 lines

--
Tom