[U-Boot-Users] Excluding Env Variable section from the u-boot.bin

Dears, For my ppc405EP based custom board I would like to make few changes to the u-boot memory map, so that every time I update the u-boot, environment variables in the flash remain untouched.
Flash Memory used:S29GL128M(spansion 16MB Flash with 128 uniform sectors of 128KB each)
Current mapping U-Boot Start Flash Address 0xFFF60000 - 2 sectors U-Bot Env Variable Start Addr 0xFFFA000 - 1 sector U-Bot Env Variable(Redundant)Start Addr 0xFFFC000 - 1 sector U-Boot End sector - 1 sector
Size of the binary output of u-boot(u-boot.bin) after build is 128kb*5sectors=648Kbytes.
Current settings in the source tree:
U-boot-1.1.4/include/configs/my_board.h #define CFG_FLASH_BASE 0xFFF60000 #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MONITOR_LEN (640 * 1024)
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR 0xFFFA0000 #define CFG_ENV_SECT_SIZE 0x20000 #define CFG_ENV_ADDR_REDUND 0xFFFC0000 #define CFG_ENV_SIZE_REDUND 0x20000
U-boot-1.1.4/my_board/config.mk TEXT_BASE = 0xFFF60000
U-boot-1.1.4/my_board/u-boot.lds ppcenv_assert = ASSERT(. < 0xFFFA0000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified."); . = 0xFFFA0000; .ppcenv : { common/environment.o(.ppcenv); }
Required mapping: U-Bot Env Variable Start Addr 0xFFF8000 - 1 sector U-Bot Env Variable(Redundant)Start Addr 0xFFFA000 - 1 sector U-Boot Start Flash Address 0xFFFC0000 - 2 sectors
Required Size of the binary output of u-boot(u-boot.bin) after build is 128kb*2sectors=256Kbytes.
I have already tried to modify the above specified files to:
U-boot-1.1.4/include/configs/my_board.h #define CFG_FLASH_BASE 0xFFFC0000 #define CFG_MONITOR_BASE CFG_FLASH_BASE #define CFG_MONITOR_LEN (256 * 1024)
#define CFG_ENV_IS_IN_FLASH 1 #define CFG_ENV_ADDR 0xFFF80000 #define CFG_ENV_SECT_SIZE 0x20000 #define CFG_ENV_ADDR_REDUND 0xFFFA0000 #define CFG_ENV_SIZE_REDUND 0x20000
U-boot-1.1.4/my_board/config.mk TEXT_BASE = 0xFFFC0000
U-boot-1.1.4/my_board/u-boot.lds ppcenv_assert = ASSERT(. < 0xFFF80000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified."); . = 0xFFF80000; .ppcenv : { common/environment.o(.ppcenv); }
But after doing "make all" I get the message ppc_4xx-ld:.bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified.
In a simple term, I wanted to build my u-boot by excluding environment variable section of the memory..
Can any one help me?
Where am I going wrong??
Is there any other modification needs to be done other than the above specified changes?
Thanks in advance for your support, With best regards, Albert.

In message 61124de70601120327o12f9294die4bda6bbfdb464ac@mail.gmail.com you wrote:
For my ppc405EP based custom board I would like to make few changes to the u-boot memory map, so that every time I update the u-boot, environment variables in the flash remain untouched.
...
U-boot-1.1.4/my_board/u-boot.lds ppcenv_assert = ASSERT(. < 0xFFF80000, ".bss section too big, overlaps .ppcenv section. Please update your confguration: CFG_MONITOR_BASE, CFG_MONITOR_LEN and TEXT_BASE may need to be modified.");
Now isn't this a very precise error message? Which other hints do you need?
Where am I going wrong??
Your whole approach seems overkill to me. Why don;t you simply include a "saveenv" command in your update script? As long as the environment is not shifted (which seems unlikelyin your case) no other changes are needed.
Best regards,
Wolfgang Denk

Your whole approach seems overkill to me. Why don;t you simply include a "saveenv" command in your update script? As long as the environment is not shifted (which seems unlikelyin your case) no other changes are needed.
oh! i didnt know this! it's an easy way to retain env variables :)
btw, when i update my u-boot in the field (for some unavoidable reason), the update_uboot script erases all the u-boot flash sectors and over writes the new u-boot.bin - what if somethings goes wrong with the communication or power while copying u-boot.bin to flash?? i may loose important settings of my product in the field! u-boot.bin can always be updated using the BDI tool! But i cannot recover the environment variables.
i can make my update_uboot script in such a way that, before erasing the u-boot sectors, it will copy the env section to some free flash sector(as a backup) , update the u-boot.bin and then call 'saveenv'. i hope this is the better way to protect my environment variables.
please let me know if someone has better idea than this. Best regards, Albert.

Albert David wrote:
when i update my u-boot in the field (for some unavoidable reason), the update_uboot script erases all the u-boot flash sectors and over writes the new u-boot.bin -
Hi, I think you should change your update_uboot script so that it only erases the sector with the bin. Are you updating u-boot from u-boot or from Linux (or some other OS)?
what if somethings goes wrong with the communication or power while copying u-boot.bin to flash?? i may loose important settings of my product in the field! u-boot.bin can always be updated using the BDI tool! But i cannot recover the environment variables.
In this case you would need to read the environment variables first and keep them backed up during the u-boot update.
/Tore Martin Hagen

In message 61124de70601122029v6f84d9fbya8a6c22a9f59afa8@mail.gmail.com you wrote:
when i update my u-boot in the field (for some unavoidable reason), the update_uboot script erases all the u-boot flash sectors and over writes the new u-boot.bin - what if somethings goes wrong with the communication or power while copying u-boot.bin to flash?? i may loose
You shoudl always download theimage to ram *before* you start erasing the flash, thus communication failures are not a problem.
If you have a power fail you are lost.
important settings of my product in the field! u-boot.bin can always be updated using the BDI tool! But i cannot recover the environment variables.
You can make it more reliable for normal operation by using redundant environment setors.
i can make my update_uboot script in such a way that, before erasing the u-boot sectors, it will copy the env section to some free flash sector(as a backup) , update the u-boot.bin and then call 'saveenv'. i hope this is the better way to protect my environment variables.
Yes, you can additionally create a bacup copy for cases where you had a power failure, but it is not as trivial as you (1) need to know exactly where your environment is located (ok, not so difficult) and (2) in case of redundand sectors you will have to test which one is the active and which one the obsoleted sector.
Best regards,
Wolfgang Denk
participants (3)
-
Albert David
-
Tore Martin Hagen
-
Wolfgang Denk