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: "peter_ku" <peter_ku at issc dot com dot tw>
- To: "'Ecos-Discuss'" <ecos-discuss at sources dot redhat dot com>
- Date: Fri, 11 Oct 2002 11:01:09 +0800
- Subject: RE: [ECOS] Memory access in a loop
Hi, Robert
You are right. After I disable the cache, it can work. and even my second problem is caused by this reason.
appreciate for your suggestion.
Peter
-----Original Message-----
From: ecos-discuss-owner@sources.redhat.com [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of Robert Cragie
Sent: Thursday, October 10, 2002 5:07 PM
To: peter_ku; 'Ecos-Discuss'
Subject: RE: [ECOS] Memory access in a loop
After a quick scan through the S3C4510B user manual, a better suggestion
might be to set A[26] on the address you are accessing. This bypasses the
cache. So 0x0200b8f6 would become 0x0600b8f6. So try:
unsigned short x[10];
for(int i=0; i<10; i++)
{
x[i] = *(volatile unsigned short *)(0x600b8f6);
}
instead.
Robert Cragie, Design Engineer
Direct: +44 (0) 114 281 4512
_______________________________________________________________
Jennic Ltd, Furnival Street, Sheffield, S1 4QT, UK
http://www.jennic.com Tel: +44 (0) 114 281 2655 Confidential
_______________________________________________________________
Visit our stand at Electronica, Munich 12-14 November 2002
_______________________________________________________________
> -----Original Message-----
> From: ecos-discuss-owner@sources.redhat.com
> [mailto:ecos-discuss-owner@sources.redhat.com]On Behalf Of peter_ku
> Sent: 10 October 2002 05:36
> To: 'Ecos-Discuss'
> Subject: RE: [ECOS] 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
--
Before posting, please read the FAQ: http://sources.redhat.com/fom/ecos
and search the list archive: http://sources.redhat.com/ml/ecos-discuss