[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] tmr.h:15: error: `__vector_4' undeclared here (not i
From: |
Ned Konz |
Subject: |
Re: [avr-gcc-list] tmr.h:15: error: `__vector_4' undeclared here (not in a function) |
Date: |
Mon, 23 Aug 2004 07:02:10 -0700 |
User-agent: |
KMail/1.6.2 |
On Monday 23 August 2004 6:29 am, Günter Dannoritzer wrote:
> Now, don't beat me ;-), but I installed the AVR-GCC provided by Atmel.
> Is that a big mistake or is this installation setup right to work? I
> thought having this DWARF debugging capability might be a nice feature,
> but maybe I overestimated it and should rather use the WINAVR installation?
Should be OK.
> Anyhow, I did some changes to the code of my project, mostly include
> paths. That took away most of the compile errors except for this one error:
>
> tmr.h:15: error: `__vector_4' undeclared here (not in a function)
>
> which has to do with the interrupt vector. I tried to find some more
> information about how the interrupt handling works, but had no luck
> getting rid of this error. I read through the AVR libc documentation
> concerning the INTERRUPT macro and it looks like it is used correct in
> my code.
>
> My code line (line 15 of the tmr.h file) causing the error is this:
>
> INTERRUPT [SIG_OUTPUT_COMPARE1A] void TmrTenMillisecondTick(void);
This is wrong for several reasons:
* you can't declare interrupt functions with different names (you can call
functions from them, but they have fixed names)
* macro arguments are given in parentheses, not square brackets
* INTERRUPT() and SIGNAL() are used with pre-defined function names (generally
defined by macros named like your SIG_OUTPUT_COMPARE1A that resolve to
specific names like __vector_4 )
The INTERRUPT() and SIGNAL() macros are generally used to *define* a function,
not to *declare* it. The declaration in your header file is unnecessary
(besides being wrong), as it's not callable externally (i.e. by your C code)
anyway.
Instead, these macros define functions with particular names (like, for
instance __vector_4).
You would do this to define your function (note that it *isn't* possible to
name it something else):
INTERRUPT(SIG_OUTPUT_COMPARE1A)
{
// the function that was once called TmrTenMillisecondTick() ...
}
> What I don't understand is, it looks like that the avr-gcc needs to know
> about this __vector_ which it seems like it does not. I searched through
> the archive but did not find any similar problems.
--
Ned Konz
http://bike-nomad.com