<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167</link>
    <title>MATLAB Central Newsreader - Build a simulink model with RTW with s-function</title>
    <description>Feed for thread: Build a simulink model with RTW with s-function</description>
    <language>en-us</language>
    <copyright>&amp;copy;1994-2012 by MathWorks, Inc.</copyright>
    <webmaster>webmaster@mathworks.com</webmaster>
    <generator>MATLAB Central Newsreader</generator>
    <docs>http://blogs.law.harvard.edu/tech/rss</docs>
    <ttl>60</ttl>
    <image>
      <title>MathWorks</title>
      <url>http://www.mathworks.com/images/membrane_icon.gif</url>
    </image>
    <item>
      <pubDate>Fri, 06 Nov 2009 11:51:02 -0500</pubDate>
      <title>Build a simulink model with RTW with s-function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167#692654</link>
      <author>Massimiliano </author>
      <description>I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.&lt;br&gt;
&lt;br&gt;
I build RT windows target. I get the following error&lt;br&gt;
&lt;br&gt;
gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'.  Stop. &lt;br&gt;
&lt;br&gt;
So I compile SG_c.c by hand whith the following command line:&lt;br&gt;
wcc386 -fo=SG_c.obj -wcd=202 -wcd=302 -wcd=400 -wcd=1180 -zq -ei -zp8 -6r -fpi87 -zl -wx  -oneatxh  -DEXT_MODE -DUSE_RTMODEL -DMODEL=rtwinIdent1 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__OBSCURE_STREAM_INTERNALS  -I.;..;F:\PROGRA~1\MATLAB\R2008b\simulink\include;F:\PROGRA~1\MATLAB\R2008b\extern\include;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src\ext_mode\common;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\src;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\openwat\include;&amp;lt;etc...&amp;gt; SG_c.c &lt;br&gt;
&lt;br&gt;
after that step all works.&lt;br&gt;
&lt;br&gt;
How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?&lt;br&gt;
&lt;br&gt;
thanks</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 13:03:03 -0500</pubDate>
      <title>Re: Build a simulink model with RTW with s-function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167#692669</link>
      <author>Massimiliano </author>
      <description>&quot;Massimiliano &quot; &amp;lt;massimiliano.cialdiNOSP@Mpowersoft.it&amp;gt; wrote in message &amp;lt;hd12j6$r88$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I build RT windows target. I get the following error&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'.  Stop. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I compile SG_c.c by hand whith the following command line:&lt;br&gt;
&amp;gt; wcc386 -fo=SG_c.obj -wcd=202 -wcd=302 -wcd=400 -wcd=1180 -zq -ei -zp8 -6r -fpi87 -zl -wx  -oneatxh  -DEXT_MODE -DUSE_RTMODEL -DMODEL=rtwinIdent1 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__OBSCURE_STREAM_INTERNALS  -I.;..;F:\PROGRA~1\MATLAB\R2008b\simulink\include;F:\PROGRA~1\MATLAB\R2008b\extern\include;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src\ext_mode\common;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\src;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\openwat\include;&amp;lt;etc...&amp;gt; SG_c.c &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; after that step all works.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?&lt;br&gt;
&lt;br&gt;
I have some other infos&lt;br&gt;
I use:&lt;br&gt;
Matlab 7.7.0.471 (R2008b)&lt;br&gt;
&lt;br&gt;
Sept 17,2008&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
Simulink 7.2 (R2008b)&lt;br&gt;
&lt;br&gt;
Aug 04, 2008&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
RTW 7.2 (R2008b)&lt;br&gt;
&lt;br&gt;
Aug 04, 2008&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
And I want to compile a RT Windows Target&lt;br&gt;
&lt;br&gt;
I have a directory where my model is, called model_dir.&lt;br&gt;
In model_dir there are my simulink model (rtwinIdent1.mdl) and s-function c file SG_c.c&lt;br&gt;
&lt;br&gt;
When I build with Ctrl+B, are created 2 subdirs: slprj and rtwinIdent1_rtwin where are created all source files needed to compile the target: are created some .c and .h files and make file rtwinIdent1.mk&lt;br&gt;
&lt;br&gt;
When build it enters rtwinIdent1_rtwin directory and calls gmake as follows:&lt;br&gt;
&quot;F:\PROGRA~1\MATLAB\R2008b\bin\win32\gmake&quot; -f rtwinIdent1.mk  GENERATE_REPORT=0 EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 TMW_EXTMODE_TESTING=0&lt;br&gt;
&lt;br&gt;
unfortunatelly make file contains a line like this:&lt;br&gt;
S_FUNCTIONS          := SG_c.c&lt;br&gt;
&lt;br&gt;
So whel it build it cannot find SG_c.c because it is placed on the upper directory.&lt;br&gt;
How can makefile be generated with correct referenze to SG_c.c file? Where I am wrong?&lt;br&gt;
&lt;br&gt;
I can use 2 workarounds:&lt;br&gt;
1) I make the build process to only generate file, then I edit rtwinIdent1.mk to get the line&lt;br&gt;
S_FUNCTIONS          := ../SG_c.c&lt;br&gt;
and then calls gmake from dos command line with correct parameters&lt;br&gt;
2) I copy SG_c.c into rtwinIdent1_rtwin directory&lt;br&gt;
&lt;br&gt;
thanks</description>
    </item>
    <item>
      <pubDate>Fri, 06 Nov 2009 13:32:02 -0500</pubDate>
      <title>Re: Build a simulink model with RTW with s-function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167#692674</link>
      <author>Massimiliano </author>
      <description>&quot;Massimiliano &quot; &amp;lt;massimiliano.cialdiNOSP@Mpowersoft.it&amp;gt; wrote in message &amp;lt;hd16q7$pec$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I can use 2 workarounds:&lt;br&gt;
&amp;gt; 1) I make the build process to only generate file, then I edit rtwinIdent1.mk to get the line&lt;br&gt;
&amp;gt; S_FUNCTIONS          := ../SG_c.c&lt;br&gt;
&amp;gt; and then calls gmake from dos command line with correct parameters&lt;br&gt;
&amp;gt; 2) I copy SG_c.c into rtwinIdent1_rtwin directory&lt;br&gt;
Unfortunately workaround 2 is not applicable, because, when build process starts it cleans up the rtwinIdent1_rtwin directory, and also SG_c.c file is deleted.&lt;br&gt;
So the only workaround is the first&lt;br&gt;
&lt;br&gt;
thanks</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 07:55:04 -0500</pubDate>
      <title>Re: Build a simulink model with RTW with s-function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167#693151</link>
      <author>Massimiliano </author>
      <description>&quot;Massimiliano &quot; &amp;lt;massimiliano.cialdiNOSP@Mpowersoft.it&amp;gt; wrote in message &amp;lt;hd18gi$bfm$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&lt;br&gt;
UP</description>
    </item>
    <item>
      <pubDate>Mon, 09 Nov 2009 15:20:20 -0500</pubDate>
      <title>Re: Build a simulink model with RTW with s-function</title>
      <link>http://www.mathworks.com/matlabcentral/newsreader/view_thread/265167#693235</link>
      <author>riccardo</author>
      <description>&quot;Massimiliano &quot; &amp;lt;massimiliano.cialdiNOSP@Mpowersoft.it&amp;gt; wrote in message &amp;lt;hd12j6$r88$1@fred.mathworks.com&amp;gt;...&lt;br&gt;
&amp;gt; I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; I build RT windows target. I get the following error&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'.  Stop. &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; So I compile SG_c.c by hand whith the following command line:&lt;br&gt;
&amp;gt; wcc386 -fo=SG_c.obj -wcd=202 -wcd=302 -wcd=400 -wcd=1180 -zq -ei -zp8 -6r -fpi87 -zl -wx  -oneatxh  -DEXT_MODE -DUSE_RTMODEL -DMODEL=rtwinIdent1 -DRT -DNUMST=1 -DTID01EQ=0 -DNCSTATES=0 -DMT=0 -D__OBSCURE_STREAM_INTERNALS  -I.;..;F:\PROGRA~1\MATLAB\R2008b\simulink\include;F:\PROGRA~1\MATLAB\R2008b\extern\include;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src;F:\PROGRA~1\MATLAB\R2008b\rtw\c\src\ext_mode\common;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\src;F:\PROGRA~1\MATLAB\R2008b\toolbox\rtw\targets\rtwin\openwat\include;&amp;lt;etc...&amp;gt; SG_c.c &lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; after that step all works.&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?&lt;br&gt;
&amp;gt; &lt;br&gt;
&amp;gt; thanks&lt;br&gt;
&lt;br&gt;
Massimiliano,&lt;br&gt;
the s-funct block has a parameter called &quot;sfunctionmodules&quot; specifically for defining this sort of dependencies (at least in previous versions - I'm not running yours, but hopefully it still works).&lt;br&gt;
You can use set_param / get_param to access it from m-scripts as usual.&lt;br&gt;
HTH &lt;br&gt;
Riccardo</description>
    </item>
  </channel>
</rss>

