I wrote a tutorial before on how to setup a toolchain and build the STM32F4xx standard peripheral drivers into one convenient library, since then, a few people have asked me about the library, so to make life easier, I downloaded the latest StdPeriph/CMSIS, in addition to a few other libraries that I might need later, and shared everything in one repository, which currently has the following libraries:
Cortex-M CMSIS V3.20 STM32F4xx CMSIS V1.3.0 STM32F4xx StdPeriph V1.3.0 STM32_USB_Device V1.1.0 STM32_USB_OTG V2.1.0
In addition to those, the repository also includes a simple USB device library (stm32f4xx/USB_Generic) which abstracts all the horrible details of the USB libraries into a very simple generic USB device implementation with just two Bulk endpoints...
To use this library you just pass a struct with two callback functions and the library will call those functions whenever data is received or requested, it's as simple as that, note that it's configured for OTG FS only, it could still be useful if you just want to get USB working and don't have time to go through all the examples.
Finally, repository also includes some examples, a Blinky, a USB_Generic example and some user-space code with libusb.
Building The Libraries:
To build the libraries and examples just type make in the top directory, the top Makefile will pass along all the flags and variables, here are some options you can pass on the command line:
make DEBUG=0This will build everything with -O2 and no debugging symbols (not recommended)
make DEBUG=1 CFLAGS="-DOSC=xx"
This will build the library with debugging enabled, no optimization and using the given crystal frequency in MHz (for example -DOSC=16)
https://github.com/iabdalkader/stm32f4xx.git