Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
compiling code with RTW for DSpace from compiled M-function

Subject: compiling code with RTW for DSpace from compiled M-function

From: Tom van Dongen

Date: 26 Feb, 2002 17:47:17

Message: 1 of 2

Hi,

I've written an M-function in Matlab and compiled this to a S-function
using the Matlab compiler (mcc -S -u 3 -y 4 ......).

This S-function I use in a simulink model which is compiled towards RTW
code for a DSpace controller. This is done on another PC which doesn't
has the Matlab compiler (mcc) installed. I get the following error
message:

libmatlb.h not found

When I check for this header file, it is not there. If I get it from my
PC where I compiled the S-function, I get these errors:

< begin compiler output >
 
COMPILING C:\DSPACE3.3\MATLAB\RTI1401\SFcn\ds1401dio_t1_bit_in.c
COMPILING C:\DSPACE3.3\MATLAB\RTI1401\SFcn\ds1401dio_t1_bit_out.c
COMPILING C:\DSPACE3.3\MATLAB\RTI1401\C\rti_lookup1d.c
COMPILING C:\DSPACE3.3\MATLAB\RTI1401\C\rti_lookup2d.c
COMPILING C:\DSPACE3.3\matlab\rtican\c\rtican_err1.c
COMPILING C:\DSPACE3.3\MATLAB\RTI1401\C\rti1401dio.c
 
COMPILING "tom_2502_lib.o03" library sources
          
................................................................
 
BUILDING LIBRARY "tom_2502_lib.o03" ...
BUILDING LIBRARY FINISHED
 
LINKING APPLICATION ...
< LNKPPC >
(E) #A0368-D Unresolved external:
    mclArrayRef1 (first referenced in module: jcalc.o03)
    mxGetClassID (first referenced in module: jcalc.o03)
    mlfSqrt (first referenced in module: jcalc.o03)
    mclPlus (first referenced in module: jcalc.o03)
    mlfCalcfuel (first referenced in module: jcalc.o03)
    mlfCtranspose (first referenced in module: jcalc.o03)
    mclGetUninitializedArray (first referenced in module: jcalc.o03)
    mclVe (first referenced in module: jcalc.o03)
    mclGt (first referenced in module: jcalc.o03)
    mclGe (first referenced in module: jcalc.o03)
    mclLt (first referenced in module: jcalc.o03)
    mclMrdivide (first referenced in module: jcalc.o03)
    mlfBatcalc (first referenced in module: jcalc.o03)
....

< end compiler output


Seems like references towards basic operations are missing.
Unfortunatelly I don't know much on programming in C.
Can someone help me with this?

Best Regards,
Tom van Dongen

Subject: compiling code with RTW for DSpace from compiled M-function

From: wouters@ecn.nl (Dennis Wouters)

Date: 27 Feb, 2002 08:37:07

Message: 2 of 2

>I've written an M-function in Matlab and compiled this to a S-function
>using the Matlab compiler (mcc -S -u 3 -y 4 ......).
>
>This S-function I use in a simulink model which is compiled towards RTW
>code for a DSpace controller.


Tom,

You can't use S-functions based on M-files (even after translating them
into C using the Matlab Compiler) in models to be run on a dSPACE-target.
The C-code of your S-function relies on libraries that come with the Matlab
Compiler. Those libraries only work when compiling for an I386 processor.
For your line of attack to work, dSPACE should provide the same libraries
for their PowerPC targets, which is not likely to happen any day soon.
You should either rewrite the S-function in C-code not depending on
libraries provided by The Mathworks, or build the functionality of you S-
function out of Simulink blocks.

Sorry for the bad news,

Dennis Wouters

Tags for this Thread

No tags are associated with this thread.

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.

Contact us