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
Hot Topic (More than 8 Replies) Dynamic Memory Question? (Read 6736 times)
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Dynamic Memory Question?
Aug 4th, 2017 at 12:58am
Print Post  
I am working on a finite state machine project (Automaton TinkerSpy Library being used) with an Arduino UNO 100% compatible (SparkFun Redboard).  In the final stages of development I wanted to be able to continue to use the Arduino IDE 1.6.7 observing its trace serial monitor capability every step of the way.  As I reached 90% of dynamic memory I still can run the project in a stable way ... but no serial monitor ... which could be helpful.
Can an expert share with me if using the Atmel Plugin Visual Studio with the pro debugger extra cost software extension will also have a similar problem of short of enough memory?
« Last Edit: Aug 4th, 2017 at 4:43pm by JusticeMan »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Dynamic Memory Question?
Reply #1 - Aug 4th, 2017 at 12:11pm
Print Post  
Hi,

The Visual Micro Pro system is available to you already to try. When you attempt to build the first time each day you are asked if you want to start a trial, you can click Start Trial and use the pro debugger. It's the same as buying.

However the visual micro debugger will only help if you have used a lot of serial.print commands in your code without using the F switch. In that case all the strings in your serial prints will be consuming the arduino memory and that is where the debugger will help. You will be able to remove your serial prints and use the debugger messages instead. The debugger does not add the messages to the arduino code, it keeps them on the pc and shows the correct message when breakpoint #1 or #2 etc. is hit.

If you have used a lot of serial prints then you can remove them and probably free some memory. The debugger does have small overhead per breakpoint so it might or might not be a useful solution.

Visual Micro, In Atmel studio, will allow you to build Arduino but debug with hardware/atmel debugging. So another option is to buy a hardware debugger such as JTAG but again I can tell you that debugging an Uno or Mega is not easy. It requires you to change some fuses on the board, can damage the board if done wrong and can in some cases 
disable SPI. Hardware debugging is not easy for the type of board you have so this is why Visual Micro released the Serial debugger.

You are caught between a rock and a hard place. If you have a lot of serial.print statements then the Visual Micro Pro debugger might well be an option but will only prove to be useful after you test it and subsequently remove your serial print statements. If you do that don't forget to click YES to save the Solution when you close your project. Atmel and Visual Studio save breakpoint info into the solution so if you don't save you will lose your breakpoint config. One past user saved 5k by removing his Serial.prints.

Sorry can't be of more help.
  
Back to top
WWW  
IP Logged
 
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Re: Dynamic Memory Question?
Reply #2 - Aug 4th, 2017 at 2:37pm
Print Post  
Thanks, is it possible to see the status of pin states somewhat during the debugging if the board is connected during the process without resorting to the jtag hardware debugging?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Dynamic Memory Question?
Reply #3 - Aug 4th, 2017 at 2:58pm
Print Post  
You can add {vars} to debug messages which also become watch expressions

You can switch on vMicro>debugger digital/analog/free memory graphs. These are refreshed each time the loop is hit
or
You can use special vars in breakpoint messages such as {@DigitalReport} which also shows the graphs but refreshes when the breakpoint is reached.

You can plot your own charts

http://www.visualmicro.com/page/User-Guide.aspx?doc=Working-With-Breakpoints.htm...

http://www.visualmicro.com/page/User-Guide.aspx?doc=Working-With-Breakpoints-Whe...

http://www.visualmicro.com/page/User-Guide.aspx?doc=Multiplot.html

  
Back to top
WWW  
IP Logged
 
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Re: Dynamic Memory Question?
Reply #4 - Aug 6th, 2017 at 10:28pm
Print Post  
Tim,

Your responses have been very helpful for getting the initial setup with Visual Micro with 2017 Visual Studio Community Version.  It looks like I will be getting re-acquainted with breakpoints similar to when I used to do some beginner level programming with Microsoft VBA for Access about 15 years ago.  That VBA programming is still being used which proves that it was durable enough for its limited MS Access purpose.

The Automaton TinkerSpy Library being used in my project appears to have a mixture of C along with C++.  Visual Micro documentation says that break points for execution with a library can only be used if the library is placed as part of the source code.  The specific Automaton Library is actually a framework of sorts.  I am using the base Automaton Class & the base Machine Class along with a few specific Machine Classes which are stored in the default C:/Documents/Arduino/libraries directory. Notice the reactive finite state machine "Event Table" approach within his github code.  See https://github.com/tinkerspy/Automaton

To observe more exact "real time" functioning within all code interactions & potential debugging ... do I put just the pertinent .cpp & .h files within his github src folder code in the same folder as my .ino file?  Would that meet the Visual Micro requirement for the library to be relocated?

Thanks in advance.

« Last Edit: Aug 6th, 2017 at 10:28pm by JusticeMan »  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Dynamic Memory Question?
Reply #5 - Aug 7th, 2017 at 3:41pm
Print Post  
Hi,

That's old out of date documentation.

You should not change any code structure for debug. Use as published by the author or whatever you are using.

Visual Micro does now support debug of libraries.

You just need to add the existing libraries as shared projects to your visual studio solution

You can see a shared project working if you use the checkbox on the visual micro "add library to code" menu. Then add a library.

http://www.visualmicro.com/post/2017/01/16/Arduino-Cross-Platform-Library-Develo...
  
Back to top
WWW  
IP Logged
 
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Re: Dynamic Memory Question?
Reply #6 - Aug 10th, 2017 at 2:01am
Print Post  
Hi Tim,

I have the most current of the downloads of the softwares & the ftdi com port drivers etc.

I have tried with some simpler test (Tinkerspy's trafficlight etc) programs & I see the debugging & watch window abilities as long as the dynamic memory is not too close to minimum stated after build.  With the Automaton library installed & with my .ino file running in the Arduino Ide along with all the .cpp & .h files I have only 92% used of the dynamic memory.

With the same setup except in Visual Studio Visual Micro ... when I hit the build & upload ... it is showing 99% minimum needed.  "Launching debugger ..." shows in output window & nothing else after the build.  I don't understand this because I thought that the Visual Micro would run about the same memory usage as the Arduino IDE or even less.  Could I be having something adding to Visual Micro's overhead that is not happening in the Arduino Ide without its fprint trace commands - serial monitor???  Do you have a helpful suggestion besides the drastic move of going to the Mega board??? Thanks
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Dynamic Memory Question?
Reply #7 - Aug 10th, 2017 at 9:53am
Print Post  
Hi,

Please change the tool bar option from Debug to Release. Then build and upload.

After that visual micro will take the same amount of memory as the Arduino IDE
  
Back to top
WWW  
IP Logged
 
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Re: Dynamic Memory Question?
Reply #8 - Aug 10th, 2017 at 2:43pm
Print Post  
Tim,

After the successful build:

"Debug=>Attach to Process" shows a message box that says attach requires a build with debugger?

The attached observations are crucial to observe the external input - code response for my project.

Thanks
  
Back to top
 
IP Logged
 
JusticeMan
Newbies
*
Offline


Posts: 8
Location: North Dakota
Joined: Apr 16th, 2016
Re: Dynamic Memory Question?
Reply #9 - Aug 10th, 2017 at 3:19pm
Print Post  
Below shows in my connect window???:

VMDP�_|||35|_VMDPR
VMDPR_|252:31:||1

No visualizations are occurring like were seen on previous smaller Arduino Automaton process testing.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12076
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Dynamic Memory Question?
Reply #10 - Aug 10th, 2017 at 6:51pm
Print Post  
Hi,

1)
In your previous post you said that you would expect visual micro to produce the same or smaller program than the arduino ide. Visual Micro should produce the same size program because it uses the same build process as the arduino ide.

Your test in release mode was to make this comparison about size.

2)
The serial debugger will add some overhead. That depends on how many breakpoints and how many watch expressions. 

Long messages strings for debug display are not stored on the arduino so if users have lots of serial.prints and have not used the F() expression then debug will usually reduce memory usage.

Arduino's often get flakey over 90% so unless you can save some memory by removing your own strings or F()'ing your own strings then you probably can't use the serial debugger.

Your other option is to use an atmel hardware debugger with visual micro in atmel studio. That way you get the benefit of the atmel studio debugger and an arduino compatible build. However hardware debugging avr is not always easy.


The amount of memory the debugger takes will vary. for example: If your code does not use serial at all then just the fact the serial is used by the debugger will take the most amount of memory.
« Last Edit: Aug 10th, 2017 at 7:51pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint