Pages: [1]   Go Down
Author Topic: Assembler library  (Read 1823 times)
0 Members and 1 Guest are viewing this topic.
Trento, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino (kinda) rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi you all,
I have a rather humble question: a friend of mine  smiley-wink 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
Logged

Trento, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino (kinda) rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6252
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
« Last Edit: September 26, 2008, 08:12:02 am by mem » Logged

Trento, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino (kinda) rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
« Last Edit: September 26, 2008, 08:30:51 am by paolobosetti » Logged

London
Offline Offline
Tesla Member
***
Karma: 10
Posts: 6252
Have fun!
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Logged

New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Trento, Italy
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino (kinda) rocks
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

0
Offline Offline
God Member
*****
Karma: 1
Posts: 588
LumiNet rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


New Zealand
Offline Offline
God Member
*****
Karma: 0
Posts: 999
Arduino pebbles
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I will try to create a patch if you are still interested.
That would be helpful. :-)

--Phil.
Logged

0
Offline Offline
God Member
*****
Karma: 1
Posts: 588
LumiNet rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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".
Logged


Irkutsk, Russia
Offline Offline
Newbie
*
Karma: 0
Posts: 11
Arduino fan
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Any body add fft library in Arduino project?
Logged

Pages: [1]   Go Up
Jump to: