I have some questions about modular embedded systems codes and its usage. I am building an IoT Systems with esp32 now. To learn professional approaches for embedded systems, I have split codes to libraries. My aim at this architecture, create generic libraries for my colleagues and learn something about modular embedded systems programming.

I created .cpp files and .h files for Communication layers, sensor measurement layers, connections and database(EEPROM) layers etc.

I have some high level programming lang. experiences(C#,Python) so I want use OOP on my codes. So I created cpp classes on my codes. In C, I wrote .c and .h files too.

My approach may be wrong for this situation. I have no professional embedded systems experiences . My main field is Automation Systems. I tried implement this kind of High level approaches on PLC's too.

In this situation what are differences betweeb cpp classes and .c sources? What are pros and cons? If you have suggestions and documents-tutorials, can you share?


  • CPP and C are different languages. C++ (CPP) is a superset of C. – Majenko Sep 6 at 9:39
  • 2
    At the end of the day it's all compiled into machine code, so there's not that much difference in how you arrange your source code. Whatever is most easy for you to maintain is best. The only caveat is that too much polymorphism can have a performance hit in some situations as function lookups have to be abstracted through vtables. – Majenko Sep 6 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.