cancel
Showing results for 
Search instead for 
Did you mean: 

[CubeMX feature request]Prevent warning when using custom USB String descriptors

martonmiklos
Senior
Posted on September 15, 2017 at 13:34

If I setup custom string USB string descriptors in the CDC Middleware configuration...

0690X00000608FwQAI.png

..these strings will be generated to the usbd_desc.c file in the following format:

/** @defgroup USBD_DESC_Private_Defines
 * @{
 */ 
#define USBD_VID 1155
#define USBD_LANGID_STRING 1033
#define USBD_MANUFACTURER_STRING ''Digitroll Ltd.''
#define USBD_PID_FS 22336
#define USBD_PRODUCT_STRING_FS ''XLiNE-USB Converter''
#define USBD_SERIALNUMBER_STRING_FS ''00000000001A''
#define USBD_CONFIGURATION_STRING_FS ''CDC Config''
#define USBD_INTERFACE_STRING_FS ''CDC Interface''�?�?�?�?�?�?�?�?�?�?�?

When compiling this code with gcc I got the following warnings:

pointer targets in passing argument 1 of 'USBD_GetString' differ in signedness [-Wpointer-sign] usbd_desc.c /xlineusb/Src line 76 C/C++ Problem�?

It is because the the USBD_getString expects unsigned pointer:

void USBD_GetString (uint8_t *desc, uint8_t *unicode, uint16_t *len);�?

I would recommend to generate the USB descriptor strings in the following format to prevent these warnings:

/** @defgroup USBD_DESC_Private_Defines
 * @{
 */ 
#define USBD_VID 1155
#define USBD_LANGID_STRING 1033
#define USBD_MANUFACTURER_STRING (uint8_t*)(''Digitroll Ltd.'')
#define USBD_PID_FS 22336
#define USBD_PRODUCT_STRING_FS (uint8_t*)(''XLiNE-USB Converter'')
#define USBD_SERIALNUMBER_STRING_FS (uint8_t*)(''00000000001A'')
#define USBD_CONFIGURATION_STRING_FS (uint8_t*)(''CDC Config'')
#define USBD_INTERFACE_STRING_FS (uint8_t*)(''CDC Interface'')�?�?�?�?�?�?�?�?�?�?�?

Thanks in advance an let me know if you need any further details!

#cubemx-4.22
3 REPLIES 3
martonmiklos
Senior
Posted on June 07, 2018 at 10:59

Hi ST guys/girls,

Any feedback, concerns regarding to this one?

Khouloud GARSI
Lead II
Posted on June 07, 2018 at 11:18

Hi

Marton.Miklos

‌,

This is also reported internally for further check.

We really appreciate your contribution to the enhancement of our STM32

resources.

Khouloud.

Posted on June 27, 2018 at 15:29

Hi Maton, 

I'm not able for the moment to reproduce your issue with TrueStudio and SW4STM32, could you please share your ioc it will be helpful for debug.