DSPRelated.com
Forums

V3.5 asm c interface

Started by Steve Holle September 3, 2004
I have an asm file with a c header that used to compile in 3.0 and won't
compile in 3.5 for the ADSP21065L.

My header is as follows :
#if defined(__cplusplus)
extern "C" {
#endif
const int l_NumLoops = TDM_NumLoops ;
const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
const int l_NumInputChannels = TDM_NumInputChannels ;

void mix ( const int dm samples[], // Sample buffer.
const long /*pm*/ gains0[], // Gains for channel 0 on
this card.
const long /*pm*/ gains1[], // Gains for channel 1 on
this card.
long delay0[], // Output buffer for
channel 0 on this card.
long delay1[] // Output buffer for
channel 1 on this card.
);

#if defined(__cplusplus)
}
#endif

and the errors are as follows :

[Error li1021] The following symbols referenced in processor 'p0' could
not be resolved:
'_l_NumInputChannels' referenced from 'Mix.doj'
'_l_NumLoops' referenced from 'Mix.doj'
'_l_NumPairs' referenced from 'InputSplitConvert_V2_00.doj'
'_l_NumScalingShiftBits' referenced from 'Mix.doj'

I reference the const ints in my asm file with a prepended underscore as
follows :

r2 = dm(_l_NumLoops) ; Is this no longer correct?

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101






I have an asm file with a c header that used to compile in 3.0 and won't
compile in 3.5 for the ADSP21065L.

My header is as follows :
#if defined(__cplusplus)
extern "C" {
#endif
const int l_NumLoops = TDM_NumLoops ;
const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
const int l_NumInputChannels = TDM_NumInputChannels ;

void mix ( const int dm samples[], // Sample buffer.
const long /*pm*/ gains0[], // Gains for channel 0 on
this card.
const long /*pm*/ gains1[], // Gains for channel 1 on
this card.
long delay0[], // Output buffer for
channel 0 on this card.
long delay1[] // Output buffer for
channel 1 on this card.
);

#if defined(__cplusplus)
}
#endif

and the errors are as follows :

[Error li1021] The following symbols referenced in processor 'p0' could
not be resolved:
'_l_NumInputChannels' referenced from 'Mix.doj'
'_l_NumLoops' referenced from 'Mix.doj'
'_l_NumPairs' referenced from 'InputSplitConvert_V2_00.doj'
'_l_NumScalingShiftBits' referenced from 'Mix.doj'

I reference the const ints in my asm file with a prepended underscore as
follows :

r2 = dm(_l_NumLoops) ; Is this no longer correct?

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101




On Tue, 7 Sep 2004, Steve Holle wrote:

> I have an asm file with a c header that used to compile in 3.0 and won't
> compile in 3.5 for the ADSP21065L.
>
> My header is as follows :
> #if defined(__cplusplus)
> extern "C" {
> #endif
> const int l_NumLoops = TDM_NumLoops ;
> const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
> const int l_NumInputChannels = TDM_NumInputChannels ;
>
> void mix ( const int dm samples[], // Sample buffer.
> const long /*pm*/ gains0[], // Gains for channel 0 on
> this card.
> const long /*pm*/ gains1[], // Gains for channel 1 on
> this card.
> long delay0[], // Output buffer for
> channel 0 on this card.
> long delay1[] // Output buffer for
> channel 1 on this card.
> );
>
> #if defined(__cplusplus)
> }
> #endif
>
> and the errors are as follows :
>
> [Error li1021] The following symbols referenced in processor 'p0' could
> not be resolved:
> '_l_NumInputChannels' referenced from 'Mix.doj'
> '_l_NumLoops' referenced from 'Mix.doj'
> '_l_NumPairs' referenced from 'InputSplitConvert_V2_00.doj'
> '_l_NumScalingShiftBits' referenced from 'Mix.doj'
>
> I reference the const ints in my asm file with a prepended underscore as
> follows :
>
> r2 = dm(_l_NumLoops) ; > Is this no longer correct?

I've got no clue, really. But I'm willing to guess :-) You might need to
declare the variables as external in the asm section. What happens when
you leave off the underscore in front? It may be it adds that after the
pre-processor has gone over everything - including your asm source.

Patience, persistence, truth,
Dr. mike



At 10:41 AM 9/7/2004, Mike Rosing wrote:
>On Tue, 7 Sep 2004, Steve Holle wrote:
>
> > I have an asm file with a c header that used to compile in 3.0 and won't
> > compile in 3.5 for the ADSP21065L.
> >
> > My header is as follows :
> > #if defined(__cplusplus)
> > extern "C" {
> > #endif
> > const int l_NumLoops = TDM_NumLoops ;
> > const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
> > const int l_NumInputChannels = TDM_NumInputChannels ;
> >
> > void mix ( const int dm samples[], // Sample buffer.
> > const long /*pm*/ gains0[], // Gains for channel 0 on
> > this card.
> > const long /*pm*/ gains1[], // Gains for channel 1 on
> > this card.
> > long delay0[], // Output buffer for
> > channel 0 on this card.
> > long delay1[] // Output buffer for
> > channel 1 on this card.
> > );
> >
> > #if defined(__cplusplus)
> > }
> > #endif
> >
> > and the errors are as follows :
> >
> > [Error li1021] The following symbols referenced in processor 'p0' could
> > not be resolved:
> > '_l_NumInputChannels' referenced from 'Mix.doj'
> > '_l_NumLoops' referenced from 'Mix.doj'
> > '_l_NumPairs' referenced from 'InputSplitConvert_V2_00.doj'
> > '_l_NumScalingShiftBits' referenced from 'Mix.doj'
> >
> > I reference the const ints in my asm file with a prepended underscore as
> > follows :
> >
> > r2 = dm(_l_NumLoops) ;
> >
> >
> > Is this no longer correct?
>
>I've got no clue, really. But I'm willing to guess :-) You might need to
>declare the variables as external in the asm section. What happens when
>you leave off the underscore in front? It may be it adds that after the
>pre-processor has gone over everything - including your asm source.
>
>Patience, persistence, truth,
>Dr. mike
.extern _l_NumInputChannels ;
.extern _l_NumLoops ;
.extern _l_NumScalingShiftBits ;

This is what the declaration looks like in the asm file. I've tried
removing the leading underscore and changing it to a double underscore. No
luck.
>_____________________________________
>Note: If you do a simple "reply" with your email client, only the author
>of this message will receive your answer. You need to do a "reply all" if
>you want your answer to be distributed to the entire group.
>
>_____________________________________
>About this discussion group:
>
>To Join: Send an email to
>
>To Post: Send an email to
>
>To Leave: Send an email to
>
>Archives: http://groups.yahoo.com/group/adsp
>
>Other Groups: http://www.dsprelated.com/groups.php3
>
>Yahoo! Groups Links >
>

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101




On Tue, 7 Sep 2004, Steve Holle wrote:

> .extern _l_NumInputChannels ;
> .extern _l_NumLoops ;
> .extern _l_NumScalingShiftBits ;
>
> This is what the declaration looks like in the asm file. I've tried
> removing the leading underscore and changing it to a double underscore. No
> luck.

Can you generate a cross reference file and see which files are attempting
to reference each label? I really don't know how the compiler sees the
assember stuff either - maybe you need to reference the labels outside the
asm so the C compiler can see them. Something like

extern l_NumLoops;
:
:
asm{

.extern _l_NumLoops;
:
:
}

Seems weird, but there's the C pre-processor, C compiler, assembler then
linker - so there's all kinds of ways for this stuff to get lost!

Patience, persistence, truth,
Dr. mike


On Tuesday 07 September 2004 21:04, Steve Holle wrote:
...
> > > [Error li1021] The following symbols referenced in processor
> > > 'p0' could not be resolved:
> > > '_l_NumInputChannels' referenced from 'Mix.doj'
> > > '_l_NumLoops' referenced from 'Mix.doj'
> > > '_l_NumPairs' referenced from

silly idea because you worked with them already, but...
did you make sure if _I_ means the correct thing:
might be upper case 'i' or lower case 'L'

Bernhard


  hello ,

the problem is u didn't add linker file to that . linker file is desperately needed for ur program. On Wed, 08 Sep 2004 Steve Holle wrote :
>At 10:41 AM 9/7/2004, Mike Rosing wrote:
> >On Tue, 7 Sep 2004, Steve Holle wrote:
> >
> > > I have an asm file with a c header that used to compile in 3.0 and won't
> > > compile in 3.5 for the ADSP21065L.
> > >
> > > My header is as follows :
> > > #if defined(__cplusplus)
> > > extern "C" {
> > > #endif
> > > const int l_NumLoops = TDM_NumLoops ;
> > > const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
> > > const int l_NumInputChannels = TDM_NumInputChannels ;
> > >
> > > void mix (  const int  dm  samples[],    // Sample buffer.
> > >              const long  /*pm*/  gains0[],      // Gains for channel 0 on
> > > this card.
> > >              const long  /*pm*/  gains1[],      // Gains for channel 1 on
> > > this card.
> > >                    long          delay0[],      // Output buffer for
> > > channel 0 on this card.
> > >                    long          delay1[]      // Output buffer for
> > > channel 1 on this card.
> > >          );
> > >
> > > #if defined(__cplusplus)
> > > }
> > > #endif
> > >
> > > and the errors are as follows :
> > >
> > > [Error li1021]  The following symbols referenced in processor 'p0' could
> > > not be resolved:
> > >          '_l_NumInputChannels' referenced from 'Mix.doj'
> > >          '_l_NumLoops' referenced from 'Mix.doj'
> > >          '_l_NumPairs' referenced from 'InputSplitConvert_V2_00.doj'
> > >          '_l_NumScalingShiftBits' referenced from 'Mix.doj'
> > >
> > > I reference the const ints in my asm file with a prepended underscore as
> > > follows :
> > >
> > >          r2 = dm(_l_NumLoops) ;
> > >
> > >
> > > Is this no longer correct?
> >
> >I've got no clue, really.  But I'm willing to guess :-)  You might need to
> >declare the variables as external in the asm section.  What happens when
> >you leave off the underscore in front?  It may be it adds that after the
> >pre-processor has gone over everything - including your asm source.
> >
> >Patience, persistence, truth,
> >Dr. mike
>.extern _l_NumInputChannels ;
>.extern _l_NumLoops ;
>.extern _l_NumScalingShiftBits ;
>
>This is what the declaration looks like in the asm file.  I've tried
>removing the leading underscore and changing it to a double underscore.  No
>luck. >
> >_____________________________________
> >Note: If you do a simple "reply" with your email client, only the author
> >of this message will receive your answer.  You need to do a "reply all" if
> >you want your answer to be distributed to the entire group.
> >
> >_____________________________________
> >About this discussion group:
> >
> >To Join:  Send an email to a...@yahoogroups.com
> >
> >To Post:  Send an email to a...@yahoogroups.com
> >
> >To Leave: Send an email to a...@yahoogroups.com
> >
> >Archives: http://groups.yahoo.com/group/adsp
> >
> >Other Groups: http://www.dsprelated.com/groups.php3
> >
> >Yahoo! Groups Links
> >
> >
> >
> >
>
>Steve Holle
>Link Communications, Inc.
>1035 Cerise Rd.
>Billings, MT  59101
>s...@link-comm.com >
>
>_____________________________________
>Note: If you do a simple "reply" with your email client, only the author of this message will receive your answer.  You need to do a "reply all" if you want your answer to be distributed to the entire group.
>
>_____________________________________
>About this discussion group:
>
>To Join:  Send an email to a...@yahoogroups.com
>
>To Post:  Send an email to a...@yahoogroups.com
>
>To Leave: Send an email to a...@yahoogroups.com
>
>Archives: http://groups.yahoo.com/group/adsp
>
>Other Groups: http://www.dsprelated.com/groups.php3
>
>Yahoo! Groups Links
>
><*> To visit your group on the web, go to:
>    http://groups.yahoo.com/group/adsp/
>
><*> To unsubscribe from this group, send an email to:
>    a...@yahoogroups.com
>
><*




Following is the answer from AD tech support. I will be trying this later
today and posting the results.

Hi,

In C++, const variables have internal linkage by default i.e. they are
not visible outside of the file in which they are defined. It is
possible to override this behaviour by using the "extern" keyword, so in
the following example, x is not externally visible, but y is:

const int x = 55;
extern const int y = 66;

In the previous release (VDSP++ 3.0), any const variables declared using
extern "C" { ...} were (incorrectly) externally visible, and this is
what allowed your project to compile; this behaviour was changed in
VDSP++ 3.5, and this resulted in the unresolved symbols in your project.
The solution is to use the "extern" keyword in each variable that must
be visible, as follows:

#if defined(__cplusplus)
extern "C" {
#endif
extern const int l_NumLoops = TDM_NumLoops ;
extern const int l_NumScalingShiftBits = TDM_NumScalingShiftBits ;
extern const int l_NumInputChannels = TDM_NumInputChannels ;
#if defined(__cplusplus)
}
#endif

A good discussion of this topic can be found in "The C++ Programming
Language" by Bjarne Stroustrup, section 9.2.4.

Regards

DSP Tools Support

>_____________________________________
>About this discussion group:
>
>To Join: Send an email to
>
>To Post: Send an email to
>
>To Leave: Send an email to
>
>Archives:
><http://groups.yahoo.com/group/adsp" target="_blank" rel="nofollow">http://groups.yahoo.com/group/adsp>http://groups.yahoo.com/group/adsp
>
>Other Groups:
><http://www.dsprelated.com/groups.php3" target="_blank" rel="nofollow">http://www.dsprelated.com/groups.php3>http://www.dsprelated.com/groups.php3 >
>
>----------
>Yahoo! Groups Links
> * To

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101




On Thu, 9 Sep 2004, Steve Holle wrote:

> Following is the answer from AD tech support. I will be trying this later
> today and posting the results.
:
:

Cool, sounds like it should!

Patience, persistence, truth,
Dr. mike



That did do the trick. I've never seen that before. I've used constants
defined in headers with a number of different compilers and have not run
into that particular gotcha. I allways assumed that extern meant "defined
elsewhere."

At 10:52 AM 9/9/2004, Mike Rosing wrote:
>On Thu, 9 Sep 2004, Steve Holle wrote:
>
> > Following is the answer from AD tech support. I will be trying this later
> > today and posting the results.
>:
>:
>
>Cool, sounds like it should!
>
>Patience, persistence, truth,
>Dr. mike

Steve Holle
Link Communications, Inc.
1035 Cerise Rd.
Billings, MT 59101