From: Aggelos Manousarides <amanous@inaccessnetworks.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] Embedded environment setup
Date: Fri, 23 Mar 2007 19:20:32 +0200 [thread overview]
Message-ID: <46040C60.5070505@inaccessnetworks.com> (raw)
I have a flash chip with equally sized sectors and I don't want to waste
an entire sector for the environment. I have the u-boot environment
embedded in the u-boot sector. The declarations in my board file are:
#define CFG_ENV_IS_IN_FLASH 1
#define CFG_MONITOR_BASE (CFG_FLASH_BASE)
#define CFG_MONITOR_LEN (256* 1024)
#define CFG_ENV_ADDR (CFG_MONITOR_BASE + 16 * 1024)
#define CFG_ENV_SIZE (32 * 1024)
#define CFG_ENV_SECT_SIZE CFG_MONITOR_LEN
I use the CFI driver for this flash chip and I noticed that it protects
one more sector than necessary my default. There is this piece of code
in drivers/cfi_flash.c:
#ifdef CFG_ENV_IS_IN_FLASH
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR,
CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
flash_get_info(CFG_ENV_ADDR));
#endif
Because my CFG_ENV_SECT_SIZE exceeds the first sector, the second sector
is locked as well. I believe that in this point the code should check if
the environment is embedded in the flash before locking this section,
since code directly above that has already locked the u-boot sector. I
have modified it like that:
/* Environment protection ON by default */
#ifdef CFG_ENV_IS_IN_FLASH
#ifndef ENV_IS_EMBEDDED
flash_protect (FLAG_PROTECT_SET,
CFG_ENV_ADDR,
CFG_ENV_ADDR + CFG_ENV_SECT_SIZE - 1,
flash_get_info(CFG_ENV_ADDR));
#endif
#endif
I tried to remove the CFG_ENV_SECT_SIZE declaration but this breaks the
saveenv command. While trying to save the environment I got:
Saving Environment to Flash...
Error: start address not on sector boundary
--
Angelos Manousaridis
next reply other threads:[~2007-03-23 17:20 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-03-23 17:20 Aggelos Manousarides [this message]
2007-03-25 20:27 ` [U-Boot-Users] Embedded environment setup Wolfgang Denk
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=46040C60.5070505@inaccessnetworks.com \
--to=amanous@inaccessnetworks.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.