Missing variable definition in .h

5 次查看(过去 30 天)
oussama
oussama 2023-6-26
编辑: oussama 2023-7-10
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 :

回答(1 个)

Aniketh
Aniketh 2023-7-6
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 个评论
oussama
oussama 2023-7-10
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 .

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Deployment, Integration, and Supported Hardware 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by