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.

TDA4VM: Compilation error in PDK headers

Part Number: TDA4VM

I've been trying to rebuild TIDL-RT inside the ti-processor-sdk-rtos-j721e-evm-08_05_00_11 SDK, and I have found what looks to be a major error in a header in a PDK driver which causes compilation to fail.

/opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/pdk_jacinto_08_05_00_36/packages/ti/drv/sciclient/soc/sysfw/include/tisci/tisci_protocol.h:98:16: error: flexible array member ‘tisci_header::payload’ not at end of ‘struct tisci_msg_rm_proxy_cfg_req’
98 | uint8_t payload[];
| ^~~~~~~
In file included from /opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/pdk_jacinto_08_05_00_36/packages/ti/drv/sciclient/sciclient.h:375,
from /opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/pdk_jacinto_08_05_00_36/packages/ti/drv/udma/udma.h:101,
from /opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/tidl_j721e_08_05_00_16/ti_dl/test/src/pc_linux/../tidl_tb_utils.c:91:
/opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/pdk_jacinto_08_05_00_36/packages/ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_proxy.h:83:25: note: next member ‘uint32_t tisci_msg_rm_proxy_cfg_req::valid_params’ declared here
83 | uint32_t valid_params;
| ^~~~~~~~~~~~
/opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/pdk_jacinto_08_05_00_36/packages/ti/drv/sciclient/soc/sysfw/include/tisci/rm/tisci_rm_proxy.h:81:8: note: in the definition of ‘struct tisci_msg_rm_proxy_cfg_req’
81 | struct tisci_msg_rm_proxy_cfg_req {
| ^~~~~~~~~~~~~~~~~~~~~~~~~~
In file included from /opt/ti-processor-sdk-rtos-j721e-evm-08_05_00_11/tidl_j721e_08_05_00_16/ti_dl/test/src/pc_linux/../tidl_tb_utils.c:91:

This is caused by a variable length struct tisci_header (final member is an array with undefined size) - which is by itself legal - being used as a non-final member in other containing structs - which is not.  The compiler has no way to know the size or offset of any members in the containing structs that are after the tisci_header member.

This is a compilation error, so it implies the delivered binaries in the SDK were not built from the source provided in the SDK.

  • Hi Ross,

    This should not create issues. The payload is just a placeholder. It is an empty array and does not really have memory allocated to this.

    When used in the context of a message for example:

    struct tisci_msg_set_device_req {

        struct tisci_header    hdr;

        uint32_t            id;

        uint32_t            reserved;

        uint8_t            state;

    } __attribute__((__packed__));

     

    Payload will point to the address of id in the above structure.

    Can you please share the complete logs?

    Regards,
    Parth

  • Hi Parth,

    Thanks for the quick response.  I'm sure functionally the code is doing what you want, but this is actually a violation of the C99 standard, which is why GCC rejects it and throws an error.

    ISO 9899:1999 - 6.7.2.1 Structure and union specifiers, paragraph 2:

    A structure or union shall not contain a member with incomplete or function type ..., except that the last member of a structure with more than one named member may have incomplete array type; such a structure (and any union containing, possibly recursively,a member that is such a structure) shall not be a member of a structure or an element of an array.

    Sounds like you just want a pointer there instead from your example?

    I've attached a full log as requested.

    3755.make.log

  • Hi Ross,

    I will raise this concern with the development team. But I'll need few details before that.

    Can you please share detailed procedure to reproduce the error on my end? I did not find what commands you are running from the logs.

    Also, meanwhile, you can try setting the payload size to 0  //uint8_t payload[0]; or try removing it altogether to move forward.

    Regards,
    Parth

  • Hi Parth,

    I just was using "make -sj8 TIDL_BUILD_ONNX_IMPORT_LIB=1 TARGET_BUILD=1 TARGET_PLATFORM=PC" from within the top level TIDL folder inside the SDK.

    Personally, I suspect part of the reason is that I don't have access to g++-5, so I'm using standard g++ (v11) - I have this symlinked as g++-5 in my path to allow the SDK to build.

    It may be the case (but I can't check) that the older compiler was missing this error - although that's just lucky I guess, and it should still get fixed :)

    Thanks,

    Ross

  • Hi Ross,

    I believe this has been answered in the thread https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1220814/tda4vm-bug-reports-for-tidl

    Closing this one. Let me know if anything else is required on this.

    Regards,
    Parth