When is the compiler invoked in Simulink

1 次查看(过去 30 天)
I am using simulink to model a system which will eventually be flashed onto the embedded microcontroller (using NXP MPC57xx series). Now, NXP has some modelling toolboxes to use (which can be downloaded for free) but supports only three compilers at this moment. I have purchased an unsupported compiler and plan to make a workaround which is only generate code and take the code out into an IDE and then compile it using the purchased compiler (instead of the one NXP supports). The question is slightly more abstract from this. When does the compiler get invoked by the simulink engine? I ask this to know till where I can do the modelling and testing without the supported compiler. From my own understanding, it looks like I can generate code but not build and run (which means PIL and SIL is not possible). But I do want to confirm this.

回答(1 个)

Brandon Eidson
Brandon Eidson 2017-9-11
The short answer is more-or-less, "The compiler does not come into play if you are merely generating the C/C++ code." If one is, for example, generating an executable, using acceleration mode, simulating using an S-function, or performing hardware-in-loop simulation, a C/C++ compiler is invoked.
Embedded Coder generates ANSI/ISO C/C++ code and thus supports all embedded compilers and IDEs that support C/C++ code. If portable ANSI/ISO C/C++ that can be called by any scheduler is not sufficient, Embedded Coder has a variety of options and features that end users can leverage to generate target specific code for their particular compiler environment. A sample of these options and features are listed below.
Optimize Generated Code by Developing and Using Code Replacement Libraries - MATLAB and Simulink: https://www.mathworks.com/help//ecoder/examples/optimize-generated-code-by-developing-and-using-code-replacement-libraries-mc.html https://www.mathworks.com/help/ecoder/examples/optimize-generated-code-by-developing-and-using-code-replacement-libraries-sc.html
Custom Simulink Real-Time drivers: https://www.mathworks.com/help/xpc/driver/introduction.html
Memory/Pragma Sections: https://www.mathworks.com/help/ecoder/ug/control-data-and-function-placement-in-memory-by-inserting-pragmas.html
Legacy Code Integration using Legacy Code Tool: https://www.mathworks.com/help/simulink/legacy-code-integration.html
Control generation of Function Prototypes: https://www.mathworks.com/help/ecoder/ug/function-prototype-control.html
Code Generation from MATLAB and Simulink Code: https://www.mathworks.com/help/ecoder/c-c-code-generation-from-matlab-code.html https://www.mathworks.com/help/ecoder/c-c-code-generation-from-simulink-models.html
MATLAB Central contains several examples that may also be relevant to your needs: https://www.mathworks.com/matlabcentral/fileexchange/?term=Embedded+coder+type%3A%22Example%22&utf8=%E2%9C%93
Note that MathWorks does not guarantee or warrant the use or content of MATLAB Central submissions. Any questions, issues, or complaints should be directed to the contributing author.
In addition to ANSI C/C++ code generation and target customization options mentioned above, MathWorks and third party link and target products offer built-in integration support for several target, compiler, and RTOS combinations. These products provide device driver blocks, target optimized code, build environment automation, Processor-in-Loop testing, and other features.
You can find all the relevant details related to Embedded Coder in the below link: https://www.mathworks.com/products/embedded-coder.html
Finally, MathWorks consulting and a number of third parties service providers are able to create custom solutions for your target environment needs.

类别

Help CenterFile Exchange 中查找有关 Simulink Coder 的更多信息

Community Treasure Hunt

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

Start Hunting!

Translated by