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.

TMS320F28034: How to use assembly language to realize square root.

Part Number: TMS320F28034
Other Parts Discussed in Thread: CONTROLSUITE, C2000WARE

Hi team:

When of my customer want to use assembly language to achieve square root. Is there a routine in controlSUITE?

Or how to call IQsqrt function in assembly language?

He added the below code in .asm file:

MOVB AL, #0x0
MOV @AH, #0x6400
.ref __IQ24sqrt
LCR __IQ24sqrt

And below code in .c file:

tmp = _IQ24sqrt(100L << 24);

The function of these two parts of code is to square 100L << 24.

After compilation, the .c file generate the following code:

259 tmp = _IQ24sqrt(100L << 24);
3e9e24: FF69 SPM #0
3e9e25: 9A00 MOVB AL, #0x0
3e9e26: 28A86400 MOV @AH, #0x6400
3e9e28: 767F617A LCR _IQ24sqrt
3e9e2a: 1E42 MOVL *-SP[2], ACC

Why the program will trigger the 'ILLEGAL_ISR' when use 'LCR __IQ24sqrt' in the .asm file?

Best regards

  • Hi,

    Please take a look at thread. It may help you

    e2e.ti.com/.../555483

  • Can you elaborate a little on what you want to do please?  If it's simply calling IQ24sqrt from C there is no need to be concerned about the assembly code.  The routine is an object module in IQmathLib, and there are examples in that library in C2000Ware to guide you for this device.  My guess about the ILLEGAL_ISR is that an access has been made to illegal memory because the IQmath tables are not properly accounted for in the linker command file.  Again, there are example .cmd files in C2000Ware to help.

    I ask this because a post came in last week about square root implementation in assembly code which has now been removed (was that related?).  If you want to call this function from assembly the answer is more involved.

    Looking forward to your clarification.  Thanks.

    Regards,

    Richard