Reply by Brad Griffis May 11, 20042004-05-11
Angus,

There's a build option for "autoinitialization" in CCS.  This setting
basically means that you are running a C environment.  With this option
selected, when the DSP starts running it begins by running the function
_c_int00 from the rts library.  This sets up the C environment and then
branches to your main( ) function.  It appears you've coded everything in
assembly and don't have a main( ) function.  That's why you're getting the
linker error.

One solution would be to create a C file with the function void main(void)
in it.  From within this function you could make a call to your assembly
function by following the C calling conventions.

Another alternative is to change that build option to "no
autoinitialization" and put in a "code entry point" with the same name as
your assembly function.  That way the DSP will know what code to start
running after you restart it.

Brad

"Angus" <abrandt@dsp.sun.ac.za> wrote in message
news:a06da7c341e399d8172dafe3cddcba22@localhost.talkaboutelectronicequipment.com...
> No Jarvis, TexusFIR is not the problem. I noticed my rts.lib is looking > for _main. But I only have main.inc. When I change the name to _main.inc I > get other error. > > >
Reply by tnk May 11, 20042004-05-11
I think you will need an entry point to your routine (_main) .

tnk

"Angus" <abrandt@dsp.sun.ac.za> wrote in message news:<2e1554f63b40195848c3c86996e634d9@localhost.talkaboutelectronicequipment.com>...
> Hi Wolfgang, > Thanx for your reply. > > Not sure I understand what you mean. Here is my assembler code. I am > implimenting a filter. > > > This is my main.inc file > > * Filename: Main.inc > * Includes all the constants that are used in the entire application > K_0 .set 0 ; constant > K_FIR_INDEX .set 1 ; index count > K_FIR_BFFR .set 16 ; FIR buffer size > K_neg1 .set -1h ; index count > K_BIQUAD .set 2 ; there are 2 bi-quad sections > K_IIR_SIZE .set 10 ; each bi-quad has 5 coeffs > K_STACK_SIZE .set 200 ; stack size > K_FRAME_SIZE .set 256 ; PING/PONG buffer size > K_FRAME_FLAG .set 1 ; set after 256 collected > H_FILT_SIZE .set 128 ; H(z) filter size > ADPT_FILT_SIZE .set 128 ; W(z) filter size > K_mu .set 0h ; initial step constant > K_HOST_FLAG .set 1 ; Enable EVM_HOST interface > K_DEFAULT_AC01 .set 1h ; default AC01 init > > * This include file sets the FFT size for the ?54x Real FFT code > * Note that the Real FFT size (i.e. the number of points in the > * original real input sequence) is 2N; whereas the FFT size is > * the number of complex points formed by packing the real inputs, > * which is N. For example, for a 256-pt Real FFT, K_FFT_SIZE > * should be set to 128 and K_LOGN should be set to 7. > > K_FFT_SIZE .set 128 ; # of complex points (=N) > K_LOGN .set 7 ; # of stages (=logN/log2) > K_ZERO_BK .set 0 > K_TWID_TBL_SIZE .set 128 ; Twiddle table size > K_DATA_IDX_1 .set 2 ; Data index for Stage 1 > K_DATA_IDX_2 .set 4 ; Data index for Stage 2 > K_DATA_IDX_3 .set 8 ; Data index for Stage 3 > K_FLY_COUNT_3 .set 4 ; Butterfly counter for Stage 3 > K_TWID_IDX_3 .set 32 ; Twiddle index for Stage 3 > > This is my filter design > ; TEXAS INSTRUMENTS INCORPORATED > .mmregs > .include "main.inc" > ; the 16 tap FIR coefficients > COFF_FIR_START .sect "coff_fir" ; filter coefficients > .word 6Fh > .word 0F3h > .word 269h > .word 50Dh > .word 8A9h > .word 0C99h > .word 0FF8h > .word 11EBh > .word 11EBh > .word 0FF8h > .word 0C99h > .word 8A9h > .word 50Dh > .word 269h > .word 0F3h > .word 6Fh > COFF_FIR_END > FIR_DP .usect "fir_vars",0 > d_filin .usect "fir_vars",1 > d_filout .usect "fir_vars",1 > fir_coff_table .usect "fir_coff",20 > d_data_buffer .usect "fir_bfr",40 ; buffer size for the filter > .def fir_init ; initialize FIR filter > .def fir_task ; perform FIR filtering > ;----------------------------------------------------------------------------- > ; Functional Description > ; This routine initializes circular buffers both for data and coeffs. > ;----------------------------------------------------------------------------- > .asg AR0, FIR_INDEX_P > .asg AR4,FIR_DATA_P > .asg AR5,FIR_COFF_P > .sect "fir_prog" > fir_init: > STM #fir_coff_table,FIR_COFF_P > RPT #K_FIR_BFFR-1 ; move FIR coeffs from program > MVPD #COFF_FIR_START,*FIR_COFF_P+ ; to data > STM #K_FIR_INDEX,FIR_INDEX_P > STM #d_data_buffer,FIR_DATA_P ; load cir_bfr address for the > ; recent samples > RPTZ A,#K_FIR_BFFR > STL A,*FIR_DATA_P+ ; reset the buffer > STM #(d_data_buffer+K_FIR_BFFR-1), FIR_DATA_P > RETD > STM #fir_coff_table, FIR_COFF_P > ;--------------------------------------------------------------------------- > ; Functional Description > ; > ;This subroutine performs FIR filtering using MAC instruction. > ; accumulator A (filter output) = h(n)*x(n-i) for i = 0,1...15 > ;----------------------------------------------------------------------------- > .asg AR6,INBUF_P > .asg AR7,OUTBUF_P > .asg AR4,FIR_DATA_P > .asg AR5,FIR_COFF_P > .sect "fir_prog" > fir_task: > ; LD #FIR_DP,DP > STM #K_FRAME_SIZE-1,BRC ; Repeat 256 times > RPTBD fir_filter_loop-1 > STM #K_FIR_BFFR,BK ; FIR circular bffr size > LD *INBUF_P+, A ; load the input value > fir_filter: > STL A,*FIR_DATA_P+% ; replace oldest sample with newest > ; sample > RPTZ A,(K_FIR_BFFR-1) > MAC *FIR_DATA_P+0%,*FIR_COFF_P+0%,A ; filtering > STH A, *OUTBUF_P+ ; replace the oldest bffr value > fir_filter_loop > RET > > > Wolfgang, what am I doing wrong. > > Angus
Reply by Angus May 11, 20042004-05-11
No Jarvis, TexusFIR is not the problem.  I noticed my rts.lib is looking
for _main. But I only have main.inc. When I change the name to _main.inc I
get other error.



Reply by Angus May 11, 20042004-05-11
Wofgang, should I change the name of my main.inc file to _main.inc.

My error again:
==========================================================
undefined                        first referenced
 symbol                              in file
---------                        ----------------
_main                            C:\ti\c5400\cgtools\lib\rts.lib
>> error: symbol referencing errors - ./Debug/TexusFIR.out not built
Build Complete, 1 Errors, 0 Warnings, 0 Remarks. ========================================================== my assembler code * Filename: Main.inc * Includes all the constants that are used in the entire application K_0 .set 0 ; constant K_FIR_INDEX .set 1 ; index count K_FIR_BFFR .set 16 ; FIR buffer size K_neg1 .set -1h ; index count K_BIQUAD .set 2 ; there are 2 bi-quad sections K_IIR_SIZE .set 10 ; each bi-quad has 5 coeffs K_STACK_SIZE .set 200 ; stack size K_FRAME_SIZE .set 256 ; PING/PONG buffer size K_FRAME_FLAG .set 1 ; set after 256 collected H_FILT_SIZE .set 128 ; H(z) filter size ADPT_FILT_SIZE .set 128 ; W(z) filter size K_mu .set 0h ; initial step constant K_HOST_FLAG .set 1 ; Enable EVM_HOST interface K_DEFAULT_AC01 .set 1h ; default AC01 init * This include file sets the FFT size for the &#2013266066;54x Real FFT code * Note that the Real FFT size (i.e. the number of points in the * original real input sequence) is 2N; whereas the FFT size is * the number of complex points formed by packing the real inputs, * which is N. For example, for a 256-pt Real FFT, K_FFT_SIZE * should be set to 128 and K_LOGN should be set to 7. K_FFT_SIZE .set 128 ; # of complex points (=N) K_LOGN .set 7 ; # of stages (=logN/log2) K_ZERO_BK .set 0 K_TWID_TBL_SIZE .set 128 ; Twiddle table size K_DATA_IDX_1 .set 2 ; Data index for Stage 1 K_DATA_IDX_2 .set 4 ; Data index for Stage 2 K_DATA_IDX_3 .set 8 ; Data index for Stage 3 K_FLY_COUNT_3 .set 4 ; Butterfly counter for Stage 3 K_TWID_IDX_3 .set 32 ; Twiddle index for Stage 3 ; TEXAS INSTRUMENTS INCORPORATED .mmregs .include "main.inc" ; the 16 tap FIR coefficients COFF_FIR_START .sect "coff_fir" ; filter coefficients .word 6Fh .word 0F3h .word 269h .word 50Dh .word 8A9h .word 0C99h .word 0FF8h .word 11EBh .word 11EBh .word 0FF8h .word 0C99h .word 8A9h .word 50Dh .word 269h .word 0F3h .word 6Fh COFF_FIR_END FIR_DP .usect "fir_vars",0 d_filin .usect "fir_vars",1 d_filout .usect "fir_vars",1 fir_coff_table .usect "fir_coff",20 d_data_buffer .usect "fir_bfr",40 ; buffer size for the filter .def fir_init ; initialize FIR filter .def fir_task ; perform FIR filtering ;----------------------------------------------------------------------------- ; Functional Description ; This routine initializes circular buffers both for data and coeffs. ;----------------------------------------------------------------------------- .asg AR0, FIR_INDEX_P .asg AR4,FIR_DATA_P .asg AR5,FIR_COFF_P .sect "fir_prog" fir_init: STM #fir_coff_table,FIR_COFF_P RPT #K_FIR_BFFR-1 ; move FIR coeffs from program MVPD #COFF_FIR_START,*FIR_COFF_P+ ; to data STM #K_FIR_INDEX,FIR_INDEX_P STM #d_data_buffer,FIR_DATA_P ; load cir_bfr address for the ; recent samples RPTZ A,#K_FIR_BFFR STL A,*FIR_DATA_P+ ; reset the buffer STM #(d_data_buffer+K_FIR_BFFR-1), FIR_DATA_P RETD STM #fir_coff_table, FIR_COFF_P ;--------------------------------------------------------------------------- ; Functional Description ; ;This subroutine performs FIR filtering using MAC instruction. ; accumulator A (filter output) = h(n)*x(n-i) for i = 0,1...15 ;----------------------------------------------------------------------------- .asg AR6,INBUF_P .asg AR7,OUTBUF_P .asg AR4,FIR_DATA_P .asg AR5,FIR_COFF_P .sect "fir_prog" fir_task: ; LD #FIR_DP,DP STM #K_FRAME_SIZE-1,BRC ; Repeat 256 times RPTBD fir_filter_loop-1 STM #K_FIR_BFFR,BK ; FIR circular bffr size LD *INBUF_P+, A ; load the input value fir_filter: STL A,*FIR_DATA_P+% ; replace oldest sample with newest ; sample RPTZ A,(K_FIR_BFFR-1) MAC *FIR_DATA_P+0%,*FIR_COFF_P+0%,A ; filtering STH A, *OUTBUF_P+ ; replace the oldest bffr value fir_filter_loop RET
Reply by Jerry Avins May 11, 20042004-05-11
Angus wrote:

> Could someone tell me what I should do to get rid of the following error. > > ---------------------------- TexusFIR.pjt - Debug > ---------------------------- > "c:\ti\c5400\cgtools\bin\cl500" -g -q -fr"C:/ti/myprojects/TexusFIR/Debug" > -d"_DEBUG" -@"Debug.lkf" "FIR_16pnt.asm" > <fir_16pnt.asm> > > "c:\ti\c5400\cgtools\bin\cl500" -@"Debug.lkf" > <Linking> > > undefined first referenced > symbol in file > --------- ---------------- > _main C:\ti\c5400\cgtools\lib\rts.lib > >>> error: symbol referencing errors - ./Debug/TexusFIR.out not built > > > Build Complete, > 1 Errors, 0 Warnings, 0 Remarks.
Should "...TexusFIR..." be "...TexasFIR..."? Jerry -- Engineering is the art of making what you want from things you can get. &#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;&#2013266095;
Reply by Angus May 11, 20042004-05-11
Hi Wolfgang,
Thanx for your reply.

Not sure I understand what you mean. Here is my assembler code. I am
implimenting a filter.


This is my main.inc file

* Filename: Main.inc
* Includes all the constants that are used in the entire application
K_0 			.set 0 		; constant
K_FIR_INDEX 	.set 1 		; index count
K_FIR_BFFR 		.set 16 	; FIR buffer size
K_neg1 			.set -1h 	; index count
K_BIQUAD 		.set 2 		; there are 2 bi-quad sections
K_IIR_SIZE 		.set 10 	; each bi-quad has 5 coeffs
K_STACK_SIZE 	.set 200 	; stack size
K_FRAME_SIZE 	.set 256 	; PING/PONG buffer size
K_FRAME_FLAG 	.set 1 		; set after 256 collected
H_FILT_SIZE 	.set 128 	; H(z) filter size
ADPT_FILT_SIZE 	.set 128 	; W(z) filter size
K_mu 			.set 0h 	; initial step constant
K_HOST_FLAG 	.set 1 		; Enable EVM_HOST interface
K_DEFAULT_AC01 	.set 1h 	; default AC01 init

* This include file sets the FFT size for the &#2013266066;54x Real FFT code
* Note that the Real FFT size (i.e. the number of points in the
* original real input sequence) is 2N; whereas the FFT size is
* the number of complex points formed by packing the real inputs,
* which is N. For example, for a 256-pt Real FFT, K_FFT_SIZE
* should be set to 128 and K_LOGN should be set to 7.

K_FFT_SIZE 		.set 128 	; # of complex points (=N)
K_LOGN 			.set 7 		; # of stages (=logN/log2)
K_ZERO_BK 		.set 0
K_TWID_TBL_SIZE .set 128 	; Twiddle table size
K_DATA_IDX_1 	.set 2 		; Data index for Stage 1
K_DATA_IDX_2 	.set 4 		; Data index for Stage 2
K_DATA_IDX_3 	.set 8 		; Data index for Stage 3
K_FLY_COUNT_3 	.set 4 		; Butterfly counter for Stage 3
K_TWID_IDX_3 	.set 32 	; Twiddle index for Stage 3

This is my filter design
; TEXAS INSTRUMENTS INCORPORATED
		.mmregs
		.include "main.inc"
; the 16 tap FIR coefficients
COFF_FIR_START 	.sect "coff_fir" ; filter coefficients
				.word 6Fh
				.word 0F3h
				.word 269h
				.word 50Dh
				.word 8A9h
				.word 0C99h
				.word 0FF8h
				.word 11EBh
				.word 11EBh
				.word 0FF8h
				.word 0C99h
				.word 8A9h
				.word 50Dh
				.word 269h
				.word 0F3h
				.word 6Fh
COFF_FIR_END
FIR_DP 			.usect "fir_vars",0
d_filin 		.usect "fir_vars",1
d_filout 		.usect "fir_vars",1
fir_coff_table 	.usect "fir_coff",20
d_data_buffer 	.usect "fir_bfr",40 ; buffer size for the filter
				.def fir_init ; initialize FIR filter
				.def fir_task ; perform FIR filtering
;-----------------------------------------------------------------------------
; Functional Description
; This routine initializes circular buffers both for data and coeffs.
;-----------------------------------------------------------------------------
				.asg AR0, FIR_INDEX_P
				.asg AR4,FIR_DATA_P
				.asg AR5,FIR_COFF_P
				.sect "fir_prog"
fir_init:
		STM 	#fir_coff_table,FIR_COFF_P
		RPT 	#K_FIR_BFFR-1 					; move FIR coeffs from program
		MVPD 	#COFF_FIR_START,*FIR_COFF_P+ 	; to data
		STM 	#K_FIR_INDEX,FIR_INDEX_P
		STM 	#d_data_buffer,FIR_DATA_P 		; load cir_bfr address for the
												; recent samples
		RPTZ 	A,#K_FIR_BFFR
		STL 	A,*FIR_DATA_P+ 					; reset the buffer
		STM 	#(d_data_buffer+K_FIR_BFFR-1), FIR_DATA_P
		RETD
		STM 	#fir_coff_table, FIR_COFF_P
;---------------------------------------------------------------------------
; Functional Description
;
;This subroutine performs FIR filtering using MAC instruction.
; accumulator A (filter output) = h(n)*x(n-i) for i = 0,1...15
;-----------------------------------------------------------------------------
				.asg AR6,INBUF_P
				.asg AR7,OUTBUF_P
				.asg AR4,FIR_DATA_P
				.asg AR5,FIR_COFF_P
				.sect "fir_prog"
fir_task:
; 		LD #FIR_DP,DP
		STM 	#K_FRAME_SIZE-1,BRC 			; Repeat 256 times
		RPTBD 	fir_filter_loop-1
		STM 	#K_FIR_BFFR,BK 					; FIR circular bffr size
		LD 		*INBUF_P+, A 					; load the input value
fir_filter:
		STL 	A,*FIR_DATA_P+% 				; replace oldest sample with newest
												; sample
		RPTZ 	A,(K_FIR_BFFR-1)
		MAC 	*FIR_DATA_P+0%,*FIR_COFF_P+0%,A ; filtering
		STH 	A, *OUTBUF_P+ 					; replace the oldest bffr value
fir_filter_loop
		RET


Wolfgang, what am I doing wrong.

Angus

Reply by Wolfgang May 11, 20042004-05-11
Hello Angus,

Probably you use the real time system and you do not have 
a "void main(void)" in your TexusFIR.
Seems that the rts wants to jump into your main which is not found...

                                May that's a hint,
                                                        Wolfgang

P.S.: Each C-level function gets a "_" at the beginning in assembler. If you write in C
a "main" -function is missing. If you use Assembler a "_main" -function is missing.

Reply by Angus May 11, 20042004-05-11
Could someone tell me what I should do to get rid of the following error.

----------------------------  TexusFIR.pjt - Debug 
----------------------------
"c:\ti\c5400\cgtools\bin\cl500" -g -q -fr"C:/ti/myprojects/TexusFIR/Debug"
-d"_DEBUG" -@"Debug.lkf" "FIR_16pnt.asm"
<fir_16pnt.asm>

"c:\ti\c5400\cgtools\bin\cl500" -@"Debug.lkf"
<Linking>

undefined                        first referenced
 symbol                              in file
---------                        ----------------
_main                            C:\ti\c5400\cgtools\lib\rts.lib
>> error: symbol referencing errors - ./Debug/TexusFIR.out not built
Build Complete, 1 Errors, 0 Warnings, 0 Remarks.