Andes Workshop
http://forum.andestech.com/

簡易random pattern的memory測試(使用gdb)
http://forum.andestech.com/viewtopic.php?f=16&t=222
Page 1 of 1

Author:  cindy [ Fri Dec 23, 2011 6:02 pm ]
Post subject:  簡易random pattern的memory測試(使用gdb)

當我們要開發軟件時,首先要驗證memory讀寫正確。
下面的例子雖然是以Andes 32 bit risc cpu(Andes晶心科技)為例,
但是gdb script的用法各家cpu都是一樣的。

下面是一個簡易的memory的測試檔案。
裡面是針對ILM的測試。您也可以改一下script,改成對DLM或是DRAM。
Attachment:
andes_run1.zip [256.85 KiB]
Downloaded 843 times


解開檔案後,裡面有一個gdb script。在這個linker script中,先將ILM (instruction local memory) enable,然後restore一個64k大小的檔案到ILM。如果您不需要初始化ILM,去掉這一行” set $ilmb=0x1”
因為我們用的SOC上的ILM是一個寫入很慢的flash,所以我dump memory有3次,以比較它的不同。

Code:
target remote:1234
echo  >>> I connect the target \n
set $ilmb=0x1
echo >>> set $ilmb \n
restore 64k.bin binary 0x0
echo >>> after restore \n
dump memory ilm1_dump1 0x0 0x10000
echo >>> after ilm1_dump1 \n
dump memory ilm1_dump2 0x0 0x10000
echo >>> after ilm1_dump2 \n
dump memory ilm1_dump3 0x0 0x10000
echo >>> after ilm1_dump3 \n
echo >>> Complete!! \n
disconnect
quit


使用方法
Attachment:
p1.gif
p1.gif [ 11.53 KiB | Viewed 8201 times ]

先啟動ICEman,然後執行gdb script。

得到幾個memory dump檔案。
然後用Cygnus比對寫入的檔案和讀出是否相同。
Attachment:
p2.gif
p2.gif [ 38.82 KiB | Viewed 8201 times ]

如上圖就是正確的。

比對用的檔案64k.bin檔我是用cygwin下打dd指令產生的。
指令
Code:
dd bs=1024 if=/dev/random of=64k.bin count=64

Attachment:
p3.gif
p3.gif [ 8.92 KiB | Viewed 8201 times ]

Page 1 of 1 All times are UTC + 8 hours [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/