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 Debugging with Serial does not work (Read 3051 times)
Nikolai
Newbies
*
Offline


Posts: 5
Joined: Jan 31st, 2023
Debugging with Serial does not work
Feb 8th, 2023 at 9:13pm
Print Post  
I am trying vMicro, and cannot get debugging to work.

I am using ESP32 with a touch-screen.  Screen uses SPI for drawing and I2C for touch interface.  I also use Serial to occasionally output messages.

setup() function inits Serial for 115,200 as follows:

    // Serial port
    Serial.begin(115200);
    Serial.setTimeout(1000);
    Serial.printf("\r\n");
    Serial.printf("\r\n");
    Serial.printf("Free Heap: %d\r\n", (int)ESP.getFreeHeap());

When I build in Release mode with Debug Off, project runs fine and outputs the following minimal info in Serial:

Opening port
Port open

Free Heap: 324536
Found I2C address 93
Begin Touch on address 93
Goodix::begin - calling reset
Goodix::begin - after reset result=1
Goodix::begin return 1
Touch init - SUCCESS
Touch Config is OK
Main screen draw=55

However when I compile in Debug mode with Debug: Serial and "No Optimizations" as recommended, I don't see anything on Serial besides "VMDPR_" and nothing shows on screen.  I disabled the "automatic breakpoint" option that was created at the beginning of setup() function, but it still does not run.

Am I doing something wrong?  Is there some setting I missed to make it work?
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12198
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Debugging with Serial does not work
Reply #1 - Feb 8th, 2023 at 9:46pm
Print Post  
Hi optimization should remain at Default. It never needs to change when using the serial debugger. 

Other tips ...

Setting No Optimisation will fail for most boards, where did you see the recommendation?

Using the serial debugger alongside your own serial does have some limitations. You example should work but if your code uses Serial.Read then you need to either switch debug to TraceOnly mode or use an alternative serial port for debug.

If you have more questions please provide the information requested in yellow above.

Thanks
  
Back to top
IP Logged
 
Nikolai
Newbies
*
Offline


Posts: 5
Joined: Jan 31st, 2023
Re: Debugging with Serial does not work
Reply #2 - Feb 11th, 2023 at 6:56am
Print Post  
You are right.  It works with "Default Optimizations".  I am just used to build without optimizations for debugging, and that may have tripped me.

If I set a breakpoint in a random spot, is there a reason program doesn't just pause there?
  
Back to top
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline


Posts: 2773
Joined: Feb 13th, 2019
Re: Debugging with Serial does not work
Reply #3 - Feb 11th, 2023 at 12:11pm
Print Post  
Off-Topic replies have been moved to this Topic.
  
Back to top
IP Logged
 
Nikolai
Newbies
*
Offline


Posts: 5
Joined: Jan 31st, 2023
Re: Debugging with Serial does not work
Reply #4 - Feb 11th, 2023 at 7:40am
Print Post  
I do get messages in "Micro Debug Trace".  Just no breakpoint hits / program pauses.  Is this a limitation of Serial debugging?

  

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


Posts: 2773
Joined: Feb 13th, 2019
Re: Debugging with Serial does not work
Reply #5 - Feb 11th, 2023 at 12:19pm
Print Post  
With the Serial debugger, all break/trace points have to be set (and any watch expressions/output messages configured) before building and uploading the code to the board.

Also ensure you have not enabled the vMicro > Debugger > Trace Only (No Break) menu option.

The walkthrough guide should help, and works through all the features of the Serial debugger:
https://www.visualmicro.com/page/User-Guide.aspx?doc=Debugging-Walkthrough-Start...

It is not recommended to use the serial debug to debug serial.print lines. That can cause confusion. 

« Last Edit: Feb 11th, 2023 at 1:09pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint