cancel
Showing results for 
Search instead for 
Did you mean: 

STM32CubeMx sometimes not generating MX_USB_DEVICE_Init()

RMart.0
Associate III

STM32CubeMX v6.1.0, H7 lib v 1.8.0

is generating code where main() calls MX_USB_DEVICE_Init();, but MX_USB_DEVICE_Init does not seem to be defined anywhere.

int main(void)
{
...
 
  /* Initialize all configured peripherals */
  MX_GPIO_Init();
...
  MX_USB_DEVICE_Init();
 
...}

Also worth noticing that MX_USB_DEVICE_Init "line" can be seen in Project Manager-> Advanced Settings, but the Visibility (Static) box cannot be marked:

0693W000006EtI2QAK.pngChange the order/rank of MX_USB_DEVICE_Init did not work around the issue :(

Is this a know issue or do I need to set something extra to get that function's implementation?

1 ACCEPTED SOLUTION

Accepted Solutions
Khouloud ZEMMELI
ST Employee

Hi @RMart.0​ 

The Visibility (Static) check-box is always unchecked because the MX_USB_DEVICE_Init function is already defined in usb_device.c file (under your_project\USB_DEVICE\App).

If you still can't find the MX_USB_DEVICE_Init function, please share your ioc file.

Thanks, Khouloud

View solution in original post

1 REPLY 1
Khouloud ZEMMELI
ST Employee

Hi @RMart.0​ 

The Visibility (Static) check-box is always unchecked because the MX_USB_DEVICE_Init function is already defined in usb_device.c file (under your_project\USB_DEVICE\App).

If you still can't find the MX_USB_DEVICE_Init function, please share your ioc file.

Thanks, Khouloud