Skip to main content
WDobb.1
Associate
Jan 14, 2025 8:14 PM UTC
Question

USBX improper code generation

After editing the .IOC file, the code generator will mess up the app_usbx_device.c\MX_USBX_Device_Init() function by placing the code

if (ux_device_stack_initialize(...)

right after the variable declarations at the top of the function.

Typically, that function call should be around line 151 after 6 other function calls initialize all the pointer variables.

The end result is 8 compile warnings about using uninitialized variables.

Attempts to wrap the stack initialization in /* USER CODE BEGIN MX_USBX_Device_Init0 */ don't work, and the code generator will just move it to the top of the file anyway.

What is the work-around for this?

STM32H562VGTx

STM32CubeMX 6.12.0

STM32CubeIDE 1.16.0

 

This topic has been closed for replies.

5 replies

ST Technical Moderator
Jan 17, 2025 10:44 AM UTC

Hello @WDobb.1 ,

First let me thank you for posting and welcome to the ST Community.

For more investigation, I suggest please that you provide the Ioc.File.

Thanks.

Mahmoud

 

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.
WDobb.1
WDobb.1Author
Associate
Jan 17, 2025 1:43 PM UTC

The ioc file is attached.

WDobb.1
WDobb.1Author
Associate
Feb 7, 2025 6:38 PM UTC

I am including the file that gets manged vs. what the original one looks like.

 

 

Visitor II
May 29, 2025 6:29 PM UTC

What is the status on this? Is it expected to be fixed in the next release?

Visitor II
Aug 27, 2025 5:42 PM UTC

The fix for this issue is here: Case: 00241689