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.

Bypassing exception handling routine

Other Parts Discussed in Thread: 4430, SYSBIOS

I am trying to handle a series of exceptions thrown by various cache and bus situations. I have installed hooks in the config file and they are getting called as required. Unfortunately, by the time they are called, somewhere down the line in Exception.c, the stack pointer is mangled  and is different than when the exception handler was entered, so I can't dump the correct stack. I would like to just store off the stack into some static location at the outset of the excursion into Exception_handler(), but to do this I have to edit and re-compile the file, Exception.c. How do I go about doing such a thing?

relevant entities

bios 6_33_05_46

omap 4430

  • We've saved away the A and B registers away.  The original stack pointer would be B14.  You could try to use this through the Exception_getLastStatus().

    Otherwise, you would need to write your own Exception handler that overrides the BIOS default

    Judah

  • The latter course seems desirable, although I would merely rewrite what's there to reflect our own debug output and would add a stack dump. My question is how best do I rebuild the relevant exception.c library after I have re-coded it?

    Thanks for speedy reply.

  • Richard,

    FYI: The code which actually modifies the stack is not in the exception.c but rather in the exception_asm file.

    I think what you should do is write your own exception handler which can be modeled after the one in the .c file and include it into your build.  [Not part of the BIOS build].

    Then in your *.cfg file do the following:

         Hwi.plugMeta(1, '&Your function');

    Don't even include the Exception module into your *.cfg file.

    Basically this will replace the Exception dispatch handler with yours.  I'm hoping the Hwi.plugMeta works...I haven't done it myself but it should work.

    Judah

  • I found the area where Exception_module, the keeper of the system state (stored, as you said, in Exception.asm) is kept. As it happens it gets clobbered by System_printf which explains why I am getting the wrong stuff from it...  exceptionHandler doesn't call it's first hook till after the print. 

    So I went into the cfg file and asserted <Exception.enablePrint = false;> which it did not reject, but it did not turn off the print either.

    The SP which is also B15 is unmolested however, so I get my stack dump.

    As to Hwi.plugMeta, my cfg code gen tool rejects it as unknown. I tried Hwi_dispatch but that won't handle interrupt vector 1. Do you know of any other way to rewrite the hwi vector to point elsewhere?

  • Hwi.plugMeta is specific to the c64+ target so you would need to do:

         var Hwi = xdc.useModule("ti.sysbios.family.c64p.Hwi");
         Hwi.plugMeta()

    Judah

  • Hi.

    I've got the same problem with my TIVA C129 xnzad.

    I'd like to write my exception handler and if possibile to avoid the BIOS stop, but continue working.

    Is it possible?

    Thanks in advance
    Marco C
  • You should open a new forum thread. "Answered" threads get ignored generally.

    Having said that, you can plug your own exception handler in but "continue working" may be a bit hard to achieve.

    Assuming you haven't explicitly relocated the vector table in your config script, you can overwrite the summary hardfault vector by writing the address of your exception handler to location 0x20000008. If you initialize this in main(), then any exception that occurs afterwards will vector directly to your exception handler. The details of handling and returning from a cortexM exception are left to you.

    Alan