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.

Unable to compile CRC functions

Other Parts Discussed in Thread: CONTROLSUITE

Hi all,

I would love to have some help with the CRC functions, I'm new with them and with Texas, and I'm having problems trying to compile the code.

I have a working project in CCS(6.0.1.00040) with a TMS320F28069PNT that make use of ADC, FIR and SCI. But now I need to run a CRC-CCITT to 22 bytes of data before sending them.

Taking a look to "TMS320x2806x Piccolo Technical Reference Manual" I found VCRC16P2L_1 and VCRC16P2H_1 as part of the instruction set, so I create a new .asm source with the example code:

; -------------------
; Calculate the CRC of a block of data
; This function assumes the block is a multiple of 2 16-bit words
;
	.global _CRC16P2
_CRC16P2
	VCRCCLR 				; Clear the result register
	MOV AL, *+XAR4[4] 		; AL = CRCLen
	ASR AL, 2 				; AL = CRCLen/4
	SUBB AL, #1 			; AL = CRCLen/4 - 1
	MOVL XAR7, *+XAR4[2] 	; XAR7 = &CRCData
	.align 2
	NOP 					; Align RPTB to an odd address
	RPTB _CRC16P2_done, AL 	; Execute block of code AL + 1 times
	VCRC16P2L_1 *XAR7 		; Calculate CRC for 4 bytes
	VCRC16P2H_1 *XAR7++		; ...
	VCRC16P2L_1 *XAR7 		; ...
	VCRC16P2H_1 *XAR7++ 	; ...
_CRC16P2_done
	MOVL XAR7, *_+XAR4[0] 	; XAR7 = &CRCResult
	MOV32 *+XAR7[0], VCRC 	; Store the result
	LRETR 					; return to caller

and get a lot of errors... E0002, E0003, E0004:

Any help would be appreciated, thanks !!

  • Hi Eloy,

    Please check in Properties -> Build -> C2000 Compiler -> Processor Options. Is the VCU0 compiler flag set to support the VCU instructions?

    sal
  • Hi Sal.

    No, it wasn't set !!! Now it is,and I have least Errors, but those who remains, don't come from instructions.

    Maybe you can still help me, but at least now I can try on my own, thank you very much.

    Just in case, I place the new report:

    Thank you again!

  • I believe for the first two errors, you need to eliminate the underscore in the second operand.

    I do not think MOV32 is a proper instruction. MOVL is the one to use.
  • Ok, removing the underscore solves part of the problem, but the MOV32 instruction still doesn't compiling, even changing it to MOVL. Searching in Tech_reference I found VMOV32. I tried and it compiles, but I'm not pretty sure if it's going to work properly.

    Sorry for bothering you, but as you may have noticed, I lack in assembler knowledge, and try changes over a Texas example code that I am unable to compile, makes me think I'm doing something wrong.

    New "CRC16P2_done" code:

    Thank you again Sal !

  • Hi Eloy,

    Just FYI, we have a VCU DSP library in controlsuite where the CRC functions are implemented. You will find the source code for it under

    C:\ti\controlSUITE\libs\dsp\VCU\v2_10_00_00\source\vcu0\crc

    assuming you have installed controlsuite under C:\ti
  • Thank you Vishal, I will take a look.
  • Did you get this figured out?
  • Unfortunately not yet. All your help was very useful, but I'm in a hurry to finish a project, so I worked in a C code instead of using VCU (I'm not proud of this decision, but It was Important to have something working quickly).

    For me, to understand adequately all the example codes, is necessary to learn much more assembler, how to make C callable functions, working with the stack, and so on... Once I have enough, I would be able to retake the VCU and make things properly, but now I'm just too noob.

    I hope to return soon, and anyway, thank you two!