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 Compilation fail if debug is active (Read 1707 times)
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Compilation fail if debug is active
Oct 18th, 2020 at 7:04am
Print Post  
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.
« Last Edit: Oct 18th, 2020 at 7:05am by Kabron »  

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


Posts: 170
Joined: Nov 1st, 2015
Re: Compilation fail if debug is active
Reply #1 - Oct 18th, 2020 at 7:06am
Print Post  
Compilation out & code.
  

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


Posts: 170
Joined: Nov 1st, 2015
Re: Compilation fail if debug is active
Reply #2 - Oct 18th, 2020 at 7:09am
Print Post  
One BP is enough for compilation fail.
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compilation fail if debug is active
Reply #3 - Oct 18th, 2020 at 12:29pm
Print Post  
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
Select All
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

« Last Edit: Oct 18th, 2020 at 12:49pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Compilation fail if debug is active
Reply #4 - Oct 18th, 2020 at 1:37pm
Print Post  
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
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: Compilation fail if debug is active
Reply #5 - Oct 21st, 2020 at 6:19pm
Print Post  
Do you feel that my answer has given you the compile option that works?
  
Back to top
WWW  
IP Logged
 
Kabron
Full Member
***
Offline


Posts: 170
Joined: Nov 1st, 2015
Re: Compilation fail if debug is active
Reply #6 - Oct 21st, 2020 at 8:49pm
Print Post  
Surelly!
  
Back to top
 
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint