C standard (for the Flex-CAN driver)

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

C standard (for the Flex-CAN driver)

675 Views
scotty
Contributor IV

Hello SDK developers,

Thank you for software support. We use the FLEX-CAN driver which can be found at

https://github.com/nxp-mcuxpresso/mcux-sdk/blob/main/drivers/flexcan/fsl_flexcan.c

https://github.com/nxp-mcuxpresso/mcux-sdk/blob/main/drivers/flexcan/fsl_flexcan.h

Currently we compile our project with the C99 or GNU99 standard.

When we compile this driver, a lot of warnings are issued by the GNU compiler. (With the C2x standard, the warnings are gone.)

Please can you specify the C standard to which the SDK drivers are compliant. Thank you.

0 Kudos
Reply
3 Replies

617 Views
scotty
Contributor IV

Thank you, Alice, for you response.

Yes, indeed. When compiling with the C99 standard we get 52 warnings. But the number of different warnings is less:

  • warning: ISO C restricts enumerator values to range of 'int' before C2X [-Wpedantic]
  • warning: ISO C99 doesn't support unnamed structs/unions [-Wpedantic]
  • warning: union has no named members [-Wpedantic]
  • warning: struct has no named members [-Wpedantic]
  • warning: conversion from 'unsigned int' to 'uint16_t' {aka 'short unsigned int'} may change value [-Wconversion]
  • warning: conversion from 'int' to 'unsigned char:1' may change value [-Wconversion]

Maybe you want to specify from which FSL version which coding standard is required. Thanks.

0 Kudos
Reply

670 Views
scotty
Contributor IV

In MCUXpresso SDK fact sheet it says that "All drivers and startup code are MISRA-C:2012 compliant". - I wonder if this is correct.

0 Kudos
Reply

628 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello @scotty 

The SDK drivers are primarily written to be compliant with the C99 standard. 

The fact that the warnings disappear when using the C2x standard suggests that some constructs in the SDK drivers are more aligned with newer C standards or that the GNU compiler is more lenient in C2x mode.

 

BR

Alice

 

 

0 Kudos
Reply