I created a simple test project for a STM32G431CBU6 MCU. In CubeMX I set SYS/debug = Serial Wire, RCC/High Speed Clock = Crystal Ceramic Resonator and clock HCLK = 170 MHz, then clicked save and generate code.
Back in CubeMX in Middleware and Software Packs I clicked CMSIS-DSP. A screen opened where I set CMSIS DSP to "Source" and clicked OK.
In CubeMX in Middleware and Software Packs I clicked CMSIS-DSP (again). This time there is a single checkbox: foir CMSIS DSP. Click to check the checkbox. Click save and generate code. In Project Explorer under the project folder a Middlewares folder structure is created which contains, under Third_Party/ARM_CMSIS/, a set of folders including Include and Source folders.
I added some code to the main.c file:
/* Includes ------------------------------------------------------------------*/
#include "main.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
#include "arm_math.h"
/* USER CODE END Includes */
...
/* USER CODE BEGIN PV */
arm_status stat;
float32_t y;
float32_t x;
float32_t result;
/* USER CODE END PV */
...
int main(void)
{
...
/* USER CODE BEGIN 2 */
x = 2;
y = 3;
stat = arm_atan2_f32(y, x, &result);
/* USER CODE END 2 */
I hit "Build". There were a lot of build errors. It seems that CubeMX omitted to copy most of the source files from the repository. I copied the source files manually. After a lot of compiling activity there were a bunch of "multiple definition of" errors (684 of them). I excluded the source files I had copied over manually from the build (they are #included in the source files that CubeMX did copy over). The project then built with no errors.
In debug I set a break point at the arm_atan2_f32() line and ran the program. After executing the arm_atan2_f32() function the stat code was "ARM_MATH_SUCCESS" and the result value was 0.982793808. This is in fairly close agreement with the result of the same calculation in Excel (0.982793723).
So this method can be employed to use newer CMSIS-DSP versions than is bundled with the firmware packages with a bit of faffing about copying source files and then excluding them from the build.