VS Arduino
Visual Micro >> Project Guidance >> code only works when compiled with arduino IDE
https://www.visualmicro.com/forums/YaBB.pl?num=1616530967

Message started by ebg on Mar 23rd, 2021 at 8:22pm

Title: code only works when compiled with arduino IDE
Post by ebg on 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.


https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=spi_test.zip ( 11 KB | 4 Downloads )

Title: Re: code only works when compiled with arduino IDE
Post by Tim@Visual Micro on 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?

Title: Re: code only works when compiled with arduino IDE
Post by ebg on 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.

https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=compiler_output_003.txt ( 65 KB | 4 Downloads )

Title: Re: code only works when compiled with arduino IDE
Post by Simon@Visual Micro on 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...

Title: Re: code only works when compiled with arduino IDE
Post by Simon@Visual Micro on 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)

Title: Re: code only works when compiled with arduino IDE
Post by ebg on 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




Title: Re: code only works when compiled with arduino IDE
Post by Simon@Visual Micro on 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?

Title: Re: code only works when compiled with arduino IDE
Post by ebg on 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

Title: Re: code only works when compiled with arduino IDE
Post by ebg on Mar 25th, 2021 at 2:50pm
Here is the missing attachment ;)
Regards,
Gene
https://www.visualmicro.com/forums/YaBB.pl?action=downloadfile;file=comparison.zip ( 41 KB | 2 Downloads )

Title: Re: code only works when compiled with arduino IDE
Post by Tim@Visual Micro on 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"


ProjectProperiesOpt.png ( 10 KB | 2 Downloads )

Title: Re: code only works when compiled with arduino IDE
Post by ebg on Apr 6th, 2021 at 5: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.  :)
Gene.


Title: Re: code only works when compiled with arduino IDE
Post by Tim@Visual Micro on Apr 6th, 2021 at 6:19pm
Can you please restart VS then open the .ino using "File>Open>Arduino Project". Then see if eveything works okay?

VS Arduino » Powered by YaBB 2.6.12!
YaBB Forum Software © 2000-2024. All Rights Reserved.