本帖最后由 cszhoujin 于 2014-8-14 15:30 编辑
最近移植u-boot-2014.04到mini2440,在初始化环境变量时程序不继续运行了,卡在这个地方很多天了,都要崩溃了,请大侠帮我分析一下是什么原因,谢谢了!
u-boot从Nand Flash启动,运行到board_init_r函数中的env_relocate()就不继续了,经过添加打印信息发现函数执行流程如下:
board_init_r()
env_relocate()
env_relocate_spec()
readenv
nand_block_isbad
mtd_block_isbad
mtd->_block_isbad -> nand_block_isbad
nand_block_checkbad
chip->scan_bbt(mtd)->nand_default_bbt()
nand_create_badblock_pattern
bd = kzalloc(sizeof(*bd), GFP_KERNEL); (Nand_bbt.c)
函数在执行到kzalloc去申请内存时就停止运行了,搞了很多天都不知道问题出在哪,大侠们帮我看一下是什么情况?
同时在nand_default_bbt也会调用nand_scan_bbt函数,nand_scan_bbt函数中也调用了kzalloc接口,却没有问题,偏偏
nand_create_badblock_pattern函数中调用kzalloc就出问题;
<mini2440.h>
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET 0xc0000 /*0x00000~0xc0000: 768K-U-Boot 0xc0000~0xe0000: 128K-ENV*/
#define CONFIG_ENV_SIZE 0x20000 /*128K*/
#define CONFIG_ENV_OVERWRITE
U-Boot打印信息如下:
U-Boot 2014.04 (Aug 14 2014 - 14:33:15)
U-Boot code: 33F00000 -> 33F39A88 BSS: -> 33F3F590
CPUID: 32440001
FCLK: 400 MHz
HCLK: 100 MHz
PCLK: 50 MHz
monitor len: 0003F590
ramsize: 04000000
TLB table from 33ff0000 to 33ff4000
Top of RAM usable for U-Boot at: 33ff0000
Reserving 253k for U-Boot at: 33f00000
Reserving 4096k for malloc() at: 33b00000
Reserving 32 Bytes for Board Info at: 33afffe0
Reserving 160 Bytes for Global Data at: 33afff40
New Stack Pointer is: 33afff30
RAM Configuration:
Bank #0: 30000000 64 MiB
relocation Offset is: 00000000
WARNING: Caches not enabled
monitor flash len: 00039A88
dram_bank_mmu_setup: bank: 0
Now running in RAM - U-Boot at: 33f00000
Flash: fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
fwc addr 0000aaaa cmd aa 00aa 16bit x 16 bit
fwc addr 00005554 cmd 55 0055 16bit x 16 bit
fwc addr 0000aaaa cmd 90 0090 16bit x 16 bit
fwc addr 00000000 cmd f0 00f0 16bit x 16 bit
JEDEC PROBE: ID f0 ea00 0
Found JEDEC Flash: S29AL016
unlock address index 1
unlock addresses are 0x555/0x2aa
erase_region_count = 1 erase_region_size = 16384
erase_region_count = 2 erase_region_size = 8192
erase_region_count = 1 erase_region_size = 32768
erase_region_count = 31 erase_region_size = 65536
flash_protect ON: from 0x00000000 to 0x00039A87
protect on 0
protect on 1
protect on 2
protect on 3
protect on 4
protect on 5
protect on 6
2 MiB
NAND: board_nand_init()
end of nand_init
hwcontrol(): 0xff 0x83
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x90 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0xffffffff 0x81
dev_ready
hwcontrol(): 0x90 0x83
hwcontrol(): 0x00 0x85
hwcontrol(): 0xffffffff 0x81
dev_ready
NAND device: Manufacturer ID: 0xec, Chip ID: 0x76 (Samsung NAND 64MiB 3,3V 8-bit), page size: 512, OOB size: 16
64 MiB
|