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.

TMS320F28P650DK: warning #303-D

Part Number: TMS320F28P650DK
Other Parts Discussed in Thread: SYSCONFIG, C2000WARE

Tool/software:

Hello TI Community,

While working with the TMS320F28P650DK library provided by Texas Instruments, I encountered the following compiler warning:

#303-D: typedef name has already been declared (with same type)

This warning appears when I need to include hw_types.h and (in my case) f28p65x_device.h. Although this doesn't stop the build, it does clutter the output and may confuse users who are trying to maintain clean builds.

After reviewing the code, I believe this warning could be avoided by wrapping the typedef in the f28p65x_device.h file with a conditional preprocessor directive to check if the type has already been defined by the same way of files like dsp.h or fastrts.h.

// c2000 types for IEEE754 (same as defined in <device>/inc/hw_types.h)
#ifndef C2000_IEEE754_TYPES
#define C2000_IEEE754_TYPES
#ifdef __TI_EABI__
typedef float float32_t;
typedef double float64_t;
#else // TI COFF
typedef float float32_t;
typedef long double float64_t;
#endif // __TI_EABI__
#endif // C2000_IEEE754_TYPES

Would it be possible for the TI team to consider integrating such a guard in future releases of the library? This small change could help improve compatibility and reduce unnecessary warnings across projects.

Or maybe I'm doing wrong inclusion, so let me know.

Thank you for your support and for providing such a robust set of tools and libraries.

All the best,

Alexandre

  • Hi Alexandre,

    Thank you for the feedback. I believe the issue you are seeing is due to the fact that the hw_types.h file is already being included by driverlib files by way of (driverlib.h). By adding aa #include to your file, it will result in a duplicate warning. The best solution would be to make sure your source files have a #include to driverlib.h. Alternatively, your suggestion of the guards is the best workaround. Let me know if the suggestions work.

    Regards,

    Ozino

  • Hi Ozino,

    Thank you for your suggestion. Unfortunately, this solution doesn't work in my case.

    I rely on the bool_t type definition (for 8 bit types portability), which is required by the CANopenNode stack I'm integrating into my project and define in f28p65x_device.h file. Additionally, I need to use the f28p65x_globalvariabledefs.c file to access peripheral register definitions specific to the F28P65x device. And finaly, I use FreeRTOS through sysconfig and it includes directly cputimer.h (normaly include by driverlib). That create multiple inclusion and it fails (got the warning) when both f28p65x_device.h and hw_types.h are included.

    Because of these dependencies, I can't simply found another guard or remove the inclusion without breaking other parts of the project.

    Regards,

    Alexandre

  • Hi Alexandre,

    Thanks for the clarification. Is the issue arising only in files that include both the device.h and hw_types.h files? Or does this show in other files that only include either file? For the files that include both, does the error still persist if you swap the order of inclusion to specify hw_types.h after device.h and vice-versa?

    Regards,

    Ozino

  • Hi Ozino,

    Thank you for your response. I had done the tests and I should have communicated them to you in the previous post

    Yes, it appears when both are included in files and only those files generate the warning.

    The effect is the same when I changed the order of file inclusion.

    Regards,

    Alexandre.

  • Hi Alexandre,

    Thanks for clarifying. It makes sense that you would get the generated warnings given the file is included twice (once via hw_types.h and the other by way of driverlib.h)

    If you disable the hw_types.h in the file that has both files included, do you get the previously mentioned errors/warnings? Can you confirm if the code works as expected when only one of the files is included.

    Regards,
    Ozino

  • Hi, thanks for your message, Ozino.

    I believe there might be a misunderstanding regarding the source of the issue. The problem doesn't seem to stem from the inclusion of hw_types.h (it's included through driverlib), but rather from f28p65x_device.h. Unfortunately, I do need to include f28p65x_device.h for other parts of the code to function correctly.

    Let me know if (how) you’d like me to provide more details. A minimal reproducible example would be ideal to illustrate the issue, but preparing one will take some time.

    Regards,

    Alexandre.

  • Hi Alexandre,

    I think I understand what's going on. It appears that you are mixing bit-field and driverlib device files in the same project. Can you confirm whether your project supports either bit-field, driverlib or both. If both, there needs to be additional considerations when adding include files in the projects.

    Please refer to the F28P65x Firmware Development Package User's Guide on how to add bit-field and driverlib support (located at  in C2000Ware under device_support\f28003x\docs\F28P65x_FRM_EX_UG.pdf).

    Section 2.3 (page 35) specifically provides details on adding this project support. 

    Take note that \when combining bit-field and driverlib support, add a pre-defined symbol within the project properties called
    "_DUAL_HEADERS". This is required to avoid having conflicting definitions (in enums/structs/macros) which share the exact same names in both bit-field and driverlib headers.

    Regards,

    Ozino

  • Hi Ozino,

    Thanks for your message and the detailed reference to the F28P65x Firmware Development Package User's Guide.

    To confirm, yes—my project is configured to support both bit-field and driverlib, and I have followed the document and defined the _DUAL_HEADERS symbol as recommended. The project builds and runs as expected, which is great. But even all  the recommendations, I still encounter a warning related to "same typedef" definitions.

    I believe this might be due to typedef is not protected in f28p65x_device.h, that's why I suggest a potential improvement to that file to better handle and avoid redundant typedefs definitions.

    For memo, the warning messages concern the following typedef:

    typedef float float32_t;
    typedef double float64_t;
    typedef _Bool bool_t;

    Best regards,

    Alexandre

  • Hi Alexandre,

    Thank you for the specifics. I am going to have our software team look into this further. I'll go ahead and close out this forum post.

    Regards,

    Ozino