Tim,
I've found what seems to me a clear bug in VM:
I decided to play with a small test program, instead of my huge, hulking monster application. But I'm getting some truly bizarre errors. First, here is the program (just something I used a while back to resolve a problem I was having using variable arguments).
First, I set HitCounter to Counter rather than millseconds.
#include <Arduino.h>
#include <stdio.h>
#include <stdarg.h>
/**************************************************
* DebugMsg()
*************************************************/
void DebugMsg(const char *fmt, ...)
{
char s[256];
__gnuc_va_list args;
va_start (args, fmt);
vsprintf (s, fmt, args);
Serial.print(s);
va_end (args);
}
void setup()
{
Serial.begin(115200);
}
int cnt = 0;
void loop()
{
cnt++;
DebugMsg("Hello, %s %d %c %f\n", "world", 42, 'X', 1.2345);
delay(100);
}
If I set a single breakpoint on the DebugMsg line in loop, it works fine. I then set a condition of "cnt > 0", and it also works fine. But, I then set HitCount to anything BUT "always", I get these compiler errors:
Quote: Compiling debug version of 'BlivetSketch' for 'Arduino Due (Programming Port)'
Build folder: due_x_dbg
BlivetSketch.ino:1:107: error: stray '#' in program
:unsigned long __VisualMicro_DEBUG_1_HITCOUNTER__ = 0L;bool __VisualMicro_DEBUG_1_HITCOUNTER___COMPLETE = 0#include "arduino.h"
BlivetSketch.ino:6:28: error: stray '#' in program
:*[VM_DEBUG_HEADERS_END]*\#include <Arduino.h>
BlivetSketch.ino:1:108: error: expected ',' or ';' before 'include
:unsigned long __VisualMicro_DEBUG_1_HITCOUNTER__ = 0L;bool __VisualMicro_DEBUG_1_HITCOUNTER___COMPLETE = 0#include "arduino.h"
BlivetSketch.ino:6:29: error: 'include' does not name a type
:*[VM_DEBUG_HEADERS_END]*\#include <Arduino.h>
BlivetSketch.ino:In function 'void loop()
BlivetSketch.ino:32:58: error: 'DebugMsg' was not declared in this scope

ebugMsg("Hello, %s %d %c %f\n", "world", 42, 'X', 1.2345);if (cnt > 0) {__VisualMicro_DEBUG_1_HITCOUNTER__ +=1;if ((__VisualMicro_DEBUG_1_HITCOUNTER__==5) ) { __VisualMicro_DEBUG_1_HITCOUNTER__=0L;
debugger: The error shown above might be caused by invalid breakpoint syntax?
Error compiling
If I insert a blank line as the very first line of the file, I get:
Quote:
Compiling debug version of 'BlivetSketch' for 'Arduino Due (Programming Port)'
Build folder: due_x_dbg
BlivetSketch.ino:1:107: error: stray '#' in program
:unsigned long __VisualMicro_DEBUG_1_HITCOUNTER__ = 0L;bool __VisualMicro_DEBUG_1_HITCOUNTER___COMPLETE = 0#include "arduino.h"
BlivetSketch.ino:1:108: error: expected ',' or ';' before 'include
:unsigned long __VisualMicro_DEBUG_1_HITCOUNTER__ = 0L;bool __VisualMicro_DEBUG_1_HITCOUNTER___COMPLETE = 0#include "arduino.h"
Error compiling
Set HitCounters back to milliseconds, and all these errors go away.
Regards,
Ray L.