Forum Discussion
Altera_Forum
Honored Contributor
20 years agoNewbie 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
Honored 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
Honored 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 ---
- Altera_Forum
Honored Contributor
you can define the static ISR in the corresponding class.