Skip to content

ISR USART3_RX_vect Error: multiple definition of `__vector_54' #29

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

Closed
theblond opened this issue Dec 12, 2018 · 8 comments
Closed

ISR USART3_RX_vect Error: multiple definition of `__vector_54' #29

theblond opened this issue Dec 12, 2018 · 8 comments

Comments

@theblond
Copy link

theblond commented Dec 12, 2018

Hallo,

i have programmed a DMX reciever on a Controllino MEGA over the RS 485 interface. The compiler crashes with the error: multiple definition of `__vector_54'

It compiles, when I comment out the ISR in my ino-file.
ISR (USART3_RX_vect) {//Do something}

Or it compiles, when I leave my ISR as it is and comment out the initialization routine of the RS 485 in the Controllino.cpp and Controllino.h.
char Controllino_RS485Init( long aBaudrate )

I hope there will be a clever adaption, so I don't have to modify the library manually.

btw:
I use the latest library (3.0.4) and board package version (3.0.2).

@LukasSeget
Copy link
Member

Hello,

let´s try to use Controllino_RS485Init( void ). This function just configures the bus direction control signals and does not call Serial3 at all.

@theblond
Copy link
Author

Of course, I can't write my own code for USART3 and use the Arduino Serial3 at the same time.

Sorry I have not been specific at this point, but the curious thing is, I never call Controllino_RS485Init( long aBaudrate ) in my project.

The error already turns up with this few lines of code:

#include <Controllino.h>

void setup() {
// put your setup code here, to run once:

}

void loop() {
// put your main code here, to run repeatedly:

}

ISR (USART3_RX_vect) {
// do something
}

The compile error:

HardwareSerial3.cpp.o (symbol from plugin): In function `Serial3':

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

sketch\Controllino.ino.cpp.o (symbol from plugin):(.text+0x0): first defined here

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

collect2.exe: error: ld returned 1 exit status

exit status 1
Fehler beim Kompilieren für das Board CONTROLLINO MEGA.

@LukasSeget
Copy link
Member

Yes, you are right, the compiler builds also the Serial3 code even if you do not call Controllino_RS485Init( long aBaudrate ). Pretty sad ... I am afraid that you have to comment out the line Serial3.begin(aBaudrate); in our Controllino.cpp. Then the compilation of your example code works fine - as you have already found. Maybe we can add some define in future versions of the library. Like CONTROLLINO_DO_NOT_USE_SERIAL3 :)

@theblond
Copy link
Author

theblond commented Jan 3, 2019

I found a quote in the Arduino core library HardwareSerial0.cpp regarding this problem:

// Each HardwareSerial is defined in its own file, sine the linker pulls
// in the entire file when any element inside is used. --gc-sections can
// additionally cause unused symbols to be dropped, but ISRs have the
// "used" attribute so are never dropped and they keep the
// HardwareSerial instance in as well. Putting each instance in its own
// file prevents the linker from pulling in any unused instances in the
// first place.

@theblond theblond closed this as completed Jan 3, 2019
@theblond theblond reopened this Jan 3, 2019
@LukasSeget
Copy link
Member

Unfortunately, Arduino has troubles to pass defines to the library sources, so my proposal with the CONTROLLINO_DO_NOT_USE_SERIAL3 will be not implemented.

@LukasSeget
Copy link
Member

See this thread for more details.

@vallemar
Copy link

something to fix this? I have come across this problem and I don't know how to solve it

@LukasSeget
Copy link
Member

As I have proposed in my previous comment: "...I am afraid that you have to comment out the line Serial3.begin(aBaudrate); in our Controllino.cpp".

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