Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
19 years ago

Newbie Help - ISR Context ptr vs. Global

Hello,

I'm working on my first Nios II project and am trying to figure out what advantage there is to using an ISR's context pointer. Typically with all my other MCU projects, I simply use global variables. Does the compiler optimize the context pointers better or is this just a stylistic approach?

Thanks a bunch,

Kevin

(P.S. Sorry if this has been discussed in other threads... I couldn't find them when I searched)

3 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    When you use C++ to develop your code, you'll need the context pointer to pass object pointer to ISR. Because ISR should be static.

    FYI.
  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Thanks, I get that. Then do you have any suggestions as to how to put the static ISRs into seperate source files? As they are static, they will not compile without error due to the scope of a static var/function. I've (obviously incorrectly) gotten around this in the past simply by not declaring them static.

    Regards,

    Kevin

    --- Quote Start ---

    originally posted by david_cai@Jul 17 2006, 09:20 PM

    when you use c++ to develop your code, you'll need the context pointer to pass object pointer to isr. because isr should be static.

    fyi.

    <div align='right'><{post_snapback}> (index.php?act=findpost&pid=16971)

    --- quote end ---

    --- Quote End ---