/stm8-toolchain

Easy to use toolchain for building applications with STM8

Primary LanguageC

STM8 Toolchain

Easy to use toolchain for building applications with STM8
Report Bug · Request Feature


Table of contents

  • About The Toolchain
  • Getting Started
  • Usage
  • Limitations
  • Contact
  • Acknowledgments
  • About The Toolchain

    This toolchain is based on compilation with SDCC and programming the controller with STVP. This allows you to use all the features of C99 standard and use any programmer that is supported by STVP.

    In addition to this, unused functions are removed during compilation with the use of sdccrm.

    Getting Started

    Follow all the steps below for desired functionality of the toolchain.

    Disclaimer: the steps are described for windows because i suppose linux users are much smarter than windows users so they don't need to be guided XD

    Prerequisites

    Before running the toolchain on your machine, some necessary tools need to be downloaded.

    You may have some of these tools already downloaded.

    Nodejs

    • Toolchain uses nodejs to handle more complex tasks (parsing json config, calculating the size of files, adjusting SPL library)
    • Download (download the LTS version): nodejs.org

    STVP

    • Programmer to flash the program to stm
    • STVP comes with STVD that is distributed by STM. You can download STVD and STVP here

    SDCC

    Others

    choco install git make vscode mingw

    Installation

    Now when all necessary tools are downloaded you can run the toolchain on your machine.

    1. Clone the repo

      git clone https://github.com/matejkrenek/stm8-toolchain.git {project_name}
    2. Edit config.json according to you needs

      {
        "device": "STM8S103",
        "flash": {
          "stvp_path": "C:/Program Files (x86)/STMicroelectronics/st_toolset/stvp/",
          "stlink": "ST-LINK",
          "device": "STM8S103F3"
        }
      }

      Supported parameters

      Property Values
      "device" STM8S103, STM8S105, STM8S208
      "flash.stlink" Any programmer supported by STVP
      "flash.device" Any device supported by STVP
    3. After editing config.json

      make update

    Usage

    • After any adjustment of config.js run:

      make update

      or

      make install
    • For libraries there is associated folder lib:

      |--app
         |--inc
         |--src
      |--lib
         |--SPL
           |--inc
           |--src
         |--Your-Library
           |--inc
           |--src

    Commands

    • make commands that you can use to trigger functions

      make {command}
      Command Functionality
      "install" It installs desired version of SPL library based on your configuration
      "update" Same as the install command
      "clean" Removes build directory
      "compile" Compiles the program
      "flash" Uploads the program to stm
      "run" Runs clean, compile, flash commands

    Contact

    Matěj Křenek - mate23.krenek@gmail.com

    Project Link: https://github.com/matejkrenek/stm8-toolchain

    Limitations

    • You have to run make file commands in git bash 😥

    Acknowledgments

    Apart from this toolchain I recommend any of these:

    (Back to top)