Skip to contentSkip to conversation

REQ: advice regarding u-boot config

U-Boot Darius Augulis 2 participants 2 messages Jun 26, 2009

lore
Share & tools
lore
#0 lore raw

Hi all on the list,

I need some help with optimizing board config:

1. What is the best practice to configure environment? I have unified sector NOR flash. It has 128 sectors size of 128 KB, total 16Mbytes flash memory. U-boot is stored at 0x0. Where to put ENV?

2. What is optimal ENV size? If all sectors are 128 KB size, ENV should be 128Kb too?

3. Now my ENV configuration is follows:

#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_OFFSET (2 * 128 * 1024)
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
#define CONFIG_ENV_SIZE (8 * 1024)
#define CONFIG_ENV_SECT_SIZE (128 * 1024)

I can't put my ENV and the offset of (128 * 1024), because final u-boot image size is increased by the size of ENV. If I place ENV at (2 * 128 * 1024), it is normal 80kb. What is wrong? My text base is 0x1004000, flash base is 0x30000000

If I specify CONFIG_ENV_SIZE the same like CONFIG_ENV_SECT_SIZE (128 * 1024), u-boot does not start at all. Why it can't be size of full sector size - 128Kb ? Now I made it 8Kb...

4. Command 'saveenv' does not work for me. When I type it, u-boot tells me "Saving Environment to flash" and hangs immediately.

5. Below is debug log attached. ENV was like listed in [3].

Any help is very appreciated!

regards,
Darius A.

---

U-Boot 2009.06-00192-gd850236-dirty (Jun 26 2009 - 21:30:45)

U-Boot code: 10040000 -> 100557E8 BSS: -> 10057BD4 RAM Configuration:
Bank #0: 10000000 64 MB
flash detect cfi
fwc addr 30000000 cmd f0 f0f0 16bit x 8 bit fwc addr 30000000 cmd ff ffff 16bit x 8 bit fwc addr 300000aa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr 30000020 is= 0051 5151 fwc addr 30000aaa cmd 98 9898 16bit x 8 bit is= cmd 51(Q) addr 30000020 is= 0051 5151 fwc addr 30000000 cmd f0 00f0 16bit x 16 bit fwc addr 30000000 cmd ff 00ff 16bit x 16 bit fwc addr 300000aa cmd 98 0098 16bit x 16 bit is= cmd 51(Q) addr 30000020 is= 0051 0051 is= cmd 52(R) addr 30000022 is= 0052 0052 is= cmd 59(Y) addr 30000024 is= 0059 0059 device interface is 2
found port 2 chip 2 port 16 bits chip 16 bits

00 : 51 52 59 02 00 40 00 00 00 00 00 27 36 00 00 06  QRY.. at .....'6...
10 : 06 09 13 03 05 03 02 18 02 00 06 00 01 7f 00 00  ................
20 : 02 00 00 00 00 00 00 00 00 00 00 00 00 00 58 05  ..............X.

fwc addr 30000000 cmd f0 00f0 16bit x 16 bit fwc addr 30000aaa cmd aa 00aa 16bit x 16 bit fwc addr 30000554 cmd 55 0055 16bit x 16 bit fwc addr 30000aaa cmd 90 0090 16bit x 16 bit fwc addr 30000000 cmd f0 00f0 16bit x 16 bit fwc addr 300000aa cmd 98 0098 16bit x 16 bit manufacturer is 2
manufacturer id is 0x1
device id is 0x227e
device id2 is 0x0
cfi version is 0x3133
size_ratio 1 port 16 bits chip 16 bits found 1 erase regions
erase region 0: 0x0200007f erase_region_count = 128 erase_region_size = 131072 fwc addr 30000000 cmd f0 00f0 16bit x 16 bit flash_protect ON: from 0x30000000 to 0x300157E7 protect on 0
flash_protect ON: from 0x30040000 to 0x3005FFFF protect on 2
Flash: 16 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial

### main_loop entered: bootdelay=30

### main_loop: bootcmd="bootm"
Hit any key to stop autoboot: 30
NAS4220$ printenv
bootargs=root=/dev/mtdblock2 mem=64M
bootcmd=bootm
bootdelay=30
baudrate=115200
bootfile="nas4220"
stdin=serial
stdout=serial
stderr=serial

Environment size: 140/8188 bytes
NAS4220$ saveenv
Saving Environment to Flash...

#1 lore raw
Quoted 7 lines · Darius Augulis

Hi all on the list,

I need some help with optimizing board config:

1. What is the best practice to configure environment? I have unified sector NOR flash. It has 128 sectors size of 128 KB, total 16Mbytes flash memory. U-boot is stored at 0x0. Where to put ENV?

personnaly I prefer to put them at the end of the flash so evenif the u-boot size increase you will not overwrite them

Quoted 3 lines

2. What is optimal ENV size? If all sectors are 128 KB size, ENV should be 128Kb too?

Depend on your need 8k is good IMHO

Quoted 12 lines

3. Now my ENV configuration is follows:

#define CONFIG_ENV_IS_IN_FLASH 1
#define CONFIG_ENV_OFFSET (2 * 128 * 1024)
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + CONFIG_ENV_OFFSET)
#define CONFIG_ENV_SIZE (8 * 1024)
#define CONFIG_ENV_SECT_SIZE (128 * 1024)

*** Warning - bad CRC, using default environment

Quoted 8 lines
In:    serial
Out:   serial
Err:   serial

### main_loop entered: bootdelay=30

### main_loop: bootcmd="bootm"
Hit any key to stop autoboot: 30
NAS4220$ printenv

the Icy box :)

Best Regards,
J.