Hello Abhijeet,
I understand that you are trying to generate separate C code files for each subsystem in your Simulink model using Embedded Coder.
You can generate separate function files for subsystems in the Simulink model by following the steps below:
1. To generate code for a subsystem as a separate function and file, you need to configure the subsystem to be atomic and then use the "Function packaging" parameter. This parameter has two settings: "Reusable function" and "Nonreusable function". The "Reusable function" option generates a function that passes I/O, states, and parameters as function arguments. The "Nonreusable function" generates a function with a mix of function arguments and global data structures.
2. The generated code for a subsystem can reference global data structures of the model even if the subsystem function code is in a separate file. Each subsystem code file will contain "include" directives and comments describing the dependencies. The code generator also checks for cyclic file dependencies and issues warnings at build time.
3. For subsystem function code that is independent of the code generated for the parent model, you can place the subsystem in a library and configure it as a reusable subsystem. This is particularly useful if you have Embedded Coder and are generating code for a library consisting of reusable subsystems with different function interfaces.
Please refer to the below documentation to learn more about Generating Subsystem Code as Separate Functions and Files in MATLAB:
I hope this helps.