-
Notifications
You must be signed in to change notification settings - Fork 6
Stm32 usb project creation
Guideline for using example projects in STM32_USB-FS-Device_Lib_V4.0.0/
be sure to first have read STM32 tools
-
from directory STM32_USB-FS-Device_Lib_V4.0.0/Projects/VirtualComport_Loopback/
- copy appropriate source & header files from inc/ and src/ into your own project directory.
-
from STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32L1xx_StdPeriph_Driver
-
cp -r src/
directory into your project directory with name such asStdPeriph_src
-
-
from STM32_USB-FS-Device_Lib_V4.0.0/Libraries/CMSIS/Device/ST/STM32L1xx/Source/Templates/TrueSTUDIO copy startup_stm32l1xx_?.s depending on flash size (family) of device rename to .S
-
from STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32_USB-FS-Device_Driver/src/: usb_mem.c usb_regs.c usb_init.c usb_core.c usb_sil.c
-
linker script:
copy the
.ld
file from aSTM32*-EVAL/
directory best matching your target device.
<parentdir>/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32_USB-FS-Device_Driver/inc/
..
<parentdir>/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/CMSIS/Device/ST/STM32L1xx/Include/
<parentdir>/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/CMSIS/Include/
<parentdir>/STM32_USB-FS-Device_Lib_V4.0.0/Libraries/STM32L1xx_StdPeriph_Driver/inc/
The ..
directory references your project directory in workspace.
STM32L1XX_MD_PLUS // for stm32l152rct6
or
STM32L1XX_MD // for stm32l152vbt6
USE_STDPERIPH_DRIVER
-
In
platform_config.h
:comment out
#define (USE_STM32303C_EVAL)
if thats not your boardIn the includes section, create a USE_ ifdef for your board in the appropriate processor family section.
depending on whether your board uses DP+ pullup internally or externally, you need to make sure the appropriate preprocessor directives are set for USB_CONNECT/DISCONNECT defines.
ensure HSE_VALUE
matches your crystal, default is 8MHz