This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Memory access in a loop
- From: "peter_ku" <peter_ku at issc dot com dot tw>
- To: "'Ecos-Discuss'" <ecos-discuss at sources dot redhat dot com>
- Date: Thu, 10 Oct 2002 11:57:45 +0800
- Subject: [ECOS] Memory access in a loop
Hi,
I use GCC 2.95.2 / insight5.1 , target is E7T.
I want to access memory in a loop
unsigned short x[10];
for(int i=0; i<10; i++)
{
x[10] = *(volatile unsigned short *)(addr);
}
the addr is a entry point for another memory pool, after I read it once, the memory pointer will increase automatically.
I found a problem.
1. If I didn't set any breakpoint , it will only access the memory once. it means x[0] and x[1]........[10] are all the same value.
I use the Logic Analyzer to make sure.
2. If I set a breakpoint or debug step by step, it will access the memory ten times. it is more normal.
any one can help me?
PS: I have already turn off the optimize -O0.
One more question:
And If I read a data from address, the debug will read other 16 bytes data automatically, can I turn off this function?
ex:
If I read 0x2008032, it will read 0x2008034 0x2008036, 0x2008038 .............
Best Regards,
Peter