[U-Boot-Users] statically defined CFG_ENV_ADDR

KokHow Teh KokHow.Teh at marconi.com
Fri Jan 20 05:46:48 CET 2006


Hi;
      I recently ran into the problem of overwriting the content of flash
used to store the code sections for my PQ2FADS-ZU board. When I `setenv`
and `saveenv` some parameters into the flash, type `res` and nothing
happens. When I dig around, it was due to the fact that CFG_ENV_ADDR was
statically defined in include/configs/*. In the case of my board which is
using MPC8260ADS.h,

#ifndef CFG_RAMBOOT
#  define CFG_ENV_IS_IN_FLASH   1
#  define CFG_ENV_SECT_SIZE     0x40000
#  define CFG_ENV_ADDR          (CFG_MONITOR_BASE + CFG_ENV_SECT_SIZE)
#else
<snip>
#endif

      What happens is that the size of u-boot loaded into the flash of my
board occupies more than one sector of the flash and CFG_ENV_ADDR is
located at the second sector of the flash imimediately following u-boot
with the flash sector size of 0x40000:

8280>unlock 0xfff00000 0x40000 2
8280>erase
Erasing flash at 0xfff00000
Erasing flash at 0xfff40000
Erasing flash passed
8280>prog 0 u-boot elf
Programming u-boot , please wait ....
- File offset 0x00000078 to address 0xFFF00000 size 296544
Programming flash passed
8280>

[teh at ShrekII u-boot 10]$ size /tftpboot/u-boot
   text    data     bss     dec     hex filename
 276384   18012  252920  547316   859f4 /tftpboot/u-boot
[teh at ShrekII u-boot 11]$

      In fact CFG_ENV_ADDR is statically defined in all of the config files
in ./include/configs/*. I wonder if it is possible to use an external _end
symbol as the start address for environmental flash section. But then, when
I check System.map and with `md` command in BDI2000,  _end happens too long
after any meaningful content of u-boot in flash:

[teh at ShrekII u-boot 12]$ tail System.map
fff56994 B ide_dev_desc
fff569f8 B os_data_header
fff56a18 B send_parms
fff56a2c B hose
fff56b00 B flash_info
fff56bac B super
fff56bf8 B get_vfatname_block
fff66bf8 B get_dentfromdir_block
fff76bf8 B do_fat_read_block
fff86bf8 A _end
[teh at ShrekII u-boot 13]$

8280>md 0xfff48600
fff48600 : fff3f030 00000010 00000001 fff17130  ...0..........q0
fff48610 : fff3f038 fff3f060 fff3f084 00000002  ...8...`........
fff48620 : 00000001 fff175c4 fff3f08c fff3f0a4  ......u.........
fff48630 : fff3f130 00000010 00000001 fff17604  ...0..........v.
fff48640 : fff3f138 fff3f158 fff3f288 00000010  ...8...X........
fff48650 : 00000001 fff17604 fff3f28c 00000000  ......v.........
fff48660 : ffffffff ffffffff ffffffff ffffffff  ................
fff48670 : ffffffff ffffffff ffffffff ffffffff  ................
fff48680 : ffffffff ffffffff ffffffff ffffffff  ................
fff48690 : ffffffff ffffffff ffffffff ffffffff  ................
fff486a0 : ffffffff ffffffff ffffffff ffffffff  ................
fff486b0 : ffffffff ffffffff ffffffff ffffffff  ................
fff486c0 : ffffffff ffffffff ffffffff ffffffff  ................
fff486d0 : ffffffff ffffffff ffffffff ffffffff  ................
fff486e0 : ffffffff ffffffff ffffffff ffffffff  ................
fff486f0 : ffffffff ffffffff ffffffff ffffffff  ................
8280>

      As shown, the flash content from 0xFFF48660 (the size of u-boot shown
when loading it into the flash) to _end @0xFFF86BF8 is 0xFF. If I define
the start address of env flash to be _end, there is too much space to be
wasted in the flash while in fact the environment parameters can start at
0xFFF80000 which is the third sector after u-boot content in the flash.
      My question is if it is possible to dynamically define the start address of environment parameters in the flash and if it is, how to achieve
it..? Any insight is appreciated.

Regards,
TEH






More information about the U-Boot mailing list