eta-systems / STM8S-RGBW-Tutorial

Tutorial and example for STM8S using IAR Embedded Workbench

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

STM8 Projekt with IAR


IDE

Standard Peripheral Libraries

Libraries also contain templates and example code.


Start a new Project

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)


Add Files to 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:

remove_write_protect.png

  • inside IAR: right click on the project and add the following Groups and Files:

add_groups_files.png

project_structure.png

  • right click on the src and inc 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

Project Settings

  • Open Project > ⚙️ Options...
  • Add the include paths of all your peripheral libraries:

add_include_paths.png

include_paths.png

  • select the correct MCU:

select_mcu.png

  • select ST-Link as the debugger:

stlink_debugger.png


Code

  • use a template, example or tutorial to get started with programming in main.c
  • uncomment your MCU type in stm8s_conf.h

Compile and Upload

  • press F7 or click on the make 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

display_code_size.png

About

Tutorial and example for STM8S using IAR Embedded Workbench


Languages

Language:C 74.7%Language:C++ 18.2%Language:HTML 6.8%Language:Batchfile 0.2%Language:PowerShell 0.1%