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 Initial Impressions (Read 4846 times)
uChip
Junior Member
**
Offline


Posts: 22
Location: Washington, USA
Joined: Apr 22nd, 2013
Initial Impressions
Apr 25th, 2013 at 5:17am
Print Post  
[Edit: I just realized that most of these are for the debugger so this might be the wrong place to post.  Move this as you see fit.  Thx.]

I just upgraded from VS Express to VS Pro so that I could make use of Visual Micro and the Arduino debugger.  I installed VSP (v11.0.60315.01) and recompiled one of my existing desktop app projects.  Then I installed Visual Micro (v1.1212.30) and compiled Blink.  That seemed to upload and run with no problems.  Finally I installed the debugger and have been playing with that.

Here are a few things I am seeing.
  - Intellisense seems to work, but keyword coloring is not the same as the Arduino IDE.  For instance analogWrite is colored in the Arduino IDE but not in VS/VM.  I did set up PDE and INO in the Options dialog and have switched board types a few times.
  - If I set a breakpoint and print a message using "When Hit..." and I clear the "Continue execution" checkbox the code does not stop.  I see the message in the Output window but execution continues.
  - If I set a breakpoint on an if statement and output a message "When Hit..." the message is only output if the if statement is true.  That is inconsistent with desktop code.
  - There is no "Stop Debugging" in the Arduino debugger.  This is not really a problem, but in combination with the above, it is a little disconcerting.
  - At one point I had two Arduino boards attached to the PC at the same time.  I loaded firmware into one, then closed that project and loaded a different project with the firmware for the second.  Even though I switched COM ports the debugger seemed to get confused and continued to give me the Expressions window for the first instance instead of the second.  It did upload the code to the correct board and the COM port monitor was correct.  Just the Expressions window was in error.

Let me know if you want to pursue any of these.
Thanks.
« Last Edit: Apr 25th, 2013 at 5:21am by uChip »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Initial Impressions
Reply #1 - Apr 25th, 2013 at 11:47am
Print Post  
Hi uChip,

Thanks for the feedback. I will try to give some initial responses below although short of time today so might revisit over the next few days.

Quote:
- Intellisense seems to work, but keyword coloring is not the same as the Arduino IDE.  For instance analogWrite is colored in the Arduino IDE but not in VS/VM.  I did set up PDE and INO in the Options dialog and have switched board types a few times.


We use the VS C++ intellisense system. In the background, we override where VS looks for C++ sources, ensure the project knows about multiple .pde files and ensure lib paths/defines are correct. 

This means that color coding and intellisense will work in the same way that it would with a C++ project. This does mean that all MS and OEM extensions and helpers (such as VisualAssistX) can work unhindered by any Arduino color coding. 

Personally I don't like VS extensions that "mess" with the color coding or any properties directly in a code editor because it always seems to cause typing and moving around code editors to become slower. It has been a big priority of this project to implement only what will cause VS to continue to operate at full speed. 

However, if I get enough requests, I would be happy to look at implementing the same color coding that the arduino ide implements. The arduino ide uses the keyword.txt files that are distributed with the core and libs to deduce color coding, whereas, VS looks at the code to deduce color coding and can be further configured via the customization and options system

Quote:
  - If I set a breakpoint and print a message using "When Hit..." and I clear the "Continue execution" checkbox the code does not stop.  I see the message in the Output window but execution continues.


Because so many new and inexperienced users work with the debugger I decided it would be dangerous to allow the break/pause functionality to work without users specifically giving permission. Imagine an auto pilot of a plane pausing at a breakpoint, the plane/drone/robot would certainly crash and many new users would not realize the consequences so the default if OFF.

Therefore you need to give permission for the project to break/pause by setting the "Enable Break/Pause" project property to True. The default is false which causes all breakpoints to be treated as TracePoints. 

Quote:
  - There is no "Stop Debugging" in the Arduino debugger.  This is not really a problem, but in combination with the above, it is a little disconcerting.


Another difference between desktop and arduino debug is that the arduino debug can be running for months, when you next open VS and start the serial monitor for the project it will resume debug mode. This is because arduino does not support debugging so this solution injects "special" serial.print statements into the arduino program prior to upload. 

So this means that the serial window is responsible for debug, closing the serial window or un-tick "connect" to stop the debug.

Having said all this I do intend to add a tool bar for debug and also to add a "stop debug" option to the "Debug" menu. These options will do as I describe above but will certainly be more obvious for users. I think this especially applies to users who have worked more with windows than arduino in the past Smiley

Quote:
  - At one point I had two Arduino boards attached to the PC at the same time.  I loaded firmware into one, then closed that project and loaded a different project with the firmware for the second.  Even though I switched COM ports the debugger seemed to get confused and continued to give me the Expressions window for the first instance instead of the second.  It did upload the code to the correct board and the COM port monitor was correct.  Just the Expressions window was in error.


There is a known bug in the current version where the title of the expressions window is wrong but that it does show the correct data and is tied to the correct port
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12191
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Initial Impressions
Reply #2 - Apr 25th, 2013 at 12:16pm
Print Post  
Quote:
- If I set a breakpoint on an if statement and output a message "When Hit..." the message is only output if the if statement is true.  That is inconsistent with desktop code.


Forgot to answer this one....

Because the arduino can't really perform debug we inject serial print statements. This means that we don't really have the option to examine a line of code unless you have pre-set the variables to be examined. At the moment we don't have the facility to stop at a line and then continue to the end of the same line, all we can do it stop at each breakpoint. So we stop after the line of code for which you have applied the breakpoint.

So, this debugger replaces the concept of serial.print() messages which users would often add to the end of a line of code to report the values of variables. 

This is what the debugger does, when you set a breakpoint it is added (in background) to the end of the current line of code, if the line of code is an IF {} statement then the breakpoint is placed inside the first brace of the IF. If the IF is a single line without braces then braces are automatically added in background during compilation. (A users source code is never amended)

Unlike a normal debugger, you can place a breakpoint on empty code lines and even on commented code lines, so as you can see it is slightly different to normal.

This is an important discussion which I was hoping would be discussed more during the beta of the debugger. 

So far we have two windows/netduino users who feel it would be better if breakpoints were placed at the start of a code line and many arduino users that feel the way the current system works is okay. I'm not sure what the right solution is and have been considering making it an option.

If you progress with the debugger and use the facility to alter variable values when an arduino is running and have time to consider this issue more I will be very interested to hear your thoughts.

Also keen to hear your thoughts for new users that add a breakpoint, for example, to a function name such as "loop()". In this case the same functionality is applied, the breakpoint is actually inserted (in background) inside the first brace of the function. So again the breakpoint is inserted after the line of code. 

I am trying to keep things consistent for new users but in doing so I know that this can be confusing for experienced debugger users

Feedback and discussion about this is very much appreciated
« Last Edit: Apr 25th, 2013 at 12:19pm by Tim@Visual Micro »  
Back to top
IP Logged
 
uChip
Junior Member
**
Offline


Posts: 22
Location: Washington, USA
Joined: Apr 22nd, 2013
Re: Initial Impressions
Reply #3 - Apr 25th, 2013 at 4:15pm
Print Post  
Thanks for the quick response.

I set Enable Break/Pause to True and now the debugger stops as expected.

I will use the system some more and then post again with my thinking on the breakpoint issue.

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