A Compiler-Driven Approach for Static Dependency Injection in Embedded Software

Developing embedded software is challenging due to the need to strike a balance between writing loosely coupled and maintainable code while coping with the microcontroller’s limitations in memory, storage, and processing power. While object-oriented programming can lead to improved abstractions and cohesive, easier-to-maintain software, traditional low-level implementation of polymorphism often introduces runtime overhead that hinders its adoption. This paper proposes a compiler-driven dependency injection (DI) technique that enables the compiler to resolve dependencies and replace bound interfaces with concrete implementations in the AST tree to reduce the burden of virtual dispatch in embedded software. We compared five implementations of a breakout game written with object-oriented language features, C++20 concepts, and our proposed method. Results show that the language features allow clear interface definitions and centralized binding configurations, enhancing maintainability and portability. Furthermore, our compiler-driven approach enables optimizations beyond interface boundaries, improving code inlining, constant propagation, interprocedural optimization, and dead code elimination, producing 41.9% smaller and up to 73.3% faster firmware than equivalent versions with compile-time injection.

Authors

Publication Details

Published
2025-09-22
DOI
https://doi.org/10.5753/sblp.2025.10519
Primary Topic
Security and Verification in Computing
Type
article
Field-Weighted Citation Impact
0.00
Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

A Compiler-Driven Approach for Static Dependency Injection in Embedded Software

Anikó Costa, Tiago Oliveira
Security and Verification in Computing
article

A Compiler-Driven Approach for Static Dependency Injection in Embedded Software

Anikó Costa, Tiago Oliveira
article en

Abstract

Developing embedded software is challenging due to the need to strike a balance between writing loosely coupled and maintainable code while coping with the microcontroller’s limitations in memory, storage, and processing power. While object-oriented programming can lead to improved abstractions and cohesive, easier-to-maintain software, traditional low-level implementation of polymorphism often introduces runtime overhead that hinders its adoption. This paper proposes a compiler-driven dependency injection (DI) technique that enables the compiler to resolve dependencies and replace bound interfaces with concrete implementations in the AST tree to reduce the burden of virtual dispatch in embedded software. We compared five implementations of a breakout game written with object-oriented language features, C++20 concepts, and our proposed method. Results show that the language features allow clear interface definitions and centralized binding configurations, enhancing maintainability and portability. Furthermore, our compiler-driven approach enables optimizations beyond interface boundaries, improving code inlining, constant propagation, interprocedural optimization, and dead code elimination, producing 41.9% smaller and up to 73.3% faster firmware than equivalent versions with compile-time injection.

Openalex Percentile: Top 85%
Security and Verification in Computing
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.