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.

Conditional compilation depending on packages version

Other Parts Discussed in Thread: SYSBIOS

Hello everyone,

I'd like to do conditional compilation depending on the package version :

I'd like to do

#ifdef __IPC_1_24_03_32

...

#elif __IPC_1_22_03_23

...

How do I get the IPC package version automatically ?
Is it defined somewhere ?

Thank you

CM

  • Should this thread be moved to the compiler section ?

    CM

  • Clement,

    To my knowledge, IPC doesn't explicitly generate a version number that the target application can reference. I'd have to check to see if there's some other method to get the version number.

    What version of XDCtools are you using?

  • Tom,

    That would be a bit annoying.

    I use XDC 3_23_04_60.

    I took the example of IPC but I'd like to also get BIOS, UIA, PDK, etc. Potentially all packages.

    Thank you,

    Clement

  • Clement,

    for C target code, no version number is generated for IPC, BIOS and UIA for sure

    You can however use version string at config time (e.g. your .cfg file). The version string here wouldn't be a full version number, but it is uses an internal versioning scheme.

    For example: SYS/BIOS 6.35.02.45 == xdc-y51   SYS/BIOS 6.34.02.18 == xdc-y35

    Perhaps, this might open up to some possibilities for you to use if you want to script some of the changes.

  • Tom,

    Interesting.

    Would it possible to do something like this:

    in the cfg:

    if ( sysbios_version == xdc-y51)

    {

    Program.global.mysysbios = 123; /* then I'd get the mysysbios global variable in my C code */

    }

    but how do I get "sysbios_version" in the cfg ?

    Thanks,
    Clement 

  • Clement,
    this should work:
    var biospkg = xdc.loadPackage("ti.sysbios");
    var sysbios_vers = Packages.xdc.services.global.Vers.getXdcString(pkg.packageBase + "/package/package.defs.h");

  • Sasha and Tom,

    Thank you for your answers, I'll keep them in mind if the need of conditionnal execution depending on the package comes.

    I needed "conditionnal compilation" because even with what you provided it won't resolve link issues.

    To be clear my use case is :
    On my computer I only have UIA 1.01.00.04 and on this version not all Log_sync features are available.
    However I develop the library for users that will have at least UIA 1.01.01.14.
    So I wanted a different compilation depending on the UIA version of the user.

    Anyway that doesn't seem possible even though it'd be a welcome addition.

    Thread closed.

    Regards,
    Clement

  • I'll disregard "Thread closed" and ask for further explanation for the benefit of other users. Feel free to ignore my question if you don't have time for it.

    So, what is it that you want to compile depending on the user's version of UIA? I am assuming you are giving them an already compiled library. Do you have some templates that are shipped in the same package as the library., or maybe two different libraries in the same package?

  • To be clear,

    We are in the early stages of the development and not everyone on the team have yet the same version of tools.

    Basically, right now, I'm building a library with an older version of UIA. So users (members of the team) rebuild my library on their machine with newer version of UIA (it'll no longer be the case once everyone is on the same level).

    That's why I wanted differentiation at the compiling phase.

    Soon I'll no longer need it so don't worry about it.

    Clement