Trying to get MakeFile setup with CMSIS/DSP/Lib

I am working on some sketches using FFT.

Even though my code is working I can not get the makefile to work.

From the error I got, I need to add arm_cfft_radix4_f32 and arm_cmplx_mag_f32 functions to the linker.

my makefile looks like this right now

Project Name

TARGET = simpleFFT

Sources

CPP_SOURCES = simpleFFT.cpp

Library Locations

LIBDAISY_DIR = …/…/libdaisy

DAISYSP_DIR = …/…/DaisySP

Core location, and generic makefile.

SYSTEM_FILES_DIR = $(LIBDAISY_DIR)/core

include $(SYSTEM_FILES_DIR)/Makefile

Compiler Flags

CFLAGS += -I$(LIBDAISY_DIR)/Drivers/CMSIS/DSP/Include

Linker Flags

LDFLAGS += -L$(LIBDAISY_DIR)/Drivers/CMSIS/DSP/Lib

LDFLAGS += -l arm_cmsis_dsp

all: $(TARGET).bin

and here is the error i am getting

make
arm-none-eabi-gcc -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H750xx -DHSE_VALUE=16000000 -DCORE_CM7 -DSTM32H750IB -DARM_MATH_CM7 -DUSE_FULL_LL_DRIVER -include stm32h7xx.h -I…/…/libdaisy -I…/…/libdaisy/src/ -I…/…/libdaisy/src/sys -I…/…/libdaisy/src/usbd -I…/…/libdaisy/src/usbh -I…/…/libdaisy/Drivers/CMSIS/Include/ -I…/…/libdaisy/Drivers/CMSIS/DSP/Include -I…/…/libdaisy/Drivers/CMSIS/Device/ST/STM32H7xx/Include -I…/…/libdaisy/Drivers/STM32H7xx_HAL_Driver/Inc/ -I…/…/libdaisy/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I…/…/libdaisy/Middlewares/ST/STM32_USB_Host_Library/Core/Inc -I…/…/libdaisy/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc -I…/…/libdaisy/core/ -I…/…/DaisySP/Source -I…/…/libdaisy/Middlewares/Third_Party/FatFs/src -O2 -Wall -Wno-missing-attributes -fasm -fdata-sections -ffunction-sections -Wno-stringop-overflow -g -ggdb -MMD -MP -MF"build/startup_stm32h750xx.d" -I…/…/libdaisy/Drivers/CMSIS/DSP/Include -std=gnu11 -Wa,-a,-ad,-alms=build/startup_stm32h750xx.lst …/…/libdaisy/core/startup_stm32h750xx.c -o build/startup_stm32h750xx.o
arm-none-eabi-g++ -c -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard -DUSE_HAL_DRIVER -DSTM32H750xx -DHSE_VALUE=16000000 -DCORE_CM7 -DSTM32H750IB -DARM_MATH_CM7 -DUSE_FULL_LL_DRIVER -include stm32h7xx.h -I…/…/libdaisy -I…/…/libdaisy/src/ -I…/…/libdaisy/src/sys -I…/…/libdaisy/src/usbd -I…/…/libdaisy/src/usbh -I…/…/libdaisy/Drivers/CMSIS/Include/ -I…/…/libdaisy/Drivers/CMSIS/DSP/Include -I…/…/libdaisy/Drivers/CMSIS/Device/ST/STM32H7xx/Include -I…/…/libdaisy/Drivers/STM32H7xx_HAL_Driver/Inc/ -I…/…/libdaisy/Middlewares/ST/STM32_USB_Device_Library/Core/Inc -I…/…/libdaisy/Middlewares/ST/STM32_USB_Host_Library/Core/Inc -I…/…/libdaisy/Middlewares/ST/STM32_USB_Host_Library/Class/MSC/Inc -I…/…/libdaisy/core/ -I…/…/DaisySP/Source -I…/…/libdaisy/Middlewares/Third_Party/FatFs/src -O2 -Wall -Wno-missing-attributes -fasm -fdata-sections -ffunction-sections -Wno-stringop-overflow -g -ggdb -MMD -MP -MF"build/simpleFFT.d" -I…/…/libdaisy/Drivers/CMSIS/DSP/Include -fno-exceptions -fasm -finline -finline-functions-called-once -fshort-enums -fno-move-loop-invariants -fno-unwind-tables -Wno-register -std=gnu++14 -Wa,-a,-ad,-alms=build/simpleFFT.lst simpleFFT.cpp -o build/simpleFFT.o
simpleFFT.cpp:21:27: warning: ‘fft_out’ defined but not used [-Wunused-variable]
21 | static float fft_out[FFT_SIZE];
| ^~~~~~~
arm-none-eabi-g++ build/startup_stm32h750xx.o build/simpleFFT.o -mcpu=cortex-m7 -mthumb -mfpu=fpv5-d16 -mfloat-abi=hard --specs=nano.specs --specs=nosys.specs -T…/…/libdaisy/core/STM32H750IB_flash.lds -L…/…/libdaisy/build -L …/…/DaisySP/build -ldaisy -lc -lm -lnosys -ldaisysp -Wl,-Map=build/simpleFFT.map,–cref -Wl,–gc-sections -Wl,–print-memory-usage -L…/…/libdaisy/Drivers/CMSIS/DSP/Lib -l arm_cmsis_dsp -o build/simpleFFT.elf
/Applications/ARM/bin/…/lib/gcc/arm-none-eabi/10.3.1/…/…/…/…/arm-none-eabi/bin/ld: cannot find -larm_cmsis_dsp
collect2: error: ld returned 1 exit status
make: *** [build/simpleFFT.elf] Error 1

thanks!

Do your relative paths really use three dots for parent directory (eg. -I…/…/libdaisy/src/sys) or is this some kind of display artifact? It should be two dots for parent dir.
The error is that the linker is not finding the library libarm_cmsis_dsp.so (or .a). This could be due to the extra dot in the relative path or some other issue. If the extra dot thing is not the issue, then you need to confirm that this library is in one of the paths given by the “-L” options for the linker.

Hope this helps,
John

That library isn’t built in a normal libdaisy setup. Source files are there, but the library isn’t built.

it is in an artifact

also I think I made the mistake of assuming it was built as I did not see any makefile in that directory. generally I make sure to build any make files that are in directories being used but alas in this case there is no make file so I am not sure how to proceed. ( I am not sure which files I would need in source dir etc)

Honestly I at this point I am starting to wonder if I might not be better off just grabbing the KISSFFT directory,puting that into my projects sub-directory and then using and building that as there are tales of pain all over the internet from people trying to get the CMSIS FFT working .

thanks

It’s not hard to use CMSIS FFT.
I just did it the brute force way, copying the required files into my project directory. Works fine.
Better would be to modify the libdaisy Makefile to include the files, or to create another Makefile just to create a DSP lib.

It’s not hard to do, and learning how to write make files is a good thing.

But maybe you’ll do better trying the KISSFFT way.

yes i agree I am working hard to try to get better at writing make files
i think the issue here is that i have been able to write make files before mainly based upon looking at other make files in the lib and using those as a pattern

are there any books you would recommend for learning ?

anyway maybe I will try to do what you did and copy all(?) the files for the FFT into a my proj directory
thanks for the help (and also for letting me know it CAN be done)

Back when I was learning this stuff, O’Reilly books were a great way to start. But that was before the WWW, and before billions of people had their own Linux, Mac OSX, Unix, etc… I think you can find all you need on the Web, and looking at the ‘man’ pages on Linux or Mac.

Made curious by the posts I’d seen here about CMSIS FFT, I decided to write a simple C++ program which would use FFT to determine the frequency of the LEFT audio input, and display this on the bluemchen’s OLED.
I only copied the files required for the program I was writing, and even that is unnecessary - I could have just put the full path to the source files in my project’s Makefile.
It’s only 7 C files, and 1 ASM file. The error messages you get tell you each undefined reference, from that, it’s easy to determine which files you need.

It works as intended, but using a small FFT size, it’s only useful as a demonstration of the technique.

my only experience before the daisy was working through tom erbes stm32f47 projects and using the euro-rack ardcore module (which is very easy to understand as its AVR based and all the hardware is fixed) so I have a lot to learn. compared to using the STM32Cube IDE and a disco board I think it is a much faster way to learn and try stuff

you seem to be on of the knowledgeable people on this forum! what is your day job?

Retired software engineer.