Missing variable definition in .h

1 Ansicht (letzte 30 Tage)
oussama
oussama am 26 Jun. 2023
Bearbeitet: oussama am 10 Jul. 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 :

Antworten (1)

Aniketh
Aniketh am 6 Jul. 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 Kommentar
oussama
oussama am 10 Jul. 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 .

Melden Sie sich an, um zu kommentieren.

Kategorien

Mehr zu Simulink Coder finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by