Open JimKaidyNASA opened 5 years ago
@JimKaidyNASA I transferred this issue to the SIL repo, because SIL produced that header file, not the ECI. Will take a look.
The relevant code is here, where you can see that we unconditionally generate an include for that header file, on the assumption that Simulink code is going to generate that header file.
@JimKaidyNASA Do you mind building code and examining the code generation report and just confirming that the private header is not listed under the Model Files? Just want to establish that Simulink Coder is in fact not creating this file.
Also, can you confirm that the private header is not included anywhere else in the generated code? In every one of the SIL's unit test models I've examined that header also gets included in the model.c, so please check there and let me know if its included.
Steve, I reran the code generation. It is still missing the include files (not just private).
What header pattern am I looking for in Controller.c that would give me a tell on whether it’s there or not?
I searched for private, and that pattern is not there.
If you generate code from, for example, the FlagAtTop unit test model, in FlagAtTop.c (which is the model.c for this model), you should see:
/*
* File: FlagAtTop.c
*
* Code generated for Simulink model 'FlagAtTop'.
*
* Model version : 1.76
* Simulink Coder version : 9.0 (R2018b) 24-May-2018
* C/C++ source code generated on : Wed Jul 31 10:22:51 2019
*
* Target selection: cfs_ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives: Unspecified
* Validation result: Not run
*/
#include "FlagAtTop.h"
#include "FlagAtTop_private.h"
As you can see, this code is including its model_private.h
. If that's the case in your model, then I'd definitely expect Simulink to have generated that header, and so we need to try to figure out why Simulink didn't generate that header. If model_private.h
isn't included anywhere in the code Simulink generated, then we may have to update the SIL to only include model_private.h
if its been generated.
I'm curious if you see an include for model_private.h
at the top of your model.c?
It is still missing the include files (not just private).
I'm not sure what you mean by this?
The private include is not there:
/*
* File: Controller.c
*
* Code generated for Simulink model 'Controller'.
*
* Model version : 1.1267
* Simulink Coder version : 9.1 (R2019a) 23-Nov-2018
* C/C++ source code generated on : Wed Jul 31 11:04:48 2019
*
* Target selection: cfs_ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* Validation result: Not run
*/
#include "Controller.h"
#define NumBitsPerChar 8U
As far as the other includes I did a search for includes for the other two GN&C apps. They had bunch that Controller did not have. I don’t know if that really means anything.
So the eci_interface.h is the offending one that is looking for the private include:
/*
* File: eci_interface.h
*
* Code generated for Simulink model 'Controller'.
*
* Model version : 1.1267
* Simulink Coder version : 9.1 (R2019a) 23-Nov-2018
* C/C++ source code generated on : Wed Jul 31 11:04:48 2019
*
* Target selection: cfs_ert.tlc
* Embedded hardware selection: Intel->x86-64 (Windows64)
* Code generation objectives:
* 1. Execution efficiency
* 2. RAM efficiency
* Validation result: Not run
*/
#ifndef RTW_HEADER_eci_interface_h_
#define RTW_HEADER_eci_interface_h_
#include "Controller.h" /* Model's header file */
#include "Controller_private.h"
@JimKaidyNASA It looks like you're responding to these comments via email, but you're including the last couple messages with every post, which makes it very hard to read. Could you please try to ensure that only your response ends up in the post?
Also, if you could use code blocks for your code, that makes it much easier to read.
I've cleaned up the posts up until now, so don't worry about those.
Ok I am on the github doing responses from there. Sorry about all the email junk. I will use the code blocks when sending code.
So the question is, should the eci_interface.h have the include for Controller_private.h?
@wjstuart Can you help me out here? Are there situations under which a private header is not generated? Perhaps the SIL needs to conditionally generate that include only when the model requires it?
@JimKaidyNASA, this is likely caused by using Compact file packaging format for your code generation settings. Try using 'Modular' instead. See https://www.mathworks.com/help/releases/R2019a/ecoder/ref/file-packaging-format.html for more information on this code generation setting. A setting of 'Compact' does not produce a model_priv.h, whereas a setting of 'Modular' does.
I am using the Embedded Coder Quick Start dialogue and I have updated every one of the settings to Modular (there are a number of Quick Start settings files that are date/time stamped including the original model one. The Quick Start is getting a "new" setting to Compact from somewhere and it is making Modular "old". I understand Nick Olson is using Embedded Coder as an app without the Quick Start. I think before I do this (which I am looking for this capability), I would like to sort out why the Quick Start is changing the setting.
Quick Start is essentially meant to be one-time wizard for a project setup. The Compact setting is only a suggestion. Bottom line, you should not be using the Quick Start to generate code when using the cfs_ert.tlc target. Either the rtwbuild or slbuild API can be used to generate your model code.
Ok great. That should be more prominent in the usage. It's the only option that has Embedded Coder in it, but I will use the Build option instead if that's what to use. I tried using rtwbuild and it looks like it ran but had some errors:
>> rtwbuild('Controller')
Invalid or deleted object.
Error in simulinkcoder.internal.CodePerspectiveInStudio/refresh
Error in simulinkcoder.internal.CodePerspectiveListener/callback
Error in
simulinkcoder.internal.CodePerspectiveListener/init>@(varargin)obj.callback(varargin{:})
Warning: Error occurred while evaluating listener callback.
### Starting build procedure for model: Controller
### Generating code and artifacts to 'Model specific' folder structure
### Generating code into build folder: C:\Users\jkaidy\Documents\LPL_07112019\MAIN\codeGen\Controller_cfs_ert_rtw
### Invoking Target Language Compiler on Controller.rtw
### Using System Target File: C:\Users\jkaidy\Documents\LPL_07112019\Shared\SIL-master\src\cfs_ert.tlc
### Loading TLC function libraries
.........
### Generating TLC interface API for custom data
...............
### Initial pass through model to cache user defined code
.....
### Caching model source code
...............................................................................
...............................................................................
...............................................................................
.....................
### Writing header file Controller_types.h
### Writing source file Controller.c
### Writing header file Controller_private.h
.
### Writing header file Controller.h
### Writing header file rtwtypes.h
### Writing source file cntl_acs_gains.c
### Writing source file cntl_acs_limits.c
.
### Writing source file cntl_acs_selection.c
### Writing source file cntl_acs_thresh.c
### Writing source file cntl_acs_timing.c
### Writing source file cntl_de_gains.c
### Writing source file cntl_de_limits.c
### Writing source file cntl_de_param.c
.
### Writing source file cntl_de_select.c
### Writing source file cntl_de_thresh.c
### Writing source file cntl_srm_gains.c
### Writing header file rtGetNaN.h
.
### Writing source file rtGetNaN.c
### Writing header file rt_defines.h
### Writing header file rt_nonfinite.h
### Writing source file rt_nonfinite.c
### Writing header file rtGetInf.h
.
### Writing source file rtGetInf.c
### Writing source file Controller_data.c
### Writing header file eci_interface.h
### Writing source file ert_main.c
### TLC code generation complete.
.......Warning: Access to the base workspace is still available through data dictionary.
### Creating HTML report file Controller_codegen_rpt.html
.
### Processing Template Makefile: C:\Program Files\MATLAB\R2019a\rtw\c\ert\ert_lcc64.tmf
### Creating C:\Users\jkaidy\Documents\LPL_07112019\MAIN\codeGen\Controller_cfs_ert_rtw\Controller.mk from C:\Program Files\MATLAB\R2019a\rtw\c\ert\ert_lcc64.tmf
### Successful completion of code generation for model: Controller
Invalid or deleted object.
Error in simulinkcoder.internal.CodePerspectiveInStudio/refresh
Error in simulinkcoder.internal.CodePerspectiveListener/callback
Error in
simulinkcoder.internal.CodePerspectiveListener/init>@(varargin)obj.callback(varargin{:})
Warning: Error occurred while evaluating listener callback.
@JimKaidyNASA Reopened this because we haven't yet implemented the fix for generating the private header include if the model is using Compact packaging. We'll keep this issue open until the necessary changes have been made to the SIL, so that folks can track the progress.
I see you've opened an issue for your question above, so I deleted the comment since its not relevant to this issue.
Apparently a referenced xxx_private.h was not created in the SIL.