以Hi3519av100對應的uboot爲例,想要uboot下進行內存測試
可以使用 “mtest” 命令
編譯uboot,配置增加mtest宏
make ARCH=arm k5_hi3519av100_defconfig
make ARCH=arm menuconfig
找到
CONFIG_CMD_MEMTEST
將其變爲 CONFIG_CMD_MEMTEST=y
然後找到對應的 “include/configs/”目錄下的配置文件
這邊是“k5_hi3519av100”,修改如下內容:
#define CONFIG_SYS_MEMTEST_START (CONFIG_SYS_SDRAM_BASE + 0x3000000)
#define CONFIG_SYS_MEMTEST_END (CONFIG_SYS_SDRAM_BASE + 0x80000000 - 1)
注:
MEMTEST_START是從內存DDR的起始地址開始,但爲了避開uboot的那段地址,因此+0x3000000;
同時DDR的size爲2G,因此結束地址爲DDR_START+DDR_SIZE
然後編譯,生成uboot,在uboot下查看“mtest”:
hisilicon # mtest help
mtest - simple RAM read/write test
Usage:
mtest [start [end [pattern [iterations]]]]
hisilicon #
簡單做一個測試,測試0x30000000~0x35000000之間的內存
dcache on
hisilicon # mtest 0x30000000 0x35000000 0x0 1
Testing 30000000 ... 35000000:
Pattern 00000000 Writing... Reading...Tested 1 iteration(s) with 0 errors.
hisilicon #
結束!