Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conflict Between Wifi101.h and SoftwareSerial.h #4534

Closed
mjmoore10 opened this issue Feb 6, 2016 · 2 comments
Closed

Conflict Between Wifi101.h and SoftwareSerial.h #4534

mjmoore10 opened this issue Feb 6, 2016 · 2 comments
Milestone

Comments

@mjmoore10
Copy link

If I try to use wifi101.h and softwareserial.h in the same sketch, I get the error messages below from the IDE. I'm a beginner, so I may well be wrong, but it looks to me like both header files define either functions or variables with the same names, which causes the conflict. If there's really a bug, I hope this report is helpful. If I'm just ignorant and this is an avoidable problem, I'd be grateful for any guidance.

Arduino: 1.6.7 (Windows 10), Board: "Arduino/Genuino Mega or Mega 2560, ATmega2560 (Mega 2560)"

libraries\SoftwareSerial\SoftwareSerial.cpp.o: In function `__vector_9':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:229: multiple definition of `__vector_9'

libraries\WiFi101\bsp\source\nm_bsp_arduino_avr.c.o:/nm_bsp_arduino_avr.c:67: first defined here

c:/program files (x86)/arduino/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/bin/ld.exe: Disabling relaxation: it will not work with multiple definitions

libraries\SoftwareSerial\SoftwareSerial.cpp.o: In function `SoftwareSerial::read()':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: multiple definition of `__vector_10'

libraries\WiFi101\bsp\source\nm_bsp_arduino_avr.c.o:/nm_bsp_arduino_avr.c:62: first defined here

libraries\SoftwareSerial\SoftwareSerial.cpp.o: In function `SoftwareSerial::read()':

C:\Program Files (x86)\Arduino\hardware\arduino\avr\libraries\SoftwareSerial/SoftwareSerial.cpp:394: multiple definition of `__vector_11'

libraries\WiFi101\bsp\source\nm_bsp_arduino_avr.c.o:/nm_bsp_arduino_avr.c:62: first defined here

collect2.exe: error: ld returned 1 exit status

exit status 1
Error compiling.

@facchinm
Copy link
Member

facchinm commented Feb 8, 2016

Hi @mjmoore10,
thanks for spotting this bug!
In the meantime, if you only need to use a Mega, you can open libraries\WiFi101\bsp\source\nm_bsp_arduino_avr with a text editor end remove lines

#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
    if (!rx_pin_read() && gpfIsr)
    {
        gpfIsr();
    }
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect));
#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect, ISR_ALIASOF(PCINT0_vect));
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect));
#endif

This code is UNO specific and shouldn't be compiled for Mega.

facchinm added a commit to arduino-libraries/WiFi101 that referenced this issue Feb 8, 2016
As per arduino/Arduino#4534, compile fails if using SoftwareSerial and Wifi101 together.
This is due to the redefinition of PCINT0 ISR; since this ISR is only used to handle UNO (and since on UNO the SS-enabled pins 10/11 are already used by SPI), defining the ISR as weak will allow the sketch to compile fine on all platform (and be senseless on UNO)
facchinm added a commit to facchinm/WiFi101 that referenced this issue Feb 8, 2016
As per arduino/Arduino#4534, compile fails if using SoftwareSerial and Wifi101 together.
This is due to the redefinition of PCINT0 ISR; since this ISR is only used to handle UNO (and since on UNO the SS-enabled pins 10/11 are already used by SPI), defining the ISR as weak will allow the sketch to compile fine on all platform (and be senseless on UNO)
@mjmoore10
Copy link
Author

I'm delighted to have helped in some small way. And thank you very much for
the workaround!

On Mon, Feb 8, 2016 at 1:45 AM, Martino Facchin notifications@github.com
wrote:

Hi @mjmoore10 https://github.com/mjmoore10,
thanks for spotting this bug!
In the meantime, if you only need to use a Mega, you can open
libraries\WiFi101\bsp\source\nm_bsp_arduino_avr with a text editor end
remove lines

#if defined(PCINT0_vect)
ISR(PCINT0_vect)
{
if (!rx_pin_read() && gpfIsr)
{
gpfIsr();
}
}
#endif

#if defined(PCINT1_vect)
ISR(PCINT1_vect, ISR_ALIASOF(PCINT0_vect));
#endif

#if defined(PCINT2_vect)
ISR(PCINT2_vect, ISR_ALIASOF(PCINT0_vect));
#endif

#if defined(PCINT3_vect)
ISR(PCINT3_vect, ISR_ALIASOF(PCINT0_vect));
#endif

This code is UNO specific and shouldn't be compiled for Mega.


Reply to this email directly or view it on GitHub
#4534 (comment).

Matthew J. Moore
mjmoore10@gmail.com

@agdl agdl added this to the Release 1.6.8 milestone Feb 19, 2016
@agdl agdl closed this as completed Feb 19, 2016
wchill pushed a commit to wchill/Adafruit_WINC1500 that referenced this issue May 10, 2016
As per arduino/Arduino#4534, compile fails if using SoftwareSerial and Wifi101 together.
This is due to the redefinition of PCINT0 ISR; since this ISR is only used to handle UNO (and since on UNO the SS-enabled pins 10/11 are already used by SPI), defining the ISR as weak will allow the sketch to compile fine on all platform (and be senseless on UNO)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants