[U-Boot] Getting "Unable to save the rest of sector (196608)" when I turn on Redundant env with CFG_ENV_ADDR_REDUND

Brian Hutchinson b.hutchman at gmail.com
Thu Apr 8 02:45:22 CEST 2010


Sorry for the top post.  Resending in plain text as original message was UTF-8

On Wed, Apr 7, 2010 at 11:14 AM, Brian Hutchinson <b.hutchman at gmail.com> wrote:
> Hi,
>
> I'm using u-boot 1.1.6 and have been using a single 256k flash sector
> for the environment.  I want to use the redundant env. feature so I
> changed my config to:
>
> #define CFG_ENV_IS_IN_FLASH     1                   /* Environment
> variables stored in Flash memory */
> #define CFG_ENV_ADDR            (PC20X_BOOTABLE_FLASH_BASE+FLASH_SECTOR_SIZE)
> #define CFG_ENV_SECT_SIZE       FLASH_SECTOR_SIZE   /* One flash
> sector for environment info */
> #define CFG_ENV_SIZE            0x10000             /* But 64K is sufficient */
> //#define CFG_ENV_SIZE          CFG_ENV_SECT_SIZE /* the whole sector */
>
> /* Redundant environment */
> #define CFG_ENV_ADDR_REDUND  (CFG_ENV_ADDR + CFG_ENV_SECT_SIZE)
> #define CFG_ENV_SIZE_REDUND  (CFG_ENV_SIZE)
>
>
> #define CONFIG_ENV_OVERWRITE                        /* Turn off wite
> protection for vendor parameters */
>
> When I use u-boot built with a CFG_ENV_SIZE of 0x10000 (what was
> working before I started) and enable CFG_ENV_ADDR_REDUND .... I get
> the following when trying to saveenv:
>
> => saveenv
> Saving Environment to Flash...
> Un-Protected 1 sectors
> Un-Protected 1 sectors
> Unable to save the rest of sector (196608)
> Protected 1 sectors
> Protected 1 sectors
>
> My physical NOR flash is setup as:
> 0x20000000 = u-boot
> 0x20040000 = u-boot env. (the original env that works if I don't have
> redund turned on)
> 0x20080000 = u-boot redund env. (what I added)
>
> I'm not certain what the problem is.  I'm getting to the code in
> common/env_flash.c that has:
>
> #if CFG_ENV_SECT_SIZE > CFG_ENV_SIZE
>        up_data = (end_addr_new + 1 - ((long)flash_addr_new + CFG_ENV_SIZE));
>        debug ("Data to save 0x%x\n", up_data);
>        if (up_data) {
>                if ((saved_data = malloc(up_data)) == NULL) {
>                        printf("Unable to save the rest of sector (%ld)\n",
>                                up_data);
>                        goto Done;
>                }
>                memcpy(saved_data,
>                        (void *)((long)flash_addr_new + CFG_ENV_SIZE), up_data);
>                debug ("Data (start 0x%x, len 0x%x) saved at 0x%x\n",
>                           (long)flash_addr_new + CFG_ENV_SIZE,
>                                up_data, saved_data);
>        }
> #endif
>
> ... which to my understanding is intended to allow you to save RAM by
> using a env. smaller than your sector size which is my case.
>
> I've also tried to set CFG_ENV_SIZE to be the flash sector size which
> gets me over the above "Unable to save the rest of sector" problem but
> I suspect that I'm having RAM issues as I only have 128M RAM and am
> trying to use two environments of 256k each and the problem I'm having
> then becomes when I try to nfs boot my board .... it just hangs.
>
> Any ideas on what I should check?  The "Unable to save the rest of
> sector (196608)" is kind of strange as 196608 in hex is 0x30000 which
> is the sector u-boot lives in!
>
> Regards,
>
> Brian
>


More information about the U-Boot mailing list