How to generate code for model without building included s-function
14 次查看(过去 30 天)
显示 更早的评论
Hello, and thanks for your time.
I would like to generate external code for the General Real-Time Target that references an S-function that isn't built at code-generation time.
The S-function we're using can't be built on the same computer that we're developing our Simulink model on, because we don't have access to the libraries that are required. (I.e. we can't build our S-function because we'd get linker errors, and we can't resolve those errors.)
However, the S-function builder can generate code, and Simulink can generate code, so I thought it should be possible to generate the code for both, move them to the final destination, and build everything together (with the third-party libraries present) at that point in time. Unfortunately, if you try to generate code for a Simulink model that contains an unbuilt S-function you just get the error "S-function does not exist". This doesn't really make sense- is the complied version of the S-function really required to just generate code for the Simulink model?
Is there any way we can configure Simulink to let us generate code in this situation?
Thanks in advance, James
0 个评论
回答(1 个)
Rutuja Shirali
2015-8-31
编辑:Rutuja Shirali
2015-8-31
I understand that you want to build a Simulink Model which consists of an S-function that depends on external libraries. We cannot build a Simulink model which contains an unbuilt S-function and the error that you see is an expected behavior. However as per my understanding, you will need to build the S-function using the S-function builder on the machine which has all the required libraries and then deploy the Generated S-Function Block. More information about this can be found in the "Deploying the Generated S-Function" section on the following page:
Also, I believe that you want to create Wrapper S-function that inline a call to your algorithm, this would require the "s-function.tlc" file to be present while building your Simulink model. Make sure that you have the basic files mentioned on the following page required for the Implementation:
Once this is done, you can then build the entire model which includes the built S-function.
"Legacy Code Tool" can also be used as an alternative to S-Function Builder to build and deploy S-function and it is recommended. More information about Legacy Tool can be found here:
0 个评论
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!