Skip to contentSkip to conversation

saveenv command erases flash u-boot

U-Boot rudresh 5 participants 12 messages Feb 23, 2009 – Feb 24, 2009

lore
Share & tools
lore

rudresh

author
#0 lore raw

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this issue

Thanks
Rudresh

Signature · 2 lines
View this message in context: http://www.nabble.com/saveenv-command-erases-flash-u-boot-tp22156928p22156928.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
#1 lore raw

rudresh said the following:

Quoted 4 lines

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this issue

Sounds U-Boot and environment share a flash sector. You'll have to give more info for correct diagnostic:
Flash size, sector size, u-boot start address and size, position of environment data and if applicable of redundancy data.

Signature · 2 lines
Regards,
Michael
#4 lore raw
In reply to rudresh

Dear rudresh,

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

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this issue

1.3.0 is extremely old. Please use current code instead (v2009.03-rc1). Chances are good that the problem has long been fixed.

Best regards,

Wolfgang Denk

Signature · 6 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
What is wanted is not the will to believe,  but the will to find out,
which is the exact opposite.
		        -- Bertrand Russell, "Skeptical Essays", 1928
author
#2 lore raw
In reply to Michael Lawnick

Details are as follows .. the flash size 16Mbyte Nor flash.. NAND flash 256MB.
/*
* Environment
*/

#if defined(CONFIG_NAND_U_BOOT)
	#define CFG_ENV_IS_IN_NAND	1
	#define CFG_ENV_SIZE		CFG_NAND_BLOCK_SIZE
	#define CFG_ENV_OFFSET		((1024<<10) - (CFG_NAND_BLOCK_SIZE<<1))
#elif !defined(CFG_RAMBOOT)
	#define CFG_ENV_IS_IN_FLASH	1
	#define CFG_ENV_ADDR		(CFG_MONITOR_BASE + 0x40000)
	//Daniel Change
	#define CFG_ENV_SECT_SIZE	0x20000 /* 128K(one sector) for env */
	//Daniel Change
	#define CFG_ENV_SIZE		0x2000

/*
* FLASH on the Local Bus
*/
#define CFG_FLASH_CFI /* use the Common Flash Interface */
#define CFG_FLASH_CFI_DRIVER /* use the CFI driver */
#define CFG_FLASH_BASE 0xFE000000 /* start of FLASH */
#define CFG_FLASH_SIZE 16 /* flash size in MB */
#define CFG_FLASH_EMPTY_INFO /* display empty sectors */
#define CFG_FLASH_USE_BUFFER_WRITE /* buffer up multiple bytes */

#define CFG_FLASH_BR_PRELIM (CFG_FLASH_BASE | /* flash Base address */ \
(2<<BR_PS_SHIFT) | /* 16 bit port size */ \
BR_V) /* valid */

#define CFG_FLASH_OR_PRELIM	(0xFF000000         /* 16 MByte */ \
                                | OR_GPCM_XACS \
                                | OR_GPCM_SCY_9 \
                                | OR_GPCM_EHTR \
                                | OR_GPCM_EAD)
                                /* 0xFF006FF7   TODO SLOW 16 MB flash size

*/
#define CFG_LBLAWBAR0_PRELIM CFG_FLASH_BASE /* window base@flash base */
#define CFG_LBLAWAR0_PRELIM 0x80000017 /* 16 MB window size */

#define CFG_MAX_FLASH_BANKS 1 /* number of banks */
#define CFG_MAX_FLASH_SECT 135 /* sectors per device */

#define CFG_FLASH_ERASE_TOUT 60000 /* Flash Erase Timeout (ms) */
#define CFG_FLASH_WRITE_TOUT 500 /* Flash Write Timeout (ms) */

#define CFG_MONITOR_BASE TEXT_BASE /* start of monitor */

/* Address and size of Redundant Environment Sector */

#else
	#define CFG_ENV_IS_NOWHERE	1	/* Store ENV in memory only */
	#define CFG_ENV_ADDR		(CFG_MONITOR_BASE - 0x1000)
	#define CFG_ENV_SIZE		0x2000

#endif

#define CONFIG_LOADS_ECHO 1 /* echo on for serial download */
#define CFG_LOADS_BAUD_CHANGE 1 /* allow baudrate change */

-------------------------------------------------------------------------------

Quoted 24 lines · Michael Lawnick

rudresh said the following:

Quoted 6 lines

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR
Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this
issue

Sounds U-Boot and environment share a flash sector. You'll have to give more info for correct diagnostic:
Flash size, sector size, u-boot start address and size, position of environment data and if applicable of redundancy data.

Signature · 7 lines
Regards,
Michael

_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
View this message in context: http://www.nabble.com/saveenv-command-erases-flash-u-boot-tp22156928p22159964.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
author
#5 lore raw
In reply to Wolfgang Denk

same u-boot-1.3.0 working in other customize MPC8313 board with some different peripherals, NOR flash of 16MB is same in both the case .. but the MPC8313 evaluation board having 256MB NAND flash.. why not u-boot-1.3.0 is not working in evaluation board..

Quoted 33 lines · wd

Dear rudresh,

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

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR
Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this
issue

1.3.0 is extremely old. Please use current code instead (v2009.03-rc1). Chances are good that the problem has long been fixed.

Best regards,

Wolfgang Denk

Signature · 10 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
What is wanted is not the will to believe,  but the will to find out,
which is the exact opposite.
		        -- Bertrand Russell, "Skeptical Essays", 1928
_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Signature · 2 lines
View this message in context: http://www.nabble.com/saveenv-command-erases-flash-u-boot-tp22156928p22160018.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
#6 lore raw

Dear rudresh,

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

same u-boot-1.3.0 working in other customize MPC8313 board with some

v1.3.0 is old and you will probably find very few people here who are willing to spend (or actually waste) their time on problems that most probably have been fixed long ago.

Please try current code.

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
"Why should we subsidize intellectual curiosity?" - Ronald Reagan
#3 lore raw
In reply to rudresh

rudresh said the following:
[quoting repaired]

Quoted 21 lines
Quoted 9 lines · Michael Lawnick

rudresh said the following:

Quoted 6 lines

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR
Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this
issue

Quoted 4 lines

Sounds U-Boot and environment share a flash sector. You'll have to give more info for correct diagnostic:
Flash size, sector size, u-boot start address and size, position of environment data and if applicable of redundancy data.

Details are as follows .. the flash size 16Mbyte Nor flash.. NAND flash 256MB.
/*
* Environment
*/

#if defined(CONFIG_NAND_U_BOOT)

...

Quoted 1 line

#elif !defined(CFG_RAMBOOT)

...

Quoted 1 line

#else

...

Quoted 1 line

#endif

And now you expect me to guess your boot setting?

Assuming neither CONFIG_NAND_U_BOOT nor CFG_RAMBOOT are set: check u-boot image size against 256k, as the offset of environment seems to be set to CFG_MONITOR_BASE + 0x40000

Or is ONFIG_NAND_U_BOOT set (would be the explanation why you mention NAND at all ...)? With u-boot in NOR this indicates a general code/configuration problem in your image.

HTH

Signature · 1 line
Michael
#7 lore raw
In reply to rudresh
Quoted 11 lines · rudresh

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this issue

Thanks
Rudresh

I had a similar problem, see:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5fenv%5faddr+incorrect+mpc8313erdb+h

---
N. van Bolhuis.

#8 lore raw

Hi Norbert,
I just looked at your comment in the gmane archive. You shouldn't hardcode a new CONFIG_ENV_ADDR. Instead, you should correct the CONFIG_SYS_MONITOR_LEN, which is the number of bytes the U-Boot image uses rounded up to the next flash sector address.

Maybe we should define this in terms of new CONFIG variables, say CONFIG_SYS_FLASH_SECT_SIZE and
CONFIG_SYS_NUM_U_BOOT_SECTS, and then compute the new *_LEN
based on these? Alternatively, we can avoid using defines and instead make it a "const volatile unsigned long". Then we could use a post build script to extract
the image length from u-boot.map and compare it with u-boot.bin. If the value extracted from the map file is less than the u-boot.bin size, we could generate an error/warning. Any comments?

Best regards,
Frank

Quoted 25 lines · Norbert van Bolhuis
Quoted 11 lines · rudresh

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix ?this issue. ?help me to fix this issue

Thanks
Rudresh

I had a similar problem, see:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5fenv%5faddr+incorrect+mpc8313erdb+h

---
N. van Bolhuis.

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

author
#9 lore raw

i fix this issue with the help of all u-boot USERS, Thanks for helping .. This problem occurred because of u-boot.bin size taking 2 sector of Flash, and less space for Environment(few bytes in 2nd sector) . Then i incremented one sector in config env address , shown below.
#define CFG_ENV_ADDR (CFG_MONITOR_BASE + 0x60000) // before
CFG_MONITOR_BASE+0x40000

This help's me to solve this problem

Thanks
Rudresh

Quoted 59 lines · Frank Svendsb?e

Hi Norbert,
I just looked at your comment in the gmane archive. You shouldn't hardcode a new CONFIG_ENV_ADDR. Instead, you should correct the CONFIG_SYS_MONITOR_LEN, which is the number of bytes the U-Boot image uses rounded up to the next flash sector address.

Maybe we should define this in terms of new CONFIG variables, say CONFIG_SYS_FLASH_SECT_SIZE and
CONFIG_SYS_NUM_U_BOOT_SECTS, and then compute the new *_LEN based on these? Alternatively, we can avoid using defines and instead make it
a "const volatile unsigned long". Then we could use a post build script to extract
the image length from u-boot.map and compare it with u-boot.bin. If the value
extracted from the map file is less than the u-boot.bin size, we could generate
an error/warning. Any comments?

Best regards,
Frank

Quoted 20 lines · Norbert van Bolhuis
Quoted 8 lines · rudresh

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR
Flash , u-boot stored in NOR flash. when i do the saveenv , reset command
the u-boot is erased. i'm not able to fix ?this issue. ?help me to fix this
issue

Quoted 6 lines

Thanks
Rudresh

I had a similar problem, see:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5fenv%5faddr+incorrect+mpc8313erdb+h

Quoted 8 lines

---
N. van Bolhuis.

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

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

Signature · 2 lines
View this message in context: http://www.nabble.com/saveenv-command-erases-flash-u-boot-tp22156928p22180261.html
Sent from the Uboot - Users mailing list archive at Nabble.com.
#10 lore raw
In reply to Frank Svendsbøe

Hi Frank,

You're right.
At the time I discovered this, I wasn't sure what 'monitor' exactly is (I feared there was more to it than just the u-boot binary code itself). So I decided to fix it this way, let the list know and not submit a patch.

If you want, you can submit a patch. I think correcting CONFIG_SYS_MONITOR_LEN will suffice. The other options sound OK to me. But you should ask the list for opinions/approval.

---
N. van Bolhuis.

Quoted 46 lines · Frank Svendsb?e

Hi Norbert,
I just looked at your comment in the gmane archive. You shouldn't hardcode a new CONFIG_ENV_ADDR. Instead, you should correct the CONFIG_SYS_MONITOR_LEN, which is the number of bytes the U-Boot image uses rounded up to the next flash sector address.

Maybe we should define this in terms of new CONFIG variables, say CONFIG_SYS_FLASH_SECT_SIZE and
CONFIG_SYS_NUM_U_BOOT_SECTS, and then compute the new *_LEN
based on these? Alternatively, we can avoid using defines and instead make it a "const volatile unsigned long". Then we could use a post build script to extract
the image length from u-boot.map and compare it with u-boot.bin. If the value extracted from the map file is less than the u-boot.bin size, we could generate an error/warning. Any comments?

Best regards,
Frank

Quoted 24 lines · Norbert van Bolhuis
Quoted 11 lines · rudresh

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR Flash , u-boot stored in NOR flash. when i do the saveenv , reset command the u-boot is erased. i'm not able to fix this issue. help me to fix this issue

Thanks
Rudresh

I had a similar problem, see:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5fenv%5faddr+incorrect+mpc8313erdb+h

---
N. van Bolhuis.

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

#11 lore raw
Quoted 7 lines · Norbert van Bolhuis

Hi Frank,

You're right.
At the time I discovered this, I wasn't sure what 'monitor' exactly is (I feared there was more to it than just the u-boot binary code itself). So I decided to fix it this way, let the list know and not submit a patch.

Quoted 5 lines

If you want, you can submit a patch. I think correcting CONFIG_SYS_MONITOR_LEN
will suffice. The other options sound OK to me. But you should ask the list for opinions/approval.

Ok. Btw, I did a few shortcuts when explaining the procedure. Of course we cannot extract the content of the MONITOR_LEN variable from the map file, but we extract its address from it, then subtract TEXT_BASE, and use this address to locate its content in u-boot.bin.

Reg. approval. I'm sure there is a good reason why this, or a similar technique, is not already being used by u-boot.

Best regards,
Frank

Quoted 63 lines

---
N. van Bolhuis.

Quoted 56 lines · Frank Svendsb?e

Hi Norbert,
I just looked at your comment in the gmane archive. You shouldn't hardcode a new CONFIG_ENV_ADDR. Instead, you should correct the CONFIG_SYS_MONITOR_LEN, which is the number of bytes the U-Boot image uses rounded up to the next flash sector address.

Maybe we should define this in terms of new CONFIG variables, say CONFIG_SYS_FLASH_SECT_SIZE and
CONFIG_SYS_NUM_U_BOOT_SECTS, and then compute the new *_LEN based on these? Alternatively, we can avoid using defines and instead make it
a "const volatile unsigned long". Then we could use a post build script to extract
the image length from u-boot.map and compare it with u-boot.bin. If the value
extracted from the map file is less than the u-boot.bin size, we could generate
an error/warning. Any comments?

Best regards,
Frank

Quoted 30 lines · Norbert van Bolhuis
Quoted 9 lines · rudresh

i'm using u-boot -1.3.0 in MPC8313 evaluation board, it having a NAND , NOR
Flash , u-boot stored in NOR flash. when i do the saveenv , reset command
the u-boot is erased. i'm not able to fix ?this issue. ?help me to fix this
issue

Quoted 6 lines

Thanks
Rudresh

I had a similar problem, see:

http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5fenv%5faddr+incorrect+mpc8313erdb+h

---
N. van Bolhuis.

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