2009-06-08 02:45:25     Asm file(.S) compilation

Document created by Aaronwu Employee on Aug 15, 2013
Version 1Show Document
  • View in full screen mode

2009-06-08 02:45:25     Asm file(.S) compilation

vijai ragavan (INDIA)

Message: 75307   

 

Dear All,

 

i am getting the following error while compiling the .S file.

 

Assembler messages:

 

unknown pseudo-op: `.import'

 

I include the "c" header file on the asm file by using the ".import" which we normally used in the VDSP. But uclinux did support the same. Can anyone please suggest how to solve it?

 

 

 

Regards,

 

Vijayaragavan.S

QuoteReplyEditDelete

 

 

2009-06-08 03:15:17     Re: Asm file(.S) compilation

Mike Frysinger (UNITED STATES)

Message: 75309   

 

please read the documentation:

http://docs.blackfin.uclinux.org/doku.php?id=visualdsp:port_assembly_code

QuoteReplyEditDelete

 

 

2009-06-08 05:05:03     Re: Asm file(.S) compilation

vijai ragavan (INDIA)

Message: 75325   

 

In that document, there is no support for ".import" by GNU toolcahin. So please suggest how to compile the .S file.

QuoteReplyEditDelete

 

 

2009-06-08 05:10:28     Re: Asm file(.S) compilation

Mike Frysinger (UNITED STATES)

Message: 75326   

 

that is the answer -- there is no support, so dont use it

QuoteReplyEditDelete

 

 

2009-06-08 07:45:05     Re: Asm file(.S) compilation

ian davidson (UNITED KINGDOM)

Message: 75328   

 

Porting VDSP assembly files to uClinux

Mike is correct, .include is not supported, however, our application uses

some AD assembly modules from Visual Audio Designer.

 

This describes a somewhat dirty "workround" that I use, you may or may not find

it useful. Use at your own risk.

 

The files from visual audio designer are .asm files, in the Makefile for the

driver that uses them I have a rule that converts a dot asm file to a dot s file then

assembles the dot s file to get the dot o file.

 

============================

#for the .asm files from VisualAudioDesigner

%.o : %.asm

    @sed -f sed.txt $< >$(basename $@).s

    @bfin-uclinux-gcc -c $(basename $@).s

============================

 

sed is used to do the conversions, the file sed.txt contains this:

 

=========================

s%\.import%//.import%

s%\.IMPORT%//.IMPORT%

s%#include%//#include%

s%^\.section%//.section%

s/OFFSETOF(AMF_AGCLimiterCore,threshold)/0/

s/OFFSETOF(AMF_AGCLimiterCore,gain)/4/

=========================

etc,etc

 

As you can see it comments out the .import .section and #include directives and replaces

offsets defines as names, (e.g. AMF_AGCLimiterCore,threshold) by a number, in this case 0.

 

The VDSP code uses offsets in structures, you have to check all of these offsets

by hand. This can be painful and error prone, however, providing the Structures are not

changed you will only have to do this once.

If you get these wrong it will very probably crash the kernel, especially if used in

a driver, so it is important to fully understand how the compiler lays out any

structures that are passed to the assembler routines.

 

You have been warned!

 

A useful way to check this is to write some test code in C to access elements of the

structure, then compile the test code with the option --save-temps, this saves the intermediate

assembly file that the compiler produces, you can then examine the assembly that the

compiler produces to check that you have the offsets correctly defined.

 

Hope this helps,

 

Regards,

 

Ian Davidson

 

QuoteReplyEditDelete

 

 

2009-06-08 07:53:33     Re: Asm file(.S) compilation

Robin Getz (UNITED STATES)

Message: 75330   

 

Ian:

 

For the poking at C structures inside Assembly, here is some tips that might help:

 

https://docs.blackfin.uclinux.org/doku.php?id=toolchain:gas:structs

 

That should automate the process, and make it less error prone.

 

-Robin

QuoteReplyEditDelete

 

 

2009-06-08 09:14:36     Re: Asm file(.S) compilation

ian davidson (UNITED KINGDOM)

Message: 75334   

 

Thanks Robin,

 

Thats a great help, I widh I had been aware of it three years ago!

 

There is a host of realy useful information in the doc pages, even having downloaded them all I clearly havn't read them all !

 

Ian Davidson

QuoteReplyEditDelete

 

 

2009-06-08 12:17:51     Re: Asm file(.S) compilation

ian davidson (UNITED KINGDOM)

Message: 75360   

 

I've just implemented that change in the Makefile and it works a treat.

 

Thanks

 

Ian Davidson

QuoteReplyEditDelete

 

 

2009-06-08 16:21:22     Re: Asm file(.S) compilation

Robin Getz (UNITED STATES)

Message: 75369   

 

Ian:

 

Thanks go to Mike - he figured out the magic.

 

Hopefully the automation will remove some of the error prone manual steps...

 

-Robin

 

 

 

This is the first time I have heard of anyone using ViaualAudio with Linux though - are you doing it in as part of your driver or in userspace?

Attachments

    Outcomes