2025-04-17 8:49 AM - edited 2025-04-17 8:50 AM
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.
2025-04-18 6:30 AM
2025-04-22 2:44 AM
Thanks, I tried that but got:
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:
And then enabled it in the Middleware and Software Packs:
But, when I save the .ioc and the code is regenerated, that just gives me a second set of CMSIS files:
How do I replace the set under Drivers/CMSIS/Include instead?