2024-12-08 4:27 AM
The STM32CubeG4 package comes with CMSIS v5.6 (https://github.com/STMicroelectronics/STM32CubeG4/tree/master/Drivers/CMSIS) which I think was released in July 2019.
Is it necessary to use this version or can I upgrade it to a later release? Currently v6.1 is the latest CMSIS release.
Solved! Go to Solution.
2025-10-30 8:16 AM - edited 2025-10-30 8:26 AM
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.
2024-12-08 8:18 AM
Following the latest CMSIS is not necessary. STM32G4 is a mature Cortex-M4, it does not require the latest developments in ARM Cortex-M. Updating one of components may (and usually does) break the whole package and causes loss of productivity and time.
2024-12-10 3:54 AM
OK thanks.
What about the STM32CubeH7? Is that also a 'mature' product? It also has CMSIS v5.6.
2024-12-10 4:20 AM - edited 2024-12-10 4:20 AM
Older STM32H7's are mature products. Not sure about new ones (H7R/S).
2025-01-17 1:12 PM
Is it really not possible to upgrade the CMSIS version for STM32G4? I would really like to use the arm_atan2_xxx() function in my code but it doesn't exist in the CMSIS included in the STM32G4 firmware.
Thanks
paul
2025-01-17 2:17 PM
Can't you back-port this function to the library included in the STM32G4 firmware?
2025-01-20 1:14 AM
I guess I'll have to attempt to do that. Although I don't understand why the CMSIS can't be upgraded - there are bound to be other useful features in the new versions. Do I have to "back-port" all the new stuff that I want to use? Makes no sense.
2025-10-29 9:09 AM
Have you had any progress? I am trying to accomplish the same thing. I also wanted to use the arm_atan2_f32() function but this was not included in the G4's default 1.6.X firmware versions. I read it was added in later DSP versions, such as 1.10.X.
From my research so far, it looks like we would need to download the CMSIS DSP source from Github.io, and integrate it from source ourselves? Here is the CMSIS DSP sources: https://github.com/ARM-software/CMSIS-DSP
Then we would need to cross compile the library for the M4/G4 processor ourselves, and copy over the correct folders (Include, Lib, PrivateInclude), and define the ARM_MATH_CM4 symbol for our project.
I found this video helpful https://youtu.be/lwsWaMeP1co but I'm still debating whether I want to do all of this.
2025-10-29 6:23 PM
I haven’t tried it specifically with the CMSIS-DSP pack but you should be able to download the pack from ARM and import it into CubeMx (Help->Manage Packs then select ‘From Local’). Then you can add it to your CubeMx project from the middleware section. I did this to update the CMSIS pack and it worked well. I think ST has an app note or post on this somewhere.
https://www.keil.arm.com/packs/cmsis-dsp-arm/versions/
2025-10-30 2:53 AM
I found that in later CMSIS versions (than the version incorporated in the STM32CubeG4 package) CMSIS-DSP is a separate download from the main CMSIS package. I attempted to update the DSP element of the STM32CubeG4 package by downloading the source and compiling it to produce a library that could be linked in STM32CubeIDE.
It took a while for me to do this - I'd never used CMake or Ninja previously and it was a bit of a steep learning curve. I did manage to compile a library but it all feels a bit hacky and I'm not confident in using it.
I also tried to install the ARM DSP pack (specifically ARM.CMSIS-DSP.1.16.2.pack) into STM32CubeIDE using the Embedded Software Packages Manager but it fails with an error: