This is the mail archive of the
ecos-discuss@sources.redhat.com
mailing list for the eCos project.
Re: Memory access in a loop
- From: "William Martin" <will at rapidnet dot com>
- To: "peter_ku" <peter_ku at issc dot com dot tw>,"'Ecos-Discuss'" <ecos-discuss at sources dot redhat dot com>
- Date: Wed, 9 Oct 2002 22:12:50 -0600
- Subject: Re: [ECOS] Memory access in a loop
- References: <000001c27011$314bc780$790114ac@issc.com.tw>
Just a quick question; Did you intend to use
x[10] = ...
or
x[i] =
??
-Will
----- Original Message -----
From: "peter_ku" <peter_ku@issc.com.tw>
To: "'Ecos-Discuss'" <ecos-discuss@sources.redhat.com>
Sent: Wednesday, October 09, 2002 9:57 PM
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
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss