Simulink Real Time code generation: How to prevent the build process on the target hardware when generating code only
4 views (last 30 days)
Show older comments
Hello,
I'm using Simulink Coder and the Real Time toolbox to build and deploy a real-time simulink app on a Raspberry Pi. This simulink app uses referenced models and stateflow blocks. To do so, I use the realtime.tlc I specified in the Code Generation Pane, and set the Raspberry as target. I'm trying to generate the code only so that it can be built later in dedicated environment.
However even I the "Generate Code Only" checkbox is checked, the GCC compiler is invoked on the Raspberry Pi. Also the code generation failed if no Rapsberry is connected or if "None" is specified as the hardware taget.
How to generate the realtime code only (not build the app) without the Raspberry connected ?
****
Here are the main clues I got so far :
1) According to this post, stateflow and referenced models need to be compiled while code generation to propagate signal types: I still don't understand how a compilation step can propagate these ones. Moreover, when using other TLC as ert.tlc or grt.tlc, I'm able to generate code only whithout compiler called. So as I supposed, this step doesn't seem mandatory...
2) Mathworks suggests in this answer this answer to exploit the rtw_make_hook file to stop the build process. I see how to get the current step of the generation/build process, but I do not see how to actually stop it...
PS: I'm using realtime.tlc as it generates a code with a scheduler. I'm exploring other option to switch to a TLC that does not need a connected Raspi but provide a scheduler...
Thank you for your attention !
2 Comments
Victor Noel
on 12 Mar 2020
Edited: Victor Noel
on 12 Mar 2020
I also have this problem, for slightly different reasons and it would be great to get a Mathworks "How To", as I have spoken to others who also have the problem.
In my case, I am trying to use coder.ceval() to call some external functions from Stateflow. I too only want to get the generated source code. My source tree is quite extensive with all kinds of hardware depedancies for an embedded system. In my case the link stage is failing because all of these other source files are not available. But I don't want Embedded Coder to build an executable, all I want is the pre-compiled generated code, which I will then make in my own build system.
Help! I've been grinding away at this for days:
Q) Can someone give some insight why the custom source files has to be compiled and linked just to generate the source code?
Q) Is there any way embedded coder can be told to only generate the .c files, and not try to build?
The frustrating thing is that I have had this working, then something changes and it fails. I have no idea the magic dust needed to get back on track.
PEDRO HENRIQUE Ulhoa
on 9 Feb 2021
I am having some trouble with that too. I am using beaglebone black and i wrote a s-function to put some external C code in my model. One question: When i run the simulink model in external mode, the code is compiled on the target hardware? The gcc is invoked on Rasp/BBB?
Answers (0)
See Also
Categories
Find more on Deployment, Integration, and Supported Hardware in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!