Simulink Code Generation Assertion failed

12 views (last 30 days)
Luca Claroni
Luca Claroni on 18 Nov 2013
Answered: Andreas Goser on 18 Nov 2013
Hi, while generating code of a Simulink model in Matlab R2011b I get this error:
"Code generation assertion 'isShared == aFcn->testFlags(CG_CONST_FCN_IS_SHARED)' failed in '.\rtwcg_utils\rtwcg_module_impl.cpp:793'
[ 0] 0x67f06286 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\rtwcg.dll+00483974 ( RTWCG::RTWCGModule::OptimizeAndEmitCode+023206 )
[ 1] 0x67f06593 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\rtwcg.dll+00484755 ( RTWCG::RTWCGModule::OptimizeAndEmitCode+023987 )
[ 2] 0x67f4151c C:\Program Files (x86)\MATLAB\R2011b\bin\win32\rtwcg.dll+00726300 ( RTWCG::RTWFcnConst::OptimizeAndEmitCode+011404 )
[ 3] 0x67f0085d C:\Program Files (x86)\MATLAB\R2011b\bin\win32\rtwcg.dll+00460893 ( RTWCG::RTWCGModule::OptimizeAndEmitCode+000125 )
[ 4] 0x69ba9ecd C:\Program Files (x86)\MATLAB\R2011b\bin\win32\libmwsimulink.dll+08298189 ( BlockSetCheckVarDimsInputEmpty+066381 )
[ 5] 0x69ba6f97 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\libmwsimulink.dll+08286103 ( BlockSetCheckVarDimsInputEmpty+054295 )
[ 6] 0x69bfaa02 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\libmwsimulink.dll+08628738 ( sleGetRTWBlockForSLBlock+262210 )
[ 7] 0x69bfaf9f C:\Program Files (x86)\MATLAB\R2011b\bin\win32\libmwsimulink.dll+08630175 ( sleGetRTWBlockForSLBlock+263647 )
[ 8] 0x696eb9c5 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\libmwsimulink.dll+03324357 ( ArrayToSLObject+481685 )
[ 9] 0x0231ea8c C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_dispatcher.dll+00060044 ( mdLogging::log_function_exit+000108 )
[ 10] 0x0231e561 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_dispatcher.dll+00058721 ( Mfunction_handle::dispatch+000401 )
[ 11] 0x01e6ac96 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_interpreter.dll+00502934 ( inDestroyWS+247110 )
[ 12] 0x01e67c71 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_interpreter.dll+00490609 ( inDestroyWS+234785 )
[ 13] 0x01e76807 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_interpreter.dll+00550919 ( inDestroyWS+295095 )
[ 14] 0x01e76922 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_interpreter.dll+00551202 ( inDestroyWS+295378 )
[ 15] 0x01e562c7 C:\Program Files (x86)\MATLAB\R2011b\bin\win32\m_interpreter.dll+00418503 ( inDestroyWS+162679 )"
I would like to know how to solve it and if there are some checks I can run to understand where the problem comes from.
Thanks, Luca Claroni.

Answers (1)

Andreas Goser
Andreas Goser on 18 Nov 2013
I am aware of an issue that produced such a dump in R2011b and was fixed for R212a. The reason sounds very specifc though:
"There is a bug in Simulink Coder 8.1 (R2011b) in the way that Simulink model containing two eig calls within a MATLAB function block causes code generation assertion, when generating code. To work around this issue, insert
coder.inline('always')
at the beginning of the function "fcn(u1,u2)" that calls eig"
I definitely suggest to try out a more recent release than R2011b as a first step.

Categories

Find more on Simulink Coder in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!