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.

MEM_alloc is not run



Hi


I have question about MEM_alloc.

I have been tested in the following environments.
 - CCSv5.3.0
 - Target Board : EVMC6748
 - BSPBIOS : 5.42.0.07
 - Compiler version: v7.4.1
 - sample project:
    /pspdrivers_01_30_01/packages/ti/pspiom/examples/evm6748/vpifvbiloopback

I added the following code at "vpifSample_io.c"

====

extern int DDR;

void heap_test(void)
{
    int *mem_test;


    while (1) {

          TSK_sleep(10000);

          mem_test =(int *)MEM_alloc(DDR,100,0);

          int cnt;
          for (cnt=0; cnt<100; cnt++) {
               mem_test[cnt] = cnt*cnt;
          }

          MEM_free(DDR,mem_test,100);

    }

    return;
}

====

Display and image capture is operating normally.
But, When I try to run the MEM_alloc, permission to run the "heap_test"Task seems would have been blocked.

Could you tell me the solution and causes ?


Best regards

Chi

  • Hi Chi --

    I think your men_test array allocation incorrect.   You are only allocating 100 bytes.  You need 100 ints.

    change this:

          mem_test =(int *)MEM_alloc(DDR,100,0);

    to this:

          mem_test =(int *)MEM_alloc(DDR,100 * sizeof(int),0);


    -Karl-

  • Hi Karl

    Thank you for your reply.

    I modified the code according to your suggestions. But, the problem was not resolve.

    BUF_alloc seems to work without problems, but I want to use a heap of variable length as MEM_alloc.

    Does  BIOSPSP not be able to use the MEM_alloc ?


    Best regards

    Chi

  • Can you please put a b/p after your call to MEM_alloc() and check the return value to make sure it is not NULL?

    You might not have a heap defined or it might be too small.

    You should try using "ROV" (or KOV if you are using CCSv3) to review your MEM heap.

  • I think my heap size is enough, because create heap in DDR as 0x01000000.

     "heap_test" Task seems to be blocked in the process of MEM_alloc.

    So, I couldn't check the return value of MEM_alloc.

    vpifvbiloopback sample project has been calling FVID_creat as follow.

    capChInfo.chanHandle = FVID_create(vpifCapStrings,
                                   IOM_INPUT,
                                   &status,
                                   (Ptr)&vCapParamsChan,
                                   NULL);

    When above FVID_creat is called so on, MEM_alloc does not work in another TSK(heap_test).

    I do not know the cause.


    Best regards
    Chi

  •  

    How have things been after that?

     

    I would appreciate if you could reply my question.

     

     

    Chi

  • Chi,

    In what context are you calling FVID_create()?  Is it another task?  If so, what is the priority of that task relative to where you are calling heap_test()?

    If you move the heap_test() call to the idle task, does it work when called from there?

    Also, can you tell where within MEM_alloc() the task is blocked?

    Thanks,
    Scott

  • Scott

     

    Thank you for your reply.

     

    I create two tasks, Video In/Out task(include FVID_create) and heap_test() task(with MEM_alloc).

    I have a higher priority of heap_test task of course.

     

    MEM_alloc run successfully when heap_test() call to IDLE task.

    This is because, MEM_alloc() is called before FVID_create().

     

    I will attach my project.

    I added heap_task() to vpifloopback sample project.

    Please let me know if there is a solution.

     

    Best regards

    Chi,

    heap_test.zip
  •  

    Did I explain the problem clearly enough for you?

     

    Best Regards

    chi,