1 Prepare for Work 1.1 Create a new template folder and download 3.5 firmware library files
1.2 Create several subfolders in the template folder 0_core place the core boot files required 1_fwlib_3_5_0, place the firmware library to provide the peripheral file 2_drive, place the user's own driver file 3_project place the project file Readme Place project version information, etc.
2 KEIL5 New Project Setup 2.1 open KEIL5, click New Project and save it to Template->3_project->mdk_arm
2.2 Select chip type, here we choose STM32F103C8 Series
2.3 Automatic configuration settings after ignoring
2.3 Got an empty project with nothing.
2.4 Under Target1 left button, click Manage Project item
2.5 Change the name of the item inside and name the following
3 File Relocation 3.1 firmware Library Peripherals File Relocation Open the official firmware library package, locate the firmware library package directory We have previously prepared: Stm32f10x_stdperiph_lib_v3.5.0\libraries\stm32f10x_stdperiph_ Under Driver, copy the Src,inc folder below the directory to the Stm32f10x_fwlib folder we just created.
3.2 Boot File Relocation Open the official firmware library package, navigate to the directory Stm32f10x_stdperiph_lib_v3.5.0\libraries\cmsis\cm3\coresupport below, the file core_cm3.c and file core_ Cm3.h copied underneath the CORE. Then navigate to the directory stm32f10x_stdperiph_lib_v3.5.0\libraries\cmsis\cm3\devicesupport\st\stm32f10x\startup\arm underneath, and startup_ the inside The Stm32f10x_md.s file is copied to the CORE below. (Remark: Because I choose the chip for STM32F103C8T6, for medium capacity chip, so select this startup file, specific chip capacity size, also need to according to the specific chip manual reference selection)
3.3 Stm32f10x.h header files and system configuration header files, such as relocation stm32f10x_stdperiph_lib_v3.5.0\libraries\cmsis\cm3\devicesupport\st\stm32f10x The following three files Stm32f10x.h, system_stm32f10x.c, system_stm32f10x.h, are copied to our project directory. Then stm32f10x_stdperiph_lib_v3.5.0\project\stm32f10x_stdperiph_template the following 4 files main.c, stm32f10x_conf.h, STM32F10x _IT.C, Stm32f10x_it.h copied below the PROJECT directory.
4 will move the document and the project to stand up 4.1 go back to the Manage Project items manager Click Add Files (1) to add Core_cm3.c,startup_stm32f10x_md.s to the core group (2) in the FWLIB_3_5_0 to add our project engineering needs of the peripheral library files, from the 1_fwlib_3_5_0->src folder to add, here we first add a misc,stm32f10x_gpio,stm32f10x_ Three files such as RCC (the remaining files are added according to the project). (3) Add files such as main.c,stm32f10x_it.c,system_stm32f10x.c to the user group. (4) The Dirve group is used to add a customized driver file for the project and is not added for the time being.
4.2 Click OK, then complete the project file Add.
4.3 Add header file search path in project back to project main menu, click Magic Wand, come out a menu, then click c + + option. Then click the button on the right of the Include paths. A dialog box that adds path is displayed
Include the required header file path
4.4 Project Output path settings Click on the Magic Wand, select Output->select folder for objects, select 0_template->3_project->mdk_arm->obj folders as output folder
4.5 Setting the Global macro definition variable Select Magic Wand, in C + +, will preprocessor symbols, will stm32f10x_md,use_stdperiph_driver this paragraph add in, click OK
4.6 Simplified MAIN.C procedure
4.7 Compile and compile successfully
5 Summary
In this way, based on the STM32F103C8 series of a project template will be set up, let the beginning of our development bar ~ ...