Keil (MDK-ARM) series tutorial (I)_Detailed process of creating a new software project

Publisher:吾道明亮Latest update time:2019-09-17 Source: eefocusKeywords:Keil Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Ⅰ. Write in front

This article uses the latest version (November 2016) of Keil (MDK-ARM) V5.21a development environment and takes the STM32 processor as an example to describe the detailed process of creating a new software project.


Keil (MDK-ARM) V4 and V5 new software projects are basically the same, this article is also suitable for new software projects with V4 version.


The processor used in this article is ST's STM32F1 series chip. The process of creating a new software project for other series of ST (such as F4, etc.) and other companies (such as TI) is the same.


To facilitate the majority of STM32 learners, I will provide you with the newly built Demo software projects, related tools and documents for each series of STM32F0 - F4 chips for download below.


The content of this article has been organized into a PDF file and is available for download:


http://pan.baidu.com/s/1nuJ0RDR


Author:strongerHuang


Any other commercial use is prohibited without permission!!!


II. Main Points

As the title of this article shows, the focus is on the process of creating a new software project. However, as a software project developed by ARM, it generally contains some source code (such as libraries), which means that you need to prepare some source code files included in the project.


This article takes the STM32F1 series chip as an example (other series chips are similar). It will briefly describe the preparation of the STM32F1 standard peripheral library and Demo source code (LED flashing routine).


After the preparation work, creating a new software project is the main point of this article. The process of creating a new software project is mainly for beginners. The configuration of most projects is the default. If you want to view more detailed configuration of the software project, you can enter the blog or follow the WeChat public account to view it.


III. Preparation

As the saying goes, "sharpening the knife does not delay the chopping of wood." Although the preparation work is not closely related to the topic, it is also the focus of this article. If the preparation work is done well, the subsequent work of building a new software project will be easily accomplished.


1. Install Keil (MDK-ARM) software tools

This article requires tools, so I won't go into details here. For details, please see my other article [Introduction, download, installation and registration of Keil (MDK-ARM):


Blog: http://blog.csdn.net/ybhuangfugui/article/details/51501781


PDF: http://pan.baidu.com/s/1nuJ0RDR


2. Download STM32 standard peripheral library

Official website download link (ST account required to log in):


http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software.html?querycriteria=productId=SC961


Download the corresponding standard peripheral library according to the chip model (for example, if the chip is STM32F103ZE, download the corresponding STM32F10x_StdPeriph_Lib), as shown below:

You can also download it from my Baidu network disk (same as the official website):


http://pan.baidu.com/s/1qYbBKMK


3. Organize project folders

The content of this section can be organized according to your own habits. The file and folder structure I organized is based on the conventional organization method. If you think it is reasonable, you can quote it; if you feel uncomfortable with this structure, you can organize it yourself.


First, create a folder to store the project files: STM32F103ZE (Keil)_Demo


A. Extract ST standard peripheral library files


There are many source code files in the standard peripheral library downloaded from the ST official website, but we only need to use some files. Therefore, we need to extract the used files and folders into our project.


Unzip "STM32F10x_StdPeriph_Lib", you can see four folders under the main directory:


_htmresc: picture folder (not extracted)


Libraries: Library folder (extract most of it)


Project: Sample project (extract a small part)


Utilities: Public code, evaluation board code (not extracted)


The main files we extract using the standard peripheral library are the files under Libraries, but some files and folders are redundant. Therefore, I remove the redundant files and folders and keep the required files and folders.


B. Create new files and folders


In addition to the standard peripheral library files, we need to create files and folders to store our own code. I mainly need to create three folders here:


App: Application code


Bsp: underlying part of the code


Doc: Documentation


You also need to create your own file under the newly created folder and add the source code to the file. The demo project we provide has a relatively simple function, which is to make an LED flash. I won't describe it here, but you can download it at the end for details.


After completing the above two steps, we can see the folders organized under "STM32F103ZE (Keil) _Demo":

At this point, the preparation work is complete. Please download the Demo project to view the specific contents of the files extracted above and the newly created files.


IV. New Software Project

Creating a simple, basic software project requires about three steps: creating a project, adding files, and configuring the project.


After completing the above preparations, you can create your own software project. The following will describe the detailed process of creating a new software project from scratch step by step.



1. Create a project

The steps to create a project are basic and relatively simple.


A. Open the software and create a new project (Project -> New uVision Project)


B. Select the path and save the name

C. Select chip model

D. Foundation Engineering

A basic project has been completed, but it is not enough to use it, the following steps are required.


2. Add files

To be precise, it should be adding groups (folders) and adding files. To put it more directly, it is to add your own source code (libraries extracted earlier, newly created files, etc.) to the project.


The engineering project management here can be defined according to your own ideas (similar to classifying and naming folders and files by yourself). I manage projects in the conventional way here.

 

 

Add step by step until you are done


3.Configure the project

For beginners, most of the configuration items can be left as default. Here are just a few common configurations that can meet basic functions. For more configurations, please visit my WeChat public account or blog.


A. Click "Project Target Options" to enter the configuration (or Project -> Options for Target)

B. Output Hex file


Many beginner friends will ask how to output Hex (a file that can be downloaded directly). Just check [Project -> Options for Target -> Output] "Create HEX File".

CC/C++ Configuration


This option has many configuration parameters, which is more important for large projects, but for beginners, you only need to configure two simple items.


The first configuration---predefined:


[This only applies to the STM32F103 large-capacity chip, other chips depend on the situation]

STM32F10X_HD is predefined, and some projects also predefine USE_STDPERIPH_DRIVER. Since they all use the "standard peripheral library", I personally like to define USE_STDPERIPH_DRIVER in the stm32f10x.h file, so I can't see the one I defined here.


The second configuration --- includes the path:


Since there are many folders in our previous project, we need to add the corresponding paths so that the compiler can find them.

Add step by step until you are done

D. Select Download Debug Tool


This option is selected according to your download debugger (for example: ST-Link)

E. Download reset and run setup


Some beginner friends asked, "Why do I need to press the reset button to run the program after downloading it?" You can do this by simply checking "Reset and Run" in the project. The program will run immediately after downloading.

At this point, a newly created project is completed (of course, the correct source code is added to the new file I created). You only need to compile it, connect it to the downloader, and you can download and run it.

Keywords:Keil Reference address:Keil (MDK-ARM) series tutorial (I)_Detailed process of creating a new software project

Previous article:Interrupt-button control LED light
Next article:Keil (MDK-ARM) series tutorial (II)_Toolbar detailed description

Recommended ReadingLatest update time:2024-11-16 12:27

Mini2440 is used to migrate the ADS project to Keil MDK step by step
It has been two months since I bought the board. At first, I wanted to run it naked, but the projects were all under ADS, which couldn't be used on the win7 system. So I thought about running it on MDK, but the startup file of s3c2440 on MDK is incomplete, so it is not recommended to use. I talked about it for a long
[Microcontroller]
Solve a Keil C error message: error C132
Today, after I changed one of my programs into multiple files, the following alarm appeared: not in formal parameter list. I searched for a long time but couldn't solve the problem. Later, I found someone else's solution to the same problem on the Internet. It was caused by a missing semicolon in a function declaratio
[Microcontroller]
The specific process of establishing a project in KEIL51 using assembly language
1. Start Keil 2. Project-New Project 3. Find a place to save the project file 4. Click atmel-at89c51 in the tree directory, then confirm 5. File-New, a blank box appears 6. File-Save as, save it where you find it, output file name.asm 7. Right-click on the left and right Source Group 1-Add files to group "Source
[Microcontroller]
About embedding assembly in KEIL C51 and calling between C51 and A51
An example of how to call an assembly function in KEIL C51 (v6.21) There are many posts about how to call assembly from C51, but generally only the key points are mentioned, and few of them describe the whole process in detail, which is not enough for beginners. Here, the author describes this process through a si
[Microcontroller]
Create a new STM32 project in keil5
Preface I believe that many stm32 beginners still find it difficult to create a new project. Even if they have studied stm32 for a while, they still feel at a loss when creating a new project. I believe that everyone copied the entire routine project file at the beginning of learning stm32, and modified the programmin
[Microcontroller]
Ignore warning settings in Keil
Keil uVision3 Ignore Warning Settings After using Keil for several years, I am sometimes annoyed by the compile-time warnings, such as WARNING L16: UNCALLED SEGMENT and WARNING L15: MULTIPLE CALL. If we as programmers know that there are no problems with these, we can ignore these warnings and focus more on solving
[Microcontroller]
Ignore warning settings in Keil
Solution to directly use binary numbers in Keil C51
    In Keil C51, numbers cannot be assigned directly in binary form, although it is possible in 8051 assembly. Although binary numbers are long to write and prone to errors, because they are written one bit at a time, programmers can clearly see the status of each bit, which is more intuitive. Therefore, many people m
[Microcontroller]
Keil enters simulation, the window does not display the program running arrow
After Keil enters simulation, the program running arrow is not displayed in the program window. Click "Run" and the program will run, but the program running arrow will not be displayed. It may be that the "Debug Infomation" option is not checked, just check it.
[Microcontroller]
Keil enters simulation, the window does not display the program running arrow
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号