Skip to contentSkip to conversation

problem with saveenv command if CFG_ENV_IS_IN_EEPROM...

U-Boot-Users sean chang 2 participants 2 messages Jun 11, 2004 – Jun 12, 2004

lore
Share & tools
lore

sean chang

author
#0 lore raw

Hi all,

A quick question.

If I have my environment variables stored in eeprom (i.e. define CFG_ENV_IS_IN_EEPROM), I should be able to use the saveenv command to save any user modified env values back to eeprom right?

But U_BOOT_CMD saveenv does not get compiled unless I have defined both CFG_CMD_ENV and CFG_CMD_FLASH. Also, if you look at the function do_saveenv, which is called when user uses the saveenv command, it does get compiled if I only define CFG_ENV_IS_IN_EEPROM alone.

Am I missing something or is there a problem? Any help is greatly appreciated.

Thanks,
Sean

copied from common/cmd_nvedit.c
================================================================================
#if ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == (CFG_CMD_ENV|CFG_CMD_FLASH))

U_BOOT_CMD(
saveenv, 1, 0, do_saveenv,
"saveenv - save environment variables to persistent storage\n", NULL
);

#endif /* CFG_CMD_ENV */

#if (CONFIG_COMMANDS & CFG_CMD_ASKENV)

===================================================================

#if defined(CFG_ENV_IS_IN_NVRAM) || defined(CFG_ENV_IS_IN_EEPROM) || \
    ((CONFIG_COMMANDS & (CFG_CMD_ENV|CFG_CMD_FLASH)) == \
      (CFG_CMD_ENV|CFG_CMD_FLASH))

int do_saveenv (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) {
extern char * env_name_spec;

printf ("Saving Environment to %s...\n", env_name_spec);

return (saveenv() ? 1 : 0);
}

#1 lore raw

Dear Sean,

Quoted 2 lines · in message <[email protected]> you wrote:

If I have my environment variables stored in eeprom (i.e. define CFG_ENV_IS_IN_EEPROM), I should be able to use the saveenv command to save any user modified env values back to eeprom right?

Sure. That's how it works on quite a lot of boards.

Quoted 1 line

But U_BOOT_CMD saveenv does not get compiled unless I have defined both CFG_CMD_ENV and CFG_CMD_FLASH. Also, if you look at the function do_saveenv, which is called when user uses the saveenv command, it does get compiled if I only define CFG_ENV_IS_IN_EEPROM alone.

Will you please restrict your line legth to some 70 characters or so? thanks.

Yes, the "saveenv" command entry only gets compiled when the CFG_CMD_ENV or CFG_CMD_FLASH options are enabled in your CONFIG_COMMANDS settings.

And the do_saveenv() code only gets compiled when the CFG_CMD_ENV or CFG_CMD_FLASH options are enabled in your CONFIG_COMMANDS settings, or when your environment is in EEPROM or in NVRAM.

Quoted 1 line

Am I missing something or is there a problem? Any help is greatly appreciated.

There is no problem.

Why are you asking?

Best regards,

Wolfgang Denk

Signature · 5 lines
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd at denx.de
Good manners are the settled  medium  of  social,  as  specie  is  of
commercial, life; returns are equally expected for both.
           - Lord Chesterfield _Letters to his Son_, 25 December 1753