[U-Boot] saveenv command erases flash u-boot

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

rudresh said the following:
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.

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 at 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 */
-------------------------------------------------------------------------------
Michael Lawnick wrote:
rudresh said the following:
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.
-- Regards, Michael
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

rudresh said the following: [quoting repaired]
Michael Lawnick wrote:
rudresh said the following:
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.
Details are as follows .. the flash size 16Mbyte Nor flash.. NAND flash 256MB. /*
- Environment
*/
#if defined(CONFIG_NAND_U_BOOT)
...
#elif !defined(CFG_RAMBOOT)
...
#else
...
#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

Dear rudresh,
In message 22156928.post@talk.nabble.com 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

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..
wd wrote:
Dear rudresh,
In message 22156928.post@talk.nabble.com 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
-- 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@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@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

Dear rudresh,
In message 22160018.post@talk.nabble.com 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

rudresh 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
Thanks Rudresh
I had a similar problem, see:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5...
--- N. van Bolhuis.

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
On Tue, Feb 24, 2009 at 10:09 AM, Norbert van Bolhuis nvbolhuis@aimvalley.nl wrote:
rudresh 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
Thanks Rudresh
I had a similar problem, see:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5...
N. van Bolhuis.
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

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
Frank Svendsbøe wrote:
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
On Tue, Feb 24, 2009 at 10:09 AM, Norbert van Bolhuis nvbolhuis@aimvalley.nl wrote:
rudresh 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
Thanks Rudresh
I had a similar problem, see:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5...
N. van Bolhuis.
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

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.
Frank Svendsbøe wrote:
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
On Tue, Feb 24, 2009 at 10:09 AM, Norbert van Bolhuis nvbolhuis@aimvalley.nl wrote:
rudresh 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
Thanks Rudresh
I had a similar problem, see:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5...
N. van Bolhuis.
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot

On Tue, Feb 24, 2009 at 1:01 PM, Norbert van Bolhuis nvbolhuis@aimvalley.nl wrote:
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.
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
N. van Bolhuis.
Frank Svendsbøe wrote:
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
On Tue, Feb 24, 2009 at 10:09 AM, Norbert van Bolhuis nvbolhuis@aimvalley.nl wrote:
rudresh 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
Thanks Rudresh
I had a similar problem, see:
http://article.gmane.org/gmane.comp.boot-loaders.u-boot/51703/match=config%5...
N. van Bolhuis.
U-Boot mailing list U-Boot@lists.denx.de http://lists.denx.de/mailman/listinfo/u-boot
participants (5)
-
Frank Svendsbøe
-
Michael Lawnick
-
Norbert van Bolhuis
-
rudresh
-
Wolfgang Denk