[U-Boot-Users] still got "*** Warning - bad CRC, using default environment" after saveenv is sucessfully done

Hi, u-boot users,
I have written hardware-dependent flash functions for my EVB u-boot support. Hence, "saveenv" works and I can see the env data in the configured env sector by "md" command.
However, I still get the warning messages, "*** Warning - bad CRC, using default environment", after press reset button.
Should any CONFIG/CFG need to be added in board configuration file?
I use u-boot 1.1.2 and the followings are part of board configurations.
/*----------------------------------------------------------------------- * Physical Memory Map */ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */ #define PHYS_FLASH_1 0xFF800000 /* Flash Bank #1 */ #define CFG_FLASH_BASE PHYS_FLASH_1
/*----------------------------------------------------------------------- * FLASH and environment organization */ #define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ #define PHYS_FLASH_SIZE 0x00400000 /* 4MB */ #define CFG_MAX_FLASH_SECT (71) /* max number of sectors on one chip */ /* addr of environment */ #define CFG_FLASH_CFI /* The flash is CFI compatible */
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_SIZE 0x2000 /* Total Size of Environment Sector */ #define CFG_ENV_SECT_SIZE 0x2000 #define CFG_ENV_OFFSET 0x3F8000 /* environment starts here */ #define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
Thanks. Wayne

In message 200505020725.j427P98R014633@ismp.csie.ncku.edu.tw you wrote:
I have written hardware-dependent flash functions for my EVB u-boot support. Hence, "saveenv" works and I can see the env data in the configured env sector by "md" command.
However, I still get the warning messages, "*** Warning - bad CRC, using default environment", after press reset button.
This means that U-Boot does not find a valid environment in flash.
Should any CONFIG/CFG need to be added in board configuration file?
Added or fixed - how should we know? We don't know your hardware...
I use u-boot 1.1.2 and the followings are part of board configurations.
/*-----------------------------------------------------------------------
- Physical Memory Map
*/ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */
You shouldn't do that., You should use auto-sizing instead.
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_SIZE 0x2000 /* Total Size of Environment Sector */ #define CFG_ENV_SECT_SIZE 0x2000 #define CFG_ENV_OFFSET 0x3F8000 /* environment starts here */ #define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
This looks ok to me. I just wonder why you provide redundant definitions - one of either CFG_ENV_OFFSET or CFG_ENV_ADDR is sufficient.
Best regards,
Wolfgang Denk

My SoC flash memory logic is poor. (poor hardware) It only supports 32bit read. That is, 16-bit read and 8-bit read returns wrong values. (I wrote a simple bootloader to copy u-boot to RAM for execution at first.) I found that some hardware-independent fuctions read flash via 8-bit access. (for example, crc32() and env_relocate_spec()).
Hence, even I really upgrade the environment into dedicated flash sector, u-boot shows the warning message while booting.
It seems unavoidable to hardcode u-boot. :)
Thanks. Wayne
-----Original Message----- From: wd@denx.de [mailto:wd@denx.de] Sent: Monday, May 02, 2005 4:38 PM To: Wayne Lee Cc: u-boot-users@lists.sourceforge.net Subject: Re: [U-Boot-Users] still got "*** Warning - bad CRC, using default environment" after saveenv is sucessfully done
In message 200505020725.j427P98R014633@ismp.csie.ncku.edu.tw you wrote:
I have written hardware-dependent flash functions for my EVB u-boot
support.
Hence, "saveenv" works and I can see the env data in the configured env sector by "md" command.
However, I still get the warning messages, "*** Warning - bad CRC, using default environment", after press reset button.
This means that U-Boot does not find a valid environment in flash.
Should any CONFIG/CFG need to be added in board configuration file?
Added or fixed - how should we know? We don't know your hardware...
I use u-boot 1.1.2 and the followings are part of board configurations.
/*-----------------------------------------------------------------------
- Physical Memory Map
*/ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */
You shouldn't do that., You should use auto-sizing instead.
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_SIZE 0x2000 /* Total Size of Environment Sector */ #define CFG_ENV_SECT_SIZE 0x2000 #define CFG_ENV_OFFSET 0x3F8000 /* environment
starts here
*/ #define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
This looks ok to me. I just wonder why you provide redundant definitions - one of either CFG_ENV_OFFSET or CFG_ENV_ADDR is sufficient.
Best regards,
Wolfgang Denk

I was having this same problem, and it turned out I was writing the enviornment over the top of some of my u-boot code.
I'd make sure CFG_ENV_OFFSET is set to an empty area.
NZG. On Monday 02 May 2005 02:21, Wayne Lee wrote:
Hi, u-boot users,
I have written hardware-dependent flash functions for my EVB u-boot support. Hence, "saveenv" works and I can see the env data in the configured env sector by "md" command.
However, I still get the warning messages, "*** Warning - bad CRC, using default environment", after press reset button.
Should any CONFIG/CFG need to be added in board configuration file?
I use u-boot 1.1.2 and the followings are part of board configurations.
/*-----------------------------------------------------------------------
- Physical Memory Map
*/ #define CONFIG_NR_DRAM_BANKS 1 /* we have 1 bank of DRAM */ #define PHYS_SDRAM_1 0x00000000 /* SDRAM Bank #1 */ #define PHYS_SDRAM_1_SIZE 0x04000000 /* 64 MB */ #define PHYS_FLASH_1 0xFF800000 /* Flash Bank #1 */ #define CFG_FLASH_BASE PHYS_FLASH_1
/*-----------------------------------------------------------------------
- FLASH and environment organization
*/ #define CFG_MAX_FLASH_BANKS 1 /* max number of memory banks */ #define PHYS_FLASH_SIZE 0x00400000 /* 4MB */ #define CFG_MAX_FLASH_SECT (71) /* max number of sectors on one chip */ /* addr of environment */ #define CFG_FLASH_CFI /* The flash is CFI compatible */
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_SIZE 0x2000 /* Total Size of Environment Sector */ #define CFG_ENV_SECT_SIZE 0x2000 #define CFG_ENV_OFFSET 0x3F8000 /* environment starts here */ #define CFG_ENV_ADDR (CFG_FLASH_BASE + CFG_ENV_OFFSET)
Thanks. Wayne
This SF.Net email is sponsored by: NEC IT Guy Games. Get your fingers limbered up and give it your best shot. 4 great events, 4 opportunities to win big! Highest score wins.NEC IT Guy Games. Play to win an NEC 61 plasma display. Visit http://www.necitguy.com/?r=20 _______________________________________________ U-Boot-Users mailing list U-Boot-Users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/u-boot-users
participants (3)
-
NZG
-
Wayne Lee
-
Wolfgang Denk