Re: [avr-gcc-list] ISR function name aliasing?
As John Myers wrote: It looks like I can use ISR_ALIAS(XXX_vect,my_isr) which creates in extra jump instruction to the ISR. Yes, that looks like it would work. although I wanted to avoid any extra overhead. Well, interrupt response takes quite a bit of time already anyway, so I think another couple of clocks for the jump isn't really a show-stopper. -- cheers, Jorg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] ISR function name aliasing?
On Mon, Apr 6, 2009 at 12:29 AM, John Myers atomicdog@gmail.com wrote: I have an ISR in a library. I want to be able to compile the ISR with a generic target and not have the ISR name tied to a specific interrupt vector. I want to be able to add the library with the ISR to a project and then have the ISR function name aliased or linked to the appropriate vector that the specific AVR target uses. I'am unable to get the project to compile with a vector name in the vector jump table. The ISR itself is added but nothing in the vector jump table. If I'm understanding what you want correctly, you might be able to do this by making the ISR into an include file, rather than .c . Coincidentally, I just did this today, where I have two options for compiling. I set one of two versions, then in main .c file: #ifdef option1 #include ISR-1.inc #endif #ifdef option2 #include ISR-2.inc #endif In my case, the .inc files contain the vector label, and the entire ISR. ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] ISR function name aliasing?
It looks like I can use ISR_ALIAS(XXX_vect,my_isr) which creates in extra jump instruction to the ISR. although I wanted to avoid any extra overhead. On Mon, Apr 6, 2009 at 9:15 PM, Joerg Wunsch j...@uriah.heep.sax.de wrote: John Myers atomicdog@gmail.com wrote: I have an ISR in a library. That doesn't work directly, because it's hard to trigger an undefined reference to it that will make the linker link that particular library module. All the interrupt vectors are always defined already (so they won't appear as `global undefined' symbol which is what makes the linker search a library), but they are defined as weak symbols so any object module can override them. There are two situations I could think of: 1) The module is not linked by its __vector_N name but by another symbol (that could be a data reference or another function name) that will also be resolved by the same object module in the library. 2) I'm not sure, but perhaps you can force the __vector_N symbol to be `global undefined' using the -u__vector_N linker option. I want to be able to compile the ISR with a generic target and not have the ISR name tied to a specific interrupt vector. This is currently not possible because avr-libc does not work by vector names but by vector numbers. That's what I meant with __vector_N, where N is a number. Each XXX_vect name is converted into a (MCU specific) __vector_N name already at the preprocessing stage. Is this possible? I think your best bet is to make the library supply a function name that is then called by your actual ISR. It's not quite optimal, in particular if the function is relatively short and doesn't use all the caller saved registers per the ABI because the compiler will always save all of them on the stack before calling that function (since it doesn't know what is actually going to be destroyed). -- cheers, Jorg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] ISR function name aliasing?
I wanted some ISR's in a library so users would only need to include the pre-compiled library file (lib.a) instead of a few source code files. And then depending on what variables or functions are used the appropriate ISR would be added. On Tue, Apr 7, 2009 at 2:50 AM, David VanHorn d...@mobilefusioninc.comwrote: On Mon, Apr 6, 2009 at 12:29 AM, John Myers atomicdog@gmail.comwrote: I have an ISR in a library. I want to be able to compile the ISR with a generic target and not have the ISR name tied to a specific interrupt vector. I want to be able to add the library with the ISR to a project and then have the ISR function name aliased or linked to the appropriate vector that the specific AVR target uses. I'am unable to get the project to compile with a vector name in the vector jump table. The ISR itself is added but nothing in the vector jump table. If I'm understanding what you want correctly, you might be able to do this by making the ISR into an include file, rather than .c . Coincidentally, I just did this today, where I have two options for compiling. I set one of two versions, then in main .c file: #ifdef option1 #include ISR-1.inc #endif #ifdef option2 #include ISR-2.inc #endif In my case, the .inc files contain the vector label, and the entire ISR. ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
RE: [avr-gcc-list] ISR function name aliasing?
-Original Message- From: avr-gcc-list-bounces+eric.weddington=atmel@nongnu.org [mailto:avr-gcc-list-bounces+eric.weddington=atmel@nongnu. org] On Behalf Of John Myers Sent: Tuesday, April 07, 2009 9:05 PM To: David VanHorn Cc: avr-gcc Subject: Re: [avr-gcc-list] ISR function name aliasing? I wanted some ISR's in a library so users would only need to include the pre-compiled library file (lib.a) instead of a few source code files. And then depending on what variables or functions are used the appropriate ISR would be added. See this: http://www.nongnu.org/avr-libc/user-manual/library.html ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] ISR function name aliasing?
On Tue, Apr 7, 2009 at 8:55 PM, Weddington, Eric eric.wedding...@atmel.comwrote: -Original Message- From: avr-gcc-list-bounces+eric.weddington=atmel@nongnu.org [mailto:avr-gcc-list-bounces+eric.weddingtonavr-gcc-list-bounces%2Beric.weddington =atmel@nongnu. org] On Behalf Of John Myers Sent: Tuesday, April 07, 2009 9:05 PM To: David VanHorn Cc: avr-gcc Subject: Re: [avr-gcc-list] ISR function name aliasing? I wanted some ISR's in a library so users would only need to include the pre-compiled library file (lib.a) instead of a few source code files. And then depending on what variables or functions are used the appropriate ISR would be added. See this: http://www.nongnu.org/avr-libc/user-manual/library.html Hi Eric, Thanks for the link, I got the library part under control though. It's the part were the interrupt vectors can't seem to be linked or aliased to an ISR in a library. I noticed the function attributes alias and weakref but they don't work across different translation units. -- John ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
Re: [avr-gcc-list] ISR function name aliasing?
John Myers atomicdog@gmail.com wrote: I have an ISR in a library. That doesn't work directly, because it's hard to trigger an undefined reference to it that will make the linker link that particular library module. All the interrupt vectors are always defined already (so they won't appear as `global undefined' symbol which is what makes the linker search a library), but they are defined as weak symbols so any object module can override them. There are two situations I could think of: 1) The module is not linked by its __vector_N name but by another symbol (that could be a data reference or another function name) that will also be resolved by the same object module in the library. 2) I'm not sure, but perhaps you can force the __vector_N symbol to be `global undefined' using the -u__vector_N linker option. I want to be able to compile the ISR with a generic target and not have the ISR name tied to a specific interrupt vector. This is currently not possible because avr-libc does not work by vector names but by vector numbers. That's what I meant with __vector_N, where N is a number. Each XXX_vect name is converted into a (MCU specific) __vector_N name already at the preprocessing stage. Is this possible? I think your best bet is to make the library supply a function name that is then called by your actual ISR. It's not quite optimal, in particular if the function is relatively short and doesn't use all the caller saved registers per the ABI because the compiler will always save all of them on the stack before calling that function (since it doesn't know what is actually going to be destroyed). -- cheers, Jorg .-.-. --... ...-- -.. . DL8DTL http://www.sax.de/~joerg/NIC: JW11-RIPE Never trust an operating system you don't have sources for. ;-) ___ AVR-GCC-list mailing list AVR-GCC-list@nongnu.org http://lists.nongnu.org/mailman/listinfo/avr-gcc-list