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.

RTOS/TMDXIDK5718: Checking if SYSBIOS is used

Part Number: TMDXIDK5718
Other Parts Discussed in Thread: SYSBIOS

Tool/software: TI-RTOS

Hi

I would like to write some C header files that work with and without SYSBIOS.
How can I find out whether SYSBIOS is used or not?

Regards,
Markus

  • I don't understand your question. Can you please explain in more detail.
  • Hi

    Here is an example what I like to do:

    #ifdef (SYSBIOS_AVAILABLE)
    #include <ti/sysbios/hal/Hwi.h>
    #endif

    ...

    #ifdef (SYSBIOS_AVAILABLE)

    // use SYSBIOS functions
    #define INT_DISABLE (Hwi_disable());
    #define INT_RESTORE(Int) (Hwi_restore(Int));

    #elif defined(__TMS320C28X__)

    // use compiler intrinsics
    #define INT_DISABLE (__disable_interrupts());
    #define INT_RESTORE(Int) (__restore_interrupts(Int));

    #else
    ...
    #endif


    Is there a predefined symbol for "SYSBIOS_AVAILABLE"?

    Regards,
    Markus
  • Markus,
    what is your build enviornment? Are you building in CCS?

    If the statements that check if SYS/BIOS is used are at the top of the compilation unit, then the only place where any macro could come is a command line. SYS/BIOS builds don't have any SYS/BIOS specific macro added to the command line. You could check for 'xdc_target_name__', which is defined whenever XDCtools is used. In most cases, that would mean SYS/BIOS is used and it might work for you, but I would have to know more about your build environment and the context in which this header file is used to be sure.

    There are plenty of macros defined by SYS/BIOS header files that you could use in case this header file is included after the decision to include or not SYS/BIOS header files is already made. One of them is 'ti_sysbios_BIOS_version'.
  • Hi Sasha

    Thank you for your suggestions.

    My build environment is CSS and this will also be true for some other people who work without sysbios.

    The idea to check ti_sysbios_version for existance also can to my mind,
    but this would require to include <ti/sysbios/bios.h> which will result in an error if that
    package is not installed.
    Is it possible to check the CSS sysbios install path variable from within C code?

    Regards,
    Markus

  • Markus,
    I don't really know if they are any environment variables defined only for SYS/BIOS projects. You could try printing the environment from within a project with and without SYS/BIOS and see if there is a difference.

    Have you tried using
    #ifdef xdc_target_name__
    ... use SYS/BIOS
    #else
    ... no SYS/BIOS
    #endif
  • Hi Sasha

    Sorry for the delay.
    Yes, with "xdc_target_name__" it works.

    Thank you!

    Regards,
    Markus