EABI stands for Embedded Application Binary Interface. It is a specification that defines how executables, libraries, and startup code interact with the ARM processor architecture. The EABI helps ensure compatibility and interoperability between different software components running on ARM-based devices.
The ABI or Application Binary Interface is basically a set of rules that govern how application code interacts with system libraries, the operating system, and the underlying processor architecture. The ABI covers details like:
- Function calling conventions – how parameters are passed to functions and return values are handled.
- Register usage conventions – which registers are preserved across function calls.
- Object file formats – how executable and library code is structured in binary files.
- Exception handling – how errors and interrupts are handled across different components.
The EABI specification is an ABI tailored specifically for embedded applications running on ARM processors. It was created to standardize interactions between components in the embedded ARM ecosystem.
History of EABI
In the 1990s, ARM Holdings introduced the first ARM architecture processor chips for embedded and mobile applications. As ARM chips started gaining popularity, the need for a standard ABI arose.
Initially, vendors like Apple, Symbian, and PalmSource created their own proprietary ABIs for ARM. This caused fragmentation – software compiled for one platform would not work on another. Porting software was difficult.
To address this problem, ARM Holdings created the Common ABI in 1997. This allowed some degree of interoperability between platforms using ARM chips. However, the Common ABI had limitations – it was specific to ARM architecture version 4 and could not exploit some of the enhancements introduced in newer ARM versions.
This led to the development of the Extended ABI, known as EABI, by ARM Holdings in collaboration with its partners. First introduced in 2005, EABI provided a more robust and future-proof standard ABI for the ARM architecture.
The EABI specification has gone through a few revisions over the years. EABI version 5 released in 2008 is the most widely adopted version today.
Goals of EABI
The goals behind creating the EABI standard were:
- Interoperability – Allow compatibility between different operating systems, compilers, and libraries running on ARM chips.
- Portability – Reduce work required to port software between different ARM platforms.
- Performance – Enable better utilization of architecture capabilities and optimizations.
- Compatibility – Retain backward compatibility with existing ABIs where possible.
- Conformance – Provide a clear conformance test suite for compliance.
In essence, EABI aims to create a common ground between the hardware (ARM architecture) and the software (applications, OS, libraries). This allows developers to write code that runs reliably across different ARM devices.
Key Aspects of EABI
The EABI specification covers several aspects of how software interacts with the ARM architecture. Some key areas are:
Function Calling Convention
This defines how function arguments are passed and return values retrieved. The EABI uses registers instead of stack to pass arguments for better performance. There are also conventions about preserving register values across calls.
Stack and Registers
The specification mandates which registers and stack areas are reserved for global use vs available to developers. For example, register r13 is reserved as the stack pointer.
Object File Format
Executable and library files have sections containing code, data, debugging symbols organized in a standard format. This allows linking between objects built by different compilers.
Debugging Information
The EABI specifies how source-level debugging data like line numbers, variables, filenames are embedded in object files. This allows debuggers to provide information across toolchains.
C++ Exception Handling
Defines how C++ exceptions are implemented under the hood using stack unwinding. This enables C++ code to work reliably with exceptions across different compilers.
Floating Point Arithmetic
Specifies conventions like register usage, argument passing, return values for floating point computations. This ensures consistency of floating point operations.
Integer Arithmetic
Similarly defines how integer-based calculations are handled by the compiler for conformity.
Vector Floating Point (VFP)
Specifies conventions when using the ARM Vector Floating Point architecture extension for improved floating point performance.
Benefits of Using EABI
Adopting the EABI standard provides various benefits for developers, OEMs, device manufacturers in the ARM ecosystem:
- Write once, run anywhere – the same code can run on different ARM devices.
- Reuse libraries – no need to recompile libs for each platform.
- Leverage OS support – Linux, RTOS ports conforming to EABI can be reused.
- Link objects from any compiler – as long as it supports EABI.
- Improved performance compared to earlier ABIs.
- Modern language support – efficient C++11 features, Rust, Go etc.
- Simplified board bring-up – faster time to market.
By providing a standard ABI for ARM systems, EABI has fueled interoperability and portability in the ARM embedded ecosystem, similar to how x86 systems benefit from standard ABIs.
Who Uses EABI?
The EABI specification is broadly used in the ARM embedded ecosystem:
- Operating Systems – Linux, Android, FreeRTOS,VxWorks have added EABI support.
- Compiler Toolchains – GCC, LLVM, ARM Compiler, IAR.
- Middleware Vendors – for RTOS, TCP/IP, USB stacks.
- Device Manufacturers – NXP, STMicro, Samsung, TI etc.
- IoT Platforms – AWS FreeRTOS, Zephyr RTOS.
Any software expected to run across multiple ARM devices needs to conform to the EABI. Even proprietary software stacks implement EABI underneath for portability.
EABI Support in Toolchains
To build EABI compliant code, compilers and assemblers need to follow the specification when generating machine code. Most modern toolchains used for ARM development provide explicit flags to enable EABI support:
- GCC – Compiling with
-mabi=aapcs
enables EABI in generated code. - Clang/LLVM – Use
-target armv7-none-linux-gnueabi
or similar target triple. - ARM Compiler – Supports
--arm_linux_eabi
option. - IAR – Enable EABI in compiler settings.
The toolchain creates object code that conforms to EABI standards for areas like function calls, stack usage, and exceptions. The linker also needs to support generating EABI compliant final executables.
Checking for EABI Compliance
ARM provides an EABI Compliance Checker tool that can analyze object files, libraries and executables for conformance. It checks areas like:
- Function call sequences
- Stack pointer usage
- Initialization sequences
- Debugging information
For Linux systems, ABI Compliance Checker (abi-compliance-checker) can be used. Several IDEs also integrate EABI compliance checking into builds.
Conforming to EABI validates that the application, libraries and runtime are not violating conventions required for interoperability. This helps avoid hard-to-debug issues because of ABI incompatibilities.
Limitations of EABI
While EABI has strongly benefited portability in the ARM ecosystem, it has some limitations:
- EABI is not fully architecture agnostic – different versions are needed for ARM v6, v7, v8.
- It does not cover aspects like syscalls, machine initialization – so OS ports are still needed.
- Some runtime components like dynamic linker may still need customization.
- Can affect performance in some cases due to additional overheads.
So while adopting EABI does not fully eliminate the work needed to retarget software, it significantly reduces the porting effort compared to no standard ABI.
Conclusion
The Embedded Application Binary Interface (EABI) has played a key role in fueling the growth of ARM-based solutions. By providing a standard way for application components to interact with the hardware and OS, EABI enables portability and interoperability in the ecosystem.
Understanding EABI helps developers utilize it effectively to write portable code for ARM devices. Toolchain and compiler support for EABI must be validated to ensure compliance. Overall, adopting EABI is vital for developing robust, compatible embedded software for the ARM world.