Environment in flash rather than EEProm
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
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
Quoted 62 lines
I'm using a PPChameleonEVB, and am trying to move the u-boot environment into flash. I've modified the
include/configs/PPChameleon.hfile as follows:#define
CFG_ENV_IS_IN_FLASH1
#defineCFG_ENV_ADDR0xFFFFA000
#defineCFG_ENV_OFFSET(CFG_ENV_ADDR-0xFFFC0000)
#defineCFG_ENV_SIZE0x2000I'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-CacheBoard: ### 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: 01f90000Reserving 128 Bytes for Board Info at:
01f8ff80Reserving 48 Bytes for Global Data at:01f8ff50Stack Pointer at:01f8ff38
New Stack Pointer is:01f8ff38
Now running in RAM - U-Boot at:01fd0000
FLASH: 4 MB
env_relocate[204] offset =0x2010000env_relocate[216] embedded ENV (before reloc) atfffd9474env_relocate[218] embedded ENV (after reloc) at01fe9474U-Boot relocated to01fd0000
NAND:Probing at0xff000000
32 MB
###main_loopentered: bootdelay=5###
main_loop: bootcmd="<UNDEFINED>"
=>As you can see, the address of the environment before relocation is
0xfffd9474. Shouldn't this be0xFFFFA000? 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
Quoted 2 lines · In message <[email protected]> you wrote:
Is the below recipe the way to put the environment in flash?
Obviously not - as it doesn't work.
Quoted 1 line
I can't seem to find any other instructions on this...
There are lots of working board config files.
Quoted 2 lines
Quoted 2 lines
I'm using a PPChameleonEVB, and am trying to move the u-boot environment into flash. I've modified the
include/configs/PPChameleon.hfile 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.
Quoted 1 line
Quoted 1 line
#define
CFG_ENV_IS_IN_FLASH1
OK.
Quoted 2 lines
Quoted 2 lines
#define
CFG_ENV_ADDR0xFFFFA000
#defineCFG_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?
Quoted 1 line
Quoted 1 line
#define
CFG_ENV_SIZE0x2000
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 0x2000Best regards,
Wolfgang Denk
Signature · 4 lines
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
Quoted 2 lines
Quoted 1 line
Is the below recipe the way to put the environment in flash?
Obviously not - as it doesn't work.
:-)
Quoted 2 lines
Quoted 1 line
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!
Quoted 3 lines
Quoted 2 lines
Quoted 2 lines
I'm using a PPChameleonEVB, and am trying to move the u-boot environment into flash. I've modified the
include/configs/PPChameleon.hfile as follows:This statement is bogus.
Fortunately I didn't write it!
Quoted 3 lines
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?!
Quoted 2 lines
Quoted 1 line
Quoted 1 line
#define
CFG_ENV_IS_IN_FLASH1OK.
Almost too easy...
Thanks for the guidelines,
Martin
Quoted 3 lines · In message <[email protected]> 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.
Quoted 1 line
Thanks for the guidelines,
You are welcome.
Best regards,
Wolfgang Denk
Signature · 3 lines
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."
Hi,
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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.
Quoted 1 line
#define
CFG_ENV_IS_IN_FLASH1
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
Quoted 6 lines
Quoted 2 lines
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
Quoted 6 lines · In message <[email protected]> you wrote:
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
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.
Quoted 1 line
#define
CFG_ENV_IS_IN_FLASH1Don't know it you care at all :-), but in my default PPChameleon config
I do care.
Quoted 5 lines
this definition is hidden by the surrounding
#defineENVIRONMENT_IN_EEPROM
#ifdefENVIRONMENT_IN_EEPROM#define
CFG_ENV_IS_IN_EEPROM1
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.
Quoted 4 lines
Quoted 2 lines
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.
Quoted 1 line
Thanks again!
You are welcome.
Best regards,
Wolfgang Denk
Signature · 4 lines
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
Hi Wolfgang,
Quoted 11 lines
Quoted 8 lines
Quoted 4 lines
Quoted 4 lines
Quoted 4 lines
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.
Quoted 1 line
#define
CFG_ENV_IS_IN_FLASH1this definition is hidden by the surrounding
#defineENVIRONMENT_IN_EEPROM
#ifdefENVIRONMENT_IN_EEPROM
#defineCFG_ENV_IS_IN_EEPROM1Yes, and
ENVIRONMENT_IN_EEPROMis NOT defined, and the #else branch uses #defineCFG_ENV_IS_IN_FLASH1 (i. e. the default is in the #else branch.)
Hum, mine was... Maybe some of the patches from my board manufactorer added this...
Quoted 3 lines
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