If you are using RTOS other than CMSIS-RTOS2 RTX5 for your project please make sure to satisfy USB Device Resource Requirements. Refer to CDC: Communication Device Class (ACM) for details about these template functions. The USBD_User_CDC_0.c is an adapted code template that implements all necessary file access functions.Furthermore, it contains the code that exchanges the data internally between the USB and the UART port. VirtualCOM.c contains the main C function that initializes the board hardware and the USB Device Component.
Typical Project Structure of an USB VCOM Example Source Files