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.

crcSignGen big endian bug

Other Parts Discussed in Thread: HALCOGEN

Version 04.05.01 of HalCoGen generated crc.c has a bug in crcSignGen at line 135. High word goes into low PSA register and low word goes into high PSA register. Most significant byte is at the lowest address and when copied to the register the first register is the low one. The code needs to swap words when used on a big endian system, for IAR compiler at least. My guess is the same goes for CCS.

Best Regards

Henrik

  • Henrik,

    To be sure I understand, I'm assuming based on prior posts that you are using the LS0432 and so line 135 when generated for IAR tools is the one marked 135 below - is that correct?    Reason I ask is that the line number 135 changes depending on which device and toolchain you generate for.

    void crcSignGen(crcBASE_t *crc,crcModConfig_t *param)
    {
    /* USER CODE BEGIN (6) */
    /* USER CODE END */
        uint32 i = 0U, psaSigx;
    volatile uint64 * ptr64, * psaSigx_ptr64;
        ptr64=param->src_data_pat;
    	
    	/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    	/*SAFETYMCUSW 439 S MR:11.3 <APPROVED> "Pointer Manupulation required to find offset - Advisory as per MISRA" */
    	psaSigx = (uint32)(&crc->PSA_SIGREGL1) + ((uint32)(param->crc_channel) * 0x40U);
    	psaSigx_ptr64 = (uint64 *) (psaSigx);
    
    	if(param->mode==CRC_FULL_CPU)
        {
            for(i=0U;i<param->data_length;i++)
            {
    		    /*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    
                *psaSigx_ptr64 = *ptr64;
    
    			/*SAFETYMCUSW 45 D MR:21.1 <APPROVED> "Valid non NULL input parameters are only allowed in this driver" */
    			/*SAFETYMCUSW 567 S MR:17.1,17.4 <APPROVED> "Pointer increment needed" */
    			ptr64++;
            }
    /* USER CODE BEGIN (7) */
    /* USER CODE END */
        }
        else
    	{
            /* Empty */
        }