cancel
Showing results for 
Search instead for 
Did you mean: 

Error when Building STM32-MAT blocks in Simulink

dlwalter
Associate
Posted on October 29, 2015 at 00:45

I' have tried to build this model in both Matlab 2014b and 2015a and both fail.

Whenever I try to build a model containing the STM32-MAT blocks in Simulink I get an error ''

♯♯♯ Failed to generate all binary outputs.

''

This error does not occur when building a model containing blocks from the Embedded Coder Support Package for the STM32F4 Discovery Board.  This only occurs with the STM32-MAT blocks from http://www.st.com/web/en/catalog/tools/PF258513♯

The error is as follows:

♯♯♯ Generating code into build folder: E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw ♯♯♯ Invoking Target Language Compiler on stm32f4discovery_led4.rtw ♯♯♯ Using System Target File: E:\MATLAB\R2014b\rtw\c\ert\ert.tlc ♯♯♯ Loading TLC function libraries ♯♯♯ Initial pass through model to cache user defined code ♯♯♯ Caching model source code ♯♯♯ Writing header file stm32f4discovery_led4.h ♯♯♯ Writing source file stm32f4discovery_led4.c ♯♯♯ Writing header file stm32f4discovery_led4_I2C.h ♯♯♯ Writing source file stm32f4discovery_led4_I2C.c ♯♯♯ Writing header file stm32f4discovery_led4_types.h ♯♯♯ Writing header file rtwtypes.h ♯♯♯ Writing header file stm32f4discovery_led4_private.h ♯♯♯ Writing source file stm32f4discovery_led4_data.c ♯♯♯ Writing header file rtmodel.h ♯♯♯ Writing source file ert_main.c ♯♯♯ TLC code generation complete.

Adding source and include directories to make process. ♯♯♯ WARNING: Unable to run 'rtwmakecfg' file in directory: 'C:\MATLAB\STM32-MAT\STM32\blks\mex' due to error: 'group STM32 does not exist' ♯♯♯ Evaluating PostCodeGenCommand specified in the model ♯♯♯ Writing source file arm_cortex_m_multitasking.c ♯♯♯ Using toolchain: GNU Tools for ARM Embedded Processors v4.7 | gmake (64-bit Windows) ♯♯♯ Creating 'E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw\stm32f4discovery_led4.mk' ... ♯♯♯ Using toolchain: GNU Tools for ARM Embedded Processors v4.7 | gmake (64-bit Windows) ♯♯♯ Creating 'E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw\stm32f4discovery_led4.mk' ... ♯♯♯ Building 'stm32f4discovery_led4': E:\MATLAB\R2014b\bin\win64\gmake -f stm32f4discovery_led4.mk all E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw>cd . E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw>if '''' == '''' (E:\MATLAB\R2014b\bin\win64\gmake -f stm32f4discovery_led4.mk all ) else (E:\MATLAB\R2014b\bin\win64\gmake -f stm32f4discovery_led4.mk ) arm-none-eabi-gcc -std=c99 -MD -ffunction-sections -fdata-sections -Wall -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard -fsingle-precision-constant -include stm32f4xx.h -DMODEL=stm32f4discovery_led4 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DSTM32F4XX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DONESTEPFCN=1 -DTERMFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=0 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTID01EQ=0 -DUSE_STDPERIPH_DRIVER -DUSE_STM32F4_DISCOVERY -DSTM32F4XX -DARM_MATH_CM4=1 -D__FPU_PRESENT=1 -D__FPU_USED=1 -DHSE_VALUE=8000000 -DNULL=0 -DEXIT_FAILURE=1 -DEXTMODE_DISABLEPRINTF -DEXTMODE_DISABLETESTING -DEXTMODE_DISABLE_ARGS_PROCESSING=1 -DRT -DSTACK_SIZE=64 -DMODEL=stm32f4discovery_led4 -DNUMST=1 -DNCSTATES=0 -DHAVESTDIO -IE:/Projects/VehNAV/work/stm32f4discovery_led4_ert_rtw -IE:/Projects/VehNAV/work -IC:/MATLAB/SupportPackages/R2014b/stmicroelectronicsstm32f4discovery/toolbox/target/supportpackages/stm32f4discovery/stm32f4discoveryexamples -IE:/MATLAB/R2014b/extern/include -IE:/MATLAB/R2014b/simulink/include -IE:/MATLAB/R2014b/rtw/c/src -IE:/MATLAB/R2014b/rtw/c/src/ext_mode/common -IE:/MATLAB/R2014b/rtw/c/ert -IE:/MATLAB/R2014b/rtw/c/src/ext_mode/serial -IC:/MATLAB/SupportPackages/R2014b/armcortexm/toolbox/target/supportpackages/arm_cortex_m/scheduler/include -IC:/MATLAB/SupportPackages/R2014b/STM32F4-Discovery_FW_V1.1.0/Libraries/CMSIS/ST/STM32F4xx/Include -IC:/CMSIS/CMSIS/Include -IC:/MATLAB/SupportPackages/R2014b/STM32F4-Discovery_FW_V1.1.0/Project/Peripheral_Examples/SysTick -IC:/MATLAB/SupportPackages/R2014b/STM32F4-Discovery_FW_V1.1.0/Libraries/STM32F4xx_StdPeriph_Driver/inc -IC:/MATLAB/SupportPackages/R2014b/stmicroelectronicsstm32f4discovery/toolbox/target/supportpackages/stm32f4discovery/@slCustomizer/../include -o ''stm32f4discovery_led4.o'' ''E:/Projects/VehNAV/work/stm32f4discovery_led4_ert_rtw/stm32f4discovery_led4.c'' In file included from E:/Projects/VehNAV/work/stm32f4discovery_led4_ert_rtw/stm32f4discovery_led4.h:20:0, from E:/Projects/VehNAV/work/stm32f4discovery_led4_ert_rtw/stm32f4discovery_led4.c:16: E:/Projects/VehNAV/work/stm32f4discovery_led4_ert_rtw/stm32f4discovery_led4_I2C.h:18:41: fatal error: stm32f4discovery_led4_STM32.h: No such file or directory compilation terminated. gmake: *** [stm32f4discovery_led4.o] Error 1 E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw>echo The make command returned an error of 2 The make command returned an error of 2 E:\Projects\VehNAV\work\stm32f4discovery_led4_ert_rtw>An_error_occurred_during_the_call_to_make 'An_error_occurred_during_the_call_to_make' is not recognized as an internal or external command, operable program or batch file.

[&&sharp8;Warning: The following error was caught while executing 'onCleanup' class destructor: Invalid or deleted object.]&&sharp8; ♯♯♯ Build procedure for model: 'stm32f4discovery_led4' aborted due to an error.

Error(s) encountered while building model : ♯♯♯ Failed to generate all binary outputs.

#simulink-st32-mat-matlab-2015a
2 REPLIES 2
Posted on November 03, 2015 at 09:18

Hi ddub,

As we can see from log, your Simulink model is NOT configured for STM32.

### Using System Target File: E:\MATLAB\R2014b\rtw\c\ert\ert.tlc

You must set :

Configuration Parameters>Code Generation>System target file to stm32.tlc to be able to build model for STM32.

-Shahrzad-

dlwalter
Associate
Posted on November 04, 2015 at 20:53

Thanks, shahrzad. I've set the STMtlc file and that resolved my first error. However, I'm now getting a new error when I try to build the model. I've also read RN0087 (located here: http://www.st.com/st-web-ui/static/active/en/resource/technical/document/release_note/DM000809pdf) and applied the workaround listed in Section 2.3 Limitations regarding code generation for peripherals initialization not working in 2014b or 2015a. How can I clear this error?

This is what I get in the Diagnostic Viewer:

Error during code generation: Error using codertarget.resourcemanager.getAllResources (line 12)
Property 'DynamicTargetHardwareResourcesBuilding' does not exist
Error in codertarget.resourcemanager.get (line 15)
Error in codertarget.stm32f4discovery.internal.addSrcFileOrIncludeDirToBuildInfo>addToResourceManager (line 21)
custom_section_content = codertarget.resourcemanager.get(current_blk, 'CustomCode', custom_section);
Error in codertarget.stm32f4discovery.internal.addSrcFileOrIncludeDirToBuildInfo (line 16)
addToResourceManager(blk_path_or_mdlname, 'SourceFiles', fname_path);
Error in tlc_c (line 178)
[sfcnsCell, buildInfo, modelrefInfo] = ...
Error in coder.internal.ModelBuilder/make_rtw (line 611)
[buildResult, codeInstrResult] = tlc_c(h,...
Error in coder.internal.ModelCodegenMgr/make_rtw (line 8)
buildResult = obj.make_rtw(varargin);
Error in make_rtw (line 18)
buildResult = h.make_rtw(varargin{:});
Error in build_target>RunBuildCmd (line 135)
Error in build_target (line 5)
Error in build_standalone_rtw_target (line 59)
Error in slbuild_private>loc_codegenentry (line 797)
Error in slbuild_private (line 469)
Error in sl (line 15)
[varargout{1:nargout}]=feval(varargin{:});
Error in slbuild (line 61)
sl('slbuild_private', mdl, varargin{:});
Error in coder.internal.simulinkcodermenus>BuildModelCB (line 441)