I am trying to implement DSP on the STM32F411RE Nucleo board, for which I would require the use of the CMSIS library. I am trying to get this to work by setting up the STM32 in CubeMX (setting Clock, HAL, DMA, but most crucially setting the toolchain to MDK-ARM V5 and "copy all used library files into project folder") and then transitioning to Keil uVision.
I receive 3 signals total on the ADC / DMA setup (via continuous buffering), which are converted into voltages and sorted into their correct arrays for their use in DSP. Whilst this buffer runs continuously to take in results, the values are only converted and passed on to the arrays whilst the DSP is not running at the moment: my goal is to implement double buffering later, hence the lack of a timer interrupted 'run once' buffer and instead this continuous buffering (DMA, so it does not influence the CPU anyway). get 3 different results via this input buffer (which are sorted into the arrays) and I also need to run the DSP algorithms 3 times total, to avoid the results folding back onto themselves and the data becoming useless.
Thus, to include the use of the DSP functions on the STM32F4xx I invoke the <arm_math.h> library via setting it in the uVision 'Manage Run-Time Environment' applet. The download process completes successfully and I can see the folder (with contents!) has been added to my MDK-ARM project folder, but when I try to compile ("Re-build") the project it gives me the following errors, which only occurs with the #include "arm_math.h" for the ARM::CMSIS:DSP library.
Error code(s); https://pastebin.com/dU7rzBSS
Project code: https://pastebin.com/XWsS7urd
I have tried a bunch of different includes and defines in the project code, but I cannot get rid of this error nor can I garner any information about how I could possibly fix this. I understand it has got something to do with the project not being able to call the required functions and algorithms correctly (as per the warning: #47-D: incompatible redefinition of macro "__PKHBT" (declared at line 852 of ../Drivers/CMSIS/Include/cmsis_armcc.h"), but AFAIK I have included the necessary includes / defines (or tried doing so) and the library is in the project folder, so what is happening??
EDIT: I tried rebuilding my project completely and I ensured that I had the CMSIS + CMSIS:DSP libraries included via the "Manage Run-Time Environment" applet. I then tried to invoke the command "arm_rfft_fast_instance_f32 S;" to setup the Real Fast Fourier Transform: it then gives me an error: unknown type name: "arm_rfft_fast_instance_f32', which can be fixed by #include "arm_math.h" // ARM::CMSIS:DSP but then it refuses to compile (re-build) again thanks to the aforementioned errors.
It is starting to get somewhat frustrating that the available documentation for this is so sparse, as I cannot seem to find any other approach that gives me a different error or helps me along, aside from the cryptic error about the "arm_math.h" library not being able to define its own contents.
Added some images to maybe help illustrate my problem.
Overview with errors
Manage Run-Time Environment shows CMSIS + CMSIS:DSP included
Error: need to include arm_math.h, despite it not compiling (rebuilding) if included
Yet arm_math.h is present in the project folder
I have tried this morning to include the CMSIS:DSP library as source code, rather than linking it as a library. It now gives me a whopping 330 errors and 55 warnings (compared to 30 errors and 5 warnings before), which are all pointed towards the arm_math.h file.
I am starting to believe that this file is broken, because despite it being present and having the necessary functions at first glance it does not appear to work whatsoever.
Thanks to some insightful advice from a fellow programmer it appears that the issues in the code above are that the #include arm_math.h needs to be called prior to the #include main.h; also all the instancing and inits need to take place within the main(), as apparently they are not truly static in nature.
So that was 40+ hours well spent
I get the same error (30 errors and 5 warnings) when using ARM compiler 5.06 but if I use ARM compiler 6.10.1 the error disappears.
View all questions in Arm Development Studio forum