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
Hot Topic (More than 8 Replies) code only works when compiled with arduino IDE (Read 3800 times)
ebg
Newbies
*
Offline


Posts: 6
Location: Belton Texas
Joined: Mar 23rd, 2021
code only works when compiled with arduino IDE
Mar 23rd, 2021 at 8:22pm
Print Post  
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.

  

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


Posts: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: code only works when compiled with arduino IDE
Reply #1 - Mar 23rd, 2021 at 11:17pm
Print Post  
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
WWW  
IP Logged
 
ebg
Newbies
*
Offline


Posts: 6
Location: Belton Texas
Joined: Mar 23rd, 2021
Re: code only works when compiled with arduino IDE
Reply #2 - Mar 24th, 2021 at 2:24am
Print Post  
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.
  

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


Posts: 2145
Joined: Feb 13th, 2019
Re: code only works when compiled with arduino IDE
Reply #3 - Mar 24th, 2021 at 10:30am
Print Post  
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: 2145
Joined: Feb 13th, 2019
Re: code only works when compiled with arduino IDE
Reply #4 - Mar 24th, 2021 at 10:52am
Print Post  
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)
« Last Edit: Mar 24th, 2021 at 11:48am by Simon@Visual Micro »  
Back to top
 
IP Logged
 
ebg
Newbies
*
Offline


Posts: 6
Location: Belton Texas
Joined: Mar 23rd, 2021
Re: code only works when compiled with arduino IDE
Reply #5 - Mar 24th, 2021 at 3:53pm
Print Post  
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: 2145
Joined: Feb 13th, 2019
Re: code only works when compiled with arduino IDE
Reply #6 - Mar 24th, 2021 at 5:30pm
Print Post  
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
Location: Belton Texas
Joined: Mar 23rd, 2021
Re: code only works when compiled with arduino IDE
Reply #7 - Mar 25th, 2021 at 2:49pm
Print Post  
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
Location: Belton Texas
Joined: Mar 23rd, 2021
Re: code only works when compiled with arduino IDE
Reply #8 - Mar 25th, 2021 at 2:50pm
Print Post  
Here is the missing attachment Wink
Regards,
Gene
  

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


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

The default is "False"

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

Please Register or Login to the Forum to see File Attachments
Back to top
WWW  
IP Logged
 
ebg
Newbies
*
Offline


Posts: 6
Location: Belton Texas
Joined: Mar 23rd, 2021
Re: code only works when compiled with arduino IDE
Reply #10 - Apr 6th, 2021 at 5:12pm
Print Post  
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: 12071
Location: United Kingdom
Joined: Apr 10th, 2010
Re: code only works when compiled with arduino IDE
Reply #11 - Apr 6th, 2021 at 6:19pm
Print Post  
Can you please restart VS then open the .ino using "File>Open>Arduino Project". Then see if eveything works okay?
« Last Edit: Apr 6th, 2021 at 6:24pm by Tim@Visual Micro »  
Back to top
WWW  
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint