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.

SysBios "raiseHook" configuration

Other Parts Discussed in Thread: SYSBIOS, DM3730

Hi all,

I have added a hook function to the "xdc_runtime_Error.raiseHook" in SysBios configuration as below.

xdc_runtime_Error.raiseHook = "&myHook";

Below is my hook function in the source file.

Void myHook(Error_Block *eb)

{

    myPrintf("Error_getCode:%d, File:%s, Line:%d", Error_getCode(eb), site->file, site->line);

}

I am not using JTAG and "myPrintf" is a print function to my system log file.

Whenever there is an exception error in SysBios, "myHook()" function is getting called and prints the above print message to my log file.

Below are my issues and questions:

1. I am not getting any print for the variable "site->file". I see that the printed string is an empty string. I read somewhere in SysBios documentation that SysBios intentionally provides empty string to the variable "site->file" to save space. But, I do see the line number of error. Here is my question. Is there a way to enable these file names?

2. Is there any other way to get more information about SysBios error into "myHook" function?. For example, information about which "file and line" in my source file caused the SysBios exception error.

Thanks and Regards,

Syam

  • Syam,

    There is a discussion of the removal of the file name strings under the topic “Controlling File Name Strings” here: http://rtsc.eclipse.org/docs-tip/Integrating_RTSC_Modules

    In your myPrintf() call I think there are some errors.  Shouldn’t “site->file” be “eb->site.file”?  And “site->line” be “eb->site.line”?  Is this the problem?  Or was this just a typo in the forum post?

    Also, for #2, which device are you running on?  Here is a FAQ note that may be of some help: http://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs#4_Exception_Dump_Decoding_Using_the_CCS_Register_View

    If this doesn’t help let me know and I’ll look into it more…

    Scott

  • Scott,

    Thank you for your reply. I am sorry for the confusion. I forgot to include the "site" variable declaration. I rewrote the function below.

    =================

    Void myHook(Error_Block *eb)

    {

     Types_Site *site = Error_getSite(eb);

     myPrintf("Error_getCode:%d, File:%s, Line:%d", Error_getCode(eb), site->file, site->line);

    }

    =================

    I looked into “Controlling File Name Strings” topic. I tried this option, but I am not successful in getting the file name information. As mentioned in the topic, Below is the piece of code I included in my header files.

    =================

    #define xdc_FILE __FILE__

    #include <xdc/runtime/xdc.h>
    #include <xdc/runtime/Assert.h>
    #include <xdc/runtime/Error.h>
    =================

    Is there anything I am missing in above piece of code?. Please let me know of your suggestions.

    Regarding your question on #2, I am using DM3730 device. I looked at this topic '"Exception_Dump_Decoding_Using_the_CCS_Register_View", but I haven't tried this yet as I am still working on the above filename issue.

    Thanks,
    Syam

  • Syam,

    OK, thanks.  Yes, I think you are doing the right thing with the #define xdc_FILE. 

    I’ll ask some others for help with this, and then get back to you…

    Scott

  • Syam,

    The key is that the module that is raising the error needs to have been built with xdc_FILE set to __FILE__.  By default, xdc_FILE will default to NULL, which means site->file will indeed be NULL when your hook is called.

    If you are using version SYS/BIOS v6.32 or later, the easiest way to do this is to use the custom build flow (which rebuilds/optimizes the relevant SYS/BIOS modules as part of the application build), and specify the proper value for xdc_FILE as a define for the compiler.  For example, you can add this to your application configuration script:

    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts += " -Dxdc_FILE=__FILE__ ";

    The custom build flow is described in Section 2.3.3 “Compiler and Linker Optimization” in Bios_User_Guide.pdf.

    If you are using an earlier version of SYS/BIOS that doesn’t support the custom build then you’ll need to rebuild the SYS/BIOS libraries, with the same define added to the build options.  This rebuild procedure is described in Appendix B of the same user’s guide.

    Are you using v6.32 or later? Can you try modifying the custom build opts?

    Thanks,
    Scott

  • Scott,

    I am using latest tools: "SysBios 6.32.4.49 with CCS 5.1.0". I have added the below lines to the bios config script.

    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts += " -Dxdc_FILE=__FILE__ ";

    This change solved my problem. I am able to see file name information in my print messages. Thank you so much for your help.

    I am having another issue with this custom build of SysBios.

    I have a "src/" folder in my project with all my source files. When I do the SysBios custom build, SysBios is taking "../src" as a default path and stores all the generated SysBios files in this "src" folder. When I looked at the "makefile.libs" file (which is also a SysBios generated file), I see the below path.

    GEN_SRC_DIR ?= ../src

    Here is my question: Where should I change the path for "GEN_SRC_DIR"?

    I want to change this path, because my project build fails when I do rebuild the project when my source files are in the same directory as SysBios generated files ("../src" directory). When I build the project for the first time, my project builds fine. But, the problem happens when there are SysBios generated files in my "../src" directory.

    Thanks,

    Syam

  • Syam,

    OK, great! 

    To change the default custom build subdirectory you can add something like this to your config script:

    BIOS.libDir = “newDir”;

    You can change newDir to whatever subdirectory name you want.

    Scott

  • Scott,

    It worked. Thank you for your help.

    I tried to search for "BIOS.libDir" in SysBios users guide and also in CCS help. I couldn't find anywhere.

    Is there a link or document where I can get information about these BIOS options for the cfg script? I am asking this for my future reference.

    I have started looking into the topic http://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs#4_Exception_Dump_Decoding_Using_the_CCS_Register_View  to solve my second issue, as I mentioned in my first post above. My goal in this issue is to find the file and line in my source file that caused the SysBios to raise the error. I will post my questions after looking into this topic.

    Thanks,

    Syam

  • Syam,

    OK, good.  

    You’re right, there isn’t any documentation on this.  For the moment, I added an FAQ item to the SYS/BIOS FAQs here: http://processors.wiki.ti.com/index.php/SYS/BIOS_FAQs

    I also added an item about specifying xdc_FILE so the file name will be available to the Error raise hook.

    Thanks,
    Scott

  • Hi

    Adding

    BIOS.libType = BIOS.LibType_Custom;
    BIOS.customCCOpts += " -Dxdc_FILE=__FILE__ ";

    worked for me too.

    Thanks a bunch.

    Cheers2u