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 debugger compatible with my system? - breakpoint causes MCU to reboot (Read 9040 times)
Eric Weitzman
Newbies
*
Offline


Posts: 4
Joined: Dec 8th, 2013
debugger compatible with my system? - breakpoint causes MCU to reboot
Dec 8th, 2013 at 7:42pm
Print Post  
It's really nice to be working with my Arduino code in Visual Studio. Truly a breath of fresh air. (gasp...gasp) Thank you.

BUT, the debugger does nothing but cause the MCU to reboot endlessly.

I have a few Serial.print statements in setup() and loop(). Whereever I set a breakpoint, the serial output prior to it shows up in the monitor, and then the same output repeats endlessly as the MCU reboots when the breakpoint is "hit". If I move the breakpoint, output is produced up to the location of the new breakpoint. If I delete it, the code runs properly. None of the variations in the breakpoint actions that I tried allow it stop execution and return control to Visual Studio.

I suspect this is a compatibility issue. Can someone tell me if the debugger is compatible with my system configuration?

Windows 7 x64
Visual Studio 2008
Arduino 0022
Arduino Mega 2560 R3

Thanks,
- Eric
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #1 - Dec 8th, 2013 at 7:54pm
Print Post  
Hi Eric,

I am sorry you are having problems. 

The debugger does not work with Arduino versions earlier than Arduino 1.0 which includes changes to Serial.print().

Sorry. I hope you manage to update your project to a version of Arduino from Nov 2011 when Arduino 1.0 was released. Arduino 1.0 had a few bugs, you might find the current Arduino 1.0.5 release is the most robust and closest match.

It might not affect you but might be worth knowing that the 2560 with Arduino 0023 will not allow a program size > 128k.

EDIT. We will make this clearer on the web site. It used to be stated clearly but the message seems to be lost. Thanks for the report. Let us know if we can help.
« Last Edit: Dec 8th, 2013 at 8:06pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Eric Weitzman
Newbies
*
Offline


Posts: 4
Joined: Dec 8th, 2013
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #2 - Dec 10th, 2013 at 1:16am
Print Post  
Ported my Wire code and am running Arduino 1.0.5. The MCU doesn't reboot continuously. That's progress!

I set (Micro Debug) to Full in my project's properties. I set an unconditional breakpoint in loop(). When I press "Start Debugging" (green run button), the project compiles, is uploaded to the Arduino, and a window called "vm_1_00_VS_refactor | Expressions on COM4" opens up and displays "Waiting for debug breakpoint data". The processor doesn't stop at the break and just runs as normal.

My program is writing to Serial on COM4. Does this conflict with Visual Micro's debugger?

Or did I just not/mis- configure something?

- Eric
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #3 - Dec 10th, 2013 at 2:00pm
Print Post  
Hi Eric,

That is working. Please watch the youtube video on the debugger page.

By default the break/pause is not enabled which prevents novice users from crashing their robot or drones Smiley There is a project property called Enable Break/Pause which when set to True will stop at any breakpoints that do not have the "Continue Execution" "When Hit" property set.

The required watch expressions are are set via the "When Hit" property for example this will watch millis()

{millis()}

and this will watch millis but also give a textual message

Code
Select All
Millis is currently {millis()} 



and this would allow a variable called abc to be updated without recompiling the Arduino code.

Code
Select All
Millis is currently {millis()} and abc is {abc=?} 



All changes to breakpoint properties require a recompile and upload.

Hope his helps
« Last Edit: Dec 10th, 2013 at 2:01pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Eric Weitzman
Newbies
*
Offline


Posts: 4
Joined: Dec 8th, 2013
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #4 - Dec 10th, 2013 at 8:25pm
Print Post  
Enable break/pause is set. I have a print statement in the "When hit" breakpoint property, and "Continue execution" is checked.

Could you perhaps point me to the documentation on setting the project and Visual Micro properties properly to enable debugging? I've already watched the 25 minute video two times.

See screenshot of some settings, etc.

Thanks,
- Eric

http://postimg.org/image/dez6viu8l/
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #5 - Dec 10th, 2013 at 9:32pm
Print Post  
Thanks for the useful pic. 

It looks good except that "Continue Execution" would need to be unchecked to break.

One other important note is that the software debugger currently injects code at the end of a line. If a "loop" or "if" etc. statement is encountered then the breakpoint is injected into the first line of the "If" or loop etc. If a one liner existed then it is transformed (in a temp code copy) into a multi-line. It's not an exact science so it is best to place breakpoints on lines of code with a simple structure. I mention this because in your example the breakpoint will only fire if power == POWER_OFF

We certainly DO need better documentation! Hopefully sales of the debugger will provide the resource to do this and hopefully allow the main tool to remain free. It's a bit of chicken and egg I know  Cry

For now this is what we have

Youtube overview http://www.youtube.com/watch?v=fFM8_RhIG0U

Debug overview http://www.visualmicro.com/post/2012/05/05/Debug-Arduino-Overview.aspx

How to modify variables while the arduino is running http://www.visualmicro.com/post/2012/10/24/Modify-Arduino-Variables-During-a-Deb...

Debug wiki http://www.visualmicro.com/archive.aspx#Arduino-Debug

Hope this helps. Please ask questions if you can find an answer on visualmicro.com or forum. It will help to understand what is confusing or in need of explanation. Thanks
  
Back to top
IP Logged
 
Eric Weitzman
Newbies
*
Offline


Posts: 4
Joined: Dec 8th, 2013
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #6 - Dec 10th, 2013 at 11:52pm
Print Post  
Ok, so I set it up as I thought I should per your instructions, added as statement to set a variable x to millis(), and put the break on this statement so there's be no ambiguity about whether the injected code would be hit. Now the MCU resets shortly after the code starts, after emitting my stuff in setup(), and repeats ad infinitum.

http://postimg.org/image/5kfk3q0h5/

I loaded "Blink" and it runs without resetting, and it debugs, breaks, and displays a variable okay. I duplicated Visual Micro's project settings from the Blink project to the one I've been working with and it still restarts continuously. So this tells me that there is something in my setup() function (and there is a lot in this legacy code there) that is incompatible with or disturbing your injected code.

Is there some way I can see the actual code that gets compiled without trying to do a command line build and grabbing the preprocessor output? I poked around in C:\Users\Eric\AppData\Local\VMicro\Arduino\Builds\vm_1_00_VS_refactor\mega2560 without finding anything with unfamiliar code added.

Thanks,
- Eric
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: debugger compatible with my system? - breakpoint causes MCU to reboot
Reply #7 - Dec 11th, 2013 at 3:01pm
Print Post  
Hi,

The only time I have heard of this problem is when someone put a breakpoint in the initialization of a class. This caused the Arduino to reboot because the Arduino Serial object (used by debugger) had not yet been instantiated when the users class was instantiated.

You have found the build folder. It can be reported during builds by switching on "tools>options>visual micro>compiler>always show build folder". In this folder you will find a [sketchName].cpp with injected code but also if you have cpp files with breakpoints they will also exist in the folder with injected code. Please zip and email the entire folder info [at] visualmicro.com.

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