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.

Requirements for Task_sleep()

One of my application tasks is making a call to Task_sleep() and the console output of the debugger reports:

s.knl.Clock: create policy error
xdc.runtime.Error.raise: terminating execution
What are the setup/configuration requirements before I can call Task_sleep?
 
Regards,
Fred
  • Hi Fred,

    I think you have something like this in your application configuration:

    Defaults.common$.memoryPolicy = xdc.module('xdc.runtime.Types').STATIC_POLICY;

    Up until recently, there was a restriction that when the STATIC_POLICY was selected, Clock_construct() calls (as done in Task_sleep()) were prohibited, and you’d get an error like this.

    If you have STATIC_POLICY declared, can you remove that and retry?

    If doing so causes your application to not fit in memory anymore, can you upgrade to the SYS/BIOS 6.33.00.19 and XDCtools 3.23.00.32 (or later) releases?

    Thanks,
    Scott

  • Hi Scott,

       You were correct.  I commented out the STATIC_POLICY line (and had to increase some stack sizes) and my application almost runs.  The GIE bit is being disabled and not being properly restored.  I will investigate.

       My goal is to only use statically created objects.  Is there a way to statically create the Clock object needed by Task_sleep?

    Regards,

    Fred

  • STATIC_POLICY and Task_sleep() is supported with the newer BIOS (6.33.01.25) and XDCtools (3.23.00.32):

        http://software-dl.ti.com/dsps/dsps_public_sw/sdo_sb/targetcontent/bios/sysbios/index.html

     

    Alan

     

  • Hi Fred,

    Each time Task_sleep() is called a new Clock object gets “constructed” on the stack, and then later gets destructed as the function finishes.  So the Clock object is not fully static, but there are no dynamic alloc/free calls from a heap either.  It is an efficient way to utilize a temporary object.  The same method is used elsewhere (e.g., Semaphore_pend()) to implement timeouts.

    Does this make sense?

    Thanks,
    Scott

  • Hi Scott,

    > Does this make sense?

    Yes.  It is an interesting implementation technique.   Task_sleep() used more stack space (58 bytes)  than I expected and it took me several trys to get the task stack allocation correct.  It is running nicely now.  Thank you for your help.

    Regards,

    Fred