Instructions for Compiling FAST

Dear Jason/Bonnie

I have a question re FAST v8 Simulink. I’m trying to re-compile the s-function so to generate c-code into a target processor for Hardware-in-the-loop simulation, using a dSPACE platform (ds1103) which is based on a PowerPC processor.

The compilation of the 64 bit FAST_SFunc.c into a MEX function into MATLAB’s workspace was successful (had to do it with Microsoft SDK 7.1 according to the dSPACE manufacturer guidelines).
The problem arises when I’m pressing ‘Build Model’ inside the Simulink environment. Here is where the entire Simulink model (including the FAST s-function) is converted into c code for the dSPACE to run it using a PowerPC specific compiler. After several trials I had to modify the FAST_SFunc.c file so to eliminate the following compilation errors:

COMPILING "C:\FAST_v8\Simulink\Source\FAST_SFunc.c" (E) C0256; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 237 pos 28; invalid redeclaration of type name "mxArray" (declared at line 41 of "C:\PROGRA~1\MATLAB\R2016b\rtw\c\src\rt_matrx.h") typedef struct mxArray_tag mxArray; ^ (E) C0256; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 257 pos 18; invalid redeclaration of type name "mxChar" (declared at line 44 of "C:\PROGRA~1\MATLAB\R2016b\rtw\c\src\rt_matrx.h") typedef CHAR16_T mxChar; ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 264 pos 5; "mxUNKNOWN_CLASS" has already been declared in the current scope mxUNKNOWN_CLASS = 0, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 265 pos 5; "mxCELL_CLASS" has already been declared in the current scope mxCELL_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 266 pos 5; "mxSTRUCT_CLASS" has already been declared in the current scope mxSTRUCT_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 267 pos 5; "mxLOGICAL_CLASS" has already been declared in the current scope mxLOGICAL_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 268 pos 5; "mxCHAR_CLASS" has already been declared in the current scope mxCHAR_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 270 pos 5; "mxDOUBLE_CLASS" has already been declared in the current scope mxDOUBLE_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 271 pos 5; "mxSINGLE_CLASS" has already been declared in the current scope mxSINGLE_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 272 pos 5; "mxINT8_CLASS" has already been declared in the current scope mxINT8_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 273 pos 5; "mxUINT8_CLASS" has already been declared in the current scope mxUINT8_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 274 pos 5; "mxINT16_CLASS" has already been declared in the current scope mxINT16_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 275 pos 5; "mxUINT16_CLASS" has already been declared in the current scope mxUINT16_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 276 pos 5; "mxINT32_CLASS" has already been declared in the current scope mxINT32_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 277 pos 5; "mxUINT32_CLASS" has already been declared in the current scope mxUINT32_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 278 pos 5; "mxINT64_CLASS" has already been declared in the current scope mxINT64_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 279 pos 5; "mxUINT64_CLASS" has already been declared in the current scope mxUINT64_CLASS, ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 282 pos 5; "mxOBJECT_CLASS" has already been declared in the current scope mxOBJECT_CLASS, /* keep the last real item in the list */ ^ (E) C0256; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 290 pos 3; invalid redeclaration of type name "mxClassID" (declared at line 33 of "C:\PROGRA~1\MATLAB\R2016b\rtw\c\src\rt_mxclassid.h") } mxClassID; ^ (E) C0101; "C:\PROGRA~1\MATLAB\R2016b\extern\include\matrix.h", line 297 pos 5; "mxREAL" has already been declared in the current scope mxREAL, ^ 20 Errors COMPILING FAILED (1)

After commenting the problematic code lines, the compilation of ‘FAST_SFunc.c’ seems to be getting somewhere, however there is only one remaining error which I’m showing you with at the screenshot:

I tried the same in another piece of RT Hardware (from another manufacturer) that uses the gcc compiler and the error seems to be similar:


Latest logbook entries: 
### ------------------------------------------------------------------------------------------------------------------------------
33 	I 	0x3a43 	mMSYS 	04-18-2017 16.44.31.474+0000 	SYS_MAIN: MSys-Software successfully started.
34 	I 	0x4220 	mRES 	04-18-2017 16.44.32.481+0000 	DBG_INIT: 'DBG' successfully started.
35 	I 	0x98ea 	bSWGIO212 	04-18-2017 16.44.43.590+0000 	SWGIO212: Module deleted.
36 	E 	0x8d73a9 	mMOD 	04-18-2017 18.01.39.109+0000 	Undefined symbol: _FAST_End (binding 1 type 0)
37 	E 	0x8d73a9 	mMOD 	04-18-2017 18.01.39.109+0000 	Undefined symbol: _FAST_Sizes (binding 1 type 0)
38 	E 	0x8d73a9 	mMOD 	04-18-2017 18.01.39.110+0000 	Undefined symbol: _FAST_Update (binding 1 type 0)
39 	E 	0x8d73aa 	mMOD 	04-18-2017 18.01.39.110+0000 	Undefined symbol: _FAST_Start (binding 1 type 0)
40 	E 	0x8d73b9 	mMOD 	04-18-2017 18.01.39.117+0000 	MOD_LOADVXW: Error mod=028 status=01 in loadModule() file '/ram0/wt21_v.o'!
41 	I 	0x8d73b9 	mMOD 	04-18-2017 18.01.39.117+0000 	MOD_LOADVXW: Unloading Module /ram0/wt21_v.o because of unresolved symbols
42 	E 	0x8d73bc 	mMOD 	04-18-2017 18.01.39.119+0000 	MOD_RPCINST1: Module not installed!
------------------------------------------------------------------------------------------------------------------------------ ###
The call to m1target_make_rtw_hook, during the exit hook generated the following error:
    Could not install SW-Module on the M1 controller

The build process will terminate as a result.
Caused by:
Could not install SW-Module on the M1 controller
Component: Simulink | Category: Model error

I would appreciate any light on this problem.

Many thanks,
Juan Pablo