stm8L051 uses the library to build a project

Publisher:ShuxiangLatest update time:2020-01-15 Source: eefocusKeywords:stm8L051 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Previously, I developed directly with registers, but it was quite troublesome. I wrote the code directly according to the English technical manual for register development of stm8s103. Now I have switched to stm8L and have to look back at the English documentation. I personally feel that the development efficiency is still very low for a novice like me. Now I have downloaded a firmware from the community to see if I can build a project using the library. (I have previously seen the process of others building projects, but I was not successful because I was not familiar with IAR. Now I have just got it to work without any errors.)


1 First download a copy of the engineering firmware stsw-stm8016. The firmware will be sent to the resources later, or you can download it from the stm32/stm8 community. 

2. Create an iar project 

The project created here is as follows (I have already done it): 

 Write the picture description here 

Note: The app file contains the BSP driver we wrote ourselves, the lib file contains the firmware, and there are three files 

Write the picture description here 

These three files are placed directly in the project. 

Finished as follows: 

Write the picture description hereWrite the picture description here 

xxconf.h file is used to load the firmware's .h file 

xxit.h contains some declarations of interrupt functions. 

3 Then create a bsp.c and .h file (this is not necessarily the case here, but it is the case here) 

Then the content of bsp.h is as follows: 

Write the picture description here

Remark: 

The device used in the project is stm8l051, so select #define STM8L05X_LD_VL 

4 Then load the directory where the source code .h file is located into iar: 

The above is the directory where the firmware and bsp package are located, and the following is preinclude bsp.h. Remember to put the device in front 

5. Finally, main: 

main.c 

6 After the compilation is successful, you can then quickly copy and paste the development documentation provided in the firmware package^_^. 

7 The above are some key steps for me in this construction project. I made a lot of mistakes in these areas before. 

8 This is just one way I build projects here. There are many developers who have their own directory arrangements for building projects. I personally feel that the document settings are quite good and it is worth my time to study them further. . . . . 

Note: Regarding the issue of locking the file library file mentioned above, you can also click the properties of the relevant file under the file directory, and then remove the option of the "read-only" attribute, and then you can modify the library file directly in IAR.

Keywords:stm8L051 Reference address:stm8L051 uses the library to build a project

Previous article:STM8L051 buzzer beep--library function version (not using TIM2 to calibrate LSI)
Next article:Benefits of STM8--Atomthreads real-time operating system

Latest Microcontroller Articles
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号