Skip to main content
This topic has been closed for replies.
Best answer by Repwoc

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.

 

4 replies

Super User
December 8, 2024

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.

 

RepwocAuthor
Explorer
December 10, 2024

OK thanks.

What about the STM32CubeH7?  Is that also a 'mature' product?  It also has CMSIS v5.6.

Super User
December 10, 2024

Older STM32H7's are mature products. Not sure about new ones (H7R/S).

 

 

RepwocAuthor
Explorer
January 17, 2025

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

Super User
January 17, 2025

Can't you back-port this function to the library included in the STM32G4 firmware?

 

RepwocAuthor
Explorer
January 20, 2025

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.