How to create an STM32F2xx project from scratch using MDK (graphic tutorial)

Publisher:Jinyu521Latest update time:2016-12-27 Source: eefocusKeywords:MDK Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Step 1: Download the standard peripheral firmware library.

        Download link: http://www.st.com/stonline/stappl/resourceSelector/app?page=resourceSelector&doctype=FIRMWARE&ClassID=1734

        Download the STM32F2xx Standard Peripherals library. The latest version is V1.1.0, but it is recommended to download V1.0.0 because the latest version V1.1.0 on the official website lacks the cm3.c file.

        It is recommended to use Thunder to download, because if you download using a browser, the download will stop at 99%, but you can complete the download using Thunder.

        After downloading, unzip it, as shown below:

                                                                              figure 1

--STM32F2xx_StdPeriph_Lib_V1.0.0

   |--_htmresc
   |--Libraries
       |--CMSIS
       |--STM32F2xx_StdPeriph_Driver

  | --Project
  |--Utilities

  |--Release_Notes.html

  |--stm32f2xx_stdperiph_lib_um.chm

  |--stm32f2xx_stdperiph_lib_um.chw

Step 2: Organize the project directory

     Create a new directory anywhere on your computer, such as APP, and then create two new directories, Project and User, under the APP directory.

     Next, copy the Libaries directory under the standard peripheral firmware library that you downloaded and unzipped earlier to the APP directory.

    Then create two new directories, Obj and List, under the Project directory.

   Finally, select a template source file from the previously unzipped files and copy it to the User directory. Here, for example, .\STM32F2xx_StdPeriph_Lib_V1.0.0\Project\STM32F2xx_StdPeriph_Examples\GPIO

Copy the source code in the directory to the Usr directory.

    Once you have these prepared you can proceed to the next step.

   The following figure shows the directory of APP:


                                                          figure 2

Step 3: Create MDK project

       Open MDK, click Project->New uVision Project..., then a dialog box pops up and asks you to select the project directory. Select APP/Project here and name the project Demo, as shown below:

                                                                    image 3

After clicking Save, a dialog box will pop up to select the MCU type. Here, select STM32F207VC from STMicroeletronics, as shown below:

                                                                        Figure 4

After clicking OK, a dialog box pops up, select whether to let MDK automatically generate the startup file startup_stm32f2xx.s to the project. Here, because there is already a startup file, select No here.

Step 4: Add project files

     First, rename the project to Demo, and then click the Manage Conponents... button on the toolbar, as shown in the red circle in the figure below:

                                                                                       Figure 5

Open the following interface:

                                               Figure 6

The next step is to add groups and source files to the project. First, add four groups: Lib, User, CMSIS, and StartUp.

Then add source files for each group:

Lib->Add all source files under APP\Libraries\STM32F2xx_StdPeriph_Driver\src. Of course, you can also select only some files as needed.

User->Add all source files in the APP\User directory, except system_stm32f2xx.c, because this file will be added in the next CMSIS group.

CMSIS->Add the core_cm3.c file in the APP\Libraries\CMSIS\CM3\CoreSupport directory

                Add the system_stm32f2xx.c file in the APP\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F2xx directory.

StartUp->Add the startup_stm32f2xx.s file in the APP\Libraries\CMSIS\CM3\DeviceSupport\ST\STM32F2xx\startup\arm directory.

This will add all the files.

Step 5: Add header files

Click the Target Options.. button on the toolbar, as shown in the red circle in the figure below:

 

                                                                   Figure 7

The following dialog box pops up, select the C/C++ tab, add the USE_STDPERIPH_DRIVER macro in the Define: column under Preprocess Symbols, and add the include path under Include Paths, as shown below:

Note: The macro USE_STDPERIPH_DRIVER can be found in the header file stm32f2xx.h. It means to open the standard peripheral firmware library. Of course, you can also modify stm32f2xx.h to open this macro, but it is not recommended.

                                                                            Figure 8

The paths included are all directories of header files, as shown below:

                                       Fig. 9

Then set the output directory and the listing directory.

Under the Output tab, click the Select Folder for Objects.. button, and then select the APP\Project\Obj directory as the output directory.

Under the Listing tab, click the Select Folder for Listings... button, and then select the APP\Project\List directory as the list directory.

At this point, all the project settings are basically set up, and the next step is to compile and burn.

Step 6: Compile the project

Click Compile and find an error. Comment out #include "stm32_eval.h" in the main.c file.


  1. //#include "stm32_eval.h"  


Then you can compile it.



complete!


Keywords:MDK Reference address:How to create an STM32F2xx project from scratch using MDK (graphic tutorial)

Previous article:Cotex-M3 core LPC17xx series clock and its configuration method
Next article:STM32 CAN --- Analysis of working/testing modes

Recommended ReadingLatest update time:2024-11-16 04:15

Compile Keil MDK project in Eclipse
Recently, I have been playing with ARM7 in my spare time, using Keil uVision integrated development environment. Sometimes I can't stand it. The code prompt/highlight function of the editor is almost zero. The code basically needs to be typed in one letter at a time! Think about how comfortable it is to develop in VS,
[Microcontroller]
Compile Keil MDK project in Eclipse
Use the logic analyzer in MDK4 to analyze the PWM wave of the IO port
1. Set up software simulation first. Refer to the chapter 2.4 Software Simulation in the STM32 incomplete manual. Example functionality:                                                    - Clock Settings:    - XTAL = 8.00 MHz    - SYSCLK = 72.00 MHz    - HCLK = SYSCLK = 72.00 MHz    - PCLK1 = HCLK/2 = 36
[Microcontroller]
Use the logic analyzer in MDK4 to analyze the PWM wave of the IO port
Compiler intrinsics for controlling IRQ and FIQ interrupts - based on Keil MDK
The compiler intrinsic functions __disable_irq, __enable_irq, __disable_fiq and __enable_fiq are used to control IRQ and FIQ interrupts. These intrinsic functions can only be used when the processor is in privileged mode, because these functions change the registers CPSR and SPSR (ARM7, ARM9, etc.) or PRIMASK and FAU
[Microcontroller]
About USE_STDPERIPH_DRIVER problem in STM32 MDK
When learning STM32 for the first time and using the STM32 firmware library to build a project in the RealView MDK environment, beginners may encounter compilation failures. The following warnings or error prompts appear:   warning: #223-D: function "assert_param" declared implicitly;assert_param(IS_GPIO_ALL_PERIPH(GP
[Microcontroller]
STM32 Keil MDK uses JLink to simulate and debug keyboard keys online - detailed explanation with pictures and text
        It turns out that buttons can be debugged online using JLINK! I used to think that buttons can only be debugged by sending key values ​​through the serial port! This is great. Newbies who don't know how to do it should read on!         Note: When debugging a statement that requires a key to be press
[Microcontroller]
STM32 Keil MDK uses JLink to simulate and debug keyboard keys online - detailed explanation with pictures and text
s3c2440 bare metal development and debugging environment (MDK4.72, Jlink v8, mini2440)
My development environment: Windows 7 32-bit, J-linkv8, a mini2440 development board. Finally, I chose: MDK4.72 version, the latest version of J-ink v8, J-linkARM v4.94. 1) Open Keil uVision4 and create a new project: 2) Create a new directory to store our project files, so I create a new test
[Microcontroller]
s3c2440 bare metal development and debugging environment (MDK4.72, Jlink v8, mini2440)
STM32 MDK project creation diagram steps self-study summary
I haven't used MDK to write STM32 programs for a long time. Now I find that I can't remember the creation steps. So I read the book again and recorded it step by step-----refer to the example of Wildfire! ---Step 1---Create a folder---Create the following folders under the folder--- ---1-1---CMSIS is used to store t
[Microcontroller]
STM32 MDK project creation diagram steps self-study summary
The problem of wandering between MDK3.08 and 4.70 versions
           Because the ALIENTEK routines are all compiled under version 3.08, now because of the upgrade of jlink, I upgraded the keil version to 4.70. The problems encountered were explained and solved in the previous blog.          Atoms are handled like this:          I have been thinking about why he di
[Microcontroller]
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号