Skip to main content
Visitor II
August 29, 2010
Question

MY FIRST QUESTION

  • August 29, 2010
  • 6 replies
  • 1141 views
Posted on August 29, 2010 at 11:50

Dear comunty,

I'm a older Microcontrollers programer. Well my question I think is easy for you.

I know program microcontrollers with machine lenguage I mean:

Lda ...

Sta...

Txa..

I don't know use C Program lenguage.

Is possible to program STM8S Discovery with Mahcine lenguage?

Where i can write the program In source screen where is?

Thank you

    This topic has been closed for replies.

    6 replies

    ST Employee
    October 5, 2010
    Posted on October 05, 2010 at 14:41

    Hello,

    You can program STM8x by using assembler language which is described in STM8 CPU programming manual (PM0044) available at

    http://www.st.com/mcu

    /index.html

    but you need at least STVD environment.

    You can find all related information by installing STVD on your computer and read the included technical documentation on how to start developping your application step by step with STVD.

    Regards.

    Visitor II
    October 10, 2010
    Posted on October 10, 2010 at 17:22

    Hello Angus,

    Thanks,

    I've 4.2.0 St Visual devolop Where I can write my source code. Do you know if I need a new workspace and a new empty project

    Thank you for you help

    ST Employee
    October 12, 2010
    Posted on October 12, 2010 at 17:56

    Hello,

    The best way is to create a workspace by the menu File\New Workspace.

    Then choose Create workspace icon, validate by OK.

    Enter a name in the dialog Box as for intance MyProject and browse the workspace location.

    Enter a Project Filename as for intance, Mytest. Select the Toolchain (if you select ST Assembler Linker, your file must be written in assembler only, or Raisonance/Cosmic if you want to mix C code and ASM).

    Select the MCU, validate by Select then OK.

    You can start editing the asm file or c file with your own code.

    Regards.

    Visitor II
    October 14, 2010
    Posted on October 14, 2010 at 20:50

    Hello,

    Thank you very much. I do it.

    I most write my program in file main.asm?

    I see isn't empty has a program, I think is to reset memories, is it truue?

    regards

    ST Employee
    October 15, 2010
    Posted on October 15, 2010 at 14:48

    Hello,

    Yes, you have to write your program in the main.asm file.

    You can delete lines that initializes RAM which are not mandatory.

    Otherwise, other method (where you can mix C and asm...) if you select STM8 Cosmic as toolchain (during project creation), you can edit the main.c file directly in assembler by adding the following directives:

    main()

    {

     #asm

       ..........your code in assembler here..........

     #endasm

     while (1);

    }

    Regards.

    Visitor II
    December 29, 2010
    Posted on December 29, 2010 at 03:20

    you'll find something interesting here.  stm8s discovery folder file

    http://tech.groups.yahoo.com/group/armForth/files/

                                   8:  init.stm8s

      (  0357  AE 07 CF       )                                 X=7CF

      (  035A  94             )                                 SP=X

      (  035B  BF 24          )                                 r24=X

      (  035D  AE 07 80       )                                 X=780

      (  0360  BF 22          )                                 r22=X

      (  0362  35 01 50 11    )                                 r5011=1

      (  0366  35 03 50 12    )                                 r5012=3

      (  036A  35 01 50 13    )                                 r5013=1

      (  036E  72 12 50 C5    )                                 r50C5.1=1

      (  0372  35 B4 50 C4    )                                 r50C4=0B4

      (  0376  72 07 50 C5 FB )                 0376            r50C5.3=0?

      (  037B  72 17 50 C5    )                                 r50C5.3=0

      (  037F  35 02 52 43    )                                 r5243=2

      (  0383  35 68 52 42    )                                 r5242=68

      (  0387  35 00 52 44    )                                 r5244=0

      (  038B  35 00 52 46    )                                 r5246=0

      (  038F  35 0C 52 45    )                                 r5245=0C

      (  0393  81             )                                 RET