public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH] riscv: binman: Fix compilation error
@ 2023-10-11 15:30 Mayuresh Chitale
  2023-10-12  3:45 ` Simon Glass
  0 siblings, 1 reply; 2+ messages in thread
From: Mayuresh Chitale @ 2023-10-11 15:30 UTC (permalink / raw)
  To: Rick Chen, Leo, Simon Glass, Yu Chien Peter Lin; +Cc: Mayuresh Chitale, u-boot

Some platforms may not have any DDR memory below 4G and for such platforms
the TEXT_BASE and LOAD addresses etc are all 64 bit addresses due to
which the u-boot build fails with below error:

u-boot/arch/riscv/dts/binman.dtsi:30.14-25
Value out of range for 32-bit array element
u-boot/arch/riscv/dts/binman.dtsi:43.14-25
Value out of range for 32-bit array element
u-boot/arch/riscv/dts/binman.dtsi:44.15-26
Value out of range for 32-bit array element
FATAL ERROR: Syntax error parsing input tree

Fix by setting the address-cells property to 2 and converting load
addresses to 64 bit values.

Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
---
 arch/riscv/dts/binman.dtsi | 14 ++++++++++----
 1 file changed, 10 insertions(+), 4 deletions(-)

diff --git a/arch/riscv/dts/binman.dtsi b/arch/riscv/dts/binman.dtsi
index 156cb00971..b448b2a712 100644
--- a/arch/riscv/dts/binman.dtsi
+++ b/arch/riscv/dts/binman.dtsi
@@ -5,6 +5,9 @@
 
 #include <config.h>
 
+#define U64_TO_U32_H(addr)		(((addr) >> 32) & 0xffffffff)
+#define U64_TO_U32_L(addr)		((addr) & 0xffffffff)
+
 / {
 	binman: binman {
 		multiple-images;
@@ -17,7 +20,7 @@
 
 		fit {
 			description = "Configuration to load OpenSBI before U-Boot";
-			#address-cells = <1>;
+			#address-cells = <2>;
 			fit,fdt-list = "of-list";
 
 			images {
@@ -27,7 +30,8 @@
 					os = "U-Boot";
 					arch = "riscv";
 					compression = "none";
-					load = <CONFIG_TEXT_BASE>;
+					load = <U64_TO_U32_H(CONFIG_TEXT_BASE)
+						U64_TO_U32_L(CONFIG_TEXT_BASE)>;
 
 					uboot_blob: blob-ext {
 						filename = "u-boot-nodtb.bin";
@@ -40,8 +44,10 @@
 					os = "opensbi";
 					arch = "riscv";
 					compression = "none";
-					load = <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
-					entry = <CONFIG_SPL_OPENSBI_LOAD_ADDR>;
+					load = <U64_TO_U32_H(CONFIG_SPL_OPENSBI_LOAD_ADDR)
+						U64_TO_U32_L(CONFIG_SPL_OPENSBI_LOAD_ADDR)>;
+					entry = <U64_TO_U32_H(CONFIG_SPL_OPENSBI_LOAD_ADDR)
+						U64_TO_U32_L(CONFIG_SPL_OPENSBI_LOAD_ADDR)>;
 
 					opensbi_blob: opensbi {
 						filename = "fw_dynamic.bin";
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] riscv: binman: Fix compilation error
  2023-10-11 15:30 [PATCH] riscv: binman: Fix compilation error Mayuresh Chitale
@ 2023-10-12  3:45 ` Simon Glass
  0 siblings, 0 replies; 2+ messages in thread
From: Simon Glass @ 2023-10-12  3:45 UTC (permalink / raw)
  To: Mayuresh Chitale; +Cc: Rick Chen, Leo, Yu Chien Peter Lin, u-boot

On Wed, 11 Oct 2023 at 08:30, Mayuresh Chitale
<mchitale@ventanamicro.com> wrote:
>
> Some platforms may not have any DDR memory below 4G and for such platforms
> the TEXT_BASE and LOAD addresses etc are all 64 bit addresses due to
> which the u-boot build fails with below error:
>
> u-boot/arch/riscv/dts/binman.dtsi:30.14-25
> Value out of range for 32-bit array element
> u-boot/arch/riscv/dts/binman.dtsi:43.14-25
> Value out of range for 32-bit array element
> u-boot/arch/riscv/dts/binman.dtsi:44.15-26
> Value out of range for 32-bit array element
> FATAL ERROR: Syntax error parsing input tree
>
> Fix by setting the address-cells property to 2 and converting load
> addresses to 64 bit values.
>
> Signed-off-by: Mayuresh Chitale <mchitale@ventanamicro.com>
> ---
>  arch/riscv/dts/binman.dtsi | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
>

Reviewed-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-10-12  3:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-11 15:30 [PATCH] riscv: binman: Fix compilation error Mayuresh Chitale
2023-10-12  3:45 ` Simon Glass

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox