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.

some questions about C6RunLib Documentation

I have read the document of "C6RunLib Documentation". 

The URL:

http://processors.wiki.ti.com/index.php/C6RunLib_Documentation#C6RunLib_Specific_Command-line_Options_2

The --C6Run:replace_malloc option can be used when calling c6runlib-ar to create a static library. So this option will affect the following standard APIs: "malloc, calloc, realloc, memalign, and free" in DSP portions. But how it can affect the whole arm portions since we know that we link the whole project by cross-compile tools "arm-none-linux-gnueabi-gcc"?

I am a little confused.

  • dian ma said:
    The --C6Run:replace_malloc option can be used when calling c6runlib-ar to create a static library. So this option will affect the following standard APIs: "malloc, calloc, realloc, memalign, and free" in DSP portions. But how it can affect the whole arm portions since we know that we link the whole project by cross-compile tools "arm-none-linux-gnueabi-gcc"?

    Actually, using this option has no bearing on the code that gets run on the DSP, and only affects the code that runs on the ARM.  It does this by causing replacement malloc, calloc, etc. APIs to be statically linked to the application. The static linking will cause the replacement symbols to be used, except within the internals of the shared library which defines its own versions (which in this case is the GNU libC library). The idea of using this option is that it makes any buffer allocated on the ARM side be one which now can be given to the DSP without any extra thought.  Without this option, explicit calls to the C6RUN_MEM_ * APIs need to be made, which means you have to think about what buffers need to passed to the DSP and which ones don't.  However, there is some risk in this option as well since it means all other libraries, besides the GNU Lib C, that will get linked to the app will use the replacement versions of these fundamental memory APIs and sometimes this seems to cause problems.

    Regards, Daniel

  • A special library "libc6rungpp_malloc.a" will be linked to the final static library when the --C6Run:replace_malloc option is used. So such APIS "malloc, calloc, realloc, memalign, and free" will be repalced in the whole application.

    Thanks for your help. I have got it.