{"status":"ok","message-type":"work","message-version":"1.0.0","message":{"indexed":{"date-parts":[[2025,10,9]],"date-time":"2025-10-09T12:40:29Z","timestamp":1760013629709,"version":"build-2065373602"},"reference-count":23,"publisher":"Sociedade Brasileira de Computa\u00e7\u00e3o","content-domain":{"domain":[],"crossmark-restriction":false},"short-container-title":[],"abstract":"<jats:p>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\u2019s 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.<\/jats:p>","DOI":"10.5753\/sblp.2025.10519","type":"proceedings-article","created":{"date-parts":[[2025,10,9]],"date-time":"2025-10-09T12:13:46Z","timestamp":1760012026000},"page":"19-27","source":"Crossref","is-referenced-by-count":0,"title":["A Compiler-Driven Approach for Static Dependency Injection in Embedded Software"],"prefix":"10.5753","author":[{"given":"Thiago Borges de","family":"Oliveira","sequence":"first","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]},{"given":"Ariadne de Andrade","family":"Costa","sequence":"additional","affiliation":[],"role":[{"role":"author","vocabulary":"crossref"}]}],"member":"3742","published-online":{"date-parts":[[2025,9,22]]},"reference":[{"key":"1","doi-asserted-by":"crossref","unstructured":"Hudson Ayers, Evan Laufer, Paul Mure, Jaehyeon Park, Eduardo Rodelo, Thea Rossman, Andrey Pronin, Philip Levis, and Johnathan Van Why. 2022. Tighten rust\u2019s belt: shrinking embedded Rust binaries. In Proceedings of the 23rd ACM SIGPLAN\/SIGBED International Conference on Languages, Compilers, and Tools for Embedded Systems (San Diego, CA, USA) (LCTES 2022). Association for Computing Machinery, New York, NY, USA, 121\u2013132. DOI: <a href=\"https:\/\/doi.org\/10.1145\/3519941.3535075\"target=\"_blank\">10.1145\/3519941.3535075<\/a>","DOI":"10.1145\/3519941.3535075"},{"key":"2","doi-asserted-by":"crossref","unstructured":"Markus Bauer and Christian Rossow. 2021. NoVT: Eliminating C++ Virtual Calls to Mitigate Vtable Hijacking. In 2021 IEEE European Symposium on Security and Privacy (EuroS&P). 650\u2013666. DOI: <a href=\"https:\/\/doi.org\/10.1109\/EuroSP51992.2021.00049\"target=\"_blank\">10.1109\/EuroSP51992.2021.00049<\/a>","DOI":"10.1109\/EuroSP51992.2021.00049"},{"key":"3","doi-asserted-by":"crossref","unstructured":"Giorgio Buttazzo. 2006. Research trends in real-time computing for embedded systems. SIGBED Rev. 3, 3 (July 2006), 1\u201310. DOI: <a href=\"https:\/\/doi.org\/10.1145\/1164050.1164052\"target=\"_blank\">10.1145\/1164050.1164052<\/a>","DOI":"10.1145\/1164050.1164052"},{"key":"4","unstructured":"Marlin Community. 2025. Marlin Firmware. <a href=\"https:\/\/marlinfw.org\/docs\/basics\/introduction.html\"target=\"_blank\">[link]<\/a>. Accessed: 2025-04-27."},{"key":"5","unstructured":"Keith D. Cooper and Linda Torczon. 2021. Engineering a Compiler (3 ed.). Morgan Kaufmann."},{"key":"6","doi-asserted-by":"crossref","unstructured":"Tha\u00eds Dam\u00e1sio, Vin\u00edcius Pacheco, Fabr\u00edcio Goes, Fernando Pereira, and Rodrigo Rocha. 2021. Inlining for Code Size Reduction. In Proceedings of the 25th Brazilian Symposium on Programming Languages (Joinville, Brazil) (SBLP \u201921). Association for Computing Machinery, New York, NY, USA, 17\u201324. DOI: <a href=\"https:\/\/doi.org\/10.1145\/3475061.3475081\"target=\"_blank\">10.1145\/3475061.3475081<\/a>","DOI":"10.1145\/3475061.3475081"},{"key":"7","unstructured":"Thiago Borges de Oliveira. 2023. Robotis Language: A prototype language for embedded systems with compile-time dependency injection. <a href=\"https:\/\/github.com\/thborges\/robcmp\"target=\"_blank\">[link]<\/a>. Accessed: 2025-06-08."},{"key":"8","doi-asserted-by":"crossref","unstructured":"Michael D. Ernst, Greg J. Badros, and David Notkin. 2002. An Empirical Analysis of C Preprocessor Use. IEEE Trans. Softw. Eng. 28, 12 (Dec. 2002), 1146\u20131170. DOI: <a href=\"https:\/\/doi.org\/10.1109\/TSE.2002.1158288\"target=\"_blank\">10.1109\/TSE.2002.1158288<\/a>","DOI":"10.1109\/TSE.2002.1158288"},{"key":"9","doi-asserted-by":"crossref","unstructured":"Vahid Garousi, Michael Felderer, and Feyza Nur K\u0131l\u0131\u00e7aslan. 2019. A survey on software testability. Information and Software Technology 108 (2019), 35\u201364. DOI: <a href=\"https:\/\/doi.org\/10.1016\/j.infsof.2018.12.003\"target=\"_blank\">10.1016\/j.infsof.2018.12.003<\/a>","DOI":"10.1016\/j.infsof.2018.12.003"},{"key":"10","unstructured":"Marcell Ferenc Juh\u00e1sz. 2023. Modern C++ in embedded systems-Utilization of modern C++ language features for creating zero-overhead firmware architectures for resource-constrained embedded systems. Ph. D. Dissertation. Institute of Computer Technology, Technische Universit\u00e4t Wien."},{"key":"11","unstructured":"Kris Jusiak. 2018. boost-ext.di: C++14 Dependency Injection Library. <a href=\"https:\/\/github.com\/boost-ext\/di\"target=\"_blank\">[link]<\/a>. Accessed: 2025-05-20."},{"key":"12","unstructured":"Gregory Kick. 2025. Dagger Framework. <a href=\"https:\/\/dagger.dev\"target=\"_blank\">[link]<\/a>. Accessed: 2025-04-27."},{"key":"13","doi-asserted-by":"crossref","unstructured":"Chris Lattner and Vikram Adve. 2004. LLVM: A Compilation Framework for Lifelong Program Analysis & Transformation. In Proceedings of the 2004 International Symposium on Code Generation and Optimization (CGO). 75\u201386. DOI: <a href=\"https:\/\/doi.org\/10.1109\/CGO.2004.1281665\"target=\"_blank\">10.1109\/CGO.2004.1281665<\/a>","DOI":"10.1109\/CGO.2004.1281665"},{"key":"14","unstructured":"Microchip Technology Inc. 2015. ATmega328P Datasheet: 8-bit AVR Microcontroller with 32K Bytes In-System Programmable Flash. <a href=\"https:\/\/ww1.microchip.com\/downloads\/en\/DeviceDoc\/Atmel-7810-Automotive-Microcontrollers-ATmega328P_Datasheet.pdf\"target=\"_blank\">[link]<\/a>. Accessed: 2025-06-08."},{"key":"15","doi-asserted-by":"crossref","unstructured":"Brent Pappas and Paul Gazzillo. 2024. Semantic Analysis of Macro Usage for Portability. In Proceedings of the IEEE\/ACM 46th International Conference on Software Engineering (Lisbon, Portugal) (ICSE \u201924). Association for Computing Machinery, New York, NY, USA. DOI: <a href=\"https:\/\/doi.org\/10.1145\/3597503.3623323\"target=\"_blank\">10.1145\/3597503.3623323<\/a>","DOI":"10.1145\/3597503.3623323"},{"key":"16","unstructured":"Robbie Vanbrabant Schaefer. 2008. Google Guice: Agile Lightweight Dependency Injection Framework. Apress."},{"key":"17","doi-asserted-by":"crossref","unstructured":"Felix Schuster, Thomas Tendyck, Christopher Liebchen, Lucas Davi, Ahmad-Reza Sadeghi, and Thorsten Holz. 2015. Counterfeit Object-oriented Programming: On the Difficulty of Preventing Code Reuse Attacks in C++ Applications. In 2015 IEEE Symposium on Security and Privacy. 745\u2013762. DOI: <a href=\"https:\/\/doi.org\/10.1109\/SP.2015.51\"target=\"_blank\">10.1109\/SP.2015.51<\/a>","DOI":"10.1109\/SP.2015.51"},{"key":"18","unstructured":"Michael L. Scott. 2016. Programming Language Pragmatics (4 ed.). Morgan Kaufmann, Boston, MA."},{"key":"19","unstructured":"Mark Seemann and Steven van Deursen. 2019. Dependency Injection Principles, Practices, and Patterns. Manning Publications."},{"key":"20","unstructured":"Solomon Systech Limited. 2008. SSD1306: 128 x 64 Dot Matrix OLED\/PLED Segment\/Common Driver with Controller. <a href=\"https:\/\/cdn-shop.adafruit.com\/datasheets\/SSD1306.pdf\"target=\"_blank\">[link]<\/a>. Accessed: 2025-04-02."},{"key":"21","unstructured":"Bjarne Stroustrup. 1994. The Design and Evolution of C++. Addison-Wesley."},{"key":"22","doi-asserted-by":"crossref","unstructured":"Steven Varoumas, Basile Pesin, Beno\u00eet Vaugon, and Emmanuel Chailloux. 2023. Programming microcontrollers through highlevel abstractions: The OMicroB project. Journal of Computer Languages 77 (2023), 101228. DOI: <a href=\"https:\/\/doi.org\/10.1016\/j.cola.2023.101228\"target=\"_blank\">10.1016\/j.cola.2023.101228<\/a>","DOI":"10.1016\/j.cola.2023.101228"},{"key":"23","unstructured":"Craig Walls. 2022. Spring in action. Manning Publications."}],"event":{"name":"Simp\u00f3sio Brasileiro de Linguagens de Programa\u00e7\u00e3o","location":"Brasil","acronym":"SBLP 2025","number":"29"},"container-title":["Anais do XXIX Simp\u00f3sio Brasileiro de Linguagens de Programa\u00e7\u00e3o (SBLP 2025)"],"original-title":[],"link":[{"URL":"https:\/\/sol.sbc.org.br\/index.php\/sblp\/article\/download\/36944\/36729","content-type":"application\/pdf","content-version":"vor","intended-application":"text-mining"},{"URL":"https:\/\/sol.sbc.org.br\/index.php\/sblp\/article\/download\/36944\/36729","content-type":"unspecified","content-version":"vor","intended-application":"similarity-checking"}],"deposited":{"date-parts":[[2025,10,9]],"date-time":"2025-10-09T12:14:33Z","timestamp":1760012073000},"score":1,"resource":{"primary":{"URL":"https:\/\/sol.sbc.org.br\/index.php\/sblp\/article\/view\/36944"}},"subtitle":[],"short-title":[],"issued":{"date-parts":[[2025,9,22]]},"references-count":23,"URL":"https:\/\/doi.org\/10.5753\/sblp.2025.10519","relation":{},"subject":[],"published":{"date-parts":[[2025,9,22]]}}}