Skip to contentSkip to conversation

nitrogen6x: Fix RAM size variable

PATCH New Fabio Estevam 4 participants 12 messages Mar 13, 2013 – Mar 14, 2013

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 nitrogen6x: Fix RAM size variable

From: Fabio Estevam <[email protected]>

Fix the following build error when buildig nitrogen6s1g:

nitrogen6x.c:89:17: error: 'CONFIG_DDR_MB' undeclared (first use in this function)
nitrogen6x.c:89:17: note: each undeclared identifier is reported only once for each function it appears in

---
Changes since v1:
- Rebased against u-boot-imx tree

 boards.cfg |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
boards.cfg +1 -1
index fb3b197..84f96e0 100644
@@ -260,7 +260,7 @@ nitrogen6dl2g                arm         armv7       nitrogen6x          boundar
 nitrogen6q                   arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q.cfg,MX6Q,DDR_MB=1024
 nitrogen6q2g                 arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048
 nitrogen6s                   arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512
-nitrogen6s1g                 arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,MX6S,SDRAM_MB=1024
+nitrogen6s1g                 arm         armv7       nitrogen6x          boundary       mx6		nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,MX6S,DDR_MB=1024
 cm_t35                       arm         armv7       cm_t35              -              omap3
 omap3_overo                  arm         armv7       overo               -              omap3
 omap3_pandora                arm         armv7       pandora             -              omap3
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH v2 2/2 nitrogen: Use unsigned long to specify the total RAM size

From: Fabio Estevam <[email protected]>>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

---
Changes since v1:
- No changes

 board/boundary/nitrogen6x/nitrogen6x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
index 0dbb6d2..e5634d8 100644
@@ -86,7 +86,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_DDR_MB * 1024 * 1024;
+	gd->ram_size = (ulong)(CONFIG_DDR_MB * 1024 * 1024);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#2 lore raw

PATCH v2 2/2 nitrogen: Use unsigned long to specify the total RAM size

Quoted 11 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

---

Hi Fabio,

Quoted 10 lines

Changes since v1:
- No changes

 board/boundary/nitrogen6x/nitrogen6x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/boundary/nitrogen6x/nitrogen6x.c +0 -0
index 0dbb6d2..e5634d8 100644

board/boundary/nitrogen6x/nitrogen6x.c DECLARE_GLOBAL_DATA_PTR; · line 89

Quoted 5 lines
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
@@ -86,7 +86,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_DDR_MB * 1024 * 1024;
+	gd->ram_size = (ulong)(CONFIG_DDR_MB * 1024 * 1024);

This does not fix the issue. You're casting, but the value does not fit in 32 bit and the warning still remains.

I am afraid that 32 bit for gd->ram_size are not enough anymore...

We can fix the warning setting maybe a lower amout of memory (I am expecting that now the value is truncated and a wrong output is shown on the console), but for the future gd->ram_size should move to 64 bit.

Best regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#3 lore raw

PATCH v3 1/1 nitrogen: Use unsigned long to specify the total RAM size

In reply to Fabio Estevam

From: "[email protected]" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

---

Changes since V1:
- move casting inside expression to force using unsigned long

 board/boundary/nitrogen6x/nitrogen6x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
index 0dbb6d2..e5634d8 100644
@@ -86,7 +86,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_DDR_MB * 1024 * 1024;
+	gd->ram_size = (ulong)(CONFIG_DDR_MB * 1024 * 1024);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#4 lore raw

PATCH v3 1/1 nitrogen: Use unsigned long to specify the total RAM size

Quoted 4 lines · Stefano Babic

From: "fabio.estevam at freescale.com" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

Quoted 9 lines

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

---

Sorry, discharge this - it is identical to the previous one. I will send the right one in few minutes.

Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#5 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

In reply to Fabio Estevam

From: "[email protected]" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

---

Changes since V2:
- move casting inside expression to force using unsigned long

 board/boundary/nitrogen6x/nitrogen6x.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
board/boundary/nitrogen6x/nitrogen6x.c +1 -1
index 0dbb6d2..229c237 100644
@@ -86,7 +86,7 @@ DECLARE_GLOBAL_DATA_PTR;
 
 int dram_init(void)
 {
-	gd->ram_size = CONFIG_DDR_MB * 1024 * 1024;
+	gd->ram_size = ((ulong)CONFIG_DDR_MB * 1024 * 1024);
 
 	return 0;
 }
Signature · 1 line
1.7.9.5
#6 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

Dear Stefano Babic,

Quoted 2 lines · In message <[email protected]> you wrote:

2GB can not fit in 32-bits, so use ulong instead.

<nitpick>

unsigned long is 32 bits, too.

And, strictly speaking, GB is a decimal unit, so 2 GB = 2e9 = 0x77359400 which fits nicely into a signed 32 bit number.

What you actually mean is:

2 GiB cannot be expressed as a 32 bit signed number.

</nitpick>

Best regards,

Wolfgang Denk

Signature · 4 lines
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Of all the things I've lost, I miss my mind the most.
#7 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

Quoted 3 lines · Wolfgang Denk

What you actually mean is:

2 GiB cannot be expressed as a 32 bit signed number.

Good point, I will change and re-submit it.

Thanks,

Fabio Estevam

#8 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

In reply to Stefano Babic

Hi Stefano,

Quoted 11 lines · Stefano Babic

From: "fabio.estevam at freescale.com" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

2GB can not fit in 32-bits, so use ulong instead.

This somehow is redundant with Fabio's patch 2/2 with the same summary, right?

Stefano: once Fabio's series is OK,

- either you rollback your ToT, apply Fabio's series before it, and then send out an amended PR, which is more work but makes your tree build-clean;

- or I apply Fabio's series then your existing PR, which is less work but leaves your current ToT non-build-clean until you merge back from ARM (or mainline once I do my own PR).

What do you prefer? I would favor the first option, FWIW.

Amicalement,

Signature · 1 line
Albert.
#9 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

Quoted 11 lines · Albert ARIBAUD

Hi Stefano,

Quoted 6 lines · Stefano Babic

From: "fabio.estevam at freescale.com" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

Quoted 9 lines
Quoted 5 lines

2GB can not fit in 32-bits, so use ulong instead.

This somehow is redundant with Fabio's patch 2/2 with the same summary, right?

We sent quite at the same time - I will discharge mine.

Quoted 11 lines

Stefano: once Fabio's series is OK,

- either you rollback your ToT, apply Fabio's series before it, and then send out an amended PR, which is more work but makes your tree build-clean;

- or I apply Fabio's series then your existing PR, which is less work but leaves your current ToT non-build-clean until you merge back from ARM (or mainline once I do my own PR).

What do you prefer? I would favor the first option, FWIW.

I prefer to apply Fabio's patches on top of u-boot-imx and send an amended PR. This is also my favorite option. What do you mean with rollback the ToT ? As I have already pushed on the server, I do not like to rebase it or things like that. My idea is only to apply the patches and send after that a new PR to you.

Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================
#10 lore raw

PATCH v4 1/1 nitrogen: Use unsigned long to specify the total RAM size

Hi Stefano,

Quoted 34 lines · Stefano Babic
Quoted 11 lines · Albert ARIBAUD

Hi Stefano,

Quoted 6 lines · Stefano Babic

From: "fabio.estevam at freescale.com" <[email protected]>

When building for the nitrogen boards with 2GB the following warning happens:

nitrogen6x.c:89:38: warning: integer overflow in expression [-Woverflow]

Quoted 9 lines
Quoted 5 lines

2GB can not fit in 32-bits, so use ulong instead.

This somehow is redundant with Fabio's patch 2/2 with the same summary, right?

We sent quite at the same time - I will discharge mine.

Quoted 10 lines

Stefano: once Fabio's series is OK,

- either you rollback your ToT, apply Fabio's series before it, and then send out an amended PR, which is more work but makes your tree build-clean;

- or I apply Fabio's series then your existing PR, which is less work but leaves your current ToT non-build-clean until you merge back from ARM (or mainline once I do my own PR).

Quoted 7 lines
Quoted 1 line

What do you prefer? I would favor the first option, FWIW.

I prefer to apply Fabio's patches on top of u-boot-imx and send an amended PR. This is also my favorite option. What do you mean with rollback the ToT ? As I have already pushed on the server, I do not like to rebase it or things like that. My idea is only to apply the patches and send after that a new PR to you.

That's fine. :)

Quoted 1 line

Stefano

Amicalement,

Signature · 1 line
Albert.
#11 lore raw

PATCH v2 1/2 nitrogen6x: Fix RAM size variable

In reply to Fabio Estevam
Quoted 4 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

Fix the following build error when buildig nitrogen6s1g:

Quoted 8 lines

nitrogen6x.c:89:17: error: 'CONFIG_DDR_MB' undeclared (first use in this function)
nitrogen6x.c:89:17: note: each undeclared identifier is reported only once for each function it appears in

---

Hi Fabio,

Quoted 6 lines

Changes since v1:
- Rebased against u-boot-imx tree

 boards.cfg |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

You're very fast ! Thanks for fixing it !

Regards,
Stefano

Signature · 5 lines
=====================================================================
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================