Before logging an issue, please update to the latest release of Visual Micro from the Downloads Page.

When Logging a Support Issue in the Forum, please ensure you have also:-

  • Enabled vMicro > Compiler > Show Build Properties
  • Re-Compile your program with these settings enabled
 
Save the new Output to a Text File and....
  • Click the Reply button and attach as .txt file OR
  • Click here to Email us with the file attached, and a link to your post
Support requests without the output above may be impossible to answer, so please help us to help you
 
Page Index Toggle Pages: [1] 2 3  Send TopicPrint
Very Hot Topic (More than 25 Replies) Multiple Definition of Vectors.... (Read 54375 times)
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Multiple Definition of Vectors....
Nov 24th, 2012 at 4:00pm
Print Post  
I've been using the plug-in without the debugger for several weeks with no problems whatsoever.  Today I installed the debugger, and, when (Micro Debug) is set to "Full", I get the errors below - it appears the vectors are being multiply defined.  If I turn (Micro Debug) off, all is fine.  Any ideas?

Regards,
Ray L.


Compiling 'SkyNet' for 'Arduino Mega 2560 or Mega ADK'
Binary sketch size: 11648 bytes (of a 258048 byte maximum) (1.046875 secs)
Compiling debug version of 'SkyNet' for 'Arduino Mega 2560 or Mega ADK'
core.a(HardwareSerial.cpp.o)* : : In function `__vector_25':
HardwareSerial.cpp : multiple definition of `__vector_25'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:372: first defined here
ld.exe : : Disabling relaxation: it will not work with multiple definitions
core.a(HardwareSerial.cpp.o)* : : In function `__vector_36':
HardwareSerial.cpp : multiple definition of `__vector_36'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:383: first defined here
core.a(HardwareSerial.cpp.o)* : : In function `__vector_51':
HardwareSerial.cpp : multiple definition of `__vector_51'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:394: first defined here
core.a(HardwareSerial.cpp.o)* : : In function `__vector_26':
HardwareSerial.cpp : multiple definition of `__vector_26'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:302: first defined here
core.a(HardwareSerial.cpp.o)* : : In function `__vector_37':
HardwareSerial.cpp : multiple definition of `__vector_37'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:313: first defined here
core.a(HardwareSerial.cpp.o)* : : In function `__vector_52':
HardwareSerial.cpp : multiple definition of `__vector_52'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:324: first defined here
avr-objcopy* : : 'C:\Documents and Settings\RayL\Local Settings\Application Data\VMicro\Arduino\Builds\SkyNet\mega2560\SkyNet.elf': No such file
avr-objcopy* : : 'C:\Documents and Settings\RayL\Local Settings\Application Data\VMicro\Arduino\Builds\SkyNet\mega2560\SkyNet.elf': No such file
Couldn't determine program size: 
  
Back to top
 
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #1 - Nov 24th, 2012 at 4:09pm
Print Post  
BTW - Obviously, this has to do with serial port vectors.  I am setting up my own interrupt handlers for the serial ports, which work fine when (Micro Debug) is off.  Here's another odd thing - Since installing the debugger, if I select one of the vector numbers in the source code, for example "USART1_UDRE_vect", right click, and select "Go To Definition", I get an error message that USART1_UDRE_vect is undefined!  It worked before installing the debugger.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #2 - Nov 24th, 2012 at 4:45pm
Print Post  
Hi, okay this might be a couple of things. First off, install of the debugger doesn't alter the way vm works when it is switched off (not set to Full) so we are possibly looking at two problems.

1)

Quote:
"USART1_UDRE_vect", right click, and select "Go To Definition", I get an error message that USART1_UDRE_vect is undefined


When you installed the debugger did you also upgrade your visual micro installation to the latest release? What version of vm is installed tools>options>visual micro>version? Based on your answers I will have more info.

2) 

Quote:
HardwareSerial.cpp : multiple definition of `__vector_25'
SkyNet.cpp.o : :/HAL_Arduino_Code.h:372: first defined here


This looks like you are overriding the normal Arduino HardwareSerial system. The debugger currently supports HardwareSerial, UsbSerial (leonardo types), SoftwareSerial and FastSerial. By default it will attempt to use HardwareSerial which would cause this error if you are creating your own "Serial" object.

The best thing to do for now would be to override the FastSerial option as follows:-  
1) In the project debug properties set the RemoteTransport to "FastSerial"

2) Change the FastSerial.h and FastSerial references in the "VM_DBG.h" and "VM_DBG.cpp" to your own serial classes  such as "HAL_Arduino_Code.h" 

The only code you should change in the .cpp and .h will be contained within a test for VM_DEBUGGER_TYPE_FASTSERIAL. Do not change the #if just change the code within.

Code
Select All
#if defined(VM_DEBUGGER_TYPE) && VM_DEBUGGER_TYPE == VM_DEBUGGER_TYPE_FASTSERIAL 



Tip: Make a backup of your changes because the vm installer will overwrite the following files when you next upgrade, the .cpp and .h files can be found below the vm program folder. Example: "C:\Program Files (x86)\Visual Micro\Visual Micro for Arduino\Micro Platforms\Arduino\Templates\Hardware\Debuggers\VM_DBG"

If you are unsure of where vm is installed you will find the location in Tools>Options>Visual Micro>Version>Assembly
« Last Edit: Nov 24th, 2012 at 4:56pm by Tim@Visual Micro »  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #3 - Nov 24th, 2012 at 5:52pm
Print Post  
Tim,

Thanks for the prompt response.  I'm really looking forward to getting the debugger going.  It looks like a really nice piece of work, and I'm really tired of debugging with prints to a serial port!  Smiley

I installed the "stable" version of the debugger, and the indicated version of visual micro (1210.24, IIRC).  I had a previously installed version, but don't know what it was.  Is there a way to confirm what version is actually being used?

On the Serial code, I have to plead some degree of ignorance here....  A little background might be in order.  I've only been using Arduino for a few days, so it's all new to me.  I am writing code that must run on several platforms, so I've tried to avoid using any of the Arduino libraries.  Therefore, I have not so much as looked at the Arduino serial code.  I am also writing in pure C, not C++, since (sadly!) the other platforms this code needs to run on do not support C++.  I do have my own interrupt handlers for the four serial ports, and all are working perfectly.  Since the platform-specific code is isolated, I *could* switch to the Arduino serial, if that will simplify things.  It is interrupt-driven?  Of course, at the moment, I don't know how to do that....

I assume if I perform the steps you outlined, my Serial code needs to provide specific interfaces to be able to work properly?  Where are those interfaces defined?

Regards,
Ray L.
  
Back to top
 
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #4 - Nov 24th, 2012 at 6:06pm
Print Post  
Tim,

In doing some reading on Arduino Hardware serial, it appears (unless I'm reading out of date posts) that there are a surprising number of people complaining about some pretty significant issues in the low-level code - sitting in spin loops while transmitting, consuming large amounts of memory for serial buffers, even when those ports are not used.  Do you now if these issues have been fixed in current libraries?   

Really stupid question time:  If I simply use serial.begin, serial.available, serial.read and serial.write, am I getting interrupt-drive I/O?  It would be trivial for me to re-write my code around this interface if it will get the job done and resolve the current conflicts.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #5 - Nov 24th, 2012 at 7:03pm
Print Post  
Your vm version is shown in Tools>Options>Visual Micro>Version. When using the main arduino serial port(s), reading from the port has always been interrupt driven.

I think that buffered interrupt driven "write/transmit" has been optional since 1.0.1

To make your own serial system you would need to create your own Arduino library, I suggest you avoid that for now.

For the debugger it sounds like using the built in Arduino serial would be best initially or buying an FTDI Usb cable which would allow you to use SoftwareSerial on any two interrupt driven digital pins.
  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #6 - Nov 24th, 2012 at 7:09pm
Print Post  
Tim,

My installed version appears to be 1.1211.04, even though I DID install 1201.24 before installing the debugger.  Obviously, I had the newer version from my initial install a week or so back.  Is this a problem?

I do have an FTDI USB serial cable - it's what I'm using to talk, and program, to the board (Mega2560), but I'll try porting to the Arduino serial drivers first, and see how that goes.  Shouldn't take long - I'll let you know what happens.

Thanks!

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #7 - Nov 24th, 2012 at 7:23pm
Print Post  
Ok, the version is fine. 

The goto definition must be failing for some other reason. Try switching to a different arduino board and then back to the 2560 that refreshes the intellisense.

Does that sort it out? Is the .h in the sketch folder?

  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #8 - Nov 24th, 2012 at 10:05pm
Print Post  
Well, it gets wierder....  I replaced my low-level code with Serial.begin, serial.read, serial.write, and serial.available.  I can't get *anything* to come out!  Even when I put:

serial.begin(57600);
serial.println("Hello, world");

in setup(), nothing comes out.  How is that possible?  Change one define to put my driver back in and it works perfectly.

I'll try another board a bit later.  I don't have one here right now.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #9 - Nov 24th, 2012 at 10:33pm
Print Post  
Ah, poop!  I ran into a problem with using the Serial device - my code needs to know when transmit is complete, but I don't see any way clean to determine this with Serial, as the tx ring buffer is not accessible.  There is a transmitting flag, which looks like it's intended to serve this function, but, looking at the code, it does not appear to get set properly.  It gets set on transmit, then never cleared.

BTW - I'd be happy to send you my code if it would help get to the bottom of my interrupt issue.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #10 - Nov 25th, 2012 at 1:02am
Print Post  
Tim,

This is very peculiar....  I cannot for the life of me get the Serial class to actually work.  Even running a bare-minimum sketch that does a serial.begin and serial.println, nothing comes out on the terminal.  It did work before I installed the debugger....

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #11 - Nov 25th, 2012 at 12:19pm
Print Post  
It's nothing to do with the debugger especially if you have the (Micro Debug) set to "None"?

What speed shows in the terminal?
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #12 - Nov 25th, 2012 at 2:00pm
Print Post  
Is the serial monitor set to 57600?

Is the DTR checkbox on the serial monitor (make the window wider to see it) checked? 

Adding serial.print to the setup only happens once when the arduino starts so it is easily missed. The DTR will force the arduino to reboot when the serial monitor opens so you should then see the message.

It is better to add serial.print to the loop when testing
« Last Edit: Nov 25th, 2012 at 2:39pm by Tim@Visual Micro »  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #13 - Nov 25th, 2012 at 3:08pm
Print Post  
Tim,

I've used the serial monitor, plus my own custom terminal program, and get the same response with both.  Both are set for 57600.  I've also put the serial.print in the loop, with the same result.  It's baffling....

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #14 - Nov 25th, 2012 at 3:12pm
Print Post  
Oh, does your terminal program set the dtr? If not the arduino will start and send the message before your program can connect to the port.

As a test I would move the serial.println("Hello World") from the setup() to the loop(). You should then see hundreds of "Hello World" messages in your terminal program.
  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #15 - Nov 25th, 2012 at 4:09pm
Print Post  
Tim,

I'll try setting DTR, but I doubt that is the problem.  Right now, using my serial driver, there is a print statement in setup() that simply prints "Ready...".  That comes out first time, every time, using my terminal program, or the serial monitor.

Is there no way to share the interrupts with the debugger?  I can give up one serial port and let the debugger have it.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #16 - Nov 25th, 2012 at 4:18pm
Print Post  
Ray, I'm getting a bit confused

I thought you reported this

Quote:
This is very peculiar....  I cannot for the life of me get the Serial class to actually work.  Even running a bare-minimum sketch that does a serial.begin and serial.println, nothing comes out on the terminal.  It did work before I installed the debugger....


But in your last post you said this

Quote:
there is a print statement in setup() that simply prints "Ready...".  That comes out first time, every time, using my terminal program, or the serial monitor.


So is the normal arduino serial working okay now? If so then we are just discussion multiple interrupts?

So let's leave the debugger disabled for the time being.

Can you use Serial2.println("Hello World") in your own sketch combined with your own interrupt handling of Serial?
  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #17 - Nov 25th, 2012 at 4:51pm
Print Post  
Tim,

Sorry, the "Ready...." is using my drivers.

I've got Serial working now, though I'm a bit confused - when I use Serial Monitor, everything comes out as it should.  When I use my terminal program, nothing comes out, though it works perfectly when running MY serial drivers.  I am not explicitly setting DTR, and DTR is clear in SerialMonitor.  I gather by your comments that the Serial driver does not transmit if DTR is set?  So it would appear my terminal program is perhaps inadvertently leaving DTR set.

Anyway, I've gotten to where I can at least transmit using Serial, and SerialMonitor (though the data is not quite correct, yet).  I added the test I need for "Done Transmitting" by simply testing the UDRE bit in my application, so I did not have to modify HardwareSerial.cpp.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Multiple Definition of Vectors....
Reply #18 - Nov 25th, 2012 at 5:28pm
Print Post  
Not sure why your terminal program isn't seeing any data. The dtr only affects the arduino when the terminal program open the serial port. It causes the arduino to reboot so that the setup() runs once. After the reboot the dtr has no affect unless it is toggled.

Good to hear you found a solution to detect "done transmit". That sounds like a good halfway house between arduino and avr! 

Obviously you WILL need to run the debugger on a different port to the one you are testing for "transmit complete".

Please keep in mind that the debugger will block under various circumstances. Some of which can be disabled. I haven't investigated the arduino non-blocking transmit for debugger use. Non-blocking will have implications for how many TracePoint messages could be transmitted by the arduino without overflowing the transmit buffer....

Summary

The debugger is not recommended for time critical applications. There are various configuration properties that do allow use in time critical projects but these considerations require a certain amount of careful thought. 

For example the placement of breakpoints in places of least impact to time critical functions, applying conditions to breakpoints to ensure execution is limited to major events and/or exceptions, using the "Hit Counter" system to reduce the frequency
  
Back to top
IP Logged
 
RayLivingston
Full Member
***
Offline


Posts: 158
Location: California
Joined: Nov 24th, 2012
Re: Multiple Definition of Vectors....
Reply #19 - Nov 26th, 2012 at 12:52am
Print Post  
Tim,

Right now, I'm getting conflict errors on all eight serial vectors.  So, even if I dedicate one port for the debugger, and  comment out my code for one port, I've still got the errors on the other three.  How do I get around that?

I don't need to debug any time-critical code.  All the low-level, time-critical code is working fine.  It's the top-level message processing code I need to debug, and it all runs in the foreground.

Regards,
Ray L.
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: [1] 2 3 
Send TopicPrint