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.

How to add one more task into my CC2630 End Device?

Other Parts Discussed in Thread: CC2630, Z-STACK

I want to add one more task to my ZigBee End Device (CC2630) as following:

    Task_Params_init(&wzTaskParams);
    wzTaskParams.stack = wzTaskStack;
    wzTaskParams.stackSize = WZ_TASK_STACK_SIZE;
    wzTaskParams.priority = 2;
    Task_construct(&wzTask, wzTaskFxn, &wzTaskParams, NULL);

There are 2 problems:

1) Link error happens when the  WZ_TASK_STACK_SIZE >= 450, error message:

Error[Lp011]: section placement failed
            unable to allocate space for sections/blocks with a total estimated minimum size of 0x65c bytes (max align 0x8) in  
<[0x200000c8-0x200040e3]> (total uncommitted space 0x650).
            Uncommitted:
            [0x200000c8-0x200000ff]:   0x4
            [0x20000200-0x200040e3]: 0x654

2) Burn to the CC2630 device, it does not work?

I compiling source code with WZ_TASK_STACK_SIZE < 450, it can be compiled.

But the compiled code does not work on CC2630 device?

How to fix these problems?

Thanks for any suggestions!

  • Hi,

    Can you tell us which application or firmware that you are trying to compile and load?

    YenHung Chen said:
    Burn to the CC2630 device, it does not work?

    • Which device are you using (4x4, 5x5, 7x7)? If your device is not 7x7, it will not work until you change the project configurations to use the correct device.

    Project Options->C/C++ Compiler : Preprocessor tab -> Defined symbols

    Change MODULE_CC26XX_7X7 to whatever device that you have (...7X7 to ...5X5 or ...4X4).

    • Does the unaltered project compile and work?
    • Also, did you follow the instructions in the Z-Stack Home Sample Application User's Guide? More specifically, how to load the stack first and then your application.

    Located in this location on your computer (assuming a windows machine and default installation folder):

    C:\ti\simplelink\zstack_home_1_02_02_42930\Documents

    YenHung Chen said:
    unable to allocate space for sections/blocks with a total estimated minimum size of 0x65c bytes (max align 0x8) in  
    <[0x200000c8-0x200040e3]> (total uncommitted space 0x650).

    This seems to be located in RAM.

    I don't know how much RAM is used by the stack, but if there is enough space (you need to check the generated map files), you need to change the .icf files in both the stack and application images so they do not overlap.

    Here is the code from cc26xx_zstack.icf. You will have to increase the RAM_START address

    ////////////////////////////////////////////////////////////////////////////////
    // RAM
    //
    if ( isdefinedsymbol(FLASH_ROM_BUILD) )
    {
      if ( isdefinedsymbol(ICALL_RAM0_ADDR) )
      {
        define symbol RAM_START         = ICALL_RAM0_ADDR;
      }
      else
      {
        //////////////////
        // make sure ICALL_RAM0_ADDR is not defined in your project and increase the value below
        //////////////////
        define symbol RAM_START         = 0x20003800;
      }
      define symbol RAM_END             = 0x20004A13;
    }
    else // unknown build
    {
      define symbol RAM_START           = 0xFFFFFFFF;
      define symbol RAM_END             = 0xFFFFFFFF;
    }
    

    In cc26xx_app.icf:

    ////////////////////////////////////////////////////////////////////////////////
    // RAM
    //
    
    define symbol RAM_START             = 0x20000000;
    
    if ( isdefinedsymbol(CC2650) )
    {
      if ( isdefinedsymbol(ICALL_RAM0_ADDR) )
      {
        define symbol RAM_END           = (ICALL_RAM0_ADDR-1);
      }
      else // default
      {
        ////////////////
        // Increase this value to be equal to stack (from cc26xx_zstack.icf) RAM_START - 1
        ////////////////
        define symbol RAM_END           = 0x200037FF;
      }
    }
    else // CC2650 PG1
    {
      if ( isdefinedsymbol(ICALL_RAM0_ADDR) )
      {
        define symbol RAM_END           = (ICALL_RAM0_ADDR-1);
      }
      else // default
      {
        define symbol RAM_END           = 0x200029FF;
      }
    }

    If you don't know how to read map files, attach both files into your response so we can analyze them and tell you how much space you will need.

    Regards,

    Michel

    EDIT: I've looked at the sample application map files generated after the first compile and the zstack image uses a little than 3kB of RAM. That means that you could gain approximately 1500 bytes. You would need to set the RAM_END address of your application to 0x20003DFF and the RAM_START address in your ztack icf to 0x20003E00

  • Dear Michel,

    Thank you for analyzing the key point in detail!

    About your questions, my answer is as following:

    Can you tell us which application or firmware that you are trying to compile and load?

    I use the sample project:

    simplelink -> zstack_home_1_02_02a_44539 -> Projects -> zstack -> HomeAutomation -> SensorTag

    The original compiled code is work on my device (CC2630,  a 7x7 device).

    It does not work after I add one more task on it.

    At Project Options->C/C++ Compiler : Preprocessor tab -> Defined symbols, the symbol is:

    MODULE_CC26XX_7X7

    Does the unaltered project compile and work?

    Yes, it works on CC2630 device.

    Also, did you follow the instructions in the Z-Stack Home Sample Application User's Guide? More specifically, how to load the stack first and then your application.

    Yes, I have done these procedures.

    Here is the code from cc26xx_zstack.icf. You will have to increase the RAM_START address

    define symbol RAM_START         = 0x20003F00;

    In cc26xx_app.icf

    define symbol RAM_END           = 0x20003EFF;

    If I comment out these lines:

       Task_Params_init(&wzTaskParams);

       wzTaskParams.stack = wzTaskStack;

       wzTaskParams.stackSize = WZ_TASK_STACK_SIZE;

       wzTaskParams.priority = 2;

       Task_construct(&wzTask, wzTaskFxn, &wzTaskParams, NULL);

    the built code works on CC2630.

    If I add the construct task lines (as the upstairs), the built code does not on CC2630.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/158/mapfiles.7z

  • So I have looked at your map files and the Z-Stack in the SensorTag example takes a little more than 2KB of data.

    By doing calculations, you could modify your RAM_END (xxx_app.icf) to 0x3F9F and RAM_START(xxx_zstack.icf) to 0x3FA0, but this stretches your RAM to its limits. You will run out of memory very quickly again.

    If it still doesn't compile, I saw that you use a bcdlcd file which takes over 5KB of RAM. This is over 25% of your RAM. Try removing it from your project and try compiling again. You will have to find a way to reduce the size of that file.

    Regards,

    Michel

  • Dear Michel,

    Sorry for making you misunderstand my problem!

    My major problem is that the compiled code does not work on CC2630.
    If I have added following code:
    ============================================================
    #define WZ_TASK_STACK_SIZE 360

    // Configure BCD LCD task.
    Task_Params_init(&wzTaskParams);
    wzTaskParams.stack = wzTaskStack;
    wzTaskParams.stackSize = WZ_TASK_STACK_SIZE;
    wzTaskParams.priority = 2;
    Task_construct(&wzTask, wzTaskFxn, &wzTaskParams, NULL);
    ============================================================
    the compiled file, bcdlcd.hex, does not work on CC2630.
    If I remove these code, it compiled file, bcdlcd.hex, can be be work on CC2630.

    I set RAM related parameters back as following:
    In cc26xx_app.icf:
    define symbol RAM_END = 0x200037FF;

    In cc26xx_zstack.icf:
    define symbol RAM_START = 0x20003800;

    I have recuded the 5KB of RAM to 50B.

    Best regards,
  • If you can upload the stack and the app, then I presume that you can debug the application.
    Does the code enter you task if you place a breakpoint at the beginning of the wzTaskFxn?

    Are you sure that your task stack is large enough to execute its code? Can you pause the debugger to see the Stack ROV?
    It's very possible that you do not have enough allocated stack space.

    Can you tell me which IDE are you using? IAR, CCS?

    Regards,
    Michel

    EDIT: if you reduce the 5KB to 50B then you should have enough RAM to increase the stack size.

  • Dear Michel,

    I have found the problem, the task is running, but it occupied all the processing time,
    therefore my original zstack task, myTaskStack, does not do anything.

    After I add Task_sleep() into wzTaskFxn's while loop, it works.

    I use IAR with XDS110 debugger.

    Thank you very much!