avr-gcc-list
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] AT90CAN128 silicon bug in conjunction w/ external RAM


From: Marek Michalkiewicz
Subject: Re: [avr-gcc-list] AT90CAN128 silicon bug in conjunction w/ external RAM
Date: Sun, 17 Apr 2005 00:31:37 +0200
User-agent: Mutt/1.5.6+20040907i

On Sun, Apr 17, 2005 at 07:53:08AM +1000, Henrik Maier wrote:

> I investigated myself and had a look at the gcc sources. Using -O0 
> avoids optimizing with in/out instructions. However for function 
> prologues and epilogues avr-gcc still uses in/out instructions but this 
> could indeed be patched easily. Then there are several inline macros in 
> avr-libc which need to be changed as well. So it all looks like it could 
> be done.

IN/OUT instructions in prologues/epilogues only access SPL/SPH/SREG
which should be safe in any case: doing it twice shouldn't do any harm,
setting SPL/SPH must be protected against interrupts anyway.

The real problem is with I/O registers like the UART data register
(where repeated access has effect on the hardware), and for these
a new option could be added to disable only the LDS/STS -> IN/OUT
optimization (so you don't have to use -O0).

> But: I also investigated further and my findings show that there must be 
> other instructions showing the bug too. I have a failing code section of 
> a simple for loop which does not do a single in or out.

Just to make sure, check that you have no hardware problems with
external SRAM (try to slow down the clock frequency and see if the
problem still exists).  If your hardware is OK, then...

> Looking at Atmel's description: "... it seems that only "IN" and "OUT" 
> instructions are concerned.", they use the term "seem" which means to me 
> they are not quite sure.

If they are not sure, it is safest to simply say "stack in external
SRAM is broken" and stick with their recommended workaround.

Marek




reply via email to

[Prev in Thread] Current Thread [Next in Thread]