I am using STM32CubeIDE to build project fro STM32H753 microcontroller.
I am unaware why the STM32CubeIDE is updating the type of
uint32_t
to
unsigned long.
I assume for a 32 bit processor uint32_t should be typed to unsigned int.
Where do I find declaration of __UINT32_TYPE__ ?
/* Sample code to report issue */
uint32_t
my_id = "1234";
sprintf( tmpstr, "Ser# %08X\r\n", my_id );
On compiling code I observe:
../User_Code/File_Xxx.c:205:36: warning: format '%X' expects argument of type 'unsigned int', but argument 3 has type 'uint32_t' {aka 'long unsigned int'} [-Wformat=]
205 | sprintf( tmpstr, "Ser# %08X\r\n", my_id );
| ~~~^ ~~~~~~~~~~~~
| | |
| | uint32_t {aka long unsigned int}
| unsigned int
| %08lX
Is there a way I can instruct STM32CubeIDE to type case uint32_t to unsigned int.
I also want to ensure that my change is not overwritten when I regenerate the code with help of IOC file.
Regards,
Rajeev
The correct way to do this is to use the format specifiers from
inttypes.h
; eg,
PRIx32
for
uint32_t