^

Standards Compliance

Standards Compliance

BARR -C

Minimize bugs, maximize confidence. Apply the BARR-C standard

Since 2013 the BARR-C coding standards has been widely adopted to enhance the quality of embedded software applications. Source code developed in compliance with BARR-C recommendations are likely to be more maintainable and portable, and to exhibit fewer bugs.

What does BARR refer to in the context of embedded software?

The term “BARR” in “BARR-C” refers to the Barr Group and the surname of its founder, Michael Barr.

Who are the BARR Group?

According to founder Michael Barr, “Barr Group helps companies that design embedded systems make their products more reliable and more secure.” The BARR-C coding standard is just one part of a portfolio related to that end.

The Barr group was founded in 2011 as a successor to the Netrino company, which was founded in 1999.

What is BARR-C?

Barr-C is an embedded C coding standard. In its latest version, it is a style guide specifically designed to reduce the number of bugs in embedded software, while improving its maintainability and portability. It is now designed to complement and supplement the MISRA C language subset.

What are the BARR-C coding rules?

Ever since the realignment of BARR-C in 2018, BARR-C coding rules have been focused on stylistic matters. Upon the release of BARR-C:2018 Andrew Banks, Chairman of the MISRA C working group and LDRA Technical Specialist (below) was quoted as saying Now that the guidelines from MISRA can be more easily coupled with the stylistic rules from BARR-C, we look forward to seeing embedded software designers take even greater steps toward improving the safety, security and overall code-quality of their products”. 

Andrew Banks

What is the “Embedded C Coding Standard”?

Embedded C Coding Standard is the title of a book that was authored by Michael Barr, capturing the coding standard that is commonly known as BARR-C. The aim of the book is to help minimize bugs in embedded software, while improving its maintainability and portability.

How does the Netrino-C embedded coding standard relate to BARR-C?

BARR-C is a direct descendant of Netrino-C. Netrino-C was superseded in 2013 and renamed to align with the new company responsible for it.

How does BARR-C embedded coding standard compare to MISRA C?

The title of the MISRA C:2012 document is “Guidelines for the use of the C language in critical systems”. The vision statement in that document goes on to state that “many standards for the development of safety-related software require, or recommend, the use of a language subset”. It has since been made clear that MISRA C is appropriate for use in safety- security-, and mission-critical software.

Historically, there were some direct conflicts between BARR-C and MISRA C but the realignment of BARR-C in 2018 means that they are now complementary. Unlike MISRA-C, BARR-C is a style guide for the C language. MISRA’s guidelines do not provide stylistic advice and so applying BARR-C’s stylistic rules to the MISRA C subset has the potential to further increase safety, security, and reliability.

Is BARR-C suitable for critical embedded systems?

BARR-C is a style guide for the C language. The use of a style guide in the context of critical systems is potentially beneficial, but it does not fulfil the requirement for a safe or secure subset as dictated by functional safety or cybersecurity standards respectively. However, using BARR-C to complement MISRA-C would enhance the development environment by introducing stylistic rules while still ensuring that the demands of those standards are met.

How does the BARR-C embedded coding standard help?

Compliance with the BARR-C embedded coding standard helps by providing:

  • a set of guiding principles
  • specific naming conventions and rules relating to many aspects of the language, including:
    • data types
    • functions
    • pre-processor macros
    • variables
  • highlighted rules that have been demonstrated to reduce or eliminate certain types of bugs

What rules are there in the BARR-C embedded coding standard?

There is a complete BARR-C compliance matrix available detailing all of the rules and identifying those that are implemented within LDRA tools. Similar matrices are available for all coding standards supported by LDRA tools. This makes it easy to compare tool compliance to multiple versions of the standard, and to assess compliance for multiple standards.

What is a BARR-C checker?

There are many rules in the BARR-C standard. In theory it might be possible to inspect the code to ensure that they have all been implemented, but that would be a highly skilled, labour-intensive, and error-prone job. BARR-C checkers, such as those provided by LDRA, automate that process by means of static analysis.

How can LDRA help with BARR-C compliance?

The ability to statically analyse software quickly and easily with reference to the BARR-C coding standard delivers tangible benefits to development teams in terms of code quality, consistency, and reduced time-to-deployment. LDRA is committed to supporting all versions of BARR coding standards and can help in several ways.

What can LDRA static analysis find?

Static analysis can help by checking BARR-C compliance as code is developed, and automatically applied during unit, system, or integration test to ensure that compliance achieved at the outset is not compromised throughout the software development life cycle. All versions of the BARR-C rules are completely integrated into LDRA tools for efficient checking within a familiar development environment.

LDRA static analysis tools locate and highlight areas of non-conformant code to aid documentation and modification. Extensive reports and graphical displays enhance understanding of the source code, facilitating improvements, maintainability and portability in line with BARR-C rules. LDRA static analysis tools also facilitate structural coverage analysis to ensure that software “testedness” is measured and maintained.

BARR-C rules compliance tools from LDRA

  • The LDRA tool suite automates source code checking for conformance to the BARR‑C coding standard.
  • LDRArules is a cost-effective, stand-alone rules checker independent from the LDRA tool suite that is focused on increasing software quality and security through coding standards compliance, including BARR-C.
  • LDRArules for the Microchip MPLABX IDE.

Additional information and BARR-C training materials

FREE 30 Day
TRIAL

Email Us

Email: info@ldra.com

Call Us

EMEA: +44 (0)151 649 9300

USA: +1 (855) 855 5372

INDIA: +91 80 4080 8707

Connect with LDRA