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 modify and compile function Memory_alloc of RTOS



Hi, all!

We are using DVRRDK_04.00.00.03 and TI8168.

I want to add some prints inside function Memory_alloc to know how many times it has been called,
which is called by Utils_memAlloc in src_bios6/utils/src/utils_mem.c .
I tried so hard but no luck.

Two questions:
1. Is the following the right file I need to modify?
DVRRDK_04.00.00.03/ti_tools/xdc/xdctools_3_23_03_53/packages/xdc/runtime/Memory.c
2. How to compile Memory.c into output binaries (such as dvr_rdk_fw_m3vpss_1024M_256M.xem3) ?

Thanks!

  • If you want to add some print for each Memory_alloc and Memory_free then you can modify:

    /dvr_rdk/build/dvr_rdk/obj/ti816x-evm/m3vpss/release/dvr_rdk_configuro/package/cfg/MAIN_APP_m3vpss_pem3.c

    xdc_runtime_Memory_alloc__E

    xdc_runtime_Memory_free__E

    for m3vpss. Similar file will be present for m3video and c6xdsp.

    This is a generated file. Once you build dvr_rdk it will be present. You can modify and recompile dvr_rdk.

    Don't changes any cfg file else this will get overwritten.

    There is a better method to check memory usage instead of using prints. Refer /dvr_rdk/mcfw/src_bios6/utils/utils_mem.h

    UTILS_MEMLOG usage.

  • Hi, Badri!

    Thanks for your replay!

    I added print in xdc_runtime_Memory_alloc__E.

    But halt happened during initialization of DVRRDK, and adding print in xdc_runtime_Memory_free__E was OK.

    So I added print before every calling of Memory_alloc.

    By now, the issue I was researching is solved now, so this question is end.

     

  • For future reference the issue with adding print in xdc_runtime_Memory_alloc__E is Memory_alloc is called before control goes to main by bootstrap code .Calling printf from this context will cause exception as printf tries to acquire a GateMutex which can be done only from task context. You should protect call to printf within

        if (BIOS_getThreadType() == BIOS_ThreadType_Task)
        {
            /* Printf should be called only from Task context as it does pend.
             * Calling from other context will cause exception
             */
            Vps_rprintf();
        }

     

  • Thank U! It works.