stm8 sdcc header files.

  • rew

    rew - 2013-09-26


    I bought an STM8 discovery board, and I'm now trying to get a working toolchain.

    I found the stm8 examples on github. They start out with a #include <stm8l.h>, which sdcc cannot find. And neither can I.

    So where is this header supposed to come from?


  • Philipp Klaus Krause

    I don't know here the header file is supposed to come from. But AFAIK, Valentin just craeted it manually from the datasheet. I've seen it, and it just contains a few #define lines for some I/O ports he used. It is in no way complete. All the lines just look like

    #define PE_ODR *(unsigned char*)0x5014
    #define PE_IDR *(unsigned char*)0x5015
    #define PE_DDR *(unsigned char*)0x5016
    #define PE_CR1 *(unsigned char*)0x5017
    #define PE_CR2 *(unsigned char*)0x5018

    etc. Unless your board uses the same processor as Valentin's, you'd need to rewrite these according to you processors's datasheet anyway.


    P.S.: The lines probably will make his blinky example work on an STL8L-Discovery.

    P.P.S.: Sourceforge messes up any code posted on this forum (or tracker items). Maybe there is a way to post code and disable the markup bullshit; I don't know it.

    Last edit: Philipp Klaus Krause 2013-09-27
  • Maarten Brock

    Maarten Brock - 2013-09-27


    I took the liberty to modify your post and escape the # in front of the defines.

    To post code you must indent it with TAB or at least 4 spaces. To escape you prepend a backslash (e.g. \# or \_).

    Last edit: Maarten Brock 2013-09-27
  • Philipp Klaus Krause

    Thanks. I added a few more escapes to make the * visible. Do you know if there is a way to turn the markup off for the forums and tracker by default?


  • Maarten Brock

    Maarten Brock - 2013-10-02

    No, I cannot find any option for that.
    Maybe you should post a feature request at SF for that.

  • Philipp Mott

    Philipp Mott - 2014-04-26

    You might want to try my setup with SDCC and Code::Blocks (under Windows):

    Works like a charm and is free of charge (SDCC and Code::Blocks are open source, the STM toolchain and their flash tool aren't).


Log in to post a comment.