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.

AM335x SYSBIOS Exception hooks

Other Parts Discussed in Thread: SYSBIOS

Hi,

Is there an example on how to create/use AM335x exception hooks?

There are examples for ARM M3 (with Exception module embedded in hwi module) and C64x (with a separate Exception module), but none of these appears to work for this ARM (AM335x). 

I know how to set an error hook but not how to make an exception hook work. 

I would be happy to be able to get out the exception information (PC, LR etc) the same way it now does when crashing in emulator, also when not connected with an emulator.

Thanks!

  • The RTOS team have been notified. They will respond here.
  • Thank you. I am looking forward to their response.

    Meanwhile, let me explain what I would ideally like to achieve:

    (1) The register contents including PC and LR for the crash scene (similar to what is printed out when emulating at the time of crash)

    (2) Whatever call stack might be retrievable - any examples for this would be appreciated

  • Utelia,

    I'm checking on this with the TI-RTOS team to see if this is available.

    Lali

  • I would appreciate any help on this topic.

    My current status is: I have in my cfg file the configurations like this:

    Hwi.dataAbortFunc = '&function';

    Hwi.prefetchAbortFunc = '&function';

    Hwi.reservedFunc = '&function';

    Hwi.undefinedInstFunc = '&function';

    Now, the "function" runs at the appropriate times, but I have two main issues:

    - Re-using TI code from Exception.c, I seem to be able to read some of the register information etc. which is pointed to by Exception_module-> ; however, I don't think I get that quite right as the register contents do not seem to make sense

    - It looks like I only had a limited time to run the "function" as it soon gets another exception and thus the "function" starts to run in a reset-loop like manner.

    This would indicate to me the feature is there, I would just need some more specifics to be able to use it properly.

    I am looking forward to receiving more advice. Thank you!

  • Would there be an update on this question? Is there any documentation available on how to configure the exceptions for AM335x?
  • I'm assuming you are referring to support on the CortexA processor on the AM335X. Please refer to the ti.sysbios.family.arm.exc.Exception module.

    If you have the .cfg file graphically opened, you can search for it by typing "except" in the "Available Products" window. You can select it and then include it (and configure it) graphically.

    Todd
  • Thanks, this helps. I think I mostly managed to make this configuration manually bu using the Hwi module (!?).

    However, the actual question is still unanswered: how to e.g. read the PC when running the exception routine? I am re-using the one I found in Exception.c, but it does not appear to have the correct code (as e.g. PC is showing as 0). Any advice on this? An example code for how to extract the register context in a user-defined function, would be good. Thank you.
  • Continuing to debug this, I think what I am seeing is:
    - my Exception handler might actually run correctly
    - however, before it gets to run, the SYSBIOS actually runs the default Exception handler (Exception_excHandler) at Exception.c

    How do I disable the default one, which prints to CCS console?
  • Hi!

    I had the same problem and found out that this works (at least on am571x)

    var Exception = xdc.useModule ("ti.sysbios.family.arm.exc.Exception");

    Exception.enableDecode = false;

    Exception.excHookFunc = "&exception_excHandler";

    Disable console prints and enable own exception handler.

  • I ended up re-writing the default Exception handler and re-building the (whole?) Sysbios (using the custom build option). Very good to also have your solution visible in this thread - it looks to me as the correct one. Tack ska du ha!