GreyGnome / EnableInterrupt

New Arduino interrupt library, designed for Arduino Uno/Mega 2560/Leonardo/Due
329 stars 73 forks source link

Fixed error compiling for board Arduino Uno/Pro/Pro Mini #54

Closed pilinux closed 5 years ago

pilinux commented 5 years ago

Full error message:

WInterrupts.c.o (symbol from plugin): In function `attachInterrupt':

(.text+0x0): multiple definition of `__vector_1'

WInterrupts.c.o (symbol from plugin): In function `attachInterrupt':

(.text+0x0): multiple definition of `__vector_2'

collect2.exe: error: ld returned 1 exit status
pilinux commented 5 years ago

Yes, I know that it is not compatible with attachInterrupt(). For a sketch, I am using the following libraries:

EnableInterrupt LowPower Wire SPI EEPROM OneWire DallasTemperature

And I'm not using attachInterrupt() anywhere in my code. If I don't omit that block of code, it is not even possible to compile the project. If you read other open issues, you can see that few others also mentioned about the same problem.

Thank you.

GreyGnome commented 5 years ago

Something is triggering a call to attachInterrupt(), which is trying to define an interrupt for vector_1 and vector_2. What your change does is essentially recreate the behavior of the EI_NOTEXTERNAL compiler directive.

Please #define EI_NOTEXTERNAL ahead of the #include file.

I tried to find out exactly in the libraries' source code what may be causing the definition of the __vector_1 and __vector_2 and I could not. At this point, if we want to find out where the conflict is, we'd need to work our way backwards by taking out all the libraries (and the code that uses them) and reinserting them one by one until the conflict appears.

In the meantime, see https://github.com/GreyGnome/EnableInterrupt/wiki/SaveMemory where EI_NOTEXTERNAL is discussed. You may find that this answers the question about how the conflict appears, although the specifics remain a mystery.

GreyGnome commented 5 years ago

If there are no further comments, I will close this pull request without integrating it with the source. As I mentioned, the #EI_NOTEXTERNAL should do exactly what this code is trying to achieve. Adding this pull would essentially make some processors unable to use external interrupts with this library.

pilinux commented 5 years ago

Something is triggering a call to attachInterrupt(), which is trying to define an interrupt for vector_1 and vector_2. What your change does is essentially recreate the behavior of the EI_NOTEXTERNAL compiler directive.

Please #define EI_NOTEXTERNAL ahead of the #include file.

I tried to find out exactly in the libraries' source code what may be causing the definition of the __vector_1 and __vector_2 and I could not. At this point, if we want to find out where the conflict is, we'd need to work our way backwards by taking out all the libraries (and the code that uses them) and reinserting them one by one until the conflict appears.

In the meantime, see https://github.com/GreyGnome/EnableInterrupt/wiki/SaveMemory where EI_NOTEXTERNAL is discussed. You may find that this answers the question about how the conflict appears, although the specifics remain a mystery.

Thanks a lot @GreyGnome . This is actually the right solution. You can close the pull request. Later I will check which library is causing this problem.

GreyGnome commented 5 years ago

Thanks, @piLinux ! Glad it works for you! :-) I was just reviewing my open browser tabs, and read a little bit of that wiki. Man- I did a lot of work! I forgot about it. Anyway, thanks again.