Search code examples
pythoncembeddedautosar

Another approach to making changes in C source code with python?


I have been tasked with creating a (python) script that will disable a feature in our source code. The code is generated via third party configure software, through which a gui allows changes in settings to disable this feature. These changes take effort, and time to generate, hence the script. Theoretically, there are a bunch of flags in the header files (i.e #define thisFeature STD_ON) which I can flip easily with the script.

The part that is more difficult is changes in the source files, for which some functions are added/removed by the third party configuring software. These may change in the future, so I need to think of a solution that will remain usable. I cannot change the code for the third party application, as I need to avoid the generation process which takes time. I need to make changes so that when we build the product, the required changes are made and compile. Any suggestions would be great.


Solution

  • You will either introduce assumptions, which turn into future errors when they fail, or end up reimplemeting the AUTOSAR generator. Their point is to allow a implementation of a configured system under complete control of the supplier of the combination of the static code and the generated code.

    Either way, when you need an update of the supplied component you will have much more trouble than when using what is delivered.

    So I am afraid the answer is "There is none." (i.e. no alternative).
    You can make assumptions on your system and create something which within those assumptions achieves your goal short term.
    But long term, whoever decided on using AUTOSAR in your project did that for the reasons which fail when you go around the official generator.
    So in sooner or maybe later, the effort you spend now is lost and might finally cause more damage than the benefits you might harvest short term.