Replies: 6 comments
-
At the preprocessor level it is an undefined constant because preprocessor can't see names from enums. But it diesn't need to get resolved at that time soit;'sfine. When it comes time to actually compile them, it can see the enums so everything works, that name is defined in the microchip-supplied io header files. And I have no idea what you are talking about with "a similar problem with" what you claim, - I don[t understand how a similar problem could possibly come about with ADC0.SAMPCTRL = 128. That doesn't depend on anything in the core, it's purely from the io headers. You appear to not have access to the io headers. This is a problem with your build environment using an outdated toolchain instead of the updated toolchain supplied by the core. Which is why we supply that with the core, per json file. I don't know VSCode, but it sounds like a configuration issue there, not something we have control over.
|
Beta Was this translation helpful? Give feedback.
-
(and yes, i know that many of those show as azduino4a - only windows version of 4a was bad. |
Beta Was this translation helpful? Give feedback.
-
The problem is as you said that the io.h or some file is not being read when VS Code is linting (correct term?) but at compile time everything resolves okay. Without being able to resolve the define, autocompletion does not work and it appears there are errors where none actually exists. To be fair I've had similar issues with standard cores like the Mega2560 so its likely a problem in VS Code's Intellisense feature or the Arduino extension. Including the file
So that got me thinking about VS Code's Arduino extension. When you initialize a project it creates a file called c_cpp_properties.json This is the relevant section:
But I can't force include |
Beta Was this translation helpful? Give feedback.
-
Thething is that the Arduino.h file itself should be core_devices.h which should be pulling in avr/io.h, which in turn should be o pulling in the right io header and it sounds luike it does for compiling, but isnt fully resolving them for linting >.< this seemsto be a VS code issue that I can't be particularly helpful The IO headers were meant to be pulled in by including io.h and then from there it sorts out what file to include.\ |
Beta Was this translation helpful? Give feedback.
-
Does not appear to be a defect in the core but in VScode. Moved to discussions because not an action item for core |
Beta Was this translation helpful? Give feedback.
-
Oh - read this again, and though - maybe this is related to the fact that the preprocessor can't see the _gc constants? The preprocessor can only see things that are #defined. (you can't use them to test whether a variable exists either). But that's fine, they are substituted in as text, find/replace style, and during the actual compile process, they are defined and all is well. The fact that you can't do #if defined(PERIPHERAL_OPTION_SETTING_gc) is very annoying; there is no shortage of cases where that is exactly what you want to test in core libraries. |
Beta Was this translation helpful? Give feedback.
-
It still compiles properly though. I think this affects all the reference macros. I get a similar problem with things like
ADC0.SAMPCTRL = 128
for instanceBeta Was this translation helpful? Give feedback.
All reactions