Search code examples
jtagtrace32lauterbach

Trace32: How get programmatically get maintenance key expiry month and year using t32apinet?


I am trying to get the maintenance key expiry month and year of lauterbach JTAG programmatically. I am using t32apinet for that. Is there a way to read the maintenance information using the api?


Solution

  • You can get the date of you maintenance key via the PRACTICE function LICENSE.DATE(<idx>), where idx is the number of the attached serial number as it appears in the LICENSE.LIST window. Note, that one debug cable, plugged to your PowerDebug, can have up to 5 serial numbers and thus, also up to 5 maintenance key.

    To get idx for the currently running PowerView executable use the PRACTICE function LICENSE.getINDEX().

    Putting both together you get: LICENSE.DATE(LICENSE.getINDEX())

    You can test it by using the PRINT command in PowerView:
    PRINT LICENSE.DATE(LICENSE.getINDEX())
    You should get a string in the form of YYYY/MM e.g. 2020/07

    To use a PRACTICE function via the remote API, use the API function T32_Cmd() together with the TRACE32 command EVAL and then get the result via the API function T32_EvalGetString().

    E.g. in C/C++:

    char mdate[4096];    
    T32_Cmd("EVAL LICENSE.DATE(LICENSE.getINDEX())");
    T32_EvalGetString(mdate);
    printf("End Date: %s\n", mdate);
    

    I am not skilled with Visual Basic .NET at all, but I guess there it should look like this:

    Dim mdate As String   
    T32.Cmd("EVAL LICENSE.DATE(LICENSE.getINDEX())");
    T32.EvalGetString(mdate);
    Log("End Date: " + mdate)
    

    New versions of TRACE32 support also the slightly nicer API function T32_ExecuteFunction().