cancel
Showing results for 
Search instead for 
Did you mean: 

Simulink error for undeclared values by CubeMx

hsafamehr
Associate II

Hi,

I want to connect my STM32H753ZI Nucleo board to Simulink. I have generated the CubeMx file to blink a simple LED. At first, I got some errors for missing header files. I added them manually. Now, I have the following error when I try to compile the file.

error: 'STLK_TX_Pin' undeclared (first use in this function); did you mean 'STLINK_TX_Pin'?
291 | GPIO_InitStruct.Pin = STLK_RX_Pin|STLK_TX_Pin;

error: 'USB_PowerSwitchOn_GPIO_Port' undeclared (first use in this function) 392 | LL_GPIO_ResetOutputPin(USB_PowerSwitchOn_GPIO_Port, USB_PowerSwitchOn_Pin);

error: 'Direction_GPIO_Port' undeclared (first use in this function) 395 | LL_GPIO_ResetOutputPin(Direction_GPIO_Port, Direction_Pin);

...

 

As it is recommended by Matlab, I am using CubeMX 6.4. The version of my H7 package is 1.11.0. It is highly appropriated helping to solve this problem.

Thanks

3 REPLIES 3
TDK
Guru

It looks like a bug in the CubeMX code generation. The solution would be to update to the latest version. This may be problematic with Simulink, but it is worth trying.

Although missing files suggests perhaps there is an issue with your IOC file, or your workflow, in some manner.

Other options would be to add definitions in a USER CODE section to eliminate the error.

#define STLK_TX_Pin STLINK_TX_Pin

 

If you feel a post has answered your question, please click "Accept as Solution".
Ghofrane GSOURI
ST Employee

Hello @hsafamehr 

First let me thank you for posting.

Could you please provide your IOC in order to check your configuration.

THX

Ghofrane

Hi Ghofrane,

Thanks for your response. I have attached my ioc and Simulink files. I also tried the latest version of CubeMx. In that case, the error changes to this:

--------------------------------------------------------------------------

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

   

C:\H753Board\H753Board_ert_rtw>echo The make command returned an error of 2

The make command returned an error of 2

   

C:\H753Board\H753Board_ert_rtw>exit /B 1

### Build procedure for H753Board aborted due to an error.

--------------------------------------------------------------------------

 

Finally, I should add that everything becomes fine once I remove my timers and the program becomes a simple blinking LED!