Go Down

Topic: Assembler library (Read 2093 times) previous topic - next topic

Paolo Bosetti

Hi you all,
I have a rather humble question: a friend of mine  ;) has a good and superfast routine written in assembler for Atmel168, and he wants to use it on Arduino, compiling it as a library. Now he as two files: the header file (superlibrary.h) and the assembler file (superlibrary.S). Being keen, he toss both files within hardware/libraries/Superlibrary and fires up Arduino. Rather surprisingly, no compilation occours and no messages are printed on console, even if the avr-gcc is expected to drink .S files as well as .c files.
I told my friend that probably the somewhere there's a Makefile missing a .S rule... but is there someone having a better and more detailed explanation? or perhaps a solution?
Thanks a lot,
Paolo

Paolo Bosetti

Jeez... no one replying. Perhaps this is the wrong forum section?

mem

#2
Sep 26, 2008, 03:10 pm Last Edit: Sep 26, 2008, 03:12 pm by mem Reason: 1
Hi Paolo,

I doubt many here are writing anything for the arduino in assembler. The few cases where assembler code is faster than optimized C code, the assembler has been embedded in a C or C++ file using the asm directive. That is one way to get the assembler code  recognized by the arduino build process.

What does the routine do?

Paolo Bosetti

#3
Sep 26, 2008, 03:30 pm Last Edit: Sep 26, 2008, 03:30 pm by paolobosetti Reason: 1
Mem, thanks for your reply.
The routine does the fast Fourier transform of an array of data. The fact is that it is not a product of mine, and I'm not so fluent in reading and understanding assembler. So I would like to use it as is, but it's kinda long (~600 lines) to be included with the asm directive.
Of course I could write a new routine by my own, but I'm used to be lazy, you know, and moreover looks like that routine (named avrfft) scores quite good in terms of efficiency.
Thanks again,
-P.

mem

Perhaps something in these links will help:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1218921378
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1201426232/3#3



follower

I'm actually interested in this issue due to the use of assembler in my Arduino and AVRUSB integration.

I think the short answer is that the way the IDE calls the avrgcc compiler doesn't include .S files automatically. I suspect inline asm directives might be the easiest approach (I don't think I can use them though as the code I use also "includes" more asm files) although another option would be to write a patch for the IDE. :-)

What I ended up doing is compiling the .S files separately and then putting the .o files generated in the library directory and they did get picked up.

--Phil.

Paolo Bosetti

Thanks, follower. In fact I was suspecting something like that.
I'll try to compile it by hand...

bohne

I am using .S assembler files in my core. follower is right, you have to modify you IDE.

A first step is to find this line in Target.java:

if (files.endsWith(".c") || files.endsWith(".cpp"))

and replace it with this line:
if (files.endsWith(".S") || files.endsWith(".c") || files.endsWith(".cpp"))

and then you have to modify the Compiler.java and get the .S files into the build process.
I have a modified Arduino IDE that can compile the assembler files, I will try to create a patch if you are still interested.
http://www.dorkbot.de
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254
http://www.luminet.cc

follower

Quote
I will try to create a patch if you are still interested.

That would be helpful. :-)

--Phil.

bohne

You can find the "LumiNet patch" in this thread:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254

this patch should work with all Arduino boards and includes the "assembler patch". Tell me if this is working for you or if I need to create an isolated "assembler patch".
http://www.dorkbot.de
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1236434254
http://www.luminet.cc

AMurchick

Any body add fft library in Arduino project?

Go Up
 


Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy