cancel
Showing results for 
Search instead for 
Did you mean: 

How do I update the CMSIS used by a project?

CTapp.1
Senior II

I've created a project for an STM32G031 device, but the code does not build cleanly with -Wsign-conversion due to some "nasty" stuff in the CMSIS core_cm0plus.h file:

../Drivers/CMSIS/Include/core_cm0plus.h: In function '__NVIC_SetVector':
../Drivers/CMSIS/Include/core_cm0plus.h:964:23: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
  964 |   (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
      |                       ^
../Drivers/CMSIS/Include/core_cm0plus.h:964:72: warning: conversion to 'int' from 'uint32_t' {aka 'long unsigned int'} may change the sign of the result [-Wsign-conversion]
  964 |   (* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4)) = vector;
      |                                                                        ^~~~~~
../Drivers/CMSIS/Include/core_cm0plus.h: In function '__NVIC_GetVector':
../Drivers/CMSIS/Include/core_cm0plus.h:984:40: warning: conversion to 'long unsigned int' from 'long int' may change the sign of the result [-Wsign-conversion]
  984 |   return (uint32_t)(* (int *) (vectors + ((int32_t)IRQn + NVIC_USER_IRQ_OFFSET) * 4));

The file is for CMSIS V5.0.7. V6.1.0 looks like it fixed this.

Is is possible to select a different version of CMSIS within the project?

For now, I've just wrapped the affected code with a GCC diagnostic ignored "-Wsign-conversion" pragma, but I would prefer to use files that are not modified within the project so that it does not have to take ownership of them.

--

Edited to fix a typo.

2 REPLIES 2
Souhaib MAZHOUD
ST Employee

Hello @CTapp.1 

The CMSIS pack V6.1.0 can be downloaded from arm website and then imported locally in CubeMX( Help> Manage embedded software package), as shown in screenshot:

SouhaibMAZHOUD_0-1744982941808.png

BR,

Souhaib

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

CTapp.1
Senior II

Thanks, I tried that but got:

CTapp1_0-1745312820379.png

My installation is in the default location (C:\ST). The package installer does not show me where it is trying to install, so I'm not able to verify the permissions.

However, the package did install when I used the "Software packs" menu that is presented when the project's .ioc file was opened.

I then used the Software Packs Component Selector to add in CMSIS CORE:

CTapp1_1-1745313546939.png

And then enabled it in the Middleware and Software Packs:

CTapp1_2-1745313776192.png

But, when I save the .ioc and the code is regenerated, that just gives me a second set of CMSIS files:

CTapp1_3-1745314834579.png

How do I replace the set under Drivers/CMSIS/Include instead?