stm32 development environment MDK+ library file configuration

Publisher:真瓷堂Latest update time:2017-02-06 Source: eefocusKeywords:stm32 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

stm32 is an arm cortex-m3 architecture chip. It can be used with library functions to realize various functions more conveniently, especially when combined with various bus development applications. Because the library functions have encapsulated many bus processing methods and drivers, directly calling the corresponding library functions can operate each bus. Compared with directly operating registers, operating I2C SPI CAN and other bus structures will be much simpler.

There are many development tools for stm32, such as MDK, ADS, AVR, etc. I use MDk, which can actually compile arm's keil. The interface is the same as keil. I have installed keil before. I can directly overwrite the original keil with MDK to support the development of 51 microcontrollers and arm chips.

MDK official website download address: https://www.keil.com/arm/demo/eval/arm.htm

stm32 V3.5.0 library file official website download: stm32f10x_stdperiph_lib.zip

stm32 related information: http://www.st.com/internet/mcu/product/164492.jsp

Regarding the question of whether to use library functions or directly operate registers when developing applications, I think there are many advantages to using library functions, especially when developing applications in a team. Each programmer has his or her own coding style. In addition, the complexity of operating registers makes development and maintenance difficult. Of course, if you want to have a deeper understanding of the principles of ARM, directly operating registers is certainly advisable. And when you are familiar with it to a certain extent, the code you write may be more efficient than library functions. However, general applications can be implemented using library functions. Library functions are very similar to the concept of frameworks in languages ​​such as PHP, which is very helpful for development.

Firmware library settings

Many contents in the library function can be deleted. To reduce the size of the project, you can change the library function structure according to your own habits.

First, unzip the downloaded firmware library (keep a backup, you know)

    _htmresc: The ST logo is completely useless and can be deleted.

    Libraries: The more important files include STM32 system files and a large number of header files, that is, library files.

    Project: Contains a large number of peripheral routines and evaluation version project templates for various software versions. KEIL corresponds to the project template under the MDK-ARM file. You can also use this project template to modify it and get your own project module. If it is not needed in development, you can delete it.

    Utilities: These are the files related to the evaluation version: they will not be used and can be deleted.

You need to remove the read-only attribute of these four files first. After selecting the folder, right-click on the properties and check "Read-only".

The library function structure after I deleted it is as follows:

 

stm32_lib_file.jpgSTM32 v3.5 library function actual file structure

Cmsis contains microcontroller peripheral access layer and kernel device access layer files;

Startup of course includes the startup file of stm32, which is related to the chip Flash capacity. See the manual for details.

Libraries contains the standard peripheral library driver source files (src folder) and (inc) standard peripheral library driver header files

User contains the project code and interrupt code

Project is used to contain a series of files generated during compilation, Output is used to place output files.hex.axf, and Listing is used to place Listing information

 

 

 


MDK Setup

Find the corresponding files in the library function compression package and allocate each file as shown above (refer to this article: stm32 firmware library using V3.5 ) and then proceed to the next step 

Create a new project in Keil, for example, create TEST.uvproj, and save it in the Project folder. Select the STM32 chip you are using, for example, I use 103RB, just select that, after confirming, a window will pop up asking you whether to copy the startup code, select No, because we already have it in the library function, the previous preparation work is not in vain.

option_keil.png

Then right-click TARGET 1, select Manage Ccmponents, add the files according to the library function file structure just now, create a new folder, and then add the corresponding files.

The set interface is as follows:

set_keil.png

These folders under Keil will be virtual and may not correspond to existing folders. 

Finally, right-click TARGET 1 and select Options for TARGET1. In the Listing, Output tab, click Select Folder for Objects... to set the corresponding output folder.

The Output settings are as follows:

Output_set.png

 

In C/C++, you also need to set the Include Paths path. This path depends on your actual file directory structure:

C_tab_set_mdk.png

 

After the settings are completed, you can compile and test that the library function can run normally.


Keywords:stm32 Reference address:stm32 development environment MDK+ library file configuration

Previous article:stm32 direct operation register development environment configuration
Next article:MCU reads EEPROM (AT24C02)

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号