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) ISR(TIMERVECTOR) and Intellisense (Read 13787 times)
Jo Sto
Ex Member
*


ISR(TIMERVECTOR) and Intellisense
Aug 4th, 2012 at 3:28pm
Print Post  
ISR(TIMER4_OVF_vect)
{
     // Reinitialize Timer4's value
     TCNT4 = 0xff06;
     // TODO: Add your code here
     //wdt_reset();
     timer4_ticker_1kHz++;            
}

Code works correctly but Intellisense recognizes neither TCNT4 nor further variables. 

I change "ISR (TIMER4_OVF_vect) "on" void x (void)" Intellisense works (but of course not the code)
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #1 - Aug 4th, 2012 at 5:58pm
Print Post  
We use the standard vs c++ system for intellisense and it is not 100% perfect.

However to help plug some holes, the intellisense config and vs project are seperate/different systems to the compiler which is 100% arduino compatible.

So I can add or override any definitions we like for the intellisense. Can you suggest what definition would fix this? If so we will add to the next release.

Alternatively would it be a useful feature to allow you to include a .h that is forced into the vs intellisense yet ignored during compliation? (The file could be tucked away in the /.vmprogram folder under your sketch). This might be a more flexible option?
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: ISR(TIMERVECTOR) and Intellisense
Reply #2 - Aug 11th, 2012 at 10:05am
Print Post  
it seems that intellisense sees multiple (3) versions of the ISR macro (detected with visual assist x).

my temporary workarrond:

putting the ISR code in a inline functon and calling it from the ISR. Produces same code(size) (inline!), but intellisense works.
ISR must be at end of the file. 


Code
Select All
inline void isr_code(void)
{
// Reinitialize Timer4's value
     TCNT4 = 0xff06;
     // TODO: Add your code here
     //wdt_reset();
     timer4_ticker_1kHz++;   
}

ISR(TIMER4_OVF_vect)
{
   isr_code();          
}
 


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


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #3 - Aug 11th, 2012 at 11:54am
Print Post  
why does it see 3 versions? do you know their source?

one little question: do you have "show all arduino" files enabled? The reason why i ask is i am wondering if i need to setup the intellisense slightly differently based on the "show all files" setting. 

vs seems to behave differently when the source files are actually included in the project as opposed to being linked via includes
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: ISR(TIMERVECTOR) and Intellisense
Reply #4 - Aug 11th, 2012 at 1:51pm
Print Post  
show all arduino was disabled, but it is the same
source  isr macro is E:\arduino-1.0.1\hardware\tools\avr\avr\include\avr\interrupt.h
Code
Select All
#if defined(__DOXYGEN__)
/** \def ISR(vector [, attributes])
    \ingroup avr_interrupts

    \code #include <avr/interrupt.h> \endcode

    Introduces an interrupt handler function (interrupt service
    routine) that runs with global interrupts initially disabled
    by default with no attributes specified.

    The attributes are optional and alter the behaviour and resultant
    generated code of the interrupt routine. Multiple attributes may
    be used for a single function, with a space seperating each
    attribute.

    Valid attributes are ISR_BLOCK, ISR_NOBLOCK, ISR_NAKED and
    ISR_ALIASOF(vect).

    \c vector must be one of the interrupt vector names that are
    valid for the particular MCU type.
*/
#  define ISR(vector, [attributes])
#else  /* real code */

#if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)
#  define __INTR_ATTRS used, externally_visible
#else /* GCC < 4.1 */
#  define __INTR_ATTRS used
#endif

#ifdef __cplusplus

#  define ISR(vector, ...)            \
    extern "C" void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \
	void vector (void)

#else

#  define ISR(vector, ...)            \
    void vector (void) __attribute__ ((signal,__INTR_ATTRS)) __VA_ARGS__; \
    void vector (void)
#endif

#endif /* DOXYGEN */

 

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


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #5 - Aug 11th, 2012 at 1:58pm
Print Post  
okay would you mind trying to edit the .vsarduino.sketch.h file in the .vmprogram folder....

(NB: You can edit the .h as long as you don't click save on a sketch because that will then overwrite your .h changes)

1) First question

Is there some rubbish that vm is putting in the .h file that is causing this problem? Such as #define__DOXYGEN__. 

I've been trying to avoid intellisense errors by putting stuff in the .h but I don't really know what I am doing in this area. 


2) Second question

If I redefine stuff in the .h to help clear intellisense errors, both intellisense and F12 finds things in the .h when we don't want it to. Can you suggest a better way to "fix" these vs intellisense errors?

Thanks very much

It is possible that the changes in recent versions to include the avr include paths in correct order might have removed the need for some of the stuff that gores in the .h file?? It would be great to get this area of the system right!
« Last Edit: Aug 11th, 2012 at 1:59pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: ISR(TIMERVECTOR) and Intellisense
Reply #6 - Aug 12th, 2012 at 9:24am
Print Post  
to get working the ISR macro, if I comment __DOXYGEN__ out, the ISR-macro works
but after that  " interrupt( )/nointerrupt ( ) " not 
It seems to be a bigger lot...

The problem seems to be deeper at intellisense itself.
It  seems to ignore #ifdef, #undef and #elif directives.

so, for example,  via io.h all ioxxx.h are included and not specific for the active processor

http://connect.microsoft.com/VisualStudio/feedback/details/578151/syntax-colorin...
I almost think we must live with these small things, the rest works excellently but I continue to search.
Where can i find the template of the h.file?




 


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


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #7 - Aug 12th, 2012 at 3:46pm
Print Post  
Interesting article. Thanks for looking into this.

I forgot to say that vm also sets from preprocessor defs in the projects C++ options. If you want to see them but are unable to then just add a blank cpp to the project. 

There is some sort of vs bug that prevents the full C++ project options showing unless the project contains at least one cpp file.

A while back I tried experiementing between  preprocessor and .h include so at the moment there is no template to manage this.

Interstingly the article in your link mentions re-loading the project. You will notice that when the project structure changes, vm removes and re-adds the x.vsarduino.h. It is annoying but was the only way I could reliably force vs intellisense to detect changes. I think this is the same discussion as the one in the article.

I love it when ms say they have fixed something for the next version. What that means is that we buy their product and find the bugs, then they produce a new version which needs to be re-purchased. No doubt they meant VS 2012!! I have given up reporting problems to them Smiley

I will be happy to add some sort of template facility so that you or others can experiment. Can you suggest a  template format that would work for you?

Thanks again, it's been great having your help.
« Last Edit: Aug 12th, 2012 at 3:48pm by Tim@Visual Micro »  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #8 - Oct 28th, 2012 at 3:02am
Print Post  
Did you get a change to play with this in vs2012 yet?
  
Back to top
IP Logged
 
Jo Sto
Ex Member
*


Re: ISR(TIMERVECTOR) and Intellisense
Reply #9 - Oct 28th, 2012 at 8:07am
Print Post  
Works better, but not perfect
I sent a email with a screenshot
  
Back to top
 
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #10 - Oct 28th, 2012 at 3:01pm
Print Post  
Thanks, so was that test with or without DOXYGEN?
  
Back to top
IP Logged
 
Tim@Visual Micro
Administrator
*****
Offline


Posts: 12138
Location: United Kingdom
Joined: Apr 10th, 2010
Re: ISR(TIMERVECTOR) and Intellisense
Reply #11 - Oct 28th, 2012 at 11:00pm
Print Post  
This Topic was moved here from Installation & Troubleshooting [move by] Visual Micro.
  
Back to top
IP Logged
 
Page Index Toggle Pages: 1
Send TopicPrint