This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

inline assembly

Hi friends,

I am using inline assembly in my ISR routine. When i observe the generated sorce file. AT the start of ISR the compiler generates a code to save the ACC, DPL, DPH etc and the general purpose regi used by routine. Now i want to avoid the generation of code to save device context. I am using a saperate function to save and restore context. I want this becuse i am doing task switching in ISR so the restored context will be different then the saved one. I know that other compiler provides this facility by using control directives like "NAKED". Is there any such directive in KEIL compiler so that i can avoid generation of context save and restore by the compiler?

Thank you,
Dhaval Shah

Parents Reply Children
  • I am writing a task switcher so naturally context switcher will be involved. After replies from all of you i have decided to write the saperate ISR in assembly with its own context save and restore sections and task switching.I am doing it for the first time and i will face some problem but now lets do it. This is the best solution i have.
    Thank you all. Your more suggessions are welcome.

    Dhaval Shah

  • "Your more suggessions are welcome."

    If you are not doing this as an academic exercise my advice would be to think carefully whether a task switcher is really required for your project. If you can avoid using one you will have one less thing to debug.

  • Ya i am now thinking of using a differrent scheme and i think it will work which will not require task switcher.

  • "If you can avoid using one you will have one less thing to debug."

    The thing is that bugs in your task switcher can manifest themselves as very peculiar & bizarre behaviour in your tasks which can be very hard indeed to track down.

    So avoiding a task switcher not only relieves you of denugging the task switcher itself, but also elimitates another source of problems in the rest of your code!