Reply by Tim Wescott March 28, 20062006-03-28
stevenj@alum.mit.edu wrote:
> Even if the manufacturer's FFT library is buggy (which I find a bit > hard to believe... FFTs aren't easy to use, and users are notorious for > blaming their own errors on their FFT software), FFTW is probably not > the best choice for a DSP chip. FFTW is designed for general-purpose > CPUs. > > Cordially, > Steven G. Johnson >
Yes. I said "FFT run speed is very optimizible on a DSP" but I should perhaps have said "and you can expect FFTW to be slow as a dog by comparison". Not that I'm slamming FFTW -- it's just that DSPs are different beasts, and one of the reasons they're different is so they can be made to do FFTs _fast_. If it could be done I think giving one's FFT routines on one's DSP the same API as FFTW would make it easier to move code from a PC to the DSP, which would be an aid for prototyping. It may, however, prove more awkward than it's worth. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
Reply by March 28, 20062006-03-28
Even if the manufacturer's FFT library is buggy (which I find a bit
hard to believe... FFTs aren't easy to use, and users are notorious for
blaming their own errors on their FFT software), FFTW is probably not
the best choice for a DSP chip.  FFTW is designed for general-purpose
CPUs.

Cordially,
Steven G. Johnson

Reply by Tim Wescott March 28, 20062006-03-28
Vincent2046 wrote:

>>To use FFTW with the Freescale (or even with the Pentium on a different >>tool chain) requires that you rebuild _from source_ -- this means from >>the .c (or .cpp) files. If there is any assembly code in there -- >>whether explicitly in .asm files or implicitly in 'asm' statements >>buried in the C code -- you'll have to rewrite it for your target > > processor. > > > > What i using now is the codewarrior FOR DSP56800. i had considered to use > the FFT lib in it's SDK. But from my own exp and some discussion in > newsgroup, this lib has too many bugs. that's why i give up to use it. > > now i want to follow ur advice to rebuild the source to get a lib from for > codewarrior . But it looks very hard to archive this goal. could u give me > a simple way to do this ? >
No, I've just about wrung out my knowledge of FFTW with the answer I gave -- sorry. If it's any consolation I can say that these porting exercises usually are complex, difficult, and often end up revolving on severely obscure points. That's a pain when you're doing it, but when you come out the other end you're either a better programmer, a better mathematician, or both. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
Reply by Vincent2046 March 27, 20062006-03-27
>To use FFTW with the Freescale (or even with the Pentium on a different >tool chain) requires that you rebuild _from source_ -- this means from >the .c (or .cpp) files. If there is any assembly code in there -- >whether explicitly in .asm files or implicitly in 'asm' statements >buried in the C code -- you'll have to rewrite it for your target
processor. What i using now is the codewarrior FOR DSP56800. i had considered to use the FFT lib in it's SDK. But from my own exp and some discussion in newsgroup, this lib has too many bugs. that's why i give up to use it. now i want to follow ur advice to rebuild the source to get a lib from for codewarrior . But it looks very hard to archive this goal. could u give me a simple way to do this ?
Reply by Tim Wescott March 27, 20062006-03-27
Vincent2046 wrote:

> The FFTW works well in my VC++6.0 . But when i try to use it in > codewarrior in the same way. i met some problem. > > first :#include "fftw3.h" > then copy the three files libfftw.lib libirc.lib libm.lib into the project > folder. the program is go as following:
-- code snipped --
> > but when i try it in codewarrior ,it display the following err message: > ======================================== > Link error: Undefined: "Ffftw_execute" > referenced from "Fmain" in main.c > ======================================== > > i think The codewarrior complier add a 'F' in front of the each function. > how can i solve this problem ? anyone can give me some suggestions?
Library files are a bunch of object-code files. Object code files are primarily machine code, with some relocatable symbols thrown in. You have multiple layers of incompatibility. First, I assume from the fact that you're using Code Warrior that this is for a Freescale DSP. The machine code between your FreeScale DSP chip and the Pentium for which a VC++6.0 app is built are different, and mutually incompatible. Second, different tool chains have, in general, different object file formats, and different library file formats. Finally, different tool chains don't even necessarily even _name_ their object and library files the same -- Microsoft likes to use .obj and .lib; Gnu (and other Unix-derived toolchains) use .o and .a. I have no idea what Code Warrior uses. To use FFTW with the Freescale (or even with the Pentium on a different tool chain) requires that you rebuild _from source_ -- this means from the .c (or .cpp) files. If there is any assembly code in there -- whether explicitly in .asm files or implicitly in 'asm' statements buried in the C code -- you'll have to rewrite it for your target processor. Unless you have a burning need to use the FFTW package I suggest that you dig around on the DSP vendor's site to find their FFT routines, and use them. FFT run speed is very optimizible on a DSP, but only if the software is written for that specific processor. You will almost invariably find that the core operations are written in assembly, and that the approach in of necessity different from one processor to another. Even if you _did_ have a burning need for FFTW compatibility I would suggest that you find a way to use the FFTW header files and adapt Freescale's reference FFT routines to match the FFTW API. -- Tim Wescott Wescott Design Services http://www.wescottdesign.com Posting from Google? See http://cfaj.freeshell.org/google/
Reply by Vincent2046 March 27, 20062006-03-27
The FFTW works well in  my VC++6.0 . But when i try to use it in
codewarrior in the same way. i met some problem.

first :#include "fftw3.h"
then copy the three files libfftw.lib libirc.lib libm.lib into the project
folder.   the program is go as following:
=================================
	int i=0;
	double inputsignal[]={1,2,3,1,2,3,1,2};
	fftw_complex * outputsignal;
	fftw_plan fftwplan;

	outputsignal=(fftw_complex *)fftw_malloc(sizeof(fftw_complex)*8);
	fftwplan=fftw_plan_dft_r2c_1d(8,inputsignal,outputsignal,FFTW_ESTIMATE);

	fftw_execute(fftwplan);

	for(i=0;i<5;i++)
	{
		printf("[%d]  real=%f  image=%f
\n",i+1,outputsignal[i][0],outputsignal[i][1]);
	}
==================================
it works well in VC++6.0.   

but when i try it in codewarrior ,it display the following err message:
========================================
Link error: Undefined: "Ffftw_execute"
referenced from "Fmain" in main.c
========================================

i think The codewarrior complier add a 'F' in front of the each function.
how can i solve this problem ? anyone can give me some suggestions?