Rockbox mail archive
Subject: Re: Cowon D2 EABI
> On 14/06/2010 22:08, pouly amaury wrote:
> >
> > I have a D2 (gevaerts's one) so I could investigate. Unfortunately I
> > don't know anything about the port. Could you give me some insights of
> > it or tell where you think the problem could be (you talked about a
> > bit-banging issue). Perhaps I would be able to figure out what is wrong.
> >
>
> I had a look at the code generated by GCC 4.4.4 and compared it to the
> previous version. As I suspected, the new compiler seems to optimise
> away most of the delay_loop() in i2c-telechips.c, but unfortunately the
> timing of this is critical for correct I2C reads/writes. That explains
> why some drivers that use the PMU chip no longer work reliably.
>
> To fix this I need to find a way for the new compiler to generate the
> same code as the old version, or simply to find a new way of writing
> this loop that generates the same, working, code on both compilers.
>
> Not necessarily a simple task :/
>
> Rob.
There are two ways intuitively to do this:
1. I believe the ARM proc in the D2 has a PIT (periodic interval timer) that can be used as a clock counter, if you want a specific time period. It's a bit of work to initialize it but nothing major. The USB driver in u-boot uses this method.
2. If you're just counting clock cycles, the 'volatile' specifier should prevent gcc's loop optimizations, no?
int count(volatile int n)
{
while(n--)
;
}
Andrew
Received on 2010-06-15
Page was last modified "Jan 10 2012" The Rockbox Crew
|