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.

#770-D conversion from pointer to smaller integer

On a TMS28377D, I get the following compiler warning:

#770-D conversion from pointer to smaller integer

when I set the Cla1Regs.MVECTx registers.  The line with the warning is:

Cla1Regs.MVECT1 = (uint16_t) &cla_task;

I compared my code to the Lab 9 in the C2000 Multi-Day Workshop, which does not emit the warning and as far as I can tell, they appear the same.  What could I be doing differently that causes the warning in my project?

Edit: After posting it, I realized this perhaps goes better in the C2000 forum, but I don't see any way for me to move it there.  Please move if it should go there.

  • Joseph Chang53 said:
    #770-D conversion from pointer to smaller integer

    a pointer to a function is 32-bits wide but MVECT is a 16-bit address so there is a truncation that happens. Now the reason MVECT is 16-bits is that the CLA can only fetch code (and data) from the lower 64Kwords portion of memory. All cla tasks need to be in the "near" memory range. It is ok to ignore this warning as long as you manually (the tools wont do this for you) check that cla_task does indeed fall in the lower 64Kw.

    As for the labs my guess is this warning is suppressed in the project settings.

  • Hi Vishal,

    I appreciate the response.

    Vishal_Coelho said:

    All cla tasks need to be in the "near" memory range. It is ok to ignore this warning as long as you manually (the tools wont do this for you) check that cla_task does indeed fall in the lower 64Kw.

    My understanding is that cla_task being within the lower 64Kw is not sufficient since CLA program memory is restricted to LS0 - LS5 RAM (which is within"near"/lower 64Kw).  For example, D0 - D1 RAM and GS0 - GS3 RAM are also within the lower 64kW, however they are not accessible by the CLA.

    Vishal_Coelho said:

    As for the labs my guess is this warning is suppressed in the project settings.

    I tried looking for the warning suppression, but was unable to locate it.  The Lab 9 "Project Properties > C2000 Compiler > Summary of flags set:" is:
    -v28 -mt -ml --vcu_support=vcu2 --cla_support=cla1 --tmu_support=tmu0 --float_support=fpu32 --include_path="C:/ti/ccsv6/tools/compiler/c2000_6.4.11/include" --include_path="C:/C28x/Labs/F2837xD_headers/include" --include_path="C:/C28x/Labs/Lab_common/include" -g --define=CPU1 --diag_warning=225 --diag_wrap=off --display_error_number

    As far as I can tell, "--diag_warning=225" is the only part that refers to warnings and I have the same flag set in my project.  Also, it seems like suppressing it for the entire project is inadvisable since it could suppress a warning elsewhere that should not be suppressed.  Is there a way to suppress it just for the lines in question which assign to MVECT?  

    Just found this:

    So I tried the following which suppresses the warning for the specific lines in question:

    #pragma diag_suppress 770
        Cla1Regs.MVECT1 = (uint16_t) &cla_task;
    #pragma diag_default 770

    I'm still not sure how Lab 9 does not have the warning, however pointing out that the warning was suppressed pointed me in the right direction to an acceptable way to handle the warning.

    Thanks,

    Joseph

  • Joseph Chang53 said:
    My understanding is that cla_task being within the lower 64Kw is not sufficient since CLA program memory is restricted to LS0 - LS5 RAM (which is within"near"/lower 64Kw).  For example, D0 - D1 RAM and GS0 - GS3 RAM are also within the lower 64kW, however they are not accessible by the CLA.

    You are correct. For this device the CLA program RAM is restricted to LS0-LS5, but it is designed to have a 16-bit program address bus. In some devices the CLA program ROM is dual mapped to some portion of the lower 64Kw of memory so the CLA can access it. It is possible that on future devices additional portions of the lower 64K will be made available to the CLA. 

    For the 2837x, however, you do need to make sure the tasks are in LS0-5, and then assign ownership of the RAM (at runtime) to the CLA.