• AVR Freaks

Hot!Problem compiling a program using FFT from DSP library on the dspic33CH128MP505

Author
cbayschm
New Member
  • Total Posts : 7
  • Reward points : 0
  • Joined: 2009/03/14 09:09:25
  • Location: 0
  • Status: offline
2018/12/13 23:01:53 (permalink)
0

Problem compiling a program using FFT from DSP library on the dspic33CH128MP505

Hi Everyone,
I am trying to use the DSP lib FFT function on my program. For some reason even though I link the lib file to my project and include the dsp.h, it seems to not have the functions for FFT defined. I get the following error:
 
CLEAN SUCCESSFUL (total time: 168ms)
make -f nbproject/Makefile-default.mk SUBPROJECTS= .build-conf
make[1]: Entering directory 'D:/Documents/MPLABXProjects/uWave Sensor 2.X'
make -f nbproject/Makefile-default.mk dist/default/production/uWave_Sensor_2.X.production.hex
make[2]: Entering directory 'D:/Documents/MPLABXProjects/uWave Sensor 2.X'
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/reset.c -o build/default/production/mcc_generated_files/reset.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/reset.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/system.c -o build/default/production/mcc_generated_files/system.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/system.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/clock.c -o build/default/production/mcc_generated_files/clock.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/clock.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/traps.c -o build/default/production/mcc_generated_files/traps.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/traps.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/adc1.c -o build/default/production/mcc_generated_files/adc1.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/adc1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/interrupt_manager.c -o build/default/production/mcc_generated_files/interrupt_manager.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/interrupt_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/mcc.c -o build/default/production/mcc_generated_files/mcc.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/mcc.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/uart1.c -o build/default/production/mcc_generated_files/uart1.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/uart1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/uart2.c -o build/default/production/mcc_generated_files/uart2.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/uart2.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/pin_manager.c -o build/default/production/mcc_generated_files/pin_manager.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/pin_manager.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" mcc_generated_files/tmr1.c -o build/default/production/mcc_generated_files/tmr1.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/mcc_generated_files/tmr1.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" main.c -o build/default/production/main.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/main.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" twiddleFactors.c -o build/default/production/twiddleFactors.o -c -mcpu=33CH128MP505 -MMD -MF "build/default/production/twiddleFactors.o.d" -mno-eds-warn -g -omf=elf -DXPRJ_default=default -legacy-libc -O0 -msmart-io=1 -Wall -msfr-warn=off
twiddleFactors.c:52:9: warning: missing braces around initializer
twiddleFactors.c:52:9: warning: (near initialization for 'twiddleFactors[0]')
"C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" -o dist/default/production/uWave_Sensor_2.X.production.elf build/default/production/mcc_generated_files/reset.o build/default/production/mcc_generated_files/system.o build/default/production/mcc_generated_files/clock.o build/default/production/mcc_generated_files/traps.o build/default/production/mcc_generated_files/adc1.o build/default/production/mcc_generated_files/interrupt_manager.o build/default/production/mcc_generated_files/mcc.o build/default/production/mcc_generated_files/uart1.o build/default/production/mcc_generated_files/uart2.o build/default/production/mcc_generated_files/pin_manager.o build/default/production/mcc_generated_files/tmr1.o build/default/production/main.o build/default/production/twiddleFactors.o "C:\Program Files (x86)\Microchip\xc16\v1.35\lib\libdsp-elf.a" -mcpu=33CH128MP505 -omf=elf -DXPRJ_default=default -legacy-libc -Wl,--local-stack,,--defsym=__MPLAB_BUILD=1,,--script=p33CH128MP505.gld,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--library-path="C:/Program Files (x86)/Microchip/xc16/v1.35/lib",--force-link,--smart-io,-Map="dist/default/production/uWave Sensor 2.X.production.map",--report-mem,--memorysummary,dist/default/production/memoryfile.xml

xc16-ld 1.35 (A)
"program" Memory [Origin = 0x200, Length = 0x15d00]
section address length (PC units) length (bytes) (dec)
------- ------- ----------------- --------------------
.text 0x200 0x466 0x699 (1689)
.text 0x666 0x15c 0x20a (522)
.text 0x7c2 0x38 0x54 (84)
.const 0x800 0x400 0x600 (1536)
.text 0xc00 0x57e 0x83d (2109)
.text 0x117e 0x43c 0x65a (1626)
.dinit 0x15ba 0x34 0x4e (78)
.text 0x15ee 0x36 0x51 (81)
Total "program" memory used (bytes): 0x1e2d (7725) 5%

"data" Memory [Origin = 0x1000, Length = 0x4000]
section address alignment gaps total length (dec)
------- ------- -------------- -------------------
.nbss 0x1000 0 0x14 (20)
.ndata 0x1014 0 0x2 (2)
_074439605c134562 0x4800 0 0x400 (1024)
.bss 0x4c00 0 0x56 (86)
Total "data" memory used (bytes): 0x46c (1132) 6%

Dynamic Memory Usage
region address maximum length (dec)
------ ------- ---------------------
heap 0 0 (0)
stack 0x1016 0x37ea (14314)
Maximum dynamic memory (bytes): 0x37ea (14314)
nbproject/Makefile-default.mk:303: recipe for target 'dist/default/production/uWave_Sensor_2.X.production.hex' failed
make[2]: Leaving directory 'D:/Documents/MPLABXProjects/uWave Sensor 2.X'
nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
make[1]: Leaving directory 'D:/Documents/MPLABXProjects/uWave Sensor 2.X'
nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
build/default/production/main.o(.text+0x34): In function `.L23':
: undefined reference to `_FFTComplexIP'
build/default/production/main.o(.text+0x3a): In function `.L23':
: undefined reference to `_BitReverseComplex'
build/default/production/main.o(.text+0x42): In function `.L23':
: undefined reference to `_SquareMagnitudeCplx'
build/default/production/main.o(.text+0x4a): In function `.L23':
: undefined reference to `_VectorMax'
make[2]: *** [dist/default/production/uWave_Sensor_2.X.production.hex] Error 255
make[1]: *** [.build-conf] Error 2
make: *** [.build-impl] Error 2
BUILD FAILED (exit value 2, total time: 10s)
 
From what I can understand the linker can't find the functions _FFTComplexIP, _BitReverseComplex, _SquareMagnitudeCplx and _VectorMax.
I tried including the library in different ways, and same error. I am starting to think the library doesn't have these functions compiled for the dspic33CH128MP505.
 
Has anyone had this issue, or know how to solve it?
 
By the way, if I comment out the FFT functions the program compiles OK.
 
Thanks in advance.
 
Best Regards,
 
Carlos
#1

16 Replies Related Threads

    Nikolay_Po
    Super Member
    • Total Posts : 1859
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2018/12/14 00:55:50 (permalink)
    +1 (1)
    Have you added
    --library dsp

    parameter into linker options of a project?
     
    P.S. With --library option you needn't provide additional references to library file. XC16 toolchain will choose correct library file automatically.
    post edited by Nikolay_Po - 2018/12/14 00:59:22
    #2
    cbayschm
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2009/03/14 09:09:25
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2018/12/14 01:23:52 (permalink)
    +2 (2)
    Hi Nicolay,
     
    Thanks for the reply. Yes I included it and still had the issue. It seems the library is compiled for the 33F and 33E family and not for the 33C family. I had to recompile the library and change the parameters by hand in the bat file to compile for the processor, and now it compiles correctly.
    #3
    du00000001
    Just Some Member
    • Total Posts : 2697
    • Reward points : 0
    • Joined: 2016/05/03 13:52:42
    • Location: Germany
    • Status: online
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2018/12/14 01:42:34 (permalink)
    0
    Latest DSP lib?
    As there are some differences in the dsPIC architecture between families regarding restrictions on memory ranges for some of the DSP instructions, I'd expect the lib to differentiate between families. Which you success following re-compilation seems to confirm.

    PEBKAC / EBKAC / POBCAK / PICNIC (eventually see en.wikipedia.org)
    #4
    cbayschm
    New Member
    • Total Posts : 7
    • Reward points : 0
    • Joined: 2009/03/14 09:09:25
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2018/12/14 02:28:44 (permalink)
    +1 (1)
    The thing is I was using the latest compiler version (v1.35) and in the docs the processor was documented as compatible with the library, but looking at the assembler information, there is no definition for the DSPIC33C family in the assembler, only DSPIC33E and DSPIC33F, so that made me think it was not included even though it was on the processor list. Looking at the source files for the DSP Lib, I saw it was only being compiled for the E and F family, so that confirmed my suspicions.
     
    Well at least it compiles now, I will have to check if it works correctly. I will make a test program to see if does the correct calculations and will update later here with my results.
    #5
    RISC
    Super Member
    • Total Posts : 5376
    • Reward points : 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2018/12/17 16:59:40 (permalink)
    0
    Hi,
    Nikolay_PoHave you added
    --library dsp

    parameter into linker options of a project?
     P.S. With --library option you needn't provide additional references to library file. XC16 toolchain will choose correct library file automatically.

     
    I have also tried to do that for dsPIC33FJ256GP710A but I can't manage to compile without errors.
    I would like to add the dsp library without the path so that the project can compile with any compiler version.
     
    Currently if the library libdsp-elf.a is added in the project with the complete path :
    "..\..\..\..\..\Program Files (x86)\Microchip\xc16\v1.35\lib\libdsp-elf.a" it compiles correctly.
     
    If I have understood your suggestion, I remove this library from the Libraries folder in the project and add --library dsp in the "Option categories" > Libraries > --library dsp ?
    Unfortunately when doing that I get errors :
    =======================================================================
    "C:\Program Files (x86)\Microchip\xc16\v1.35\bin\xc16-gcc.exe" -o dist/default/production/lab1-solution_Explorer16_PIC33710A_v2_NoPath.production.elf build/default/production/drvADC_solution.o build/default/production/initIO.o build/default/production/main.o build/default/production/FIRDesign/fir.o build/default/production/initSPI.o -mcpu=33FJ256GP710A -omf=elf -DXPRJ_default=default -no-legacy-libc -Wl,,,--defsym=__MPLAB_BUILD=1,,--script=p33FJ256GP710A.gld,--stack=16,--check-sections,--data-init,--pack-data,--handles,--isr,--no-gc-sections,--fill-upper=0,--stackguard=16,--defsym,__ICD2RAM=1,--library=--library dsp,--no-force-link,--smart-io,--memorysummary,dist/default/production/memoryfile.xml
    nbproject/Makefile-default.mk:191: recipe for target 'dist/default/production/lab1-solution_Explorer16_PIC33710A_v2_NoPath.production.hex' failed
    make[2]: Leaving directory 'C:/DATA/EDUCATION/INSA_ROUEN/dsPIC33FJ256GP710A/lab1-solution_Explorer16_PIC33710A_v2_NoPath'
    nbproject/Makefile-default.mk:90: recipe for target '.build-conf' failed
    make[1]: Leaving directory 'C:/DATA/EDUCATION/INSA_ROUEN/dsPIC33FJ256GP710A/lab1-solution_Explorer16_PIC33710A_v2_NoPath'
    nbproject/Makefile-impl.mk:39: recipe for target '.build-impl' failed
    elf-gcc.exe: dsp,--no-force-link,--smart-io,--memorysummary,dist/default/production/memoryfile.xml: No such file or directory
    make[2]: *** [dist/default/production/lab1-solution_Explorer16_PIC33710A_v2_NoPath.production.hex] Error 255
    make[1]: *** [.build-conf] Error 2
    make: *** [.build-impl] Error 2
    BUILD FAILED (exit value 2, total time: 3s)
    =======================================================================
    Regards
    #6
    u741
    Starting Member
    • Total Posts : 31
    • Reward points : 0
    • Joined: 2018/10/08 12:38:57
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/03 01:02:24 (permalink)
    0
    Hello cbayschm,
     
    I confirm the same problem (see https://www.microchip.com/forums/m1081194.aspx), i.e. the XC16 v1.35 DSP libraries seem not to support the dsPIC33C devices. Let's hope for an update by Microchip soon.
     
    Did you come to a solution which works? Do you have updated libraries which work?
     
    (adding the (unmodified) libdsp-elf.a file manually to the library path didn't solve the problem for me; why would it...)
    #7
    JPortici
    Super Member
    • Total Posts : 684
    • Reward points : 0
    • Joined: 2012/11/17 06:27:45
    • Location: Grappaland
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/03 01:19:54 (permalink)
    0
    even though they still haven't updated the compiler page, v1.36 is out. I don't recall seeing anything related to the dsp library in the changelog but you may wany to try
    #8
    IACooper
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2018/09/14 12:03:56
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/09 11:34:11 (permalink)
    0
    cbayschm
    Hi Nicolay,
     
    Thanks for the reply. Yes I included it and still had the issue. It seems the library is compiled for the 33F and 33E family and not for the 33C family. I had to recompile the library and change the parameters by hand in the bat file to compile for the processor, and now it compiles correctly.




    Is someone able to help with a few more details on how to go about this please?

    Unfortunately it seems I've just fallen foul of the same problem, and the latest (20th Dec 2017)  XC16 part support patch files update processor include files, but don't touch the dsp library.  Encouraged by your report of recompiling to make it work, together with the comment in the dsPIC Language Tools Libraries manual about the source code being provided to allow recompilation, I've delved in to have a go - and come unstuck!

    I found the *.zip for the DSP library in the XC16 directory structure, expanded that and have taken a look at the batch file which should compile it all for us.  I'm guessing that where you have two chunks of apparently identical code, with one setting "__dsPIC33F=1"  and the other setting "__dsPIC33E=1",  I need to duplicate these with something like "__dsPIC33C=1" for a third block of code   ??

    Before cracking on with that I decided to have a go at just recompiling it as supplied.   The first problem are errors with unrecognised command for the various "xc16-as" and "xc-gcc"  calls.   This was resolved by adding  "SET PATH=%PATH%;C:\Program Files (x86)\Microchip\xc16\v1.35\bin" so the computer can find where the compiler executables live.
     
    Ok, next problem were errors of the form "Assembler messages:  FATAL: can't create ./obj/ etc. etc.".
    I took a guess and created a sub-directory of the name "obj" below where the batch file is located...

    Ok, a bit more progress:  Now the /obj/ directory I just created is filled with a load of files ending in *.s , *.lst , *.DEPEO , and *.DEO,   however the batch file is generating a whole load of compiler errors after each call to "xc16-gcc" stating "Options have been disabled due to restricted license, visit <website URL> to purchase a new key"
     
    <groan>
    I'm aware it is possible to obtain the open source GCC source code files to recompile the compiler to not go looking for the 'license', but I understand it is a whole load of hassle to get working, and when the code I'm writing isn't generally particularly needing the optismisations  (albeit the pre-compiled libraries might!), I don't really want to have to try and recompile the compiler to be able to recompile the library to be able to do what it apparently should be capable of doing in the first place!
     
    Does anyone know a way around this?
    If it needs the compiler optimisations enabled, then is someone with a suitable license able to compile the *.COFF (and I suppose *.ELF, although I only need *.COFF for compatibility with other libraries) versions of the DSP library with support for dsPIC33C processors and attach it to a post in the forum please?

    ...or am I best raising a tech. support ticket with M'Chip to see if they can compile it for dsPIC33C* for me ?


    Ian.
    #9
    IACooper
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2018/09/14 12:03:56
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/09 12:00:19 (permalink)
    0
    ...a further quick update:  Although the XC16 download page text still refers to Ver 1.35, I noticed the link actually went to Ver 1.36.  So I've tried downloading and installing that, then adding the latest devices patch, then trying again.

    Same problem.
    Looking at the DSP library batch file that's unchanged with the newer version as well.
    #10
    Nikolay_Po
    Super Member
    • Total Posts : 1859
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/10 06:35:29 (permalink)
    0
    The DSP functions themself are usually quite short, about 50 instructions or so. May be it is possible just move the assembler listing from existing pre-compiled libraries of dsPIC33EP or which is most compatible chip with minor correction for newer CPU/memory? It may be less demanding than library re-compilaton.
    #11
    Nikolay_Po
    Super Member
    • Total Posts : 1859
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/10 06:42:36 (permalink)
    0
    About XC16 library attachment:
    RISC
    Hi,
    Nikolay_PoHave you added
    --library dsp

    parameter into linker options of a project?
     P.S. With --library option you needn't provide additional references to library file. XC16 toolchain will choose correct library file automatically.

    ...
    If I have understood your suggestion, I remove this library from the Libraries folder in the project and add --library dsp in the "Option categories" > Libraries > --library dsp ?
    Unfortunately when doing that I get errors :
    ...

     
    No, I meant only the linker (ld) options. From my practice, both on Windows and Linux, the only addition of --library dsp (or --library q) makes the project with dsp.h or libq.h headers and functions comilable. The standard XC16 setup and standard MPLAB X setup do not requiring anything else, IIRC.
    #12
    IACooper
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2018/09/14 12:03:56
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/10 11:55:54 (permalink)
    0
    I did have a look at the source files last night, which seem to include headers I'm not sure I can readily find.  I hadn't considered the assembled versions.   You're right that a lot of the functions I looked at are already written in assembler, so hopefully they're already fairly optimised.  I'm particularly interested in the filter functions, but hadn't thought of trying to include the assembled version of them.
     
    My other two thoughts were that if the functions are already written in assembly and are fairly well optimised, then it might not be too much of a disadvantage to alter the batch file to not call for higher levels of optimisation, thus work with a 'free' version of the compiler.  The other consideration is that you can activate a 60 day trial period for the full licensed compiler, so I guess it should be possible to do that and then recompile the library.  The down side is not having the 60 day trial available at a later date if you might want to try it for *your* code rather than just recompiling the M'Chip library!
    #13
    davekw7x
    Entropy++
    • Total Posts : 1746
    • Reward points : 0
    • Joined: 2012/01/16 12:01:07
    • Location: Left Coast, USA
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/11 11:17:32 (permalink)
    +1 (1)
    Here's something to try:

    On my Linux system:
    I copied libdsp.zip from the XC16 distribution to a personal directory not in the XC16 distribution tree.


    • I unzipped libdsp.zip.
    • I created my own shell script from makedsplib.bat as indicated in the attached Readme.dave text file.  Only a couple of minor mods were required to make it run on Linux,
    • I created directories obj and lib so that the script can put stuff where it needs to.
    • I ran the shell script.  Note that I made the target file name libdsp_ch-elf.a rather than libdsp-elf.a so that I could absolutely guarandamntee that the Make process would use this rather than the supplied libdsp.a library file.

    Note that I have not changed and will not change any contents of the supplied library file.

    Now in my dsPIC33CK256MP502 project, I added this new library file to the project under the "Libraries" icon in the Projects pane.
     
    I haven't tested anything significant, but at least it's a way to get started.


    Excerpts from main.c:

    #include <dsp.h>

    #define DATA_LENGTH 1024
    signed int data_in[DATA_LENGTH] __attribute__((space(xmemory)));
    signed int data_out[DATA_LENGTH];
    IIRTransposedStruct Filter1;
    .
    .
    .
    int main()
    {
        init_system();
        // JUst test to see if these compile with special dsPIC33C library
        IIRTransposedInit(&Filter1);
        IIRTransposed(DATA_LENGTH, (fractional*) data_out, (fractional*) data_in, &Filter1);

        // A couple of functions for which it is easy to verify (manually) proper
        // operation:

        fractional fr1 = 12345;
        float fl1 = Fract2Float(fr1);
        float fl2 = 0.123;
        fractional fr2 = Float2Fract(fl2);

        printf("fr1 = %u, fl1 = %f\r\n", fr1, fl1);
        printf("fl2 = %f, fr1 = %u\r\n", fl2, fr2);
    .


    Output (XC16 version 1.36, MPLABX version 5.10)

    fr1 = 12345, fl1 = 0.376740
    fl2 = 0.123000, fr1 = 4030


    Bottom line: IWFMYMMY (It Works For Me; Your Mileage May Vary)
     

    Regards,
     
    Dave
     
    [Edit]
    Just copied my version of source files for slightly-modified Code Example project CE018 to a dsPIC33CK project and used my new dsp library file for FFTComplexIP()  and BitReverseComplex() and IFFTComplexIP() functions.  Results are completely satisfactory.
     
    The project also uses _itofQ15() from libq-dsp-elf.a   A perusal of nm -s output for that file in the XC16 version 1.36 distribution shows that it already has functions with .cheo designations, so it was not necessary to re-compile that one (!)  Just included in in my project along with the new dsp library file.
     
    I don't have any active dsp projects at the moment, so I probably won't do any more stuff "just for the heck of it," but I am interested in other folks' experiences.
     
    Updated Bottom Line (so far):
    Taa-daa!
    [/Edit]
    post edited by davekw7x - 2019/01/11 13:50:54

    Attached Image(s)


    Sometimes I just can't help myself...
    #14
    IACooper
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2018/09/14 12:03:56
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/12 03:13:18 (permalink)
    0
    Thanks, I'll give that a shot and report back how I get on... grin: grin
     
    Except at the moment I'm having a problem getting the SCCP "Special Event Trigger" to actually trigger my ADC - more double checking required sad: sad.  Once that's done I will have some data that'll need filtering Smile: Smile
    #15
    Nikolay_Po
    Super Member
    • Total Posts : 1859
    • Reward points : 0
    • Joined: 2012/04/01 13:49:27
    • Location: Russia, Novorossiysk
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/12 12:00:27 (permalink)
    0
    Dave, thank you! You saved many mans hours. Not currently busy with 33CH series, but it is good to know there is way to get desired DSP library functions.
    #16
    IACooper
    Starting Member
    • Total Posts : 44
    • Reward points : 0
    • Joined: 2018/09/14 12:03:56
    • Location: 0
    • Status: offline
    Re: Problem compiling a program using FFT from DSP library on the dspic33CH128MP505 2019/01/25 01:29:42 (permalink)
    +1 (1)
    I messed up a bit last night and posted to the wrong thread, I'll try again here now I've woken up:
    A further update:  It seems Microchip have now resolved the problem.
     
    Two weeks ago when I posted here I also raised a support ticket with Microchip, seeing as it seems a bit daft that their DSP library doesn't work with their newer dsPIC DSP devices.
     
    They responded promptly that the development team were looking into it.   Two weeks have passed and last night I was sent a new libdsp.zip  file.   Installing this over the previous files now allows me to compile source code calling functions from the library  (FIR filters in my case).
     
    I've tried to attach the *.zip file of the library to this post with a .txt extension substituted to the end.  Keep fingers crossed that it works.  Hopefully Microchip will roll it out and make it available generally soon.

    Ian.
    #17
    Jump to:
    © 2019 APG vNext Commercial Version 4.5