RE: [avr-gcc-list] assembly-c mix and interrupts

2009-11-30 Thread darkschine
Paul responded off thread >> I experienced this problem with version 4.3.0, I believe provided by an >> older version of Ubuntu. Version 4.3.2 (as provided by Ubuntu 9.04) >> fixed the problem. I assume later versions also work, though I have not >> verified. > I am indeed using 4.3.0 Perhaps

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-29 Thread Paul Stoffregen
The issue I am trying to draw attention to is that, in my case, the compiler is not being conservative so the push/pop of volatile registers must be done manually. I experienced this problem with version 4.3.0, I believe provided by an older version of Ubuntu. Version 4.3.2 (as provided b

RE: [avr-gcc-list] assembly-c mix and interrupts

2009-11-29 Thread darkschine
Weddington, Eric wrote: > > Many times in the embedded software world, you have to deal with > trade-offs. > > Sure you could design an ISR that way and do the unit testing the way you > describe. And I'm sure that it would make your unit testing easier. The > trade-off though is that it make

RE: [avr-gcc-list] assembly-c mix and interrupts

2009-11-29 Thread Weddington, Eric
t; Subject: Re: [avr-gcc-list] assembly-c mix and interrupts > > > In my opinion, the best algorithm for an interrupt would be: > > ISR(vector){ >data=getData(); >processData(data) > } > > then unit testing can be carried out on processData() and > getD

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-29 Thread darkschine
What I was trying to say was: ISR(vector){ interruptHandler(); } interruptHandler() was blindly destroying volatile registers which ISR should have been preserving since they are the callers responsibility. ISR was not preserving these registers because it was not aware that these registers w

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-29 Thread Joerg Wunsch
darkschine wrote: > my code was actually already written in C and looked something like: > > ISR(vector){ >interruptHandler(); > } Which is less than ideal because the compiler *always* has to preserve all the registers that could possibly be destroyed by interruptHandler(). If possible, a

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-28 Thread darkschine
David Brown-4 wrote: > > So any function generated by the compiler, or compatible functions > written in assembly by hand, can freely use the call-used registers > (SREG, r18-r27, r30-r31) without preserving or restoring them. But if > it wants to use the call-saved registers (r2-r17, r28-r

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-20 Thread Julius Luukko
ly ISR, you must do this also. This might provide you with some more information http://www.nongnu.org/avr-libc/user-manual/inline_asm.html Julius > > From: julius.luu...@lut.fi > > To: avr-gcc-list@nongnu.org > > Subject: Re: [avr-gcc-list] assembly-c mix and interrupts >

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-19 Thread Erik Christiansen
On Thu, Nov 19, 2009 at 05:08:45AM -0800, darkschine wrote: > My assembly code follows a standard that ALL registers used are pushed and > popped from the stack. However, my assembly code does NOT store the SREG. > Could this be causing my problems? If it is in the interrupt routine that cpu statu

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-19 Thread Ruud Vlaming
Your description is rather vague, but in any case i would say that at interrupt you should save everything you make use of in your routine. It seems to me that it is very unlikely that you do not make (indirect) use of the SREG. Thus you have to save (and restore!) it. From experience i can say t

RE: [avr-gcc-list] assembly-c mix and interrupts

2009-11-19 Thread Weddington, Eric
; Subject: [avr-gcc-list] assembly-c mix and interrupts > > > Before I continue, I would like to suggest a resolution to my > problem. I am > using the ATmega328P > My assembly code follows a standard that ALL registers used > are pushed and > popped from the stack. Howe

Re: [avr-gcc-list] assembly-c mix and interrupts

2009-11-19 Thread Julius Luukko
On Thursday 19 November 2009, darkschine wrote: > Before I continue, I would like to suggest a resolution to my problem. I am > using the ATmega328P > My assembly code follows a standard that ALL registers used are pushed and > popped from the stack. However, my assembly code does NOT store the SRE

[avr-gcc-list] assembly-c mix and interrupts

2009-11-19 Thread darkschine
Before I continue, I would like to suggest a resolution to my problem. I am using the ATmega328P My assembly code follows a standard that ALL registers used are pushed and popped from the stack. However, my assembly code does NOT store the SREG. Could this be causing my problems? I am coming acro