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
code only works when compiled with arduino IDE (Read 704 times)
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
code only works when compiled with arduino IDE
Mar 23rd, 2021 at 8:22pm
 
Hi.

I have a simple little program that works fine when compiled in the Arduino IDE but hangs when compiled in Visual Studio using the VisualMicro extension.

I do not know where to look to find the problem and need your help.

I am using a FreeRTOS port for the Arduino DUE.
The program hangs in the line "vTaskStartScheduler();"

Attached are the INO file and the compiler output.

Thanks for your help.

Back to top
 

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



Posts: 11114
United Kingdom
Re: code only works when compiled with arduino IDE
Reply #1 - Mar 23rd, 2021 at 11:17pm
 
Hi

Can you please switch off the gdb debugging (that is the default) so we can compare like for like with arduino.

vMicro>Debugger>Debug = Off
Also ensure that "vMicro>Debugger>Compiler Optimization" is set to "Default Optimization"

Does that help?

Thanks

ps: Where you only seeing the issue during a debug session?
Back to top
 

Tim Leek
home
WWW  
IP Logged
 
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
Re: code only works when compiled with arduino IDE
Reply #2 - Mar 24th, 2021 at 2:24am
 
I have verified this to be the case - see attached compiler output.

I downloaded the program again, just to be sure I wasn't making any mistake. Same results - hangs at same location.

Regards.
Back to top
 

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



Posts: 980
Re: code only works when compiled with arduino IDE
Reply #3 - Mar 24th, 2021 at 10:30am
 
Thanks for the detail, we can replicate this using a copy of this library:
https://github.com/bdmihai/DueFreeRTOS

We will update when we have further information...
Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 980
Re: code only works when compiled with arduino IDE
Reply #4 - Mar 24th, 2021 at 10:52am
 
To work around the issue while we identify the full fix:-

Try re-selecting the Release Build Configuration, Debug Off and Default Optimization again, this may also correct the setting.

(The cause when I had issues is the optimization flag being incorrectly set to -O0 in this scenario without the above work around)
Back to top
« Last Edit: Mar 24th, 2021 at 11:48am by Simon@Visual Micro »  
 
IP Logged
 
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
Re: code only works when compiled with arduino IDE
Reply #5 - Mar 24th, 2021 at 3:53pm
 
Hi.
Your suggested temp. fix doesn't work for me. I even tried creating a new project and re-configuring everything and still get the same result:

ide.compiler_flags_no_opt=-O0

P.S. The problem did not exist in an earlier release of your extension - last known compilation that worked was on 6/18/2020

Regards,
Gene



Back to top
 
 
IP Logged
 
Simon@Visual Micro
Administrator
*****
Offline



Posts: 980
Re: code only works when compiled with arduino IDE
Reply #6 - Mar 24th, 2021 at 5:30pm
 
Thanks for the update.

Would it be possible to Zip the whole solution folder and email / attach this for us to review?
Back to top
 
 
IP Logged
 
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
Re: code only works when compiled with arduino IDE
Reply #7 - Mar 25th, 2021 at 2:49pm
 
Hello again.

Sorry for the delay but I was playing around with the settings, as you suggested. I created a new Arduino project and copied the INO file there. And this actually worked. I saved the compiler output for both versions for you to compare. The version that doesn't word has the compiler option -Og set.

I also noticed that all of the vMicro toolbars are behaving erratically - many of them are empty. (see attached PNGs)
Should I re-install vMicro?

Regards,
Gene
Back to top
 
 
IP Logged
 
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
Re: code only works when compiled with arduino IDE
Reply #8 - Mar 25th, 2021 at 2:50pm
 
Here is the missing attachment Wink
Regards,
Gene
Back to top
 

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



Posts: 11114
United Kingdom
Re: code only works when compiled with arduino IDE
Reply #9 - Mar 26th, 2021 at 6:08pm
 
Is it possible that you have disabled the optmization for the "Release" configuration in the "vMicro>Project Properties"?

The default is "False"

Back to top
« Last Edit: Mar 26th, 2021 at 6:09pm by Tim@Visual Micro »  

Please Register or Login to the Forum to see File Attachments

Tim Leek
home
WWW  
IP Logged
 
ebg
Newbies
*
Offline



Posts: 6
Belton Texas
Re: code only works when compiled with arduino IDE
Reply #10 - Apr 6th, 2021 at 6:12pm
 
Hi.
Sorry for the delay - had a few other things that needed to be done.

Optimization is enabled in my release config.

Meanwhile, I managed to get my actual program to compile again by toggling various compiler options until it worked.

It may be, that my computer settings are messed up. As I mentioned before, my vMicro toolbars behave erratically.

I will certainly contact you again if I get stuck.

Thanks for your help.  Smiley
Gene.

Back to top
 
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline



Posts: 11114
United Kingdom
Re: code only works when compiled with arduino IDE
Reply #11 - Apr 6th, 2021 at 7:19pm
 
Can you please restart VS then open the .ino using "File>Open>Arduino Project". Then see if eveything works okay?
Back to top
« Last Edit: Apr 6th, 2021 at 7:24pm by Tim@Visual Micro »  

Tim Leek
home
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send Topic Print