Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-30 Thread Andrew Haines
On 11/29/2015 06:54 PM, Jeppe Johansen wrote: Don't use noreturn. It signals to the compiler that your function will not return (i.e. do an infinite loop). Ok, this is good to know. Use the interrupt directive for interrupt handlers. That makes them emit the iret instruction instead of ret t

Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Jeppe Johansen
On 11/29/2015 11:35 PM, Andrew Haines wrote: On 11/29/2015 02:13 PM, Jeppe Johansen wrote: Not sure the timer initialization is right, but it looks ok. One thing you need is the interrupt procedure directive: procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR'; Otherwise it'l

Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines
On 11/29/2015 02:13 PM, Jeppe Johansen wrote: Not sure the timer initialization is right, but it looks ok. One thing you need is the interrupt procedure directive: procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR'; Otherwise it'll probably reset at some point. Ok I got it

Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines
On 11/29/2015 02:13 PM, Jeppe Johansen wrote: Not sure the timer initialization is right, but it looks ok. One thing you need is the interrupt procedure directive: procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR'; Otherwise it'll probably reset at some point. What compiler

Re: [fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Jeppe Johansen
Not sure the timer initialization is right, but it looks ok. One thing you need is the interrupt procedure directive: procedure TIMER0_overflow; interrupt; public name 'TIMER0_COMPA_ISR'; Otherwise it'll probably reset at some point. What compiler commandline are you using? Best Regards, Jepp

[fpc-devel] AVR embedded Atmega 328p interrupts

2015-11-29 Thread Andrew Haines
Hi, I am experimenting with the avr embedded compiler from trunk and am trying to set an interrupt. I am not sure how to do it. The interrupt I want to change is TIMER0_COMPA_ISR. I see in the startup code there is: .weak TIMER0_COMPA_ISR and later there is: .set TIMER0_COMPA_ISR, Default_IRQ