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.

--C6Run:replace_malloc: Segmentation fault issue

Hello,

I am programming on omap l138 using c6runLib. I want to share variables between ARM and DSP so I added the c6run_ar option --C6Run:replace_malloc in my makefile so as malloc() to allocate shared memory. The malloc function is called on ARM side. As soon as this option is set, my very basic test program runs correctly but when I debug it with gdb I get a segmentation fault error whose I can't get rid of.

I have troubles with more advanced program and I think it can comes from this error. Is there something I am doing wrong? Do I need to add more compiler options?

 

Thanks in advance.

  • Bruno,

    I  think that part of the answer is in the Twiki C6Run page:
    http://processors.wiki.ti.com/index.php/C6RunLib_Documentation#Buffer_Allocation
    The ARM side variables that will be passed to the C674x need to be created in the CMEM area (where the alignement consideration are taken care of).
    If you want to pass ARM side variables that were not create in CMEM then you need to copy it in a CMEM buffer.

    - Here are a couple of other interesting posts:
    http://e2e.ti.com/support/dsp/omap_applications_processors/f/447/t/68103.aspx
    https://e2e.ti.com/support/dsp/omap_applications_processors/f/447/p/91996/356478.aspx

    - There is as well a none TI example documented here:
    http://en.labsegeda.org/index.php?title=BBxM_DSP_core
    Look at the "Example C6RunLib" section on how to use C6RUN_MEM_malloc().

    Anthony

  • Hello,

    I now use C6RUN_MEM_malloc() in my program and it actually works.

    However it is specified in the wiki that the --C6Run:replace_malloc c6run-ar options  "Replace all standard C malloc APIs with versions that allocate from the shared CMEM heap ". So I should be able to allocate data in shared memory with the basic malloc() function. But the main point of the issue is that any code compiled with --C6Run:replace_malloc option will cause segmentation fault error ( when debugged with gdb ), which leads me to think that this option may not be well implemented.

    But the aim of the option might just be to replace malloc() function by C6RUN_MEM_malloc() function, which can be done by hand.

     

    Thank you for the reply.

     

    Edit: Here are the version of the softwares I use: ti-dvsdk_omapl138-evm_4_01_00_09, c6run_0_94_05_06 and cgt6x_6_1_14.

  • Bruno,

    Using the --C6Run:replace_malloc option does what you think.  It provides a new implmentation of malloc() that just wraps C6RUN_MEM_malloc(). Regarding the primary issue regarding gdb, I'm not sure why the malloc option would effect things, but I do know that the underlying DSPLink component has been known to experience issues with using gdb (at least with the 1.65.00.02 version, which was the standard included with the SDK).

    I would recommend trying to update both the C6Run and DSPLink components to the latest versions (C6Run is at version 0.97.03.03 and the DSPLink is at 1.65.00.03).

    Regards, Daniel

  • Thank you for the reply, now I am sure that I can do by hand what the option is supposed to do. I will update my SDK if I have enough time.

     

    Regards, Bruno