cancel
Showing results for 
Search instead for 
Did you mean: 

How to generate MISRA C 2012 compliance BSP and HAL using CuebMX for STM32U535RBT6 ?

Vishal58
Associate II

Currently I am using CuebMX version 6.12 and tried generating BSP and HAL code for STM32U535RBT6 controller.

But the generated code is not MISRA C 2012 compliant. How do I generate MISRA C 2012 compliance code?

 

9 REPLIES 9
Sarra.S
ST Employee

Hello @Vishal58, welcome to ST Community, 

According to UM2911 "Description of STM32U5 HAL and low-layer drivers", "It is compliant with MISRA C®:2012 standard."

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.

How do we know if STM32U535RBT6 fall under STM32 legacy products ?

But I get a lot of errors while running my static code analysis tool.

For example.

Header files are generated with __Filename_H__ and I get error as "MISRA C:2012 21.1 (Required)   #define and #undef shall not be used on a reserved identifier or reserved macro name. The macro '__Filename_H__ ' shall not be defined."

Many HAL related macros start with __ which is not as per MISRA C 2012 standards.

 

I just checked the STM32CubeU5  code also there also I could see 
__STM32U5xx_HAL_VERSION_MAIN macros defined and using __STM32U5xx_HAL_H header guards.

 

Not sure if the UM2911 is not correct or the way we generate code has to be changed for MISRA C 2012 compliance.


@Vishal58 wrote:

#define and #undef shall not be used on a reserved identifier or reserved macro name.


The leading underscores are reserved to "The System".

I guess it could be argued that HAL is considered part of "The System" ... ?

>>How do I generate MISRA C 2012 compliance code?

You get to OWN the source, per the license, and get to audit it, and waiver the things you're unwilling to change, with reasoning.

Most of the people I know can't take the liability on any third-party code, and ST's going to have you indemnify them, not the other way around.

People dealing with highly critical code, develop it in house, from the ground up. They use compilers running $10K+/seat, not GNU/GCC flavour du-jour

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Sarra.S  Can ST provide any update for this MISRA C 2012 compliance ?

This is a user-to-user forum; If you want direct support from ST, raise a case here: https://ols.st.com/s/ 

Or maybe contact your local Distributor:

https://www.st.com/content/st_com/en/support/support-home.html

 

Vishal58
Associate II

Thank you @Andrew Neil , I have raised a case and it is still not yet resolved.