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.

MSP430FR5738: Header file variable type conflicts

Part Number: MSP430FR5738
Other Parts Discussed in Thread: MSP430FR59471

I am using the msp430 header files for c, specifically the msp430fr5738.h and msp430fr59471.h. Running the code through a MISRA code inspection test results in some violations due to #defines in these header files. Especially in register access. The register is defined as an unsigned integer but the bit settings are defined as signed integers. This causes a violation due to the mismatch in datatypes.

For example, in your example projects, the first line is generally as follows:

WDTCTL = WDTPW + WDTHOLD;

 

WDTCTL is defined as SFR_16BIT(WDTCTL)

where: #define SFR_16BIT(address)  extern volatile unsigned int address

WDTPW is defined as (0x5A00)

WDTHOLD is defined as (0x0080)

 

So WDTCTL is an unsigned integer, whilst WDTPW and WDTHOLD are defined as signed integers. 

Do TI provide a version of these header files with the correct definitions for register assignments? WDTPW as (0x5A00U) for example? As this really should be done to pass the MISRA software standard which is very commonly used in industry.

Thanks,

Matt

  • Hi Matt,

    We don't claim that the MSP430 code is MISRA compliant, but we do provide the files for users to change at their discretion. Though changes and results from those changes are up to the user. Code examples that are made specifically for automotive use are MISRA compliant though.

    As for the header files, currently we don't have premade header files with different declarations.

    Regards,

    Luke

  • Do TI provide a version of these header files with the correct definitions for register assignments?

    A search found the enhancement Update rts files to be MISRA compliant, which was raised 10 years ago on the TI MSP430 Code Generation Tools with a description of "Update rts files to be MISRA compliant".

    Not sure when / if the change will be done; it is currently marked with a status of "PLANNED".

**Attention** This is a public forum