All of lore.kernel.org
 help / color / mirror / Atom feed
From: Brian Hutchinson <b.hutchman@gmail.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] Getting "Unable to save the rest of sector (196608)" when I turn on Redundant env with CFG_ENV_ADDR_REDUND
Date: Wed, 7 Apr 2010 11:14:39 -0400	[thread overview]
Message-ID: <k2p3d1967ab1004070814j4d69e6c1g164ba7cce52d1f6c@mail.gmail.com> (raw)

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

             reply	other threads:[~2010-04-07 15:14 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-04-07 15:14 Brian Hutchinson [this message]
2010-04-07 20:14 ` [U-Boot] Getting "Unable to save the rest of sector (196608)" when I turn on Redundant env with CFG_ENV_ADDR_REDUND Brian Hutchinson
2010-04-08  0:47   ` Brian Hutchinson
2010-04-08 10:05     ` Wolfgang Denk
2010-04-07 21:07 ` Brian Hutchinson
2010-04-08  0:51   ` Brian Hutchinson
2010-04-08 10:08     ` Wolfgang Denk
2010-04-08 11:09       ` Brian Hutchinson
2010-04-08 14:04         ` Wolfgang Denk
2010-04-08 14:39           ` Brian Hutchinson
2010-04-08  0:45 ` Brian Hutchinson
2010-04-08 10:04   ` Wolfgang Denk
2010-04-08 11:24     ` Brian Hutchinson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=k2p3d1967ab1004070814j4d69e6c1g164ba7cce52d1f6c@mail.gmail.com \
    --to=b.hutchman@gmail.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.