[U-Boot] [PATCH v2 1/2] nitrogen6x: Fix RAM size variable

From: Fabio Estevam fabio.estevam@freescale.com
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
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com --- Changes since v1: - Rebased against u-boot-imx tree
boards.cfg | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/boards.cfg b/boards.cfg index fb3b197..84f96e0 100644 --- a/boards.cfg +++ b/boards.cfg @@ -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

From: Fabio Estevam fabio.estevam@freescale.com>
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com --- Changes since v1: - No changes board/boundary/nitrogen6x/nitrogen6x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 0dbb6d2..e5634d8 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -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; }

On 13/03/2013 23:59, Fabio Estevam wrote:
From: Fabio Estevam fabio.estevam@freescale.com>
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com
Hi Fabio,
Changes since v1:
- No changes
board/boundary/nitrogen6x/nitrogen6x.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 0dbb6d2..e5634d8 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -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

From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de ---
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(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 0dbb6d2..e5634d8 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -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; }

On 14/03/2013 09:03, Stefano Babic wrote:
From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de
Sorry, discharge this - it is identical to the previous one. I will send the right one in few minutes.
Stefano

From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de ---
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(-)
diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c index 0dbb6d2..229c237 100644 --- a/board/boundary/nitrogen6x/nitrogen6x.c +++ b/board/boundary/nitrogen6x/nitrogen6x.c @@ -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; }

Dear Stefano Babic,
In message 1363248561-11974-1-git-send-email-sbabic@denx.de 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

On Thu, Mar 14, 2013 at 8:38 AM, Wolfgang Denk wd@denx.de wrote:
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

Hi Stefano,
On Thu, 14 Mar 2013 09:09:21 +0100, Stefano Babic sbabic@denx.de wrote:
From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de
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,

On 14/03/2013 14:15, Albert ARIBAUD wrote:
Hi Stefano,
On Thu, 14 Mar 2013 09:09:21 +0100, Stefano Babic sbabic@denx.de wrote:
From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de
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.
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

Hi Stefano,
On Thu, 14 Mar 2013 15:09:15 +0100, Stefano Babic sbabic@denx.de wrote:
On 14/03/2013 14:15, Albert ARIBAUD wrote:
Hi Stefano,
On Thu, 14 Mar 2013 09:09:21 +0100, Stefano Babic sbabic@denx.de wrote:
From: "fabio.estevam@freescale.com" fabio.estevam@freescale.com
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.
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com Signed-off-by: Stefano Babic sbabic@denx.de
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.
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.
That's fine. :)
Stefano
Amicalement,

On 13/03/2013 23:59, Fabio Estevam wrote:
From: Fabio Estevam fabio.estevam@freescale.com
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
Reported-by: Albert Aribaud albert.u.boot@aribaud.net Signed-off-by: Fabio Estevam fabio.estevam@freescale.com
Hi Fabio,
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
participants (4)
-
Albert ARIBAUD
-
Fabio Estevam
-
Stefano Babic
-
Wolfgang Denk