I've been searching for this and still haven't found anything about it. This board connects directly to the host PC with a USB bus. Is it possible to emulate a serial port in this case?
This project implements CDC USB serial on the STM32F4 Discovery.
There are two USB connections on the board - the micro USB connector at the top and then the micro A/B connector for the USB On-The-Go support. The first connector is the programming interface - this connects only to the programmer chip and not to the actual target microcontroller. There's no way to use this connection as an emulated serial port.
As for the USB OTG connection I'm less familiar with it but judging by the Wikipedia page on the subject it seems that it's not really meant for that either - USB OTG is focused on acting as a semi-host for peripherals such as thumb drives or bluetooth adapters or something. Just doing a quick Google search yields no serial port emulators and from my assessment of how OTG works my initial reaction is that it won't work.
However, it is perhaps possible that you could configure the OTG device to act as a regular USB device and then code a serial port emulator to reside on the board, but that's a whole development effort on its own. You're best off attaching a cable like this to the UART pins on the board and interfacing through the UART on the microcontroller that way.
You might want to check out my question (and answer): ST-LINK is serial communication possible? I managed to run serial communication over SWD.
If there is a way to send serial data from the STM32F4 to the PC thought the programming USB connection, I have not seen how to do it.
I managed to get ( text type ) GPS data to the PC as follows:
(1) Adapt the USART software example for the STM32F4 at "Elia's" website (2) Connect the STM32F4 TX and RX and GND pins to a USB-serial device such as I use for serial communication between the Arduino and PC or the GPS device and PC. (3) Use PuTTY to display the serial data being received at the PC.
This seems to work but it rather annoying. I also cannot make it work in both directions, which I could do with the Arduino and other devices.