cancel
Showing results for 
Search instead for 
Did you mean: 

Errors in STM32CubeMX USBX device code generation

ron239955_stm1
Associate III

I've been working with USBX for a while now, and after updating to the latest X-CUBE-AZRTOS-H7 package (v3.2.0), I'm running into a couple of problems relating to the templates STM32CubeMX generates. Specifically, the files ux_device_descriptors.c and ux_device_descriptors.h

1). In the function USBD_Get_String_Framework, the variable "count" is declared as uint8_t. This is a problem if the string framework is more than 256 bytes in length. This definition is outside of the user editable code, so I need to remember to edit it every time I regenerate my code. This should be set to uint16_t or unsigned.

2). Also in USBD_Get_String_Framework, the USER CODE tags are missing BEGIN and END. As a result, any code I put in between them is deleted when regenerating code.

3). In the header file,  the "USER CODE BEGIN/END Private_defines" tags appear twice, which results in any code in one of the sections begin duplicated when regenerating code.

These are not a big deal, but they are a bit annoying when doing repeated changes in STM32CubeMX.

 

2 REPLIES 2
ron239955_stm1
Associate III

I should also mention that there are other places where the BEGIN/END tags are missing, for example the USBD_FrameWork_AddToConfDesc function.

 

ron239955_stm1
Associate III

And another addendum - it doesn't appear that there's any way to configure USBD_STRING_FRAMEWORK_MAX_LENGTH from STM32CubeMX, so any change made to that constant gets overwritten by STM32CubeMX as well.