This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

AM3352 NAND Flash无法保存环境变量的问题

Other Parts Discussed in Thread: AM3352

大家好,我的板子是AM3352,NAND Flash启动,但是发现在uboot执行saveenv时无法保存环境变量,擦除flash失败,提示:Attempt to erase non block-aligned data ,看了一下源码是在int nand_erase_opts(nand_info_t *meminfo, const nand_erase_options_t *opts)函数时出错,如下:

if ((opts->offset & (meminfo->erasesize - 1)) != 0) {
printf("Attempt to erase non block-aligned data\n");
return -1;
}

打印信息如下:

U-Boot 2016.05-00304-gad06f64-dirty (Aug 18 2017 - 18:57:40 +0800)

CPU : AM335X-GP rev 2.1
Model: TI AM335x HXDW
Watchdog enabled
I2C: ready
DRAM: 256 MiB
NAND: 256 MiB
MMC: OMAP SD/MMC: 0, OMAP SD/MMC: 1
*** Error - No Valid Environment Area found
*** Warning - bad CRC, using default environment

<ethaddr> not set. Validating first E-fuse MAC
Net: Could not get PHY for ethernet@4a100000: addr 0
eth0: ethernet@4a100000
Warning: usb_ether MAC addresses don't match:
Address in SROM is de:ad:be:ef:00:01
Address in environment is 84:eb:18:bd:a8:9e
, eth1: usb_ether
Press SPACE to abort autoboot in 2 seconds
uboot:/>saveenv
Saving Environment to NAND...
Erasing redundant NAND...
Attempt to erase non block-aligned data
Erasing NAND...
Attempt to erase non block-aligned data
uboot:/>

分区如下:

uboot:/>mtd

device nand0 <nand.0>, # parts = 10
#: name size offset mask_flags
0: NAND.SPL 0x00020000 0x00000000 0
1: NAND.SPL.backup1 0x00020000 0x00020000 0
2: NAND.SPL.backup2 0x00020000 0x00040000 0
3: NAND.SPL.backup3 0x00020000 0x00060000 0
4: NAND.u-boot-spl-os 0x00040000 0x00080000 0
5: NAND.u-boot 0x00100000 0x000c0000 0
6: NAND.u-boot-env 0x00020000 0x001c0000 0
7: NAND.u-boot-env.backup10x00020000 0x001e0000 0
8: NAND.kernel 0x00800000 0x00200000 0
9: NAND.file-system 0x0f600000 0x00a00000 0

active partition: nand0,0 - (NAND.SPL) 0x00020000 @ 0x00000000

defaults:
mtdids : nand0=nand.0
mtdparts: mtdparts=nand.0:128k(NAND.SPL),128k(NAND.SPL.backup1),128k(NAND.SPL.ba
ckup2),128k(NAND.SPL.backup3),256k(NAND.u-boot-spl-os),1m(NAND.u-boot),128k(NAND
.u-boot-env),128k(NAND.u-boot-env.backup1),8m(NAND.kernel),-(NAND.file-system)
uboot:/>