An important goal of course is to save time and commit less errors. In addition the code quality should improve, because repetitive parts are generated automatically and the complete information exists in only one place ("Single Point of Truth": from one source, the model the code for all controller, the code for the controlling PC and the documentation of the project is generated). An in addition the developers are also more motivated because the do not have to write boring "boilerplate" code themselves.
Our code generator is a .NET/ C# application, which generates C or C++ code for the embedded system. We use textual models in JSON, which contain the data structures, ranges, content descriptions etc.
First the generator reads the model, then checks it for syntax and consistency and transforms the model for code generation. With the help of the .NET Template Engine and the specific code templates for C and C++ or also C# etc. it generates the target code. Target code for the embedded system or also a PC/ Tablet based configuration tool.
We use code generation pragmatically, i.e. only where we can produce a real benefit. The two most important applications are communication and management of data and user interfaces.
For communication we model transferred data ("protocols") and configuration data. From this we can produce the code for storage, data management (non-volatile storage...) and transmission (as well as between embedded controllers as towards superordinate (PC-) systems). In addition an up-to-date documentation of the data emerges without further actions.
The modeling of GUI (Graphical User Interface) menus is the other application. The menu tree and the according authorizations are modeled, from this model the complete menu including the connection to the data model and the access/ authorization management code is generated .
A simpler application is the the is version information. There the code for the version information of the components of the embedded system is generated automatically and can e.g. be used for the management of updates.
When we apply cod generation in projects, then we can decrease the effort for development and at the same time optimize the quality, especially also for changes short before or after the start of production.
Projects? Ideas? Questions? Let's do a free initial workshop!
No Comments