From: Peter on
I am trying to read in data off a serial port on an xpc target device, I have code that works in an older version of simulink but our computer died, so I am temporarily running off a different computer w/ matlab2007a and having compile issues, I got the compile twice problem fixed and i am using MS VC 6.0. My problem seems to be that at compile/link time it can't locate the rl32, rl32e functions. I tried adding the path to the folder containing io_xpcimport.h to the VC include winXP env variable but that never helped. it can't link rl32eFcnOutpB or rl32eFcnInpB. specifically the relevant section of the error code i get is:

--------------
xpcimports.c
### Compiling C:\PROGRA~1\MATLAB\R2007a\toolbox\rtw\targets\xpc\target\build\xpcblocks\include\xpcPCFunctions.c
cl -Ot /c /O2 /nologo -DMODEL=guitest1 -DRT -DNUMST=2 -DTID01EQ=1 -DNCSTATES=0 -DMT=0 -DHAVESTDIO -DXPCMSVISUALC -DXPCCALLCONV= -DUSE_RTMODEL -DERT_CORE -DWIN32 -D_WIN32 -D_MT -MT C:\PROGRA~1\MATLAB\R2007a\toolbox\rtw\targets\xpc\target\build\xpcblocks\include\xpcPCFunctions.c
xpcPCFunctions.c
lib /nologo /out:xpcruntime.lib xpcimports.obj xpcPCFunctions.obj
### Linking ...
C:\PROGRA~1\MATLAB\R2007a\sys\perl\win32\bin\perl C:\PROGRA~1\MATLAB\R2007a\rtw\c\tools\mkvc_lnk.pl guitest1.lnk guitest1.obj guitest1_capi.obj guitest1_data.obj matrixMath.obj rt_atan2.obj rt_logging.obj rt_logging_mmi.obj rt_matrx.obj rt_nonfinite.obj rt_printf.obj rtw_modelmap_utils.obj xpctarget.obj adnipcie.obj legcond.obj legcheck.obj spdcalc.obj ismoving.obj oneshot.obj setmode.obj encnipci660x.obj attintsfnc.obj motrctrl.obj danipci671x.obj donipcie.obj myserial6.obj satdynsfnc.obj q2mrpsfnc.obj rwcontsfnc.obj
link /NOLOGO /DLL /SUBSYSTEM:CONSOLE /DEF:xpcvcdll.def /Include:_malloc C:\PROGRA~1\MATLAB\R2007a\rtw\c\lib\win32\rtwlib_vc.lib xpcruntime.lib @guitest1.lnk -out:guitest1.dll
Creating library guitest1.lib and object guitest1.exp
myserial6.obj : error LNK2001: unresolved external symbol _rl32eFcnOutpB
myserial6.obj : error LNK2001: unresolved external symbol _rl32eFcnInpB
guitest1.dll : fatal error LNK1120: 2 unresolved externals
NMAKE : fatal error U1077: 'link' : return code '0x460'
Stop.

----------------
I tried substituting my include "io_xpcimport.h with the "xpcimports.h" and never got a whole bunch of compile errors. Thanks for any help.
From: Peter on
After looking carefully through the io_xpcimport.h and io_xpcimport.c in the newer versions of matlab i found that they require a
#define ___OBSOLETE_CODE___
in order to properly use the older rl32e...() function calls - I wish there was some useful documentation on this stuff instead of having to manually read through the actual code from the libraries to debug anything.

my new problem is that now when i use that obsolete code definition and try to download anything with the rl32e.,..() calls in it then I get this cool error:
------
Error using ==> callMakeHook.p>callMakeHook at 47
The call to xpctarget_make_rtw_hook, during the exit hook generated the following error:
Error using ==> xpctarget.xpc.load at 38
TCP/IP timeout while receiving data
------
its like the target stops responding....actually it completely locks up the target! any one have any ideas on this?

I tried literally changing my rl32e..() to be xpc...() with that change I deleted the obsolete code #define and can actually download the code to the target and have it respond that the download was successful. however I can't get my code to work like it used to. It read in serial data (8 bytes) and i can't get it to read anything now... I am not sure if this is a problem of my target hw or if the newer xpc...() differ significantly from the older rl32e...() variants. if anyone knows how to debug the TCP/IP timeout so that the target responds when the download is completed that would be awesome.
From: Peter on
I tried this fix and it never seemed to change anything...
http://www.mathworks.com/support/bugreports/361601
Although it seems very similar in nature so I'm thinking it might be a bug in the release.
From: Peter on
same problem is present when I try the same code again in 2009b release...I really don't understand why s-functions wouldn't be backwards compatible.

does anyone out there have any experience with this stuff? I'm about to ditch the xpc target and try out RT Labview...
 | 
Pages: 1
Prev: textscan?
Next: How to use callAllOptimPlotFcns