[U-Boot] environment in NAND

Arno Steffen arno.steffen at googlemail.com
Wed Sep 7 08:20:22 CEST 2011


2011/9/6 Marek Vasut <marek.vasut at gmail.com>:
> On Tuesday, September 06, 2011 04:16:59 PM Arno Steffen wrote:
>> NAND is sufferered from Bad blocks and bit errors. Thats why usually
>> exists a bad block handling and an ECC. Am I wrong, that I miss both
>> on uboot  for it's environment?
>> Or is my uboot just to old (2010.06) and newer versions handle this?
>> Is there a special setting necessary to handle this?
>> I see that environment is CRC protected but this make things even
>> worse, if not an important bit is toogled.
>> Best regards
>> Arno
>
> Hi,
>
> the mtd subsystem in uboot is based on the one from linux. The ECC handling is
> there, no problem. The problem you might experience is in case you have a
> wrongly implemented NAND driver, which ignores ECC.
>
> What board/cpu do you use? Also, why so old uboot, use mainline?
>
> Cheers
>
>> _______________________________________________
>> U-Boot mailing list
>> U-Boot at lists.denx.de
>> http://lists.denx.de/mailman/listinfo/u-boot
>

Hi Marek and Wolfgang, Thanks for your answers.
I kept already one sector space for bad blocks, so 1st environment is
at c.0000, 2nd at 10.0000. Blocksize is 2.0000 (so 1 block left).
Maybe I have to announce uboot, that there is one block more
available. But how, in wich defininition? I can declare size (which is
just 8k) and blocksize (128k), but not block number ?!?
I found that this below more or less relates to environment: Maybe I
miss something here? Some look redundant to me. I adopted this from
another board included in uboot, just changed size,location and
redundancy.

#define CONFIG_ENV_SIZE			(8 << 10)	/* 8 KiB */
#define CONFIG_SYS_MALLOC_LEN		(CONFIG_ENV_SIZE + (128 << 10))
#define CONFIG_SYS_GBL_DATA_SIZE	128	/* bytes reserved for */

#define SMNAND_ENV_OFFSET		0x0C0000 /* environment starts here */

#define CONFIG_SYS_ENV_SECT_SIZE	boot_flash_sec
#define CONFIG_ENV_OFFSET		boot_flash_off
#define CONFIG_ENV_ADDR			boot_flash_env_addr

#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
#define CONFIG_ENV_OFFSET_REDUND	0x100000
#define CONFIG_ENV_SIZE_REDUND		(CONFIG_ENV_SIZE)

Regarding the version:
I use an ARM Cortex-A8 / OMAP3, and this uboot is the SDK of TI.
(source is http://arago-project.org/git/projects/?p=u-boot-omap3.git;a=summary)

about ECC: The envrionment  is written with ECC, but my impression is
- it is not working or CRC check is done BEFORE correction is done. So
from time to time I've got a flash from supplier which gives me a CRC
error, and if I check the content, there is just one bit wrong.

@ Wolfgang: I would recommend to downsize the environment size to what
you need. It happens here that a bit is toggling, and than I get CRC
error - although this toggled bit is somewhere in 128k. If the size is
smaller, chances are better that the toggling bit in sector doesn't
hurt you, as it is outside the size.

Best regards
Arno


More information about the U-Boot mailing list