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 Send TopicPrint
Normal Topic GDB Fails when using attachinterrupt() Function (Read 988 times)
groz
Junior Member
**
Offline


Posts: 16
Joined: Feb 21st, 2018
GDB Fails when using attachinterrupt() Function
Nov 20th, 2022 at 11:58pm
Print Post  
I can use the debugger without issue but when I use the attachinterrupt() function, I get the following:

Error linking for board ATmega2560 (Mega 2560) (Arduino Mega)                                                                       (mega_atmega2560)
WInterrupts.c.o (symbol from plugin)*: In function attachInterrupt
(.text+0x0)*: multiple definition of __vector_1
avr8-stub.c.o (symbol from plugin)*: (.text+0x0): first defined here
 
collect2.exe*: error: ld returned 1 exit status

If I try changing interrupts in the avr8-stub.h file, the vector number keeps changing but still does not compile.

Is this a limitation ?
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: GDB Fails when using attachinterrupt() Function
Reply #1 - Nov 21st, 2022 at 12:51pm
Print Post  
Thanks for the report.

Could you enable the settings shown at the top of the page, and attach the full build output for us to review?

Can you also let us know what your attachInterrupt() call looks like, and the function definition it is trying to attach to the pin?
  
Back to top
 
IP Logged
 
groz
Junior Member
**
Offline


Posts: 16
Joined: Feb 21st, 2018
Re: GDB Fails when using attachinterrupt() Function
Reply #2 - Nov 22nd, 2022 at 1:40am
Print Post  
I've attached multiple build files, with and without the attachinterrupt() files being referenced in the project. In addition, I'm including both the .h and .cpp files.

The main.ino file is not even calling the functions, just having them referenced causes this error. Note: The files work perfectly using the standard Serial Debugger.

The 2 functions to look at are: 
boolean FreqMeas_init(u8 pin, pin_change_dir dir, boolean use_average = true)
The above attaches the pin and call function.

static void transistions(void)
This is the attached interrupt function

Note: due to multiple files, I rolled them into a .zip

Hope this helps...
Thanks
  

Please Register or Login to the Forum to see File Attachments
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2175
Joined: Feb 13th, 2019
Re: GDB Fails when using attachinterrupt() Function
Reply #3 - Nov 22nd, 2022 at 10:17am
Print Post  
Thanks for the detail around this, the issue appears to be that using interrupts in any way will conflict with the GDBStub Library.

I believe this is due to the GDBStub using interrupts to perform its communication and breaking in its code, and it would definitely not allow debugging when stopping within an interrupt service routine.

Have you tried the Visual Micro Serial Debugger?  This won't conflict with the interrupt functionality in your code and has many more features than GDBStub including more break/tracepoints, charting, performance monitoring etc..
  
Back to top
 
IP Logged
 
groz
Junior Member
**
Offline


Posts: 16
Joined: Feb 21st, 2018
Re: GDB Fails when using attachinterrupt() Function
Reply #4 - Nov 22nd, 2022 at 11:55am
Print Post  
See previous message, I use it and it works perfectly. A few of the things I miss:
- single stepping, step into..etc
- on the fly adding break points

I'm just glad you developed this full featured tool. The above items are missed but a small price to pay. My inquiry was just to check if I was missing something.

Thanks
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint