Missing variable definition in .h

1 vue (au cours des 30 derniers jours)
oussama
oussama le 26 Juin 2023
Modifié(e) : oussama le 10 Juil 2023
Hello,
I am currently generating a .c code from a .slx (AUTOSAR model). The issue I'm facing is that all the variables used in .c file are defined in the .h file, except for two variables: SWC_NAME_VAR_INIT and SWC_NAME_CODE. This problem is causing errors during the building phase.I'm wondering why these variables are not defined in the .h file and how can I configure Simulink to resolve this issue ?.
This is the content of model_name.c file :

Réponses (1)

Aniketh
Aniketh le 6 Juil 2023
It is possible that the variables SWC_NAME_VAR_INIT and SWC_NAME_CODE are not defined in the .h file of your generated C code from the .slx (AUTOSAR model). This could be causing errors during the building phase.
One suggestion to resolve this issue is to configure Simulink to generate the necessary definitions for these variables. You can try the following steps:
  1. Open your Simulink model (.slx) in Simulink.
  2. Navigate to the Configuration Parameters by clicking on "Simulation" in the Simulink menu and selecting "Configuration Parameters."
  3. In the Configuration Parameters dialog box, go to the "Code Generation" section.
  4. Look for the option related to "Data and function memory sections" or similar.
  5. Enable the option to "Generate separate code and data sections" or a similar option that allows for separate code and data generation.
  6. Save the configuration settings and generate the code again.
By enabling the option to generate separate code and data sections, it is possible that Simulink will generate the necessary definitions for SWC_NAME_VAR_INIT and SWC_NAME_CODE in the relevant source files. These definitions will be separate from the header file and may help resolve the errors you are facing during the building phase.
  1 commentaire
oussama
oussama le 10 Juil 2023
Could you please be more specific for "Generate separate code and data sections" option ?
I'am using MATLAB R2020b and i can't find it .

Connectez-vous pour commenter.

Catégories

En savoir plus sur Simulink Coder dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by