public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] Environment in flash rather than EEProm
@ 2004-03-30 13:29 Andy Hawkins
  2005-01-27 10:21 ` [U-Boot-Users] " Martin Egholm Nielsen
  0 siblings, 1 reply; 8+ messages in thread
From: Andy Hawkins @ 2004-03-30 13:29 UTC (permalink / raw)
  To: u-boot

Hi all

I'm using a PPChameleonEVB, and am trying to move the u-boot environment
into flash. I've modified the include/configs/PPChameleon.h file as follows:

#define CFG_ENV_IS_IN_FLASH	1
#define CFG_ENV_ADDR		0xFFFFA000
#define CFG_ENV_OFFSET		(CFG_ENV_ADDR - 0xFFFC0000)
#define CFG_ENV_SIZE		0x2000

I've added some debugging into the section where it reads the environment,
and I'm seeing the following:



U-Boot 1.0.2-adh-2004/03/29 (Mar 30 2004 - 13:40:38)

CPU:   IBM PowerPC 405EP Rev. B at 133.333 MHz (PLB=133, OPB=66, EBC=33 MHz)
       IIC Boot EEPROM disabled
       PCI async ext clock used, internal PCI arbiter enabled
       16 kB I-Cache 16 kB D-Cache
Board: ### No HW ID - assuming PPChameleonEVB
I2C:   ready
DRAM:  32 MB
Top of RAM usable for U-Boot at: 02000000
Reserving 189k for U-Boot at: 01fd0000
Reserving 256k for malloc() at: 01f90000
Reserving 128 Bytes for Board Info at: 01f8ff80
Reserving 48 Bytes for Global Data at: 01f8ff50
Stack Pointer at: 01f8ff38
New Stack Pointer is: 01f8ff38
Now running in RAM - U-Boot at: 01fd0000
FLASH:  4 MB
env_relocate[204] offset = 0x2010000
env_relocate[216] embedded ENV (before reloc) at fffd9474
env_relocate[218] embedded ENV (after reloc) at 01fe9474
U-Boot relocated to 01fd0000
NAND:Probing at 0xff000000
  32 MB
### main_loop entered: bootdelay=5

### main_loop: bootcmd="<UNDEFINED>"
=>

As you can see, the address of the environment before relocation is
0xfffd9474. Shouldn't this be 0xFFFFA000? Is there anything else I need to
do to force the location of the environment into the required place?

It looks like the address of the environment is based on the location of the
'environment' variable in common/environment.c. Do I need to change the LD
script to force this variable to a certain location? If so, can anyone help
with what I need to do (I'm not familiar with LD scripts yet).

Many thanks.

Andy

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2004-03-30 13:29 [U-Boot-Users] Environment in flash rather than EEProm Andy Hawkins
@ 2005-01-27 10:21 ` Martin Egholm Nielsen
  2005-01-28 21:00   ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Egholm Nielsen @ 2005-01-27 10:21 UTC (permalink / raw)
  To: u-boot

Hi,

Is the below recipe the way to put the environment in flash?
I can't seem to find any other instructions on this...

BR,
  Martin

> I'm using a PPChameleonEVB, and am trying to move the u-boot environment
> into flash. I've modified the include/configs/PPChameleon.h file as follows:
> 
> #define CFG_ENV_IS_IN_FLASH	1
> #define CFG_ENV_ADDR		0xFFFFA000
> #define CFG_ENV_OFFSET		(CFG_ENV_ADDR - 0xFFFC0000)
> #define CFG_ENV_SIZE		0x2000
> 
> I've added some debugging into the section where it reads the environment,
> and I'm seeing the following:
> 
> 
> 
> U-Boot 1.0.2-adh-2004/03/29 (Mar 30 2004 - 13:40:38)
> 
> CPU:   IBM PowerPC 405EP Rev. B at 133.333 MHz (PLB=133, OPB=66, EBC=33 MHz)
>        IIC Boot EEPROM disabled
>        PCI async ext clock used, internal PCI arbiter enabled
>        16 kB I-Cache 16 kB D-Cache
> Board: ### No HW ID - assuming PPChameleonEVB
> I2C:   ready
> DRAM:  32 MB
> Top of RAM usable for U-Boot at: 02000000
> Reserving 189k for U-Boot at: 01fd0000
> Reserving 256k for malloc() at: 01f90000
> Reserving 128 Bytes for Board Info at: 01f8ff80
> Reserving 48 Bytes for Global Data at: 01f8ff50
> Stack Pointer at: 01f8ff38
> New Stack Pointer is: 01f8ff38
> Now running in RAM - U-Boot at: 01fd0000
> FLASH:  4 MB
> env_relocate[204] offset = 0x2010000
> env_relocate[216] embedded ENV (before reloc) at fffd9474
> env_relocate[218] embedded ENV (after reloc) at 01fe9474
> U-Boot relocated to 01fd0000
> NAND:Probing at 0xff000000
>   32 MB
> ### main_loop entered: bootdelay=5
> 
> ### main_loop: bootcmd="<UNDEFINED>"
> =>
> 
> As you can see, the address of the environment before relocation is
> 0xfffd9474. Shouldn't this be 0xFFFFA000? Is there anything else I need to
> do to force the location of the environment into the required place?
> 
> It looks like the address of the environment is based on the location of the
> 'environment' variable in common/environment.c. Do I need to change the LD
> script to force this variable to a certain location? If so, can anyone help
> with what I need to do (I'm not familiar with LD scripts yet).
> 
> Many thanks.
> 
> Andy
> 
> 
> 
> -------------------------------------------------------
> This SF.Net email is sponsored by: IBM Linux Tutorials
> Free Linux tutorial presented by Daniel Robbins, President and CEO of
> GenToo technologies. Learn everything from fundamentals to system
> administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-01-27 10:21 ` [U-Boot-Users] " Martin Egholm Nielsen
@ 2005-01-28 21:00   ` Wolfgang Denk
  2005-01-29 19:47     ` Martin Egholm Nielsen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2005-01-28 21:00 UTC (permalink / raw)
  To: u-boot

In message <ctafbf$m30$1@sea.gmane.org> you wrote:
> 
> Is the below recipe the way to put the environment in flash?

Obviously not - as it doesn't work.

> I can't seem to find any other instructions on this...

There are lots of working board config files.

> > I'm using a PPChameleonEVB, and am trying to move the u-boot environment
> > into flash. I've modified the include/configs/PPChameleon.h file as follows:

This  statement  is  bogus.  In  the  default  configuration  of  the
PPChameleonEVB  board,  the envrionment _is_ already in flash, and no
changes are needed at all.

> > #define CFG_ENV_IS_IN_FLASH	1

OK.

> > #define CFG_ENV_ADDR		0xFFFFA000
> > #define CFG_ENV_OFFSET		(CFG_ENV_ADDR - 0xFFFC0000)

This is  redundand  and  extremely  bad  style.  Why  don't  you  use
CFG_FLASH_BASE instead of the hardwired "magic" constant?

> > #define CFG_ENV_SIZE		0x2000


I really don't understand why you don't just  look  at  the  existing
source code and use this. It reads ("include/configs/PPChameleonEVB.h"):

    381 #define CFG_ENV_IS_IN_FLASH     1       /* use FLASH for environment vars */
    382 #define CFG_ENV_ADDR            0xFFFF8000      /* environment starts at the first small sector */
    383 #define CFG_ENV_SECT_SIZE       0x2000  /* 8196 bytes may be used for env vars*/
    384 #define CFG_ENV_ADDR_REDUND     0xFFFFA000
    385 #define CFG_ENV_SIZE_REDUND     0x2000




Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
You can't evaluate a man by logic alone.
	-- McCoy, "I, Mudd", stardate 4513.3

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-01-28 21:00   ` Wolfgang Denk
@ 2005-01-29 19:47     ` Martin Egholm Nielsen
  2005-01-29 21:29       ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Egholm Nielsen @ 2005-01-29 19:47 UTC (permalink / raw)
  To: u-boot

>>Is the below recipe the way to put the environment in flash?
> Obviously not - as it doesn't work.
:-)

>>I can't seem to find any other instructions on this...
> There are lots of working board config files.
Now, that's an instruction - got it!

>>>I'm using a PPChameleonEVB, and am trying to move the u-boot environment
>>>into flash. I've modified the include/configs/PPChameleon.h file as follows:
> This  statement  is  bogus.
Fortunately I didn't write it!

 > In  the  default  configuration  of  the
> PPChameleonEVB  board,  the envrionment _is_ already in flash, and no
> changes are needed at all.
Ohh, I have been fooled by the initialisation sequence - stating 
something about EEPROM.

I wonder what would happen if the EEPROM is taken off (cheaper 
production cost) - would U-Boot reject to start?!

>>>#define CFG_ENV_IS_IN_FLASH	1
> OK.
Almost too easy...

Thanks for the guidelines,
  Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-01-29 19:47     ` Martin Egholm Nielsen
@ 2005-01-29 21:29       ` Wolfgang Denk
  2005-02-11 11:59         ` Martin Egholm Nielsen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2005-01-29 21:29 UTC (permalink / raw)
  To: u-boot

In message <ctgpag$c19$1@sea.gmane.org> you wrote:
> 
> I wonder what would happen if the EEPROM is taken off (cheaper 
> production cost) - would U-Boot reject to start?!

No, but it would complain about errors  when  trying  to  access  the
device.

If you remove the EEPROM, you should also remove the EEPROm  relevant
config options from the config file.

> Thanks for the guidelines,

You are welcome.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"I didn't know it was impossible when I did it."

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-01-29 21:29       ` Wolfgang Denk
@ 2005-02-11 11:59         ` Martin Egholm Nielsen
  2005-02-11 12:20           ` Wolfgang Denk
  0 siblings, 1 reply; 8+ messages in thread
From: Martin Egholm Nielsen @ 2005-02-11 11:59 UTC (permalink / raw)
  To: u-boot

Hi,

>>> This statement is bogus. In the default configuration of the 
>>> PPChameleonEVB board, the envrionment _is_ already in flash, and
>>> no  changes are needed at all.
>>>> #define CFG_ENV_IS_IN_FLASH	1
Don't know it you care at all :-), but in my default PPChameleon config
this definition is hidden by the surrounding
#define ENVIRONMENT_IN_EEPROM
#ifdef ENVIRONMENT_IN_EEPROM

#define CFG_ENV_IS_IN_EEPROM	1

>>I wonder what would happen if the EEPROM is taken off (cheaper 
>>production cost) - would U-Boot reject to start?!
> No, but it would complain about errors  when  trying  to  access  the
> device.
> If you remove the EEPROM, you should also remove the EEPROm  relevant
> config options from the config file.
Good idea. I removed "CFG_CMD_EEPROM" from the "CONFIG_COMMANDS" - that
should do it...
Thanks again!

// Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-02-11 11:59         ` Martin Egholm Nielsen
@ 2005-02-11 12:20           ` Wolfgang Denk
  2005-02-11 12:46             ` Martin Egholm Nielsen
  0 siblings, 1 reply; 8+ messages in thread
From: Wolfgang Denk @ 2005-02-11 12:20 UTC (permalink / raw)
  To: u-boot

In message <420C9E1D.1010208@egholm-nielsen.dk> you wrote:
> 
> >>> This statement is bogus. In the default configuration of the 
> >>> PPChameleonEVB board, the envrionment _is_ already in flash, and
> >>> no  changes are needed at all.
> >>>> #define CFG_ENV_IS_IN_FLASH	1
> Don't know it you care at all :-), but in my default PPChameleon config

I do care.

> this definition is hidden by the surrounding
> #define ENVIRONMENT_IN_EEPROM
> #ifdef ENVIRONMENT_IN_EEPROM
> 
> #define CFG_ENV_IS_IN_EEPROM	1

Yes, and ENVIRONMENT_IN_EEPROM is NOT defined, and the  #else  branch
uses #define CFG_ENV_IS_IN_FLASH 1 (i. e. the default is in the #else
branch.)

This is what I wrote before: in  the  default  configuration  of  the
PPChameleonEVB  board,  the  environmment  is  in  (redundand)  flash
sectors.

> > If you remove the EEPROM, you should also remove the EEPROm  relevant
> > config options from the config file.
> Good idea. I removed "CFG_CMD_EEPROM" from the "CONFIG_COMMANDS" - that
> should do it...

Indeed.

> Thanks again!

You are welcome.

Best regards,

Wolfgang Denk

-- 
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Actual war is a very messy business. Very, very messy business.
	-- Kirk, "A Taste of Armageddon", stardate 3193.0

^ permalink raw reply	[flat|nested] 8+ messages in thread

* [U-Boot-Users] Re: Environment in flash rather than EEProm
  2005-02-11 12:20           ` Wolfgang Denk
@ 2005-02-11 12:46             ` Martin Egholm Nielsen
  0 siblings, 0 replies; 8+ messages in thread
From: Martin Egholm Nielsen @ 2005-02-11 12:46 UTC (permalink / raw)
  To: u-boot

Hi Wolfgang,

>>>>>This statement is bogus. In the default configuration of the 
>>>>>PPChameleonEVB board, the envrionment _is_ already in flash, and
>>>>>no  changes are needed at all.
>>>>>>#define CFG_ENV_IS_IN_FLASH	1
>>this definition is hidden by the surrounding
>>#define ENVIRONMENT_IN_EEPROM
>>#ifdef ENVIRONMENT_IN_EEPROM
>>#define CFG_ENV_IS_IN_EEPROM	1
> Yes, and ENVIRONMENT_IN_EEPROM is NOT defined, and the  #else  branch
> uses #define CFG_ENV_IS_IN_FLASH 1 (i. e. the default is in the #else
> branch.)
Hum, mine was... Maybe some of the patches from my board manufactorer 
added this...

> This is what I wrote before: in  the  default  configuration  of  the
> PPChameleonEVB  board,  the  environmment  is  in  (redundand)  flash
> sectors.
I read it :-)

// Martin

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-02-11 12:46 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-30 13:29 [U-Boot-Users] Environment in flash rather than EEProm Andy Hawkins
2005-01-27 10:21 ` [U-Boot-Users] " Martin Egholm Nielsen
2005-01-28 21:00   ` Wolfgang Denk
2005-01-29 19:47     ` Martin Egholm Nielsen
2005-01-29 21:29       ` Wolfgang Denk
2005-02-11 11:59         ` Martin Egholm Nielsen
2005-02-11 12:20           ` Wolfgang Denk
2005-02-11 12:46             ` Martin Egholm Nielsen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox