DSPRelated.com
Forums

assembly problem

Started by hemant ramdasi May 21, 2003
Hi all,
I am using adsp-21060 .I have written a simple mixed
c/assembly code.It compiles correctly but a linker
error occures when try to build.

The code is

in .c file
--------------------------------
#include<stdio.h>
#include<def21060.h>

float a;
void asm_func(void);

main(void)
{
int i,j;
i;
j0;
asm_func();
}
----------------------------------
in .asm file

#include<asm_sprt.h>

.segment/pm seg_pmco;
.global _asm_func;
_asm_func:
leaf_entry;
f4.5;
f4f4;
leaf_exit;
.endseg; the purpose of code is to understand the
prototype of c/mixed asm coding.

The error is like this
[Error li2007] symbol '_asm_func' referenced in file
'D:\USERS\HEMANT\VDSP PROJECT\VDSP
BASICS\DEBUG\TWO.DOJ' could not be resolved
Linker finished with 1 error(s) 0 warning(s)
cc21k: Fatal Error: Link failed

what could be the reason?

regards
hemant

__________________________________



--- In , hemant ramdasi <hemantramdasi@y...>
wrote:
> Hi all,
> I am using adsp-21060 .I have written a simple mixed
> c/assembly code.It compiles correctly but a linker
> error occures when try to build.
>
> The code is
>
> in .c file
> --------------------------------
> #include<stdio.h>
> #include<def21060.h>
>
> float a;
> void asm_func(void);
>
> main(void)
> {
> int i,j;
> i;
> j0;
> asm_func();
> }
> ----------------------------------
> in .asm file
>
> #include<asm_sprt.h>
>
> .segment/pm seg_pmco;
> .global _asm_func;
> _asm_func:
> leaf_entry;
> f4.5;
> f4f4;
> leaf_exit;
> .endseg; > the purpose of code is to understand the
> prototype of c/mixed asm coding.
>
> The error is like this
> [Error li2007] symbol '_asm_func' referenced in file
> 'D:\USERS\HEMANT\VDSP PROJECT\VDSP
> BASICS\DEBUG\TWO.DOJ' could not be resolved
> Linker finished with 1 error(s) 0 warning(s)
> cc21k: Fatal Error: Link failed
>
> what could be the reason?

What version of VDSP are you using? I tried your sample code and it
builds with just a warning (that isn't related to your error).
I suspect your error will go away if your function prototype is
changed to
extern void asm_func(void);

The error messages give you clues on what the problem is.
It says here that the symbol could not be resolved - so obviously one
of your 2 files (two.c or two.asm) can't seem to figure out that
symbol.

>
> regards
> hemant >
>
> __________________________________
>





Hi hemant,
Do you add the both 'doj' (asm and C) files in LDF?
regards
ajith --- In , "bhaskar_thiagarajan"
<bhaskar_thiagarajan@y...> wrote:
> --- In , hemant ramdasi <hemantramdasi@y...>
> wrote:
> > Hi all,
> > I am using adsp-21060 .I have written a simple mixed
> > c/assembly code.It compiles correctly but a linker
> > error occures when try to build.
> >
> > The code is
> >
> > in .c file
> > --------------------------------
> > #include<stdio.h>
> > #include<def21060.h>
> >
> > float a;
> > void asm_func(void);
> >
> > main(void)
> > {
> > int i,j;
> > i;
> > j0;
> > asm_func();
> > }
> > ----------------------------------
> > in .asm file
> >
> > #include<asm_sprt.h>
> >
> > .segment/pm seg_pmco;
> > .global _asm_func;
> > _asm_func:
> > leaf_entry;
> > f4.5;
> > f4f4;
> > leaf_exit;
> > .endseg;
> >
> >
> > the purpose of code is to understand the
> > prototype of c/mixed asm coding.
> >
> > The error is like this
> > [Error li2007] symbol '_asm_func' referenced in file
> > 'D:\USERS\HEMANT\VDSP PROJECT\VDSP
> > BASICS\DEBUG\TWO.DOJ' could not be resolved
> > Linker finished with 1 error(s) 0 warning(s)
> > cc21k: Fatal Error: Link failed
> >
> > what could be the reason?
>
> What version of VDSP are you using? I tried your sample code and it
> builds with just a warning (that isn't related to your error).
> I suspect your error will go away if your function prototype is
> changed to
> extern void asm_func(void);
>
> The error messages give you clues on what the problem is.
> It says here that the symbol could not be resolved - so obviously
one
> of your 2 files (two.c or two.asm) can't seem to figure out that
> symbol.
>
> >
> > regards
> > hemant
> >
> >
> >
> >
> >
> >
> >
> > __________________________________
> >




Hi all,

I have a big project written in c. I am trying to port
it on ADSP-21060 and using VDSP++.It runs well with
existing code.

Now I have coded one of the function in assembly.I
have taken all care about directives and syntaxes. i
have included file like asm_sprt.h and def21060.h
files.

But the compiler gives error as shown below.

"dataconv.asm", line 18: error #169: expected a
declaration
.segment/pm seg_pmco;
^
This is exactly where my asm function code starts.

I cannot figure out why this is happening? Can anyone
tell my how to get rid of it?

Also is it necessary to modify leaf_exit macro.I think
at present it contains null.So should I modify for
proper subroutine return?

waiting for reply
Hemant __________________________________




--On Thursday, June 05, 2003 11:40 AM -0700 hemant ramdasi
<> wrote:

> "dataconv.asm", line 18: error #169: expected a
> declaration
> .segment/pm seg_pmco;

What happens just before this? Many times an error message is about an earlier
construct that's missing termination.



Hi Hemant,

Previous releases of the ADSP-210xx DSP development software used the
.SEGMENT and .ENDSEG directives to define the beginning and end of a
section of contiguous memory addresses. Although these directives
have been replaced with the .SECTION directive, the source code
written with .SEGMENT/.ENDSEG legacy directives is accepted by the
ADSP-21xxx family DSP assembler.

Still you may attempt to replace .SEGMENT by .SECTION directive.

In case you attempt to change leaf_exit macro, you won't return your
C function from where you had called your asm function.

Regards,
Bhaskar Das

--- In , hemant ramdasi <hemantramdasi@y...>
wrote:
> Hi all,
>
> I have a big project written in c. I am trying to port
> it on ADSP-21060 and using VDSP++.It runs well with
> existing code.
>
> Now I have coded one of the function in assembly.I
> have taken all care about directives and syntaxes. i
> have included file like asm_sprt.h and def21060.h
> files.
>
> But the compiler gives error as shown below.
>
> "dataconv.asm", line 18: error #169: expected a
> declaration
> .segment/pm seg_pmco;
> ^
> This is exactly where my asm function code starts.
>
> I cannot figure out why this is happening? Can anyone
> tell my how to get rid of it?
>
> Also is it necessary to modify leaf_exit macro.I think
> at present it contains null.So should I modify for
> proper subroutine return?
>
> waiting for reply
> Hemant > __________________________________
>




Hi all,
I am facing a peculiar problem.

When I use fo=dm(1,i6) and then use 'fo' for my
floating point calculation then I get correct results.

But when I do

ro=dm(1,i6);
fo=float ro; and then using this 'fo' gives me wrong
result.

What could be the reason?

Thanks and regards
hemant



On Wed, 25 Jun 2003, hemant ramdasi wrote:

> Hi all,
> I am facing a peculiar problem.
>
> When I use fo=dm(1,i6) and then use 'fo' for my
> floating point calculation then I get correct results.
>
> But when I do
>
> ro=dm(1,i6);
> fo=float ro; and then using this 'fo' gives me wrong
> result.
>
> What could be the reason?

The reason is representation. In the first read, the most
signifcant byte is the exponent and the remaining bits are
the mantissa. In the second read, all the bits are taken
as mantissa and the exponent is computed from the number of
bits set. See the fix, trunc and "numeric formats" appendix
for lots more details.

Patience, persistence, truth,
Dr. mike