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.

Dynamic Clock allocation in TI-RTOS application

Hi all

I  tryed to create dynamically a new Clock item with this code

 Clock_Params clockParams;
    Clock_Handle myClock;
    Error_Block eb;

    GPIO_setupCallbacks(&Board_gpioCallbacks2);
    GPIO_enableInt(Board_MAGCLK, GPIO_INT_FALLING);


    Error_init(&eb);
    Clock_Params_init(&clockParams);
    clockParams.period = 50;
    clockParams.startFlag = TRUE;
    clockParams.arg = (UArg)0x5555;
    myClock = Clock_create(myHandler1, 5, &clockParams, &eb);
    if (myClock == NULL) {
        System_abort("Clock create failed");
    }

// However , what i get is a Clock create failure error

// line 52: error {id:0x9550000, args:[0x0, 0x28]} .. curiousely , 52 is the line

// after the handler function declare

// the handler is declared as follow

xdc_Void myHandler1(xdc_UArg ua1)
{
    GPIO_toggle(Board_LED2);
}

Should i setup Memory module in a special mode  or something l;ike this ?

 

bye

Stefano

 

  • Hi Stefano,

    I recommend you post your question at the TI-RTOS Forum - http://e2e.ti.com/support/embedded/tirtos/default.aspx

    Glenn.

  • Did you modify one of the TI-RTOS driver examples? These examples are configured to have a minimal footprint (e.g. no heap, small stack sizes, minimal text string..thus the rather cryptic error message). The Clock_create call allocates memory, but there is no heap...thus the failure.

    We debated on how to structure these examples. If we did minimal, we have customers hit issues like this. If we did full feature (e.g. logging, heaps, big default stack sizes), people screamed that TI-RTOS was too fat with features that were not needed. The compromise was to have an empty and empty minimal that highlights the differences and also have the "Memory Usage with TI-RTOS" in the User Guide. This section outlines the changes made to get the minimal footprint.

    For your case, you'll need to add a heap (or more accurately not remove the default heap). Open the .cfg as a text file (right click and open as .txt). Comment out the following line to get the default heap.
    //BIOS.heapSize = 0;

    You can comment out the following line to get more meaningful error message also.
    //Text.isLoaded = false;

    The Clock module executes you clock function in the context of Timer with the current configuration. If you enable Swi, your function would be executed in a Swi instead. To do such, comment out the following line:
    //BIOS.swiEnabled = false;

    Of course, you could just create the Clock function in the .cfg file and everything is statically created...and  you would not need the heap.

    Todd

  • Hi Todd , I could fix the problem thanks to your suggestions. I'd like to say that I greatly appreciate the effort of TI in giving a good software support for their products. However When approaching new products , ther's alwais a learning curve before beeing effective , so be patient with us poor developers.

    Stefano