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.

TI RTOS and #defines

TI,

I am looking at using TI RTOS and was curious once the code is generated from the .cfg, what is the recommended way I can include certain tasks in my code based on the features I enable in TI-RTOS.  For example, if I am using TI-RTOS with a FAT FS, is there a way for my application know that the FAT FS is included in this product instantiation of TI RTOS.  We are looking at using TI RTOS across our products but are struggling for how to differentiate for different features of TI RTOS and what features we are including with our project.  

Sincerely,

Jason 

  • Hi Jason,

    I think what you are referring to is something similar to what is being done with our TI-RTOS drivers.  When a driver is included in the .cfg file (ex. EMAC = xdc.module('ti.drivers.EMAC')), a global variable is set during build time for that driver (TI_DRIVERS_EMAC_INCLUDED).  This variable is then used in our code to include/exclude certain portions (#if statements in board.c files).

    Unfortunately, this is only implemented for our drivers, other modules do not use this approach.  However, it can be manually added to a .cfg file:

    // Fat FS
    Program.global.TI_FATFS_MODULE_INCLUDED = true;
    // HeapMem
    Program.global.TI_HEAPMEM_MODULE_INCLUDED = true;
    ...

    The TI_FATFS_MODULE_INCLUDED variable can then be used throughout your code by adding #include <xdc/cfg/global.h> to a file.  Thus you would only have to change a variable from true to false in the .cfg file.

    Thanks,

    -- Emmanuel