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.

CC2642R: How to add an exception hook function

Part Number: CC2642R
Other Parts Discussed in Thread: SYSCONFIG, SYSBIOS

In SDK 5.10.00.48 it is possible to add a hook function to handle CPU exceptions by editing the TI-RTOS configuration file. This has worked great for us so far.

We are now upgrading to the shiny new SDK 6.40.00.13 and CCS 12.2.0. The manually editable TI-RTOS configuration file is gone, and SYS/BIOS configuration must be done in the SysConfig tool. But it seems that there is no option in SysConfig 1.15.0 where a custom exception hook function could be plugged in.

Furthermore, the TI-RTOS7 source file containing the CPU exception handlers declares the Hwi_excHookFunc pointer as const NULL; thus it's not even possible to work around the issue by installing a hook function in code (see kernel/tirtos7/packages/ti/sysbios/family/arm/m3/Hwi.c, line 136):

const Hwi_ExcHookFunc Hwi_excHookFunc = NULL;

In CC1352P7: Custom exception handler define there is a suggestion to use the error hook function instead. But that is a less-than-ideal solution as the original exception information is not available there.

Short of patching the Hwi.c file manually Nauseated face is there currently any way to install an exception hook function?

  • Hi Esa,

    Hwi_excHookFunc is still available from Hwi.h as a TI-RTOS7 API.  Are you able to manually edit the SysConfig file in a Text Editor to add the functionality you require?  I will contact the TI-RTOS7 Software Development Team to determine what options are available.

    Regards,
    Ryan

  • Hi Ryan,

    I tried adding the highlighted line by hand, but the build failed with the error message "Error: unknown property: excHookFunc":

    const Hwi              = scripting.addModule("/ti/sysbios/family/arm/m3/Hwi", {}, false);
    Hwi.enableException = false;
    Hwi.excHookFunc        = "Main_hwiExceptionHook";

    Support for the Hwi.excHookFunc property appears to be missing from SysConfig 1.15.0, but the TI-RTOS7 API seems dysfunctional as well. See the code I pointed at in my previous message -- the declaration of the Hwi_excHookFunc pointer makes no provision for an override by SysConfig.

    However, the Hwi.excHandlerFunc property is indeed supported by the SysConfig core, although not by the SysConfig GUI. I was able to hook up a custom handler (adapted from the Hwi_excHandlerMin() function) by adding the following line in the SysConfig file:

    Hwi.excHandlerFunc     = "Main_hwiExceptionHandler";

    I was worried that SysConfig might discard the added line if additional changes are made and saved in the GUI, but happily the line was preserved.

    While this resolved our issue, I'd like to hear if you get any feedback on this from the RTOS development team.

    Thanks,
    Esa