Sep 15, 2021 Automotive

Diab Compiler – Building Highly Optimized Code for Safety Certified Use Cases

By Raju Subbian

Diab toolchain compiled code has been deployed in billions of devices across Automotive, Industrial, A&D and Networking markets over the last 35+ years. In Diab’s long and trusted existence in the embedded market where safety is of paramount importance for mission critical applications, customers trust Diab toolchain to generate safe and effective code in addition to meeting their performance and code size requirements. Diab toolchain undergoes continuous improvement based on customer feedback and market analysis. In this blog post, we’ll examine some of these recent improvements.

Diab, from the beginning of its existence, relied on cutting edge in-house technology and innovation to speed up the development of new features and addition of new architectures as the industry adopts newer architectures. Diab 5.9.x has evolved over 35+ years of research and development. Diab supports most widely used 32-bit and 64-bit processors in the embedded market. As automotive and industrial markets started moving more and more towards functional safety standard compliant application development due to industry regulations, compiler’s role as a critical tool in application development resulted in customers asking for functional safety certified toolchain. Diab 5.9.x was one of the first in the industry to come out with Toolchain Qualification Kit (QKit) that allowed customers to select compiler features used in application development and then run tests that match these features in their own environment to qualify the compiler for safe usage as per ISO 26262 and IEC 61508 standards.

Developed and evolved with customer feedback, Diab 5.9.x eased the qualification effort needed to be spent by customers. Instead of having customers deploy and test QKit generated test code, Diab toolchain went for pre-qualified compiler assessed by TUV SUD for any ASIL and SIL level as needed by Automotive (ISO 26262) and Industrial (IEC 61508) markets respectively. This TUV SUD qualified toolchain not only provides all the necessary documents like safety manual and tool qualification report but also provides a diagnostic compiler, an industry first. Highly complex product like compilers have bugs and they need to be analyzed for their impact on code generated for embedded applications. Diab compiler team publishes all defects on Wind River Support website and annotates defects whether they have safety impact or if only certain processor architectures are affected, options that trigger these latent defects, workarounds, etc to help customers analyze the impact and take necessary counter measures. In spite of this helpful data it is still hard for customers to know how a particular defect affects their application as it is hard to identity sequence of code or find trigger conditions in millions of lines of application code.

The diagnostic compiler concept is an innovation from the Diab compiler team offered as part of TUV certified qualified compiler offering. Diagnostic compiler is a secondary compiler based on the same compiler product but rather than containing a fix for a defect it emits helpful diagnostic messages to pin-point code in the application that triggers the defect in the compiler. The key idea is to identify probable code sequences in the application that makes the compiler generate bad code or run into an erroneous behavior. Customers can then apply workaround to the application code and recompile with the diagnostic compiler again to ensure that the trigger condition no longer exists. Customers are expected to build with diagnostic compiler periodically to make sure newly developed code does not trigger any latent compiler defects. The diagnostic compiler offering is one of the time saving and critical concepts that help Diab customers in their safety critical application development. This concept helps customers to keep their production compiler unchanged after passing key late-stage milestones in a project where changing or updating compiler is not attractive due to high cost of revalidating an application.

Wind River compiler team has a long history of developing and using open source compiler, GCC, for VxWorks platform. In addition, the team also integrates and fixes issues in GCC for Wind River Linux product. As the landscape shifted towards participating in and leveraging more open source products like LLVM based compilers in addition to GCC, Wind River also started deploying LLVM as the main compiler for VxWorks due to its strong industry backing, modern code base, ease of development, etc. Wind River compiler team leveraged LLVM based effort for Diab products too and started offering an LLVM-based cross-compiler for ARM.

Diab’s LLVM based 7.x product line offers easy migration path for existing Diab 5.9.x customers by providing migration guides and shipping with Diab linker and other binary utilities along with GNU binutils. Diab 7.x thus makes it easy for existing GCC customers and Diab 5.9.x customers to migrate their applications with ease. It is not enough just to adopt and improve LLVM based compiler for safety critical market. Pre-existing defects in LLVM, Clang and compiler runtime libraries need to be continually analyzed, categorized and published with information on whether these defects have impact on safety. To this effect, Diab compiler team analyzed over 10000 defects so far, categorized them based on their impact on safety and then finally published them on Wind River Support Network for end customers. Diab 7.x continues with the offering of diagnostic compiler to aid in functional safety application development. As a value add, Diab ships with QEMU for simulation so that application development can be efficient without getting slowed down by underpowered target CPU environment.

Recently Diab 7.x also added a new feature to instrument, check and handle ARM floating point operation related exceptions. This feature offers multiple options to suit different customer needs and allows customers to override and handle these exceptions by installing custom handlers.

Diab 5.9.x support newer TriCore architecture variants like TC 4xx and Renesas G4MH2. Diab compiler further takes advantage of newer instructions and optimizes code for performance and size.

By leveraging in-house technologies and open source development, Diab compiler versions 5.9.x and 7.x bring best of both worlds to embedded customers and provides value-added TUV certified qualified compilers with innovative features like diagnostic compilers and monitoring and publishing of open source defects that impact safety. Customers come to trust Diab compiler product for technical superiority and for offering excellent customer support and maintenance.

Previous Real time tasks need real time data
Next Meet Wind River DTO: Michael Entner