Turns out it was a bug with the signal propagation in the code generation in Matlab 2011b. According to Mathworks it was solved in 2012a and later, so I updated to 2013b. Now I don't get that error any longer.
CGIR assertion 'fitsType<size_t>()' failed
Pregunta
I have a Simulink model that I'm trying to generate to a C++ dll. I've successfully compiled similar models, but this one is giving me the following errors:
CGIR assertion 'fitsType<size_t>()' failed in 'b:\matlab\derived\win32\src\include\cg_ir\util_prim\../../../../../../src/cg_ir/export/include/cg_ir/util_prim/Size64.hpp:125'
[ 0] 0x5d20bde3 C:\MATLABR2011b_x86\bin\win32\cg_ir.dll+00769507 ( CG::Scope::treeStackSize+000019 )
[ 1] 0x5d200b68 C:\MATLABR2011b_x86\bin\win32\cg_ir.dll+00723816 ( CG::Fcn::stackSize+000024 )
[ 2] 0x590d36e2 C:\MATLABR2011b_x86\bin\win32\cgir_xform.dll+02242274 ( CG::EnforceStackLimit::getFcnStackSize+000034 )
[ 3] 0x590d390a C:\MATLABR2011b_x86\bin\win32\cgir_xform.dll+02242826 ( CG::EnforceStackLimit::initialize_fcn_stack_size_info+000234 )
[ 4] 0x590d42bb C:\MATLABR2011b_x86\bin\win32\cgir_xform.dll+02245307 ( CG::EnforceStackLimit::EnforceStackLimit+000219 )
[ 5] 0x59384cc2 C:\MATLABR2011b_x86\bin\win32\rtwcg.dll+00806082 ( RTWCG::getBlockParameterURLString+004434 )
[ 6] 0x59385e3b C:\MATLABR2011b_x86\bin\win32\rtwcg.dll+00810555 ( RTWCG::getBlockParameterURLString+008907 )
[ 7] 0x593706f1 C:\MATLABR2011b_x86\bin\win32\rtwcg.dll+00722673 ( RTWCG::RTWFcnConst::OptimizeAndEmitCode+007777 )
[ 8] 0x5933085d C:\MATLABR2011b_x86\bin\win32\rtwcg.dll+00460893 ( RTWCG::RTWCGModule::OptimizeAndEmitCode+000125 )
[ 9] 0x5a6f9ecd C:\MATLABR2011b_x86\bin\win32\libmwsimulink.dll+08298189 ( BlockSetCheckVarDimsInputEmpty+066381 )
[ 10] 0x5a6f6f97 C:\MATLABR2011b_x86\bin\win32\libmwsimulink.dll+08286103 ( BlockSetCheckVarDimsInputEmpty+054295 )
[ 11] 0x5a74aa02 C:\MATLABR2011b_x86\bin\win32\libmwsimulink.dll+08628738 ( sleGetRTWBlockForSLBlock+262210 )
[ 12] 0x5a74af9f C:\MATLABR2011b_x86\bin\win32\libmwsimulink.dll+08630175 ( sleGetRTWBlockForSLBlock+263647 )
[ 13] 0x5a23b9c5 C:\MATLABR2011b_x86\bin\win32\libmwsimulink.dll+03324357 ( ArrayToSLObject+481685 )
[ 14] 0x025dea8c C:\MATLABR2011b_x86\bin\win32\m_dispatcher.dll+00060044 ( mdLogging::log_function_exit+000108 )
[ 15] 0x025de561 C:\MATLABR2011b_x86\bin\win32\m_dispatcher.dll+00058721 ( Mfunction_handle::dispatch+000401 )
### Build procedure for model: 'vcts_auxiSns' aborted due to an error.
I also get the following error message in a dialog box:
Unexpected or internal error encountered in "in CGIR: b:\matlab\derived\win32\src\include\cg_ir\util_prim\../../../../../../src/cg_ir/export/include/cg_ir/util_prim/Size64.hpp line 125: fitsType<size_t>()
". Please report this to MathWorks if you can cause it to recur
UPDATE:
I have now been able to locate the problem, and it seems there is a problem with a specific signal. The image below shows a small part of a subsystem, and whenever one of the three signals in the red box is allowed to flow, the model can't be code generated. As soon as I disrupt all three signals, the code generation works.
Unfortunately, I haven't been able to solve the problem, so I'm still eager to hear any and all suggestions!
Solución
Otros consejos
It turns out that if it gives you this kind of error, what you do is delete the folders slprj and the "programName_etl_hrt" folders where you compiled or tried to compile and it won't give you that error anymore.
I've had this error a few times, you just need to delete those folders, don't worry simulink will regenerate them again for you