Skip to main content
Associate
February 2, 2024
Question

Simulink error for undeclared values by CubeMx

  • February 2, 2024
  • 2 replies
  • 1681 views

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

This topic has been closed for replies.

2 replies

TDK
Super User
February 2, 2024

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
Technical Moderator
February 5, 2024

Hello @hsafamehr 

First let me thank you for posting.

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

THX

Ghofrane

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
hsafamehrAuthor
Associate
February 5, 2024

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!