Showing results for 
Search instead for 
Did you mean: 

Simulink error for programming ST Nucleo board

Associate II


I want to program my STM32H753ZI Nucleo board with Simulink. I successfully programmed it to blink an LED. However, I get the following error when I try to enable a timer (for PWM, or Encoder).


C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/shared/supportpackages/stm32/src/rtiostream_serial.c:10:10: fatal error: rtiostream.h: No such file or directory

   10 | #include "rtiostream.h"

      |      ^~~~~~~~~~~~~~

compilation terminated.

gmake: *** [rtiostream_serial.o] Error 1


I have tried this with both CubeMx 6.4 and 6.10 (Matlab has recommended to use CubeMx 6.4.).

I have also tried the STM32F446RE Nucleo board and the same error emerged.

Any suggestions to solve this problem are highly appreciated.




Similar problem I am having, Windows 11 23H2, Matlab R2023b. I am using a STM32G431KB board.


...\Desktop\xxx\Software_Projects\sakin_ert_rtw>if "all" == "" ("C:\PROGRA~1\MATLAB\R2023b\bin\win64\gmake"  -f all )  else ("C:\PROGRA~1\MATLAB\R2023b\bin\win64\gmake"  -f all )
"C:/ProgramData/MATLAB/SupportPackages/R2023b/3P.instrset/gnuarm-armcortex.instrset/win/bin/arm-none-eabi-gcc" -ffunction-sections -fdata-sections -Wall -MMD -MP -MF"stm_adc_ll.dep" -MT"stm_adc_ll.o" -c -O0 -mcpu=cortex-m4 -mthumb -mlittle-endian -mthumb-interwork -mfpu=fpv4-sp-d16 -mfloat-abi=hard -DMW_ADC1_ENABLED=1 -DMW_ADC1_VAR=mw_adc1 -DMW_TIM1_ENABLED=1 -D__MW_TARGET_USE_HARDWARE_RESOURCES_H__ -DUSE_FULL_LL_DRIVER -DSTM32G431xx -DUSE_HAL_DRIVER -DMW_TIMEBASESOURCE=TIM2 -DCLASSIC_INTERFACE=0 -DALLOCATIONFCN=0 -DTERMFCN=1 -DONESTEPFCN=1 -DMAT_FILE=0 -DMULTI_INSTANCE_CODE=0 -DINTEGER_CODE=0 -DMT=1  -DTID01EQ=0 -DXCP_CUSTOM_PLATFORM -D__FPU_PRESENT=1U -D__FPU_USED=1U -DMW_FREERTOS -DMW_EXTMODE_STACKSIZE=1024 -DSTACK_SIZE=64 -DRT -DOS_STKSIZE=128 -DMODEL=sakin -DNUMST=2 -DNCSTATES=0 -DHAVESTDIO -DMODEL_HAS_DYNAMICALLY_LOADED_SFCNS=0  @sakin_comp.rsp -o "stm_adc_ll.o" "C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/shared/supportpackages/stm32/src/stm_adc_ll.c"
In file included from C:/Users/xxx/Desktop/xxxxx/Software_Projects/sakin_ert_rtw/MW_target_hardware_resources.h:7,
                 from C:/ProgramData/MATLAB/SupportPackages/R2023b/toolbox/shared/supportpackages/stm32/src/stm_adc_ll.c:5:
C:/Users/xxxx/Desktop/xxxxx/Software_Projects/sifirdan/Core/Inc/main.h:30:10: fatal error: stm32g4xx_hal.h: No such file or directory
   30 | #include "stm32g4xx_hal.h"
      |          ^~~~~~~~~~~~~~~~~
compilation terminated.
gmake: *** [stm_adc_ll.o] Error 1


Simulink generates a tlc file but as soon as GNU Tools for ARM Embedded Processors toolchain starts to build the code, it just cannot read any headers starting with the HAL driver headers. Even though they are right next to the .ioc file at the same folder, same path, without spaces in the path.


Honestly this is driving me crazy. I have contacted local Matlab support and waiting for a response.




Yes, it is a weird problem. Indeed, I tried it on another computer and it compiled successfully. The CubeMX seems to be the source of this problem. I can suggest two approaches:

1. Adding the header files manually.

2. Installing the latest version of CubeMx.



Matlab does not recommend using a newer version of the CubeMX than the 6.4 version. That's why I am not updating it.


I honestly don't think it is CubeMX's fault. I use the same version CubeMX on my other computer (had to start using my old laptop for this) and everything works well. CubeMX outputs are the same in both computers.


I am suspecting GNU Embedded compiler version is not compatible with something but I don't know what. 



edit: The root of the problem was other cubemx project folders were present in Matlab's path. Do not add .ioc folders to path of the compiler.