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.

Build problems following UIA upgrade to 2.x

Hi,

I've attempted upgrading the UIA version we use from uia_1_04_00_06 to uia_2_00_01_34, but our code fails to build with the new UIA version. The following line in our code:

LogSnapshot_writeNameOfReference(h, "Task_create: name=%s", name, std::strlen(name) + 1); 

Generates the following errors:

  /d/Dev/trunk/Src/Firmware/Sitara/Products/Stem/StemMain.cpp: In function 'void TaskCreateHook(ti_sysbios_knl_Task_Handle, xdc_runtime_Error_Block*)':
c:\TI\uia_2_00_01_34\packages\ti\uia\runtime\LogSnapshot__epilogue.h(142,61): error : 'snapshotId' was not declared in this scope
       (ti_uia_runtime_LogSnapshot_writeMemoryBlockWithIdTag(0,snapshotId, fmt, startAdrs, lengthInMAUs) )
                                                               ^
  /c/TI/uia_2_00_01_34/packages/ti/uia/runtime/LogSnapshot__epilogue.h:86:69: note: in definition of macro 'ti_uia_runtime_LogSnapshot_putMemoryRange'
        (LogSnapshot__LOGMEMORYFXN(LogSnapshot__LOGOBJ, (evt), (mid), (snapshotId), (fileName), (lineNum), (fmt), (startAdrs), (lengthInMAUs)))
                                                                       ^
  /c/TI/uia_2_00_01_34/packages/ti/uia/runtime/LogSnapshot__epilogue.h:142:6: note: in expansion of macro 'ti_uia_runtime_LogSnapshot_writeMemoryBlockWithIdTag'
       (ti_uia_runtime_LogSnapshot_writeMemoryBlockWithIdTag(0,snapshotId, fmt, startAdrs, lengthInMAUs) )
        ^
  /c/TI/uia_2_00_01_34/packages/ti/uia/runtime/LogSnapshot.h:358:42: note: in expansion of macro 'ti_uia_runtime_LogSnapshot_writeNameOfReference'
   #define LogSnapshot_writeNameOfReference ti_uia_runtime_LogSnapshot_writeNameOfReference
                                            ^
  /d/Dev/trunk/Src/Firmware/Sitara/Products/Stem/StemMain.cpp:40:2: note: in expansion of macro 'LogSnapshot_writeNameOfReference'
    LogSnapshot_writeNameOfReference(h, "Task_create: name=%s", name, std::strlen(name) + 1); 
    ^

Looking into UIAs code, it seems the writeNameOfReference function in new UIA has few issues:

  1. There is a confusion between refId and snapshotId names.
  2. In UIA 1.x this function generated a record with ti_uia_events_UIASnapshot_nameOfReference event type, while in UIA 2.x it attempts to generate record with ti_uia_events_UIASnapshot_memoryRange type. Won't that effect/break the CCS System Analyser functionality?

Looking forward for your guidance on how fix this build problem.

Best regards,
Vasili

  • Hi Vasili,

    This looks like a bug that was introduced in UIA 2.0.  I will try to get a fixed LogSnapshot__epilogue.h file that you can try out.

    Thanks,

        Janet

  • Hi Vasili,

    Can you try replacing the LogSnapshot__epilogue.h file in your <UIA_INSTALL_DIR>/packages/ti/uia/runtime directory with this one:

    4186.LogSnapshot__epilogue.h

    I replaced the call to LogSnapshot_writeMemoryBlockWithIdTag() with LogSnapshot_writeStringWithIdTag() in the LogSnapshot_writeNameOfReference define.  This should fix the build error.  I'm still not sure how System Analyzer uses this information, since the execution graph is using the name of the Task function anyway.

    Thanks,

        Janet

  • Hi Janet,

    1. Thank you! I've tried the file you provided. Indeed, it fixes the build.
    2. However, it does not provide a complete functionality fix. As far as I know. the System Analyzer does ti.uia.events.UIASnapshot.nameOfReference. You can find more info about it here:
      http://e2e.ti.com/support/development_tools/code_composer_studio/f/81/p/331559/1161814.aspx#1161814

    Best,
    Vasili

  • Hi Vasili,

    It looks like the bug, SDSCM00050080, to support dynamic Task/Swi/Hwi names in System Analyzer, was recently fixed.  So it should make it to the 6.1 release of CCS.  I do not have CCS6.1 yet to try it out - I'm not sure of the release date.

    Best regards,

        Janet

  • Sounds great. I'm waiting to see it :-)
    Any info when CCS6.1 release is planned?

    Best,
    Vasili

  • Hi Vasili,

    I found this: http://processors.wiki.ti.com/index.php/TI_Development_Tools_Information which says CCS6.1 should be available in Feb 2015.

    Best regards,

        Janet

  • Hi

    I'm using CCS 6.1.2.00015 with UIA 2.0.3.43, so in theory the System Analyzer should display the task names that I provide using LogSnapshot_writeNameOfReference . Unfortunately, it does not.

    I had a look at LogSnapshot__epilogue.h and found a few things that I thought looked suspicious:

    1. the macro ti_uia_runtime_LogSnapshot_writeNameOfReference is defined in terms of LogSnapshot_writeStringWithIdTag, which in turn seems to post a log message of type UIASnapshot_stringOnHeap (instead of UIASnapshot_nameOfReference, which I expected).
    2. the refId parameter is used as the first argument to writeStringWithIdTag while all other log message types call the parameter snapshotId and use it as the second argument.
    3. the XYZWithIdTag macros all look suspicious

    For example, ti_uia_runtime_LogSnapshot_writeStringWithIdTag is defined as follows:

    #define ti_uia_runtime_LogSnapshot_writeStringWithIdTag(idTag, snapshotId, fmt, startAdrs, lengthInMAUs) \
        ((ti_uia_runtime_LogSnapshot_isSnapshotLoggingEnabled(ti_uia_events_UIASnapshot_stringOnHeap)) ? \
            (ti_uia_runtime_LogSnapshot_putMemoryRange(ti_uia_events_UIASnapshot_stringOnHeap, Module__MID, \
            (IArg)((((UInt32)idTag & (UInt32)LogSnapshot_IDTAG_MASK) << LogSnapshot_IDTAG_BIT_SHIFT) | \
            ((((UInt32)snapshotId) & (UInt32)LogSnapshot_SNAPSHOTID_MASK)<<LogSnapshot_SNAPSHOTID_BIT_SHIFT)),\
            (IArg)__FILE__,(IArg)__LINE__, (IArg)fmt, (IArg)startAdrs, (IArg)lengthInMAUs)) : (Void)0 \
        )
    
    

    The problem is that LogSnapshot_IDTAG_MASK is defined as 0xFFFF0000 and LogSnapshot_IDTAG_BIT_SHIFT is defined as 16. Therefore, all information contained in idTag is discarded. I have no idea what the idTag and snapshotId parameters are supposed to do, but their current use doesn't look right to me.

    Now I looked at an old UIA 1.x file, tried to find out what exactly LogSnapshot_writeNameOfReference SHOULD do, and came up with the following implementation (pure guesswork):

    #define ti_uia_runtime_LogSnapshot_writeNameOfReferenceWithIdTag(idTag, snapshotId, fmt, startAdrs, lengthInMAUs) \
        ((ti_uia_runtime_LogSnapshot_isSnapshotLoggingEnabled(ti_uia_events_UIASnapshot_nameOfReference)) ? \
            (ti_uia_runtime_LogSnapshot_putMemoryRange(ti_uia_events_UIASnapshot_nameOfReference, Module__MID, \
            (IArg)((((UInt32)idTag & (UInt32)LogSnapshot_IDTAG_MASK)) | \
            ((((UInt32)snapshotId) & (UInt32)LogSnapshot_SNAPSHOTID_MASK))),\
            (IArg)__FILE__,(IArg)__LINE__, (IArg)fmt, (IArg)startAdrs, (IArg)lengthInMAUs)) : (Void)0 \
        )
    
    /*
     *  ======== ti_uia_runtime_LogSnapshot_writeNameOfReference ========
     *  Log_Events need to be converted to Type_Events prior to calling Log_put;
     *  the lower 16-bits are a mask that needs to be replaced with the caller's
     *  module ID.
     */
    
    #define ti_uia_runtime_LogSnapshot_writeNameOfReference(refId, fmt, startAdrs, lengthInMAUs) \
     (ti_uia_runtime_LogSnapshot_writeNameOfReferenceWithIdTag(refId, refId, fmt, startAdrs, lengthInMAUs))

    I am using refId for both parameters so that the full 32 bits value will be reassembled (consistent with UIA 1.x).


    Now I absolutely don't know what the parameters mean and how they are supposed to be used, all I can say is that this fixed the System Analyzer view and that all my task names are shown correctly.


    Could somebody who knows more about the inner workings of UIA please have a look at that?

    Regards

    Markus

  • Hi Markus,

    Since this thread is marked as resolved, could you please post a new thread indicating the problem you are having and what device you are using?  I will take a look at it.

    Best regards,

        Janet

  • Hi Janet,

    I opened a new thread (e2e.ti.com/.../493051)

    Markus