我用的是韦东山的JZ2440开发板,在移植u-boot时我想把环境变量放到nand flash里面,可在include/configs/xxx.h里,添加
#define CONFIG_ENV_IS_IN_NAND
#define CONFIG_ENV_OFFSET 0x00080000
#define CONFIG_ENV_SIZE 0x20000
#define CONFIG_ENV_RANGE CONFIG_ENV_SIZE
#define CONFIG_ENV_OVERWRITE
结果就卡死在这里
U-Boot 2016.09.01 (Jul 14 2018 - 07:07:45 -0700)
CPUID: 32440001
FCLK: 400 MHz
HCLK: 100 MHz
PCLK: 50 MHz
DRAM: 64 MiB
WARNING: Caches not enabled
Flash: 2 MiB
NAND: 256 MiB
如果把CONFIG_ENV_IS_IN_NAND换成
#define CONFIG_ENV_IS_IN_FLASH会报错
common/built-in.o:(.data.env_ptr+0x0): undefined reference to `environment'
只有加上
#define CONFIG_ENV_ADDR (CONFIG_SYS_FLASH_BASE + 0x070000)
才能编译通过
并且不会卡住各项功能都能实现,只是不能save环境变量
U-Boot 2016.09.01 (Jul 15 2018 - 21:08:43 -0700)
CPUID: 32440001
FCLK: 400 MHz
HCLK: 100 MHz
PCLK: 50 MHz
DRAM: 64 MiB
WARNING: Caches not enabled
Flash: 2 MiB
NAND: 256 MiB
*** Warning - bad CRC, using default environment
In: serial
Out: serial
Err: serial
Net: dm9000
Hit any key to stop autoboot: 0
JZ2440 #
JZ2440 #
JZ2440 #
JZ2440 # help
? - alias for 'help'
base - print or set address offset
bdinfo - print Board Info structure
boot - boot default, i.e., run 'bootcmd'
bootd - boot default, i.e., run 'bootcmd'
bootelf - Boot from an ELF image in memory
bootm - boot application image from memory
bootp - boot image via network using BOOTP/TFTP protocol
bootvx - Boot vxWorks from an ELF image
cmp - memory compare
coninfo - print console devices and information
cp - memory copy
crc32 - checksum calculation
.....................
.....................
.....................
JZ2440 # print
baudrate=115200
bootargs=console=ttySAC0 root=/dev/mtdblock3
bootcmd=nand read 30000000 kernel 0x200000;bootm 30000000
bootdelay=5
ethact=dm9000
ethaddr=00:0c:29:4b:e4:f4
ipaddr=192.168.2.5
netmask=255.255.255.0
serverip=192.168.2.1
stderr=serial
stdin=serial
stdout=serial
Environment size: 299/131068 bytes
JZ2440 #
那位大佬帮我看看是哪里的问题,不胜感激。 |