2024-04-16 3:06 PM
When i moved to new version of CubeMX and regenerate code for my H7 USB project i got compiler warning about some variables. Here is difference between old and new generated usbd_desc.c file;
Old file:
static void Get_SerialNum(void)
{
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
deviceserial0 = *(uint32_t *) DEVICE_ID1;
deviceserial1 = *(uint32_t *) DEVICE_ID2;
deviceserial2 = *(uint32_t *) DEVICE_ID3;
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
New file:
static void Get_SerialNum(void)
{
uint32_t deviceserial0;
uint32_t deviceserial1;
uint32_t deviceserial2;
deviceserial0 += deviceserial2;
if (deviceserial0 != 0)
{
IntToUnicode(deviceserial0, &USBD_StringSerial[2], 8);
IntToUnicode(deviceserial1, &USBD_StringSerial[18], 4);
}
}
As you can see deviceserial0, deviceserial1 and deviceserial2 variables defined but not assigned.
I fixed it myself, here is the solution in usbddesc_c.ftl file for M4 and M7 cores:
From: (at line 728 and 735)
[#if cpucore=="ARM_CORTEX_M4"]
[#elseif cpucore=="ARM_CORTEX_M7"]
To:
[#if cpucore=="ARM_CORTEX_M4" && (CLASS_FS=="CDC" | CLASS_HS=="CDC")]
[#elseif cpucore=="ARM_CORTEX_M7" | CLASS_FS!="CDC" | CLASS_HS!="CDC"]
Solved! Go to Solution.
2024-04-17 12:30 AM
Hello @Eralp
Thank you for reporting.
Actually, this issue has been already reported internally to Dev team for correction (under internal ticket number 177153) and this will be fixed ASAP.
I suggest that you take a look at this Post.
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.
2024-04-17 12:30 AM
Hello @Eralp
Thank you for reporting.
Actually, this issue has been already reported internally to Dev team for correction (under internal ticket number 177153) and this will be fixed ASAP.
I suggest that you take a look at this Post.
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.