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.

AM5728: RTOS exception handler

Part Number: AM5728

Hi

I'd like to install exception hook that stops current task and returns normally from exception handler instead of _exit.

I installed a hook via Exception.excHookFunc. tried to set priority (-1) to exc->threadHandle from hook, or send a message to another task and do it  (set -1 priority) from  a task context.

No luck.

Is there any recommendation/example for this? How do I stop the  task and recover from exception.?

Best regards

Rasty

  • We do not support recoverable exceptions in the current design. The main use for the hooks would be to dump the context to FLASH or console or somewhere for post-mortem before reboot (branch to c_int00 or reset).

    There are some subtle issues with adding that special exception support. One of the issues is that exceptions are taken on a separate stack (not the original task stack). Another issue is that the exception could occur in a critial section (mutex, or interrupt disable block) and keeping sane system state could be tricky. If you know that the kernel and ISRs are safe, and you know that all your exceptions will happen outside critical regions, than something custom could be cooked up.

    I'm afraid we cannot provide any useful examples for this.

    Regards,
    -Karl-
  • Hi Karl,
    Thank you for the answer.
    Lets's leave decision about healthy of the system to the application.
    I need best efforts recovery.
    Even to write data t to FLASH (file) I need certain services of OS, which are not available in Exception context.

    In case of event a a task , not inside critical section, etc.
    I need to know
    1. How to stop task/thread from exception (alternative is sending a message/semaphore/whatever from Exception to high priority task that can complete stop)
    2. Leave exception context.


    Best regards
    Rasty
  • A couple guys on the kernel team are going to meet on Monday dig into this topic and make a prototype. We will get back to you mid/late next week.

    Regards,
    -Karl-

  • We just met with the developers. They are going to make an example that we can post later this week.

    One important question for you ... Are you using "SMP" mode?  Or just normal single-processor version of SYS/BIOS?

    Thanks,
    -Karl-

  • Hi Karl ,
    it is normal single core version , no SMP .
    thank you
    regards
    Carlo
  • Hi,

    I've attached a zip file with a couple of files that contain an exception handler that can return when the exception occurs in a Task thread.
    There's also a very simple test case in the zip which demonstrates this with an Undefined exception.  The exception handler itself should
    work with different types of exception.  Hope this helps.

    Judah

    tests.zip

  • Thank you very much  

    We will  test it after 4/10.

    Best regards

    Rasty

  • Rasty,

    Just a note: the toolset used by Judah may be different from what you used for Processor SDK RTOS AM57x 1.0.10 or 1.0.11 package. So you might see below errors when build the example Judah provided:
    - If you get undefined symbols for “asm”. Please replaced “asm” with "__asm__ __volatile__" in the source code.
    - If you get undefined reference to `initialise_monitor_handles', please make sure that rdimon library is linked in the CCS project (property ---->build---->GNU linker---->libraries).

    Regards, Eric
  • Hi
    I tested it and does exactly what I need!
    Thank you very much.

    Best regards
    Rasty