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.

Stack placement for task in SYS BIOS 6

Other Parts Discussed in Thread: SYSBIOS

Hi,

   I'm in the process of implementing an application in SYS BIOS 6_30_02_42 in OMAP L138.

   void myfunc()

  {

 

     Thread A creation;

     .......

 }

 int main()

{

   /* Some code */

  BIOS_start(); // Entry point for BIOS is set to myfunc in the .cfg file

}

If I place the stack for Thread A in default heap, application works fine.

Now, I created one more heap and hook it in to the DDR in the .cfg as follows,

var extstackParams = new HeapMem.Params();
extstackParams.size = 0x040000;
extstackParams.sectionName = "EXTMEM_STACK_HEAP";
Program.global.sdramstack = HeapMem.create(extstackParams);
Program.sectMap["EXTMEM_STACK_HEAP"] = "DDR";

and in my application file app.c I did the following,

extern int EXTMEM_STACK_HEAP

mytask.stackHeap = (xdc_runtime_IHeap_Handle) EXTMEM_STACK_HEAP;

But when I'm trying to link, the linker shows the following error,

undefined
 symbol
---------
_EXTMEM_STACK_HEAP

If I look in to the map file, the EXTMEM_STACK_HEAP is created as a section.

How to acheive this?

Thanks In advance

Regards

Palanivel

 

 

 

  • Hi Palanivel,

    Try the following in the .c file. This is the heap you created. Note: you do not need to extern it if you have "#include <xdc/cfg/global.h>"

    mytask.stackHeap = sdramstack;

    Note: I'm assuming mytask is a Task_Params struct that is passed into Task_create.

    Todd

  • You need to pass an actual heap handle to the 'stackHeap' parameter, and not just the name of a section.

    In your config script, the line:

    Program.global.sdramstack = HeapMem.create(extstackParams);

    Creates a HeapMem handle and assigns it to the global symbol 'sdramstack'. It's this handle that you want to assign to 'stackHeap'. Make sure to #include <xdc/cfg/global.h>, and you should be able to reference the symbol 'sdramstack'.

    Also, to be technically correct, there is a macro defined for casting the HeapMem handle to an IHeap. So, your C code should read:

    mytask.stackHeap = HeapMem_Handle_to_xdc_runtime_IHeap(sdramstack);

    I think that should do it for you!

    Chris


  • Hi Todd and chris,

    Thanks for the rapid and clear response.

    The issue is resolved.

    BTW, what is the parameter stack in Task_Params struct is used for?

    I tried with the online help for SYS BIOS 6, but in vain.

    Thanks again for the help.

     

    Thanks & Best regards

    Palanivel Guruvareddiar

  • Normal 0

    Palanivel,

    The stack parameter is used if you want to provide the memory for the stack instead of having the Task_create allocate it. Refer to the "Stack Alignment" in the Sysbios API Reference for alignment requirements. You can find it in CCS' Help (it's also referred to as CDOC). Note: the default for stack is null, which means use the heap.

    The memory pointed to by the stack variable, can be allocated by you from a Heap or simply be a static global buffer. You can use the #pragma to help place and align the global buffer. For example:

    #define STACKSIZE 2048

    #pragma DATA_SECTION ( myStack, "EXTMEM_STACK_HEAP");

    #pragma DATA_ALIGN (myStack, 8);

    Char myStack[STACKSIZE]; // global variable

    ...

    taskParams.stackSize = STACKSIZE;
    taskParams.stack = myStack;

    If you are creating a heap just to pass into Task_create, you can use the stack parameter and avoid the overhead of the heap. Note: you still place your section in your .cfg file.


    Todd

  • Hi Todd,

    Thanks for the detailed answer.

    Got the point.

    Thanks & Best regards

    Palanivel Guruvareddiar

     

  • Hi Chris/ Palanivel :

                                      I have a similar problem .Part of the dspbios script in *.cfg file  is copied below.

    bios.MEM.instance("DDR").base = 0xe0000000;

    bios.MEM.instance("DDR").len = 0x00200000;

    bios.MEM.instance("DDR").createHeap = 1;  /* Just so a label shows in the map */

    bios.MEM.instance("DDR").enableHeapLabel = 1;

    bios.MEM.instance("DDR").heapLabel = "sMUDDR","asm";

    bios.MEM.instance("DDR").heapSize = 0x0008000;

     I Reference the section sMUDDR in the .c file using extern. However when I port the above  lines of script using sys bios modules and APIs I am

    unable to reference the memory section correctly. On going through this post, i found the problem to be similar to mine. However i dont understand

    Program.global.sdramstack ? How did you get this field sdramstack?

    Sorry i am new to sysbios.

     

     

    Aparna