VS Arduino
>> >> unusual vsarduino.h issue
https://www.visualmicro.com/forums/YaBB.pl?num=1569762585

Message started by John Fitter on Sep 29th, 2019 at 1:09pm

Title: unusual vsarduino.h issue
Post by John Fitter on Sep 29th, 2019 at 1:09pm
Using VS2015 and Arduino 1.6/1.8
vsarduino.h defines F_CPU and GCC_VERSION and both of these are recognized by Intellisense, both in the code window and in solution explorer. The compiler however only recognizes F_CPU. Any reference to GCC_VERSION throws a compiler error (this is just dummy code for testing)
[code]TBWFW.ino: 210:29: error: 'GCC_VERSION' was not declared in this scope
   GCC_VERSION \ 10000, (F_CPU % 10000) \ 100, F_CPU % 100)[/code]
Curious - does anyone have any idea why?
Also, forward slashes were converted to back slashes in the error message - why???
I am not new to this but this one has me stumped....

Title: Re: unusual vsarduino.h issue
Post by Visual Micro on Sep 29th, 2019 at 1:29pm
the vsarduino file is to bump start the Visual Studio C++ intellisense for Arduino which does not know about the GCC compiler tool that will be used.

The compliation uses the real tool chain which is resonposible to setting many internal #defines.

It is possible to obtain an accurate list of defines for intellisense but that requires running a tool chain. exe in background which is quite slow. So we plan to save the info after each build and use that instead of forcing generic defines. That will bring othe issues because the Vc++ intellisense does not like GCC. Therefore we also need to switch to a new intellisense engine that MS are working on.

So for now there is not a perfect correlation between intellisense and real tool chains especially when working with non-arduino lower level syntax.

Title: Re: unusual vsarduino.h issue
Post by John Fitter on Sep 29th, 2019 at 2:37pm
Solved - sort of.
__GNUC__ etc. are defined for GCC and these are used to define GCC_VERSION, but no matter how hard I try I cannot find any instance of a definition of GCC_VERSION.
I can define it myself in terms of __GNUC__ etc. and everything works.
GCC_VERSION is defined in vsarduino.h but this is only to make Intellisense happy.
Big waste of time. Now back to real work....

Title: Re: unusual vsarduino.h issue
Post by John Fitter on Sep 29th, 2019 at 2:41pm
Thanks for your reply. You are right - Intellisense does not like GCC too much.
btw Intellisense does not like __GNUC__ etc. either, so I had to add them to vs-intellisense-fix.h
At least now nothing is complaining.

Title: Re: unusual vsarduino.h issue
Post by Visual Micro on Sep 29th, 2019 at 2:55pm
This is useful it is a difficult area that changes for the different hardware

I would be useful to know what hardware (board/platform) you are using and what you removed or changed from the standard vsarduino.h

Thanks very much


Title: Re: unusual vsarduino.h issue
Post by John Fitter on Sep 29th, 2019 at 3:36pm

Tim@Visual Micro wrote on Sep 29th, 2019 at 2:55pm:
This is useful it is a difficult area that changes for the different hardware

I would be useful to know what hardware (board/platform) you are using and what you removed or changed from the standard vsarduino.h

Thanks very much


I am using my own design board with an Atmega169PA and Optiboot bootloader.
I did not alter vsarduino.h but here is my vs-intellisense-fix.h

Code (c++):
#if defined(_VMICRO_INTELLISENSE)
#define pgm_read_byte_near(address_short) uint8_t()
#define __GNUC__             5
#define __GNUC_MINOR__       4
#define __GNUC_PATCHLEVEL__  0
#endif

This keeps Intellisense happy.

In my program I just use the predefined macros and they just work, eg.

Code (c++):
ConsoleMsg(INFO,  PSTR("Compiled:   " __DATE__ " at " __TIME__ ", GCC v%d.%d.%d"), __GNUC__, __GNUC_MINOR__, __GNUC_PATCHLEVEL__);


I also tried defining the following and it worked fine too;

Code (c++):
#define GCC_VERSION ((__GNUC__*10000)+(__GNUC_MINOR__*100)+__GNUC_PATCHLEVEL__))

but as I wrote in the earlier post I could not find this definition anywhere in my GCC installation, so I had to define it myself. If it is not defined anywhere then it probably does not belong in vsarduino.h


Title: Re: unusual vsarduino.h issue
Post by Visual Micro on Sep 30th, 2019 at 12:34pm
Thanks, we will update the defs. The vsarduino.h has the same purpose as intellisense-fix.

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