Electronicdesign 24697 Ccg Adacore Promo

Ada Compiler Generates C Source

Nov. 17, 2018
AdaCore’s latest GNAT Pro Ada compiler can generate C source code, delivering portability to most platforms with a C compiler.

With AdaCore’s latest GNAT Pro Ada compiler, it’s now possible to generate C source code using its Common Code Generator (CCG). This is designed to provide portability to the vast majority of platforms that have a C compiler. It was originally done to support the popular 8-bit Microchip AVR that AdaCore doesn’t support with its native code support targeting platforms, such as the 32- and 64-bit x86, ARM, RISC-V, and Power architectures.

Using CCG is just a matter of a command-line option (see codelist below). It handles a subset of Ada, but this still includes features like fixed-point support and the minimal standard library. Features not supported are ones that would be hard to implement or those not supported by C compilers like overflow checks. This is one reason to use support for SPARK, a provable subset of Ada. CCG works with SPARK applications.

Compiling Ada/SPARK code into C like this is as easy as a command-line switch.

The ability to insert assembly code inline is also missing. However, it’s possible to edit generated C code to do this since the C compiler supports such a feature.

The Ada.Real_Time runtime package is supported if rts_monotonic_clock and rts_delay_until procedures are provided. The online documentation covers the details of everything that is and isn’t supported.

Support for 8-bit platforms is just one reason to use CCG. It can handle other platforms that don’t support Ada and SPARK compilers.

If you want a quick way to learn basic Ada and SPARK programming, then check out AdaCore’s online training tools. You can edit source code online and have it compiled and executed.

Sponsored Recommendations

Near- and Far-Field Measurements

April 16, 2024
In this comprehensive application note, we delve into the methods of measuring the transmission (or reception) pattern, a key determinant of antenna gain, using a vector network...

DigiKey Factory Tomorrow Season 3: Sustainable Manufacturing

April 16, 2024
Industry 4.0 is helping manufacturers develop and integrate technologies such as AI, edge computing and connectivity for the factories of tomorrow. Learn more at DigiKey today...

Connectivity – The Backbone of Sustainable Automation

April 16, 2024
Advanced interfaces for signals, data, and electrical power are essential. They help save resources and costs when networking production equipment.

Empowered by Cutting-Edge Automation Technology: The Sustainable Journey

April 16, 2024
Advanced automation is key to efficient production and is a powerful tool for optimizing infrastructure and processes in terms of sustainability.

Comments

To join the conversation, and become an exclusive member of Electronic Design, create an account today!