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.

Error_raiseX Error Messages -- Determining Module Number

Other Parts Discussed in Thread: AM3358, SYSBIOS

Gentlemen,

I'm on a Windows 7 64-bit PC, developing code for an AM3358 on the AM335x Starter Kit, using CCS Version: 6.1.2.00015, and have recently installed Processor SDK RTOS AM335x v2.00.02.11, and SYS/BIOS 6.45.01.29  (installs with the PDK) released just about a week ago or so, and I am using XDCtools 3.32.00.06.

I am doing some test projects in order to get up to speed with TI-RTOS (SYS/BIOS with the PDK).

In my last few projects, here and there I ran into an error message in the Console I/O window about something that happened.  In one case it was input clock speed on a timer, out of stack space on another, and missing heap space on another.  In any case, they usually ended up being issued from the Error_raiseX() function in

C:\ti\xdctools_3_32_00_06_core\packages\xdc\runtime\Error.c


I looked closely at the source code and tried to trace down the answer to my question (#1 below), but I get lost when some of the source code seems to be only in a binary library (and this may be my own incorrect interpretation).  A specific:  in Error.c::Error_policyDefault()  function, it appears the answer to my question below MIGHT be in the Error_setX() function where it takes a  CString 'file'  variable and converts it into a number for the error message.  However, when I try to trace down  the source code, "Error_setX"  seems to be translated (by a #define) to  "xdc_runtime_Error_setX__E", and I have not been able to find ANY function definition for  xdc_runtime_Error_setX__E()  anywhere in my TI source code that I have installed....

So I am coming here to ask.

1.

The below screenshot is an example error message.  (I caused this one on purpose just to provide a live example for this question.)  In 2 places in this message there is reference to a module number.  Specifically, the first example is:

"[CortxA8] {module#9}: line 52: error {id:0x30000, args:[0x0, 0x20]}
Exception occurred in ThreadType_Main.
..."

Sometimes it has been easy to determine which module called Error_raiseX() and sometimes it hasn't.  So would be very helpful here is if there is a standard way of translating module number  (e.g. in the above "{module#9}")  to the .C source file that it is referring to (that contains line 52 named in the error message)?

Here is the screenshot that contains the whole error message:

2.

When a function traces down to (e.g. in Error.h) code like this:

/* setX__E */
#define xdc_runtime_Error_setX xdc_runtime_Error_setX__E
xdc__CODESECT(xdc_runtime_Error_setX__E, "xdc_runtime_Error_setX")
__extern xdc_Void xdc_runtime_Error_setX__E( xdc_runtime_Error_Block *eb, xdc_runtime_Types_ModuleId mod, xdc_CString file, xdc_Int line, xdc_runtime_Error_Id id, xdc_IArg arg1, xdc_IArg arg2 );

How can I trace this down to the actual source code?  Is it indeed present in my installation?  Under some other name, perhaps?  (I have been scanning for the string inside *.C, *.H, *.S and *.ASM files.)

I DID find the above string (xdc_runtime_Error_setX__E) in a library file that it is no doubt linking to:

<bios>\packages\gnu\targets\arm\rtsv7A\lib\gnu.targets.arm.rtsv7A.aa8fg

but where is the source code that defines what it does???

Kind regards,
Vic

  • Hi Victor,

    To answer your first question, BIOS performs this module translation automatically you just need to enable it within your .cfg file.

    The following should help you debug your issue further, but these are generally disabled to conserve memory.

    /* ================ Text configuration ================ */
    var Text = xdc.useModule('xdc.runtime.Text');
    /*
     * These strings are placed in the .const section. Setting this parameter to
     * false will save space in the .const section. Error, Assert and Log messages
     * will print raw ids and args instead of a formatted message.
     *
     * Pick one:
     *  - true (default)
     *      This option loads test string into the .const for easier debugging.
     *  - false
     *      This option reduces the .const footprint.
     */
    Text.isLoaded = true;
    //Text.isLoaded = false;
    
    
    /* ================ Task configuration ================ */
    var Task = xdc.useModule('ti.sysbios.knl.Task');
    /*
     * Check task stacks for overflow conditions.
     *
     * Pick one:
     *  - true (default)
     *      Enables runtime checks for task stack overflow conditions during
     *      context switching ("from" and "to")
     *  - false
     *      Disables runtime checks for task stack overflow conditions.
     */
    Task.checkStackFlag = true;
    //Task.checkStackFlag = false;
    
    /*
     * Enable logs in the BIOS library.
     *
     * Pick one:
     *  - true (default)
     *      Enables logs for debugging purposes.
     *  - false
     *      Disables logging for reduced code footprint and improved runtime
     *      performance.
     */
    BIOS.logsEnabled = true;
    //BIOS.logsEnabled = false;
    
    /*
     * The SYS/BIOS runtime is provided in the form of a library that is linked
     * with the application. Several forms of this library are provided with the
     * SYS/BIOS product.
     *
     * Pick one:
     *   - BIOS.LibType_Custom
     *      Custom built library that is highly optimized for code footprint and
     *      runtime performance.
     *   - BIOS.LibType_Debug
     *      Custom built library that is non-optimized that can be used to
     *      single-step through APIs with a debugger.
     *
     */
    //BIOS.libType = BIOS.LibType_Custom;
    BIOS.libType = BIOS.LibType_Debug;
    
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    /*
     * Enable asserts in the BIOS library.
     *
     * Pick one:
     *  - true (default)
     *      Enables asserts for debugging purposes.
     *  - false
     *      Disables asserts for a reduced code footprint and better performance.
     */
    BIOS.assertsEnabled = true;
    //BIOS.assertsEnabled = false;
    
    /* ================ Defaults (module) configuration ================ */
    var Defaults = xdc.useModule('xdc.runtime.Defaults');
    /*
     * A flag to allow module names to be loaded on the target. Module name
     * strings are placed in the .const section for debugging purposes.
     *
     * Pick one:
     *  - true (default)
     *      Setting this parameter to true will include name strings in the .const
     *      section so that Errors and Asserts are easier to debug.
     *  - false
     *      Setting this parameter to false will reduce footprint in the .const
     *      section. As a result, Error and Assert messages will contain an
     *      "unknown module" prefix instead of the actual module name.
     */
    Defaults.common$.namedModule = true;
    //Defaults.common$.namedModule = false;
    
    
    
    /* ================ Error configuration ================ */
    var Error = xdc.useModule('xdc.runtime.Error');
    /*
     * This function is called to handle all raised errors, but unlike
     * Error.raiseHook, this function is responsible for completely handling the
     * error with an appropriately initialized Error_Block.
     *
     * Pick one:
     *  - Error.policyDefault (default)
     *      Calls Error.raiseHook with an initialized Error_Block structure and logs
     *      the error using the module's logger.
     *  - Error.policySpin
     *      Simple alternative that traps on a while(1) loop for minimized target
     *      footprint.
     *      Using Error.policySpin, the Error.raiseHook will NOT called.
     */
    Error.policyFxn = Error.policyDefault;
    //Error.policyFxn = Error.policySpin;
    
    /*
     * If Error.policyFxn is set to Error.policyDefault, this function is called
     * whenever an error is raised by the Error module.
     *
     * Pick one:
     *  - Error.print (default)
     *      Errors are formatted and output via System_printf() for easier
     *      debugging.
     *  - null
     *      Errors are not formatted or logged. This option reduces code footprint.
     *  - non-null function
     *      Errors invoke custom user function. See the Error module documentation
     *      for more details.
     */
    Error.raiseHook = Error.print;
    //Error.raiseHook = null;
    //Error.raiseHook = "&myErrorFxn";
    
    /*
     * If Error.policyFxn is set to Error.policyDefault, this option applies to the
     * maximum number of times the Error.raiseHook function can be recursively
     * invoked. This option limits the possibility of an infinite recursion that
     * could lead to a stack overflow.
     * The default value is 16.
     */
    Error.maxDepth = 2;

    For your second question, that libraries source isn't shipped with our product as it's the run time support library for that target.

    Best,

    Alexander

  • Hi, Alexander!

    Thank you for the above. Regarding optional named modules in error messages: outstanding! That was very helpful. I tested it and indeed it provides a MUCH more helpful message:

    [CortxA8] xdc.runtime.Memory: line 52: out of memory: heap=0x0, size=32
    Exception occurred in ThreadType_Main.

    ...and...

    ti.sysbios.family.arm.exc.Exception: line 205: E_dataAbort: pc = 0x8000ece0, lr = 0x8003d85c.
    xdc.runtime.Error.raise: terminating execution

    ...respectively.

    Regarding not shipping source with the run-time support library for the AM3358 (AM335x), this seems to be a departure from the norm of having the library code not only local, but re-build-able as well (for the many reasons us developers need such things). Can you enlighten me about this? Are there any plans to ship the source code that you're aware of?

    Kind regards,
    Vic
  • Hi Victor,

    So we aren't currently planning on shipping the full source code for the GCC RTS library. At the moment we use the default newlib library, make certain changes, build and ship.

    However, for those wanting to edit the library and re-link their application with it, you may do so by viewing the patch file, containing the changes that we apply to the library, and add your own on top of them. The version information and patch file can be seen within the SYSBIOS manifest in your TIRTOS/SYSBIOS installation.

    Ex) C:/ti/bios_6_42_03_34/bios_6_42_03_34_manifest.html

    Best,
    Alexander
  • Nice. Thank you for this, Alexander!
  • Hi Victor,

    Just to clear up my last reply, the GCC RTS isn't shipped but the source code for the xdc runtime support library is. This is where you can find the source code for the Error Module that you previously asked about. This can be found in your xdctools installation:

    Ex) C:\ti\xdctools_3_32_00_04_core_eng\packages\xdc\runtime

    Also note that the short names, ie. Error_setX() are used in the file rather than the full names, xdc_runtime_Error_setX() which are expanded during the build process.

    Apologies for any confusion this may have caused.

    Best,

    Alexander

  • That is VERY helpful!! Thank you, Alexander! :-)