Welcome, Guest. Please Login or Register
Arduino IDE for Visual Studio
 
 
When Logging a Support Issue in the Forum, please ensure you have also:-
  • Enabled vMicro > Compiler > Show Build Properties and Verbose
  • 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
 
  HomeSearch Tutorials & Wiki visualmicro.com LoginHelpRegister  
 
Page Index Toggle Pages: 1
Send Topic Print
Compilation fail if debug is active (Read 125 times)
Kabron
Member
***
Offline



Posts: 133
Compilation fail if debug is active
Oct 18th, 2020 at 8:04am
 
Board M5Stack-Core2, touch.ino example from M5Core2 library.
I guess it is a bug. If debug is enabled and BPs arrranged as on picture, compilation fails. See attachement.
Back to top
« Last Edit: Oct 18th, 2020 at 8:05am by Kabron »  

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 133
Re: Compilation fail if debug is active
Reply #1 - Oct 18th, 2020 at 8:06am
 
Compilation out & code.
Back to top
 

Please Register or Login to the Forum to see File Attachments
 
IP Logged
 
Kabron
Member
***
Offline



Posts: 133
Re: Compilation fail if debug is active
Reply #2 - Oct 18th, 2020 at 8:09am
 
One BP is enough for compilation fail.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10894
United Kingdom
Re: Compilation fail if debug is active
Reply #3 - Oct 18th, 2020 at 1:29pm
 
Hi

Thanks for the info. During compilcation the serial debugger has to inject debug statements into the code (in the temp build folder). That isn't an easy process when it comes to single line if statements because it makes them multi-line yet there are no braces {}.

Visual Micro attempts to add braces in some single line "If" scenarios but in your code fomat it has failed to manage that task. Therefore the resulting code in the temp copy is wrong.

The error from your output is as follows which confirms this. It is possible that moving each of the three breakpoints in the If/Else statements up one line will work. This is because the injected serial is appended to the end of each line, or in the case of if/else then some rework is made to add {}. It might be happier injecting into rather than after.

Code:
touch.ino: In function void loop()

touch.ino: 53:1: error: 'else' without a previous 'if
   else if(pos.x > 218)

touch.ino: 55:1: error: 'else' without a previous 'if
   else if(pos.x >= 109 && pos.x <= 218)
Error compiling project sources
Debug build failed for project 'touch'
 



As an aside I see you have changed the optimization setting from default. That is not required and debugging with serial because the debug watch statements are compiled into the code therefore preventing the omptimizer from causing any issues. Using different  optimizations settings will only be useful for hardware debugging.

Also please note, that each serial debugger breakpoint is same as adding a few lines of serial to your code. Putting breakpoints in the setup() before an mcu has fully initialized can sometimes cause issues especially with wifi net connect. Again this is not an issue in your case but please keep this in mind.

Thanks

Back to top
« Last Edit: Oct 18th, 2020 at 1:49pm by Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
Kabron
Member
***
Offline



Posts: 133
Re: Compilation fail if debug is active
Reply #4 - Oct 18th, 2020 at 2:37pm
 
Thanks a lot, Tim.
I don't really suffer from this, I just thought it would be interesting for you. In terms of optimization, I believe that the new M5Core2 library is still very crude and therefore my device does not always start up. So I'm just looking for a compile option that works.
Back to top
 
 
IP Logged
 
Visual Micro
Administrator
*****
Offline



Posts: 10894
United Kingdom
Re: Compilation fail if debug is active
Reply #5 - Oct 21st, 2020 at 7:19pm
 
Do you feel that my answer has given you the compile option that works?
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
Kabron
Member
***
Offline



Posts: 133
Re: Compilation fail if debug is active
Reply #6 - Oct 21st, 2020 at 9:49pm
 
Surelly!
Back to top
 
 
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print