- Download: IAR Embedded Workbench
- User Guides: IAR Embedded Workbench for STM8
- STSW-STM8016 for STM8L15x/16x/05x/AL3Lx/AL31x
- STSW-STM8069 for STM8S/A
Libraries also contain templates and example code.
File
> New Workspace
Project
> Create New Project
-
Toolchain:
STM8
-
Project Templates:
C
-
Save As: browse for a project location (create a new folder for the project)
- Create a Folder
Drivers
for any libraries that you want to include later - Add your libraries to the
Drivers
folder - Copy the
StdPeriph_Lib
folder to the project folder - then remove the write protection in the properties:
- inside IAR: right click on the project and add the following Groups and Files:
- right click on the
src
andinc
Groups and add the corresponding Files from your project folder
Important not every MCU supports all the peripherals! only add the peripheral drivers that are supported or required. You can also add all the files. Later during compilation you will get errors like:
Error: TIM3 is undefined
and then you know, that your MCU does not support this peripheral and you can remove it from the Group.
- also add the
stm8s_conf.h
/stm8_it.c
from a template or examaple
- Open
Project
>⚙️ Options...
- Add the include paths of all your peripheral libraries:
- select the correct MCU:
- select ST-Link as the debugger:
- use a template, example or tutorial to get started with programming in
main.c
- uncomment your MCU type in
stm8s_conf.h
- press
F7
or click on themake
button at the top - click on:
Project
>Download
>download active program
to upload it to your board
In order to show the code size, right click into the Build panel and display "All" messages