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.

Error Creating Hwi dynamically

Other Parts Discussed in Thread: MSP430WARE

Hi,

I´am having a system crash when creating a Hwi dynamically (actually I´m having same problem with Tasks or Events dynamically created). Creating the same Hwi but statically using the .cfg file everything works fine.

I´m using CCS version 6.0.1.00040, SYS/BIOS 6.40.1.15, TI-RTOS 2.1.0.03, MSP430 DriverLib 1.80.0.18 and MSP430Ware 1.80.1.03.

I attach my .cfg file.


Hwi_Handle hwi0;
Hwi_Params hwiParams;
Error_Block eb;
Error_init(&eb);
int id_ADCInt = 54;		
Hwi_Params_init(&hwiParams);
hwi0 = Hwi_create(id_ADCInt, ADC12_ISR, NULL/*&hwiParams*/, NULL/*&eb*/);

The console output is:

tion not implemented: Hwi_create
xdc.runtime.Error.raise: terminating execution

1452.task.cfg

  • Hi Nicolas,

    We do not support runtime creates on MSP430. There are several reasons for this. Supporting only static objects helps save some code memory (no create/delete code). The Hwi dispatch table is fixed and not modifiable at runtime and therefore timers cannot be created at runtime.

    If you look at your app's cfg file, you will see that the memoryPolicy is being set to STATIC:
    Defaults.common$.memoryPolicy = xdc.module("xdc.runtime.Types").STATIC_POLICY;

    Best,
    Ashish
  • Hi,

    Ok, I see.

    Altough I have it set in my cfg graphical interface to CREATE_POLICY, I see it doesnt have any effect in the cfg script tab, since it is still set to STATIC POLICY...

    I suppose then that the cfg code script always prevails over the graphical, right?

    TI-RTOS xdc.runtime tab:

    cfg script tab:

  • Hi Nicolas,

    I think you are changing Memory module's memoryPolicy and not the Defaults module's memory policy. On my setup, changing the Memory module's memoryPolicy has an affect. It adds a new line like this:
    Memory.common$.memoryPolicy = xdc.module("xdc.runtime.Types").CREATE_POLICY;

    Best,
    Ashish
  • Hi Ashish,

    Thanks, I see it now, I´ve been able to change the Memory´s memory policy now both in graphical and script cfg ways.

    1-What I haven´t found yet is the Default´s memory policy graphical config, I can only see it in code script, is there a place in the graphical config to change the default memory policy ? 

    2- I´ve been making more tests and I´ve been able to create dynamically 2 Tasks and 1 Event! My FW is running now these 2 tasks and 1 event dynamically created along with the rest of stuff statically created and everything works fine. However, if I try to switch one more task/event creation from static to dynamic it crashes with the error type reported in my first post here. Is that normal?

    Thanks.

    Nicolas

  • Hi Nicolas,

    As far as I can tell there is no way to change Defaults through the GUI.

    Best,
    Ashish

  • Hi Ashish,

    Good to know thanks.

    What about question #2? Do you know what could be happening?

    2- I´ve been making more tests and I´ve been able to create dynamically 2 Tasks and 1 Event! My FW is running now these 2 tasks and 1 event dynamically created along with the rest of stuff statically created and everything works fine. However, if I try to switch one more task/event creation from static to dynamic it crashes with the error type reported in my first post here. Is that normal?

     

     

    Nicolas

  • Hi Nicolas,

    Nicolas Diez said:

    What about question #2? Do you know what could be happening?

    2- I´ve been making more tests and I´ve been able to create dynamically 2 Tasks and 1 Event! My FW is running now these 2 tasks and 1 event dynamically created along with the rest of stuff statically created and everything works fine. However, if I try to switch one more task/event creation from static to dynamic it crashes with the error type reported in my first post here. Is that normal?

    If the default memory policy is being set to STATIC_POLICY (recommended) then I dont see how you are able to create any task dynamically. With STATIC_POLICY, the Task_create code that gets generated looks something like this:

    /* create */
    ti_sysbios_knl_Task_Handle ti_sysbios_knl_Task_create( ti_sysbios_knl_Task_FuncPtr fxn, const ti_sysbios_knl_Task_Params *__paramsPtr, xdc_runtime_Error_Block *__eb )
    {
        xdc_runtime_Error_raiseX(NULL, ti_sysbios_knl_Task_Module__id__C, NULL, 0, xdc_runtime_Error_E_generic, (xdc_IArg)"create policy error", 0);
        return NULL;
    }
    

    The above code will always raise an error when Task_create() is called. Are you removing the line that changes the memory policy to static, from your cfg file ?

    Best,

    Ashish