Menu

software context switch

Help
dsula
2010-11-08
2012-12-17
  • dsula

    dsula - 2010-11-08

    Hi,
    I was wondering if somebody write some more information regarding the software context switch (context switch method 1). It is not clear to me why this method is better. I'm also not an adept C++ user and it's difficult for me to read and undesrtand the source code. So in particular I have the following questions:
    1. how does the software mehtod avoid unnecessary context switch as stated in the user manual on page 33 (v2).
    2. how is the software method saving stack space? I guess I conceptually don't understand how the software method works.
    3. Why do I need a software interrupt? Can't I simply CALL the ContextSwitcher_ISR using emulation code (e.g. push sr / call ISR) instead of using an interrupt?
    4. Is there a demo program available that uses the software method? E.g some code that responds to a few interrupt sources (ADC and buttons, RS232) and then performs context switch. I'm especially interested in the saving of unnecessary switches as stated in item 1 above.

    Thank you very much for any response.

     
  • dsula

    dsula - 2010-11-09

    Ok, I figured it out. The trick is that the software method performs a context switch AFTER the current ISR has completed. Whereas the direct switch method does perform the context switch inside the ISR.
    I wonder if with some clever assembly code it is possible to avoid the requirement for a software interrupt while still getting all the benefits? E.g. in direct mode, instead of CALLING the context switcher from within the ISR, why not JUMP to the switcher with only the return address left on the stack? I havent'  worked out the details yet, just a thought right now.

     
  • Harry Zhurov

    Harry Zhurov - 2010-11-29

    This forum is almost dead, as you can see. scmRTOS team members and many users often visit forum Electronix: http://electronix.ru/forum/index.php?showforum=188. I think, you can get answers on Electronix forum very quickly. Also, you can ask your questions Electronix forum in English.

     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.