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

The Importance of PCB Design in Consumer Products

April 25, 2024
Explore the importance of PCB design and how Fusion 360 can help your team react to evolving consumer demands.

PCB Design Mastery for Assembly & Fabrication

April 25, 2024
This guide explores PCB circuit board design, focusing on both Design For Assembly (DFA) and Design For Fabrication (DFab) perspectives.

What is Design Rule Checking in PCBs?

April 25, 2024
Explore the importance of Design Rule Checking (DRC) in manufacturing and how Autodesk Fusion 360 enhances the process.

Unlocking the Power of IoT Integration for Elevated PCB Designs

April 25, 2024
What does it take to add IoT into your product? What advantages does IoT have in PCB related projects? Read to find answers to your IoT design questions.

Comments

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