Hello,
How to configure variant handling only for one module, say Port module?
Have configured 2 "SelectablePostBuildVariant" using EcuC and only for Port module the "Post Build variant" is ticked, not for other modules. On generation, all other modules also are getting generated for both variants though "Post Build variant" is not ticked, the content is same just different names according to variant.
Also in Port module is there a way to have the variant selection at PortContainer level instead of each pin level, as sometimes we have 2 hardware variants with different number of pins configured.
Using EB tresos version v29 and s32K3 Mcal V3
Thanks for your support
Hi @vr_2007,
With Post build variant, you need to add pointer of your Module config when call Init() function (Ex: Port_Init(&Port_VS_0_PBcfg). So, in your Init module step, you need to put which module config set you want to use. These files are generated depending on your variant references:
With Precompile variant, you don't need to add pointer of your Module config when call Init() function (Ex: Port_Init(NULL_PTR), I2c_Init(NULL_PTR)).
So, in order to just configure variant handling on port module, select the "Post Build variant" and configure the pointer in the initialization function.
As for hardware variants, AUTOSAR differentiates between PreBuild and PostBuild variation points.
So, I understand a PreBuild variant is the adequate support for different ECUs.
Best regards,
Julián
Hello Julián,
thank you for taking time to give a detail reply.
My question is more in direction, I would like to have PostBuild only for one module (Port) and not for all modules.
As seen in your example also, for every module it generates the files for both variants VS_0 and VS_1.
For e.g. even though I have not ticked the postbuild checkbox in MCU module, it still generates Mcu_VS_0_PBcfg.h and Mcu_VS_1_PBCfg.h. So even though I want Mcu to be a pre-compile variant and do not want to send any specific parameter to Mcu_Init, I have to send one of the config structure as argument, as the files are generated accordingly. Same is the case for all the other modules.
Sure there are workarounds to get it working somehow, like create 2 separate projects, one for pre-compile modules and another one just for port module with post build only of port module or another option is let tresos generate for all modules both variants and during compilation select only one for, e.g. compile only Mcu_VS_0_*.* .
Thank you and Regards
Hi @vr_2007,
I believe as long as you have PostBuild variants, the PostBuild configuration files (VS_0, VS_1) will generate. The only difference when ticking Post Build variant used is the following line in McuCfg:
You can check for precompile support when initializing your application as in the RTD examples:
Best regards,
Julián