Forums

errors in asm code

Started by vsevindik December 5, 2003
hi,
i am a new member of this group.
i want to ask something.I have Rulph Chassaing book abot TMS320C30.
I have also program codes which is written in book by him.
I am using TMS320C30 simulator and for compiling i am using "Codegen
tools v5.10".I compile and run all of the programs up to now, but i
encountered a problem in one asm program.
I have appropriote cmd file.When i run program, i see these errors.

C:\c3xtools>cl30 -sq -o2 LP11BF2.ASM -z -v0 LP11.ASM
<lp11bf2.asm>
XN .USECT "XN_BUFF",LENGTH ;BUFFER SIZE OF SAMPLES
"lp11bf2.asm", line 10: AN IDENTIFIER IN THE EXPRESSION IS INVALID

HN .USECT "HN_BUFF",LENGTH ;COEFF BUFFER SIZE IN RAM
"lp11bf2.asm", line 11: AN IDENTIFIER IN THE EXPRESSION IS INVALID 2 Errors, No Warnings

Errors in source - Assembler Aborted

and cmd file

/*LP11.CMD COMMAND FILE */
LP11.OBJ /*FIR PROGRAM */
-E BEGIN /*SPECIFIES ENTRY POINT FOR OUTPUT*/
-O LP11.OUT /*LINKED COFF OUTPUT FILE */
MEMORY
{
VECS: org = 0 len = 0x40 /*VECTOR LOCATIONS*/
SRAM: org = 0x40 len = 0x3FC0 /*16K EXTERNAL RAM*/
RAM : org = 0x809800 len = 0x800 /*2K INTERNAL RAM */
IO : org = 0x804000 len = 0x2000 /*8K -IOSTRB */
}
SECTIONS
{
.data: {} > SRAM /*DATA SECTION */
.text: {} > SRAM /*CODE */
.cinit: {} > SRAM /*INITIALIZATION TABLES */
.stack: {} > RAM /*SYSTEM STACK */
.bss: {} > RAM /*BSS SECTION IN RAM */
VECTORS:{} > VECS /*RESET & INTERRUPT VECTORS */
XN_BUFF ALIGN(64): {} > RAM /*CIRCULAR BUFFER */
}

asm program,

;LP11BF2.ASM-LOWPASS FIR WITH 11 COEFF AND 2 CIRCULAR BUFFERS
.TITLE "LP11BF2.ASM" ;LP @ 1 kHz, 2 BUFFERS
.GLOBAL MAIN,BEGIN,FILT,COEFF ;REF/DEF SYMBOLS
.DATA ;ASSEMBLE -> DATA SECT
IO_IN .WORD 804000H ;INPUT ADDRESS
IO_OUT .WORD 804001H ;OUTPUT ADDRESS
XN_ADDR .WORD XN+LENGTH-1 ;(LAST) SAMPLE ADDR
HN1_ADDR .WORD COEFF
LENGTH .SET 11 ;COEFF TABLE ADDR IN SRAM
HN2_ADDR .WORD HN ;COEFF TABLE ADDR IN RAM
XN .USECT "XN_BUFF",LENGTH ;BUFFER SIZE OF SAMPLES
HN .USECT "HN_BUFF",LENGTH ;COEFF BUFFER SIZE IN RAM
.SECT "VECTORS" ;ASSEMBLE -> VECT SECT
MAIN .WORD BEGIN ;BEGIN @ RESET (0H)
.TEXT ;ASSEMBLE -> TEXT SECT
BEGIN LDI @IO_IN,AR5 ;INPUT ADDR -> AR5
LDI @IO_OUT,AR6 ;OUTPUT ADDR -> AR6
LDI @XN_ADDR,AR1 ;"LAST"SAMPLE ADDR->AR1
LDI LENGTH,BK ;BK=SIZE OF CIRC BUFFER
LDF 0,R0 ;INIT R0=0
RPTS LENGTH-1 ;INIT ALL SAMPLES TO ZERO
STF R0,*AR1--% ;START/END AT LAST ADDR
LDI LENGTH,R4 ;COUNTER FOR FILT SUB
LDI LENGTH-1,RC ;REPEAT COUNTER=LENGTH
LDI @HN1_ADDR,AR0 ;1ST COEFF ADDR IN SRAM
LDI @HN2_ADDR,AR2 ;1ST COEFF ADDR IN RAM
RPTB EXCH ;TRANSFER BLOCK SRAM->RAM
LDF *AR0++,R5 ;COEFF IN SRAM->R5
EXCH STF R5,*AR2++ ;STORE IN RAM
LDI @HN2_ADDR,AR0 ;1ST COEFF ADDR->AR0
LOOP FLOAT *AR5,R3 ;INPUT NEW SAMPLE
STF R3,*AR1++% ;STORE TO MODEL DELAY
CALL FILT ;GO TO SUBROUTINE FILT
FIX R2,R1 ;R1=INTEGER(R2)
STI R1,*AR6 ;OUTPUT INTEGER VALUE
SUBI 1,R4 ;DECREMENT R4
BNZ LOOP ;BRANCH UNTIL R4 < 0
WAIT BR WAIT ;WAIT
;SUBROUTINE FILT
FILT LDF 0,R0 ;INIT R0=0
LDF 0,R2 ;INIT R2=0
RPTS LENGTH-1 ;N MULTIPLY
MPYF *AR0++%,*AR1++%,R0 ; HN*XN -> R0
|| ADDF R0,R2 ;// WITH ACC -> R2
ADDF R0,R2 ;LAST ACC -> R2
RETS ;RETURN FROM SUBROUTINE
.DATA ;ASSEMBLE -> DATA SECT
COEFF .FLOAT 0.0 ;H10
.FLOAT 0.0468 ;H9
.FLOAT 0.1009 ;H8
.FLOAT 0.1514 ;H7
.FLOAT 0.1872 ;H6
.FLOAT 0.2 ;H5
.FLOAT 0.1872 ;H4
.FLOAT 0.1514 ;H3
.FLOAT 0.1009 ;H2
.FLOAT 0.0468 ;H1
H0 .FLOAT 0.0 ;H0
LENGTH .SET H0-COEFF+1 ;LENGTH
.END ;END

is there anyone who encounters this error before?

Thank you.



Hello V

At the moment I dont have Rulph's C3x book in front of me (C25 version wont
do much good), but Im 99% sure that a value for LENGTH is not defined
*before* attempting to use it. The first example below would cause an
error, while the second works just fine.

LABEL_1 .usect "MYUSECT_1",SIZE_1 ; SIZE_1 is not known yet.
SIZE_1 .set 3 ; definition after (or by linker) will fail

SIZE_2 .set 3 ; define *before* usage
LABEL_2 .usect "MYUSECT_2",SIZE_2 ; SIZE_2 is known... this is OK

Note:

I know that Rulph wrote one of his C3x books (there are two) based on the
C3x DSK so it is likely that if you are porting code between them some minor
differences can creep in when comparing ASM30 to DSK3A, the DSK assembler.

DSK3A is essentially a linkerless assembler that is designed to create
simple code rapidly and with little fuss. Basically it generates an
executable output rather than object code by knowing where to put code and
data before an assembly directive is encountered. Not surprisingly it
occasionally does a better job of forward resolving things.

Strictly speaking I dont think a .usect size is really needed in the first
pass of the assembler, so this should (in my opinion) still be resolvable.
But thats the breaks of how COFF works.

Best regards
Keith Larson

================================
At 07:36 AM 12/5/03 -0000, you wrote:
hi,
i am a new member of this group.
i want to ask something.I have Rulph Chassaing book abot TMS320C30. I have
also program codes which is written in book by him. I am using TMS320C30
simulator and for compiling i am using "Codegen tools v5.10".I compile and
run all of the programs up to now, but i encountered a problem in one asm
program. I have appropriote cmd file.When i run program, i see these errors.

C:\c3xtools>cl30 -sq -o2 LP11BF2.ASM -z -v0 LP11.ASM <lp11bf2.asm>

XN .USECT "XN_BUFF",LENGTH ;BUFFER SIZE OF SAMPLES
"lp11bf2.asm", line 10: AN IDENTIFIER IN THE EXPRESSION IS INVALID

HN .USECT "HN_BUFF",LENGTH ;COEFF BUFFER SIZE IN RAM
"lp11bf2.asm", line 11: AN IDENTIFIER IN THE EXPRESSION IS INVALID 2 Errors, No Warnings

Errors in source - Assembler Aborted
+-----------+
|Keith Larson |
|Member Group Technical Staff |
|Texas Instruments Incorporated |
| |
| 281-274-3288 |
| |
| www.micro.ti.com/~klarson |
|-----------+
| TMS320C3x/C4x/VC33 Applications |
| |
| TMS320VC33 |
| The lowest cost and lowest power 500 w/Mflop |
| floating point DSP on the planet! |
+-----------+