Thread Subject: Build a simulink model with RTW with s-function

Subject: Build a simulink model with RTW with s-function

From: Massimiliano

Date: 6 Nov, 2009 11:51:02

Message: 1 of 5

I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.

I build RT windows target. I get the following error

gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'. Stop.

So I compile SG_c.c by hand whith the following command line:
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;<etc...> SG_c.c

after that step all works.

How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?

thanks

Subject: Build a simulink model with RTW with s-function

From: Massimiliano

Date: 6 Nov, 2009 13:03:03

Message: 2 of 5

"Massimiliano " <massimiliano.cialdiNOSP@Mpowersoft.it> wrote in message <hd12j6$r88$1@fred.mathworks.com>...
> I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.
>
> I build RT windows target. I get the following error
>
> gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'. Stop.
>
> So I compile SG_c.c by hand whith the following command line:
> 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;<etc...> SG_c.c
>
> after that step all works.
>
> How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?

I have some other infos
I use:
Matlab 7.7.0.471 (R2008b)

Sept 17,2008



Simulink 7.2 (R2008b)

Aug 04, 2008



RTW 7.2 (R2008b)

Aug 04, 2008


And I want to compile a RT Windows Target

I have a directory where my model is, called model_dir.
In model_dir there are my simulink model (rtwinIdent1.mdl) and s-function c file SG_c.c

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

When build it enters rtwinIdent1_rtwin directory and calls gmake as follows:
"F:\PROGRA~1\MATLAB\R2008b\bin\win32\gmake" -f rtwinIdent1.mk GENERATE_REPORT=0 EXTMODE_STATIC_ALLOC=0 EXTMODE_STATIC_ALLOC_SIZE=1000000 TMW_EXTMODE_TESTING=0

unfortunatelly make file contains a line like this:
S_FUNCTIONS := SG_c.c

So whel it build it cannot find SG_c.c because it is placed on the upper directory.
How can makefile be generated with correct referenze to SG_c.c file? Where I am wrong?

I can use 2 workarounds:
1) I make the build process to only generate file, then I edit rtwinIdent1.mk to get the line
S_FUNCTIONS := ../SG_c.c
and then calls gmake from dos command line with correct parameters
2) I copy SG_c.c into rtwinIdent1_rtwin directory

thanks

Subject: Build a simulink model with RTW with s-function

From: Massimiliano

Date: 6 Nov, 2009 13:32:02

Message: 3 of 5

"Massimiliano " <massimiliano.cialdiNOSP@Mpowersoft.it> wrote in message <hd16q7$pec$1@fred.mathworks.com>...
> I can use 2 workarounds:
> 1) I make the build process to only generate file, then I edit rtwinIdent1.mk to get the line
> S_FUNCTIONS := ../SG_c.c
> and then calls gmake from dos command line with correct parameters
> 2) I copy SG_c.c into rtwinIdent1_rtwin directory
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.
So the only workaround is the first

thanks

Subject: Build a simulink model with RTW with s-function

From: Massimiliano

Date: 9 Nov, 2009 07:55:04

Message: 4 of 5

"Massimiliano " <massimiliano.cialdiNOSP@Mpowersoft.it> wrote in message <hd18gi$bfm$1@fred.mathworks.com>...

UP

Subject: Build a simulink model with RTW with s-function

From: riccardo

Date: 9 Nov, 2009 15:20:20

Message: 5 of 5

"Massimiliano " <massimiliano.cialdiNOSP@Mpowersoft.it> wrote in message <hd12j6$r88$1@fred.mathworks.com>...
> I have a simple simulink model model containing an s-function that refers to a c file called SG_c.c.
>
> I build RT windows target. I get the following error
>
> gmake: *** No rule to make target `SG_c.obj', needed by `../rtwinIdent1.rwd'. Stop.
>
> So I compile SG_c.c by hand whith the following command line:
> 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;<etc...> SG_c.c
>
> after that step all works.
>
> How can I configure RTW builder to include SG_c.c in sources list, to make it comile automagically?
>
> thanks

Massimiliano,
the s-funct block has a parameter called "sfunctionmodules" specifically for defining this sort of dependencies (at least in previous versions - I'm not running yours, but hopefully it still works).
You can use set_param / get_param to access it from m-scripts as usual.
HTH
Riccardo

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
compile Massimiliano 6 Nov, 2009 06:54:04
simulink Massimiliano 6 Nov, 2009 06:54:04
build Massimiliano 6 Nov, 2009 06:54:04
sfunction Massimiliano 6 Nov, 2009 06:54:04
rtw Massimiliano 6 Nov, 2009 06:54:03
rssFeed for this Thread
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com