cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink error for programming ST Nucleo board

hsafamehr
Associate II

Hi,

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.

 

Thanks

8 REPLIES 8
egege
Associate II

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 sakin.mk all )  else ("C:\PROGRA~1\MATLAB\R2023b\bin\win64\gmake"  -f sakin.mk 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.

 

 

Hi,

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.

Hi,

 

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. 

 

SOLVED

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.

No chance to install the new CubeMX, SIMULINK is asking for v6.4.0; otherwhise it cannot validate the SW and sh*t will hit the fan~

Yes, this is the right solution, thank you!! 

Hi there,

Having this issue, how can I double check for .ioc folders in the path of the compiler? I don't believe there should be any, and also find it confusing how that would resolve the lack of a header file. 

I'm going insane! Would greatly appreciate any help you may have.

 

When you add a folder to Matlab path, there are 2 choicss: adding only the folder and adding it with all the downpath folders. When you choose the 2nd option CubeMx generated .ioc files and its folder gets added. No CubeMx folder should be included in the Matlab path folders. You should check added paths of the Matlab. Google it if you do not know how.

 

It is not lack of a header actually, the problem is header files being at multiple locations.

I did this and it doesn't look like I used the second option (i.e. the MATLAB path does not contain any folders that contain an ioc file) so it must be another issue unfortunately.

 

I really appreciate your help though, could have saved me big time, I wish there was a way I could just flash the board directly, I don't actually need it to communicate back to the PC at all, I just need to get code on the board.