This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

C66x - Exception_handler abortFlag

Guru 10750 points
Other Parts Discussed in Thread: SYSBIOS

Hi,

How can I influence the abortFlag in the Exception_handler function (bios_6_34_02_18\packages\ti\sysbios\family\c64p\Exception.c), I want to handle the external exceptions and than go back to the program (I added my external exception function to the exception hook),

I'm using CCSv5.3.0.00090, SYS/BIOS 6.34.2.18, XDCtools 3.24.5.48 and CGT 7.4.1

Thanks,

HR

  • You need to set the Exception.returnHook in the *.cfg file or use the runtime API: Exception_setReturnPtr().

    This will then return to the hook function that you specify.

    Judah

  • Hi Judah,

    OK, do I need to do anything in the the Exception return function? what currently happens is when I have an external exception I'm getting to the external exception function I have set but than I'm getting to the Error_raise at the end of the Exception_handler function as the abortFlag is true, what should I change in the Exception return function to override this? is there any example fo this?

    Thanks,

    Haim

  • If the Exception return function is set then the "abortFlag" will be false.  The Exception then would return into the Exception return function that you set.  At that point, you can do whatever you like.

    FYI: BIOS does not "really" support return from Exceptions in the sense that your program should not continue to run.  We treat exception as fatal and you should just cleanup or start over and not try to continue with program execution.  We can't guarantee the state of the system once an exception occurs.

    Judah

  • Hi Judah,

    OK, I agree that usually the program should not continue but there are some external exceptions that the program can continue an the exception is to notify me that there is some issue with the program,

    Thanks,

    Haim

  • Hi Judah,

    I added the Exception return function which solved the "abortFlag" but than I'm always in the return function as b10 holds the Exception return function address, should I do "B NRP" in the Exception return function or there are more things to do before?

    Thanks,

    HR

  • HR,

    This is why I say BIOS does not support return from an exception.  Doing a "B NRP" in your Exception return is not sufficient because the state of the registers has been changed from when the exception first occurred.  Now technically it could be restored since we've saved away the original register values onto the ISR stack but even then I can't say for sure that this works since we do not test such scenarios.

    Why are you trying to continue program execution after the exception?  Are you purposely generating the exception to do something or is there a problem that you need to debug and find out who's causing the exception?

    Judah

  • Hi Judah,

    Yes, I did the exception purposely and I wanted to get back to the program, but still there are external exceptions like memory protection or missed Interrupt where I will record the issue but I still want to continue with the program, is there a procedure to recover the register's or I should do that during the Exception return hook procedure before the "B NRP",

    Thanks,

    HR

  • HR,

    There is no procedure provided by BIOS.  My recommendation would be if you really are trying to do this then, plug in your own Exception handler and don't use the one BIOS plugs or better yet, since we provide our source code, simply modify the BIOS Exception handler to do what you want.

    Judah

  • Hi Judah,

    OK, it will be great if TI will add such procedure in the future as there are places where the user will want to proceed with the application after exception,

    Many Thanks,

    HR