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.

Compiler/MSP430F5438A: MISRA 17.6 giving warning

Part Number: MSP430F5438A

Tool/software: TI C/C++ Compiler

Hi,

I have activated MISRA-C:2004 checks in Code Composer Studio and getting MISRA17.6 warning for the following piece of code:

typedef struct
{
uint8_t srcAddr;
uint8_t destAddr;
uint8_t frameType;
uint8_t cmdId;
uint8_t dataLength;
uint8_t dataBytes[8];
} node_info_s;

void can_send(node_info_s nodeInfo)
{
uint8_t canSendBuf[13];
load_txbuf_params_s loadCanMsg;
uint8_t dataCount = (uint8_t)0;
canSendBuf[0] = nodeInfo.srcAddr; //MISRA 17.6 WARNING
canSendBuf[1] = nodeInfo.destAddr; //MISRA 17.6 WARNING
canSendBuf[2] = nodeInfo.frameType; //MISRA 17.6 WARNING
canSendBuf[3] = nodeInfo.cmdId; //MISRA 17.6 WARNING
canSendBuf[4] = nodeInfo.dataLength; //MISRA 17.6 WARNING
for (dataCount = (uint8_t)0; dataCount < nodeInfo.dataLength; dataCount++)
{
canSendBuf[(uint8_t)4 + dataCount] = nodeInfo.dataBytes[dataCount];
}
loadCanMsg.param_load_txbuf = LOAD_TXB0SIDH;
loadCanMsg.param_reg_txbuf = REG_TXB0CTRL;
loadCanMsg.param_rts_txbuf = RTS_TXBUF0;
SPI_MCP_Load_TXBUF(loadCanMsg, nodeInfo.dataLength, canSendBuf);
}

Resource Location Type #1423-D (MISRA-C:2004 17.6/R) The address of an object with automatic storage shall not be assigned to another object that may persist after the first object has ceased to exist ("nodeInfo")

 

What I fail to understand is how a local variable like canSendBuf can persist after the scope of the function is over? Is this is a false positive?

 

Thanks and Regards,

Ankit