1. 将STM32_USB-FS-Device_Lib_V4.0.0下的Libraries、Utilities文件夹和Projects\Custom_HID下的inc、src和MDK-ARM文件夹拷出。并保持原层叠关系:
2. 用MDK新建工程,Device选择STM32F103ZE
3. 在工程中添加如下文件夹:
4. 各文件夹下从添加的文件如下:
4.1 User文件夹下的文件在Projects\Custom_HID\src下
4.2 CMSIS文件夹下文件在Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates和Libraries\CMSIS\Device\ST\STM32F10x\Source\Templates\arm下
4.3 STM32_USB-FS-Device_Driver文件夹下文件路径Libraries\STM32_USB-FS-Device_Driver\src
4.4 STM32F10x_StdPeriph_Driver文件夹下文件路径:Libraries\STM32F10x_StdPeriph_Driver\src
4.5 STM3210E_EVAL文件夹下文件路径:Utilities\STM32_EVAL\STM3210E_EVAL
5. 工程设置:Option->C/C++ (重点)
Include Paths下各文件夹路径:
Projects\Custom_HID\inc
Libraries\CMSIS\Device\ST\STM32F10x\Include
Libraries\STM32_USB-FS-Device_Driver\inc
Libraries\STM32F10x_StdPeriph_Driver\inc
Utilities\STM32_EVAL\Common
Utilities\STM32_EVAL\STM3210E_EVAL
以上各路径均为步骤1中文件路径
6. Build Project