Regarding the installation of IAR for STM8 software, this article will not describe it, but Baidu will do it; this article mainly describes the establishment of the project.
1. Create a new project folder and name it A. A contains three folders, namely FWlib, Project, and USER;
(1) The FWlib folder is mainly for official library functions and header files, namely " inc folder " and " src folder ", and the downloaded " STM8S_StdPeriph_Driver folder " can also be used directly;
(2) The Project folder is mainly for saving project files and .hex files generated by compilation ;
(3) The USER folder mainly contains main.c , stm8s_conf.h , and user-written function files, namely .c and .h files;
2. Create a new Workspace and create a new Project:
(1)File -> New Workspace
(2) Project -> Create New Project, save to project folder A;
(3) Right-click the project name -> Add -> Add File…/Group… (File represents adding a single file, Group represents adding a folder) to add related files to the project:
Before adding:
After adding:
3. Set the project Option, right-click the project name -> Options, and make the following settings:
(1) GeneralOptions -> Device, set the corresponding STM8 microcontroller model;
(2) Add the compilation path: C/C++ Compiler -> Preprocessor, and set the path to a relative path , that is, the folder can be compiled wherever it is moved;
Set relative path:
(3) Set to .hex file output;
At this point, all the setting steps are completed, and the new project is over.