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.

LAUNCHXL2-RM57L: Solution to MISRA-C Warning

Part Number: LAUNCHXL2-RM57L
Other Parts Discussed in Thread: HALCOGEN

I tried to remove MISRA-C warning in SCI Module. I enabled SCI1 in halcogen and generated the code

Please check CCS will support following solution or not

Warning : Array Indexing is the only allowed form of pointer arithmetic

void sciSend(sciBASE_t *sci , uint32 length , uint8  *data)

{

while(length > 0U)

{

while((sci->FLR & (uint32)SCI_TX_INT)==0U)

{

}

txdata = *data;

sci -> TD = (uint32)( txdata );

data++;

length--;

}

}

In the above programme, "data" is the pointer variable, which stores the address, we should not increment the pointer variable according to Misra C rule. Hence, By giving the array as the parameter to function, we can access through array indexing.

void sciSend(sciBASE_t *sci, uint32 length, uint8 data[ ])

{

while(length >0)

{

uint8 count;

while ((sci->FLR & (uint32)SCI_TX_INT) ==0U)

{

}

txdata = data[count];

sci -> TD = (uint32)(txdata);

count++;

length--;

}

}