Has anybody implemented CMSIS FFT library Successfully?

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Has anybody implemented CMSIS FFT library Successfully?

Jump to solution
17,485 Views
Amit_Kumar1
Senior Contributor II

Hi

I want to use arm_cfft_radix4_init_q15() and arm_cfft_radix4_q15() function from CMSIS 3.2 library . I am unable to find any good resources or any examples. I have looked in the documents provided by ARM i.e CMSIS-DSP: Complex FFT Functions but I didn't find it useful. What are the inputs given to these functions I am still not clear with it. I tried writing the codes but it didn't worked

this is how I am calling the functions,

arm_cfft_radix4_init_q15(&arm_cfft_sR_q15_len256, 256, 0, 1);          // For init

arm_cfft_radix4_q15(&arm_cfft_sR_q15_len256, az);                      // For transformation where,


arm_cfft_radix4_instance_q15 arm_cfft_sR_q15_len256 = {256, 0, 1, twiddleCoef_256, armBitRevIndexTable256, 4U, 4U};

  and az[512] is an array where the data is stored. Just for testing 

float32_t az[512] = {1.2 ,0.0

                             1.3, 0.0

                              -------

                              --------

                              1.2, 0.0};

my programs hangs and I am not able to print the o/p. I am using Codewrrior 10.5 and want to implement this on FRDM-K20D50M. I posted the query in ARM's community also but I didn't get any response which makes me think if anybody is actually using this library. Please look into the matter.

Kind Regards

Amit Kumar

1 Solution
11,153 Views
martynhunt
NXP Employee
NXP Employee

Hi,

I have some good news. Your build of the library has the correct compiler options set, and your applications does as well. However, it appears you are linking the application to the pre-built library provided by CMSIS. This pre-built version does not have -ffunction-sections -fdata-sections set; therefore, the unused data will not be removed.

To link your rebuild of the library correctly into your project you need to make sure you have the following properties set:

ToolSettings_Linker_Libraries.PNG.png

and:

ToolSettings_Linker_Misc.PNG.png

Please let me know if this works for you.

Best regards,

Martyn

P.S. For reference the correct compiler settings for library and application are:

Library Compiler:

Library_Optimizations.PNG.png

Application compiler and linker options:

Application_Compiler_Optimizations.PNG.png

Applications_Linker_Options.PNG.png

View solution in original post

26 Replies
1,504 Views
Amit_Kumar1
Senior Contributor II

Hi martynhunt

I Tried implementing the CFFT code into my project. It gave an error that m_text overflowed. Then I configured the flex mem and increased the size but still the error was the same and the amount by which it was being overflowed was the same, then I reduced the input buffer size from 2048 to 32 but still the same message. I tested the library by implementing sine, cosine function example code and that is working fine then I tried to implement CFFT example code which still didn't worked. Currently I am using CMSIS 3.2, with codewarrior10.6 and I am implementing this on FRDM-K20D50M board. Attached is my project with built library please have a look into it.

The error snapshot when the data array was 256.

cm.jpg

Kind Regards

Amit Kumar

0 Kudos
Reply
1,504 Views
BlackNight
NXP Employee
NXP Employee

m_text overflowed means that your application is too big, and according to the screenshot it is over by more than 50 KByte.

I have not checked your project, but it looks like your are linking too much?

1,504 Views
Amit_Kumar1
Senior Contributor II

HI Erich

Thanks for the reply. How do I overcome this error? any suggestions? I checked with reduced array size from 2048 to 32. but the size by which it is overflowing is the same. there is a warning message also which says invalid project path. Is that message of any concern?

cm.jpg

Kind Regards

Amit Kumar

0 Kudos
Reply
11,154 Views
martynhunt
NXP Employee
NXP Employee

Hi,

I have some good news. Your build of the library has the correct compiler options set, and your applications does as well. However, it appears you are linking the application to the pre-built library provided by CMSIS. This pre-built version does not have -ffunction-sections -fdata-sections set; therefore, the unused data will not be removed.

To link your rebuild of the library correctly into your project you need to make sure you have the following properties set:

ToolSettings_Linker_Libraries.PNG.png

and:

ToolSettings_Linker_Misc.PNG.png

Please let me know if this works for you.

Best regards,

Martyn

P.S. For reference the correct compiler settings for library and application are:

Library Compiler:

Library_Optimizations.PNG.png

Application compiler and linker options:

Application_Compiler_Optimizations.PNG.png

Applications_Linker_Options.PNG.png

1,504 Views
Amit_Kumar1
Senior Contributor II

Hi Martyn

Thanks for your support. It worked

Kind Regards

Amit Kumar

0 Kudos
Reply
1,504 Views
martynhunt
NXP Employee
NXP Employee

Hi,

It looks like the GCC linker is pulling in all of the data tables in arm_common_tables.h. See .map file excerpt:

.rodata         0x00005e04        0xc ./Sources/main.o

.rodata         0x00005e10    0x26d58 C:/Users/B45635/Downloads/CMSIS-SP-00300-r3p2-00rel1/CMSIS/Lib/GCC\libarm_cortexM4l_math.a(arm_common_tables.o)

                0x00005e10                twiddleCoef_rfft_4096

                0x00009e10                twiddleCoef_rfft_2048

                0x0000be10                twiddleCoef_rfft_1024

                0x0000ce10                twiddleCoef_rfft_512

                0x0000d610                twiddleCoef_rfft_256

                0x0000da10                twiddleCoef_rfft_128

                0x0000dc10                twiddleCoef_rfft_64

                0x0000dd10                twiddleCoef_rfft_32

                0x0000dd90                armBitRevIndexTable4096

                0x0000fd10                armBitRevIndexTable2048

                0x00011ad0                armBitRevIndexTable1024

                0x000128e0                armBitRevIndexTable512

                0x00012c60                armBitRevIndexTable256

                0x00012fd0                armBitRevIndexTable128

                0x00013170                armBitRevIndexTable64

                0x000131e0                armBitRevIndexTable32

                0x00013240                armBitRevIndexTable16

                0x00013268                armRecipTableQ31

                0x00013368                armRecipTableQ15

                0x000133e8                twiddleCoefQ15

                0x000163e8                twiddleCoefQ31

                0x0001c3e8                twiddleCoef_4096

                0x000243e8                twiddleCoef_2048

                0x000283e8                twiddleCoef_1024

                0x0002a3e8                twiddleCoef_512

                0x0002b3e8                twiddleCoef_256

                0x0002bbe8                twiddleCoef_128

                0x0002bfe8                twiddleCoef_64

                0x0002c1e8                twiddleCoef_32

                0x0002c2e8                twiddleCoef_16

                0x0002c368                armBitRevTable

.rodata         0x0002cb68      0x20 C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/lib/armv7e-m\libc.a(__strtold.o)

This appears to be an issue with how the ARM library behaves when being built with GCC compiler.

Best regards,

Martyn