This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Memory access in a loop


I made some mistake, and confuse you.sorry for that and  thank you for correction.

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[i] =  *(volatile unsigned short *)(0x200b8f6);
}

the address 0x200b8f6 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 this

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:

When I use Logic Analyzer,  I want to "read" *(volatile unsigned short *)(0x200b8f6)
I found it will read from 0x200b8f8, 0x200b8fa, 0x200b8fc, 0x200b8fe , 0x200b8f0, 0x200b8f2 , 0x200b8f4, and the last one is 0x200b8f6(this is what I want)

PS : "write" will not cause this problem


Best Regards,
Peter

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]