2010-04-07 04:10 AM
New STM323 library incompatibility with C std type specifier
2011-05-17 04:46 AM
''I am getting a warning ''unsigned long *'' is in compatible with type ''uint32_t*'' . WHat should be done to remove this warning signal''
Obviously, use a type that is compatible with uint32_t !Hint: check what size an ''unsigned long'' is with your particular compiler...2011-05-17 04:46 AM
Hi,
This is clear to me but still the problem is not clear to me. I am using new CMSIS compatible STM32 library. Here in new lib u32 is defined as uint32_t which is also defined as __UINT32_T_TYPE__ in stdint.h. But I am not able to find the meaning of __UINT32_T_TYPE__ in any document. Seeing the IAR compiler document, ''long'' is defined as 4 bytes only. So now I am not able to find correct way to remove this warning signal. Do you have any idea? Rgds,2011-05-17 04:46 AM
Are you using the IAR compiler?
Have you asked IAR about this?2011-05-17 04:46 AM
Here in new lib u32 is defined as uint32_t which is also defined as __UINT32_T_TYPE__ in stdint.h. But I am not able to find the meaning of __UINT32_T_TYPE__ in any document.
I think you have this backward, because
typedef __UINT32_T_TYPE__ uint32_t;
defines __UINT32_T_TYPE__ as uint32_t, not the other way around. Perhaps it's just your English. As for uint32_t, it is probably defined as typedef unsigned long int uint32_t; Which given IAR's MISRA support probably isn't exactly the same as ''unsigned long'' Perhaps you should be using the (u32 *) or (uint32_t *) casts instead of using (unsigned long *). It's always good to use a uniform and consistent coding of types, rather than casting back and forth. -Clive2011-05-17 04:46 AM
''It's always good to use a uniform and consistent coding of types, rather than casting back and forth.''
Absolutely!2011-05-17 04:46 AM
Hi Clive1,
Thanks for the explanation. II agree that there should be a uniform way of using it but the problem is if you have some external library than what would you do. Now coming to the problem. I know how to typecast but I want to understand the relation between __UINT32_T_TYPE__ and unsigned long. As I have some library in which only ''unsigned long'' is used while on the other hand in new STM32 lib u32 is defined as uint32_t which in turn is defined as uint32_t. Hope the problem is clear now. Rgds,2011-05-17 04:46 AM
It could be because uint32_t is really typedef'd as unsigned int...